Tag: windows 10 universal

以编程方式更改Windows 10 UWP App中的主题

我能够使用this.RequestedTheme = ElementTheme.Dark;更改主题this.RequestedTheme = ElementTheme.Dark; 但我需要的是整个应用程序级别,因为这只会将当前页面的主题更改为黑暗。 每当我尝试这个App.Current.RequestedTheme = ApplicationTheme.Dark; 我总是得到这个错误 UWPApp.exe中出现“System.NotSupportedException”类型的exception,但未在用户代码中处理 有没有这样的方法,我可以将整个应用程序主题从Light更改为Dark,反之亦然? 我正在使用VS2015

UWP与uwp中的FindAncestor等效

我有一个订单列表,当订单状态为Canceled时 ,我想要闪烁文本。 到目前为止,我的代码工作。 但是, 有时会抛出exception: WinRT信息:无法解析TargetName lblOrderStatus 由于某种原因,可以找到lblOrderStatus 。 所以,我想使用“FindAncestor”,但UWP中不存在FindAncestor。 在uwp中是否有与FindAncestor等效的function? 这是我的代码: … … … … … …

无法加载文件或程序集’Newtonsoft.Json,Version = 9.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed’或其中一个依赖项

我有一个以前在Windows 8.1上使用VS 2013构建的WinJS项目。 最近我通过创建一个空白的Javascript Universal Windows 10项目将该项目升级到Universal Windows 10,然后从旧项目添加了我的所有文件。 我有Windows运行时组件和SQLite的类库。 我添加了通用Windows运行时组件和通用类库,并将我的所有文件从旧项目复制到相应的位置。 不知何故,我设法删除所有构建错误。 我安装了所有必需的SQLite-net,SQLite for Universal Windows Platform,Newtonsoft等。 但是当我运行应用程序并在Windows运行时组件中调用Native方法时,它会产生一些奇怪的错误: An exception of type ‘System.IO.FileNotFoundException’ occurred in mscorlib.ni.dll but was not handled in user code. Additional information: Could not load file or assembly ‘Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed’ or one of its dependencies. The system cannot find the […]

使用POST方法在通用应用程序中发送登录数据

我正在使用Windowsapp store,我正在尝试发送登录名和密码值,这是我的代码: try { string user = login.Text; string pass = password.Password; ASCIIEncoding encoding = new ASCIIEncoding(); string postData = “login=” + user + “&mdp=” + pass; byte[] data = encoding.GetBytes(postData); WebRequest request = WebRequest.Create(“myURL/login.php”); request.Method = “POST”; request.ContentType = “application/x-www-form-urlencoded”; request.ContentLength = data.Length; Stream stream = request.GetRequestStream(); stream.Write(data, 0, data.Length); stream.Dispose(); WebResponse response = […]

Windows UWP在发现后连接到BLE设备

我正在使用BluetoothLEAdvertisementWatcher查找附近的BLE设备,它运行良好。 找到它们后,我想通过GATT连接和读/写数据。 但在获取BluetoothLEAdvertisement后,我无法弄清楚如何使用API​​( https://msdn.microsoft.com/de-de/library/windows/apps/windows.devices.bluetooth.genericattributeprofile )。 public class Adapter { private readonly BluetoothLEAdvertisementWatcher _bleWatcher = new BluetoothLEAdvertisementWatcher(); public Adapter() { _bleWatcher.Received += BleWatcherOnReceived; } private void BleWatcherOnReceived(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementReceivedEventArgs args) { // how to connect? // I know, it’s the wrong place to to this, but this is just an example } public void StartScanningForDevices(Guid[] serviceUuids) […]