Tag: win universal app

XAML Designer窗口不会加载“通用Windows”应用程序 – 即使在新项目中也是如此

我似乎记得以前遇到过这种情况,但不能为我的生活回想起我是如何解决这个问题的,并且谷歌的深度似乎没有帮助。 这是问题所在: 当我使用“通用Windows”项目打开VS2015(社区版)时,无论是新的还是旧的,即使没有改变一件事,我在设计器窗口中都会出现exception。 XAML代码显示正常,但设计器窗口给了我 “错误0X80070005:处理请求时,由于以下错误,系统无法注册windows.capability扩展:访问被拒绝。” 接下来是我将在下面包含的一面文字。 我想知道这是否可能是因为我最近更新到了Windows 10(由于某种原因,我强迫它在没有常见的解决方法的情况下仍然无法更新)并且我在VS安装中添加了使用Universal应用程序所需的function。 如果我打开一个通用Windows 8.1项目,设计器加载得很好,但不适用于通用Windows项目。 值得注意的是,我是业余学习C#,所以这可能很简单,但对我来说似乎是IDE中的一个错误…… 这是文本的墙,以防任何人都有意义。 无法注册System.Exception包。 错误0x80070005:处理请求时,由于以下错误,系统无法注册windows.capability扩展:访问被拒绝。 。 在Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.ProcessDomainFactory.ProcessIsolationDomain的Microsoft.VisualStudio.DesignTools.HostUtility.Platform.AppContainerProcessDomainFactory.CreateDesignerProcess(String applicationPath,String clientPort,Uri hostUri,IDictionary environmentVariables,Int32&processId,Object&processData)。 Microsoft.VisualStudio.DesignTools.HostUtility.Platform.AppContainerProcessDomainFactory上的Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.ProcessDomainFactory.CreateIsolationDomain(IIsolationBoundary boundary)中的.ctor(ProcessDomainFactory工厂,IIsolationBoundary边界,AppDomainSetup appDomainInfo,IIsolationTarget isolationTarget,String baseDirectory) .CreateIsolationDomain(IIsolationBoundary boundary)at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.IsolationBoundary.Initialize()at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.IsolationBou Microsoft的Microsoft.VisualStudio.DesignTools.DesignerHost.Services.VSIsolationService.CreateObjectFactory(IIsolationTarget isolationTarget,IObjectCatalog目录)中的Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolatedObjectFactory.Initialize()的ndary.CreateInstance [T](Type type)。 Microsoft.VisualStudio.DesignTools.DesignerContract.IsolatedDesignerService.CreateLease(IIsolationTarget isolationTarget,CancellationToken)上的Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolationService.CreateLease(IIsolationTarget isolationTarget)中的VisualStudio.DesignTools.DesignerContract.Isolation.IsolationService.CreateLease(IIsolationTarget isolationTarget)在Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolatedTaskS上的Microsoft.VisualStudio.DesignTools.DesignerContract.IsolatedDesignerService.IsolatedDesignerView.CreateDesignerViewInfo(CancellationToken cancelToken)中的cancelToken,DesignerServiceEntry&entry,IServiceProvider serviceOverrides) cheduler.InvokeWithCulture [T](CultureInfo culture,Func 2 func, CancellationToken cancelToken) at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolatedTaskScheduler.c__DisplayClass10_0 1.b__0()at System.Threading.Tasks.Task`1.InnerInvoke ()at System.Threading.Tasks.Task.Execute()

从websource下载字节数

我试图在Windows Phone 8.1 Runtime上使用HttpWebRequest (可以是任何不同的方式 – 我尝试过WebRequest,HttpClient …)从websource下载一些字节 – 完整的代码: private async void Download1000_Click(object sender, RoutedEventArgs e) { Debug.WriteLine(“Download Started”); HttpWebRequest longRequest = (HttpWebRequest)WebRequest.Create(new Uri(@”http://s3.amazonaws.com/dnr/dotnetrocks_0986_enterprise_sharepoint.mp3″)); longRequest.Headers[HttpRequestHeader.IfModifiedSince] = DateTime.UtcNow.ToString(); // prevent caching the whole file longRequest.AllowReadStreamBuffering = false; using (WebResponse myResponse = await longRequest.GetResponseAsync()) using (Stream myStream = myResponse.GetResponseStream()) { int bytesRead = 0; byte[] myBuffer […]

无法从DeviceInformation.Id创建UsbDevice

我正在尝试使用仅适用于PC的通用Windows应用程序(无手机)(WinRT)通过Windows.Devices.Usb API连接到设备(SecuGen Hamster Pro 20)。 该设备是指纹扫描仪。 我已经完成了在线找到的所有步骤: 我找了所有使用的设备: var myDevices = await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(); 这将返回大约1400个设备。 经过一些过滤使用: var resultList = myDevices.Where(s => s.Name.ToLower().Contains(“secu”)).ToList(); resultList在我的机器中包含3个设备(我在其他机器上尝试了它,并在一些机器上找到了10个结果)。 我没有使用重载来查找设备DeviceInformation.FindAllAsync(String aqsFilter)因为它返回0结果,但我确定我做得对(使用了正确的VID和PID) 这里的问题是当我尝试使用以下三种结果中的任何一种创建UsbDevice对象时: UsbDevice device = await UsbDevice.FromIdAsync(resultList[0].Id); 返回值为null,我已经尝试了所有这些( resultList[0] , resultList[1] , resultList[2] )没有运气。 我使用以下方法配置function: 我还试图从DeviceInformation.FindAllAsync()返回的1400个设备中创建一个UsbDevice对象但是所有返回null甚至一些抛出一个exception,表示the system cannot find the file specified 0x80070002 我试图为它返回DeviceAccessStatus.Unspecified的设备读取DeviceAccessStatus.Unspecified 任何人都可以带我到我在这里失踪的地方?

UWP – 如何平铺背景图像?

在通用Windows应用程序中,我尝试使用背景图像(来自ImageSource)并将其平铺在控件上。 XAML C# void UpdateBackground(ImageSource source) { // … gridBackground.Background = new ImageBrush { ImageSource = source, Stretch = Stretch.None }; } 根据MSDN ,ImageBrushinheritance自TileBrush。 它甚至说: 用于ImageBrush包括文本的装饰效果,或控件或布局容器的平铺背景。 我认为这应该平铺图像,如果拉伸被禁用,但唉,它只是在控件中间绘制图像。 我没有看到任何实际的属性来使它平铺。 在WPF中,有一个TileMode属性,可以设置ViewPort来指定磁贴的尺寸。 但这似乎在通用平台下缺席。 之前的问题涉及WinRT(Windows 8),但我希望使用基于画笔的解决方案,而不是用图像填充canvas。 如何使用UWP平铺背景图像?

如何在通用Windows应用程序中调用WebView中的javascript函数

我是Universal app开发的新手。 任何人都可以帮助我编写代码, 我在通用应用程序中使用Web视图控件加载了一个网站。 我想从同一个网站上读取一些控制值。 我的标签控件ID是网站上的’lblDestination’。 我在像MAinPage.xaml这样的通用应用程序中访问它 MAinPage.xaml.cs Browser.InvokeScript(“eval”, new string[] { “document.getElementById(‘lblDestination’)” }).ToString() 这是读取浏览器控件值的正确方法吗? 我正在使用模拟器来测试这个应用程序,那么模拟器是否会产生问题?

通过绑定在TextBlock中创建超链接

我的问题是从文本内容中找到URL并通过数据绑定将其转换为可点击的超链接。 这就是我尝试过的 在代码中, public class StatusFormatter : IValueConverter { public object Convert(object value, Type targetType, object parameter, string language) { return returnTextWithUrl((String)value); } public static String returnTextWithUrl(String text) { if(text == null) { return null; } MatchCollection mactches = uriFindRegex.Matches(text); foreach (Match match in mactches) { //Need Help here HyperlinkButton hyperlink = new HyperlinkButton(); hyperlink.Content […]

‘Windows.Storage.StorageFile File = await FilePicker.PickSingleFileAsync()’无法正常工作

我有以下代码,在应用程序中显示文件选择器: var FilePicker = new Windows.Storage.Pickers.FileOpenPicker(); FilePicker.ViewMode = Windows.Storage.Pickers.PickerViewMode.Thumbnail; FilePicker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.ComputerFolder; FilePicker.FileTypeFilter.Add(“.pcs”); FilePicker.FileTypeFilter.Add(“.pcp”); Windows.Storage.StorageFile File = await FilePicker.PickSingleFileAsync(); 但是, Windows.Storage.StorageFile File = await FilePicker.PickSingleFileAsync()会在编译期间导致此错误: 错误CS4036’IAsyncOperation ‘不包含’GetAwaiter’的定义,并且找不到扩展方法’GetAwaiter’接受类型为’IAsyncOperation ‘的第一个参数(您是否缺少’System’的using指令?) 为什么会这样? 我从MSDN获得了代码。 有人可以帮帮我吗? 注意:我正在为通用Windows编程。

MediaCapture + CaptureElement生命周期/导航管理

这是在Windows Phone 8.1商店应用程序中。 我的MainPage有一个CaptureElement来显示来自MediaCapture对象的预览流。 对于应用程序内的导航(页面之间),这很有效: MediaCapture mc; protected override async void OnNavigatedTo(NavigationEventArgs e) { mc = new MediaCapture(); await mc.InitializeAsync(); preview.Source = mc; await mc.StartPreviewAsync(); } protected override async void OnNavigatedFrom(NavigationEventArgs e) { await mc.StopPreviewAsync(); } 我可以导航到其他页面并返回,预览可靠地运行。 我遇到了以下情况的问题: 用户按下Windows按钮,然后按后退按钮 用户按下Windows按钮,然后使用任务切换器返回我的应用程序 用户按下搜索按钮,然后按下后退按钮 用户按下电源按钮,然后再次按下并向上滑动以解锁设备 用户按住后退按钮进入任务切换器,然后再次点击我的应用程序 在上述每个操作(和/或它们的组合)之后,当我的应用程序返回时,预览将冻结在显示的最后一帧。 如果用户然后导航到另一个页面然后返回到MainPage,则预览会再次开始运行而不会出现问题,因此这让我相信我只需要在从上述场景之一返回后停止/启动预览。 我尝试订阅App.Suspending和App.Resuming事件,但这些都不会在这些情况下触发。 我错过了什么?

扩展执行无法正常工作?

我无法使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 […]

UWP – 应用程序文件夹中的图像Uri

我在这里展示图像时遇到了一些问题。 因此,当我尝试从XAML加载图像时,我可以使用相对uri到图像源,如下所示: 但是,如果我尝试以编程方式从代码后面更改图像源,我总是得到一个例外,我确定这是因为虚假的Uri。 我试过这样的事情: BitmapImage bitmapImage = new BitmapImage(new Uri(“/Assets/image.jpg”)); 我做错了吗? 任何帮助将不胜感激,谢谢!