Tag: windows 10 mobile

ListView ManipulationCompleted事件在手机上不起作用

我在Windows 10 UWP应用程序中有此代码: MyListView.ManipulationMode = ManipulationModes.TranslateX; MyListView.ManipulationStarted += (s, e) => x1 = (int)e.Position.X; MyListView.ManipulationCompleted += (s, e) => { x2 = (int)e.Position.X; if (x1 > x2) { DataController.PaneOpen(false); }; if (x1 < x2) { DataController.PaneOpen(true); }; }; ManipulationCompleted事件在ListView中无法在手机上运行。 处理程序中的代码永远不会被调用。 它在PC上工作正常,但在手机上不起作用。 我不明白为什么。

在ScrollViewer(UWP)中移动图像

我在Scrollviewer有一张Image …… 当我用鼠标指针拖动图像时,我想移动图像! 我试过了: private void Img_PointerPressed(object sender,PointerRoutedEventArgs e) { var p = e.Pointer; } 但我无法获得指针位置来改变scrollviewer位置。 我的代码出了什么问题? 我做得对吗?

从后面的代码附加Image / ImageBrush

我正在尝试添加一个Image作为UserControl的背景。 根据我需要更改背景的变量的值,但无论我使用的路径或Uri格式如何,背景都不会改变。 我在stackoverflow中看到了很多问题,但没有一个能解决我的问题。 我让代码如下: if (callback.liveUvis.ContainsUVI(uvi)) { this.Status.Text = “LIVE”; ImageBrush imgB = new ImageBrush(); BitmapImage btpImg = new BitmapImage(); btpImg.UriSource = new Uri(@”///IMG///Live///bck_frame_info_video_live.png”, UriKind.Relative); //imgB.ImageSource = new BitmapImage(new Uri(“~/IMG/Live/bck_frame_info_video_live.png”, UriKind.RelativeOrAbsolute)); //imgB.ImageSource = new BitmapImage(new Uri(“ms-appx:///IMG/Live/bck_frame_info_video_live.png”)); imgB.ImageSource = btpImg; this.Background = imgB; } 我在尝试附加图像时遇到了同样的问题…我想这也取决于Uri格式,但是我还是让代码以防万一:) private void setIcon_Desc(string dd) { try { Image img = new […]

如何在Windows通用应用程序中读取文本文件

我正在尝试阅读一个名为thedata.txt的文本文件,其中包含我想在刽子手游戏中使用的单词列表。 我尝试了不同的方法,但我无法确定文件的放置位置,如果应用程序运行的话。 我将文件添加到我的项目中,我尝试将构建属性设置为内容,然后嵌入资源,但找不到该文件。 我制作了一个Windows 10通用应用程序项目。 我试过的代码看起来像这样: Stream stream = this.GetType().GetTypeInfo().Assembly.GetManifestResourceStream(“thedata.txt”); using (StreamReader inputStream = new StreamReader(stream)) { while (inputStream.Peek() >= 0) { Debug.WriteLine(“the line is “, inputStream.ReadLine()); } } 我得到例外。 我还尝试列出另一个目录中的文件: string path = Windows.Storage.ApplicationData.Current.LocalFolder.Path; Debug.WriteLine(“The path is ” + path); IReadOnlyCollection files = await Windows.Storage.ApplicationData.Current.LocalFolder.GetFilesAsync(); foreach (StorageFile file2 in files) { Debug.WriteLine(“Name 2 is […]

WP8.1和WP10的区别

使用Windows Phone 8.1,下一行运行良好,但现在当用户更换为Windows 10手机时,设备出现故障。 ProductLicense inAppLicense = CurrentApp.LicenseInformation.ProductLicenses[“Keyfor”]; 如上所述,与WP 8.1很好地协作并且很好地读取和存储了许可证信息。 现在使用Windows 10手机,该行只会产生exception。 “来自HRESULT的exception:0x803F6107”。 与真实设备以及仿真器的结果相同。 那么,如何在WP 8.1项目环境下检查Windows 10手机的LicenseInformation (即用8.1项目编写的代码)?

Windows 10应用程序DownloadOperation无法启动

我试图在Windows 10通用应用程序上使用此代码下载文件: await downloadOperation.StartAsync().AsTask(token, progressCallback); 它在PC上运行但在移动设备上有时它不会开始下载,甚至在我重新启动移动设备之前都没有例外。 这是系统中的错误还是我遗漏了什么? 编辑1: 任务的状态是“等待激活”,因此它不会抛出exception。 它只是等待,直到我重新启动手机才开始我总是尝试使用相同的url,我在电脑上没有这个问题。 这只是关于手机的。 任务的属性如下:

扩展执行无法正常工作?

我无法使ExtendedExecution正常工作。 问题是在执行完成之前不会触发Revoked事件。 如果我们采样: private async void OnSuspending(object sender, SuspendingEventArgs e) { Debug.WriteLine(“Suspending in app”); var deferral = e.SuspendingOperation.GetDeferral(); using (var session = new ExtendedExecutionSession()) { session.Reason = ExtendedExecutionReason.SavingData; session.Description = “Upload Data”; session.Revoked += (s, a) => { Debug.WriteLine($”Extended execution revoked because of {a.Reason}”); }; var result = await session.RequestExtensionAsync(); if (result == ExtendedExecutionResult.Denied) Debug.WriteLine(“Extended […]

以编程方式更改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

如何检查Windows 10移动模拟器的独立存储?

我目前正在使用Windows 10,我的要求是检查Windows 10 Mobile模拟器的独立存储。 使用Windows Phone 8 / 8.1,可以使用我们可以使用命令提示符使用的IsolatedExplorerTool。 任何人都可以建议,我如何为Windows 10 Emulator实现相同的目标?

Windows 10 UWP – 检测当前的Internet连接是Wifi还是Cellular?

在Windows 10 UWP应用程序中,如何检测当前的Internet连接是Wifi还是Cellular?