22 lines
1.4 KiB
Python
22 lines
1.4 KiB
Python
# -*- coding: utf-8 -*-
|
||
"""临时 toast:ThreadingTest vthreading 专项测试编写完成"""
|
||
import base64, subprocess
|
||
|
||
t = "ThreadingTest 专项测试编写完成"
|
||
b = "新建 Test/ThreadingTest 工程(project.json + App/main.vp),覆盖 vthreading 全部 API:Thread(start/join/is_alive/退出码/传参)、Lock 4 线程互斥自增、Event 唤醒、Condition 生产者/消费者、RWLock 多读单写、TLS local、线程 ID 隔离、sleep_ms。"
|
||
ps = (
|
||
"Add-Type -AssemblyName System.Runtime.WindowsRuntime\n"
|
||
"[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null\n"
|
||
"[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null\n"
|
||
"$t = '" + t + "'\n"
|
||
"$b = '" + b + "'\n"
|
||
"$xml = [Windows.Data.Xml.Dom.XmlDocument]::new()\n"
|
||
"$xml.LoadXml('<toast><visual><binding template=\"ToastText02\"><text id=\"1\">' + $t + '</text><text id=\"2\">' + $b + '</text></binding></visual></toast>')\n"
|
||
"$toast = [Windows.UI.Notifications.ToastNotification]::new($xml)\n"
|
||
"[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('TraeCode').Show($toast)\n"
|
||
)
|
||
b64 = base64.b64encode(ps.encode('utf-16-le')).decode()
|
||
r = subprocess.run(['powershell', '-NoProfile', '-EncodedCommand', b64],
|
||
capture_output=True, text=True)
|
||
print('rc=', r.returncode)
|