标签: windows-10-mobile

UnhandledErrorDetected:未指定的错误COMException

挣扎着冻结应用程序的错误,只发生在平板电脑上(从不在我的笔记本电脑上).似乎与快速切换汉堡菜单有关.我有一个堆栈跟踪,导致第三方控制,但我得到的10次中的9次是以下.只有一些"异步空白",我无法避免它们(覆盖事件)和其他日志记录,我相信问题出在XAML中(方法是记录进入/退出):

未指定的错误:System.Runtime.InteropServices.COMException(0x80004005):未指定的错误

在Oceaneering.Commons.Utilities.Logger.CoreApplication_UnhandledErrorDetected(Object sender,UnhandledErrorDetectedEventArgs e)上的Windows.ApplicationModel.Core.UnhandledError.Propagate()中出现未指定的错误

设置如下:

CoreApplication.UnhandledErrorDetected += CoreApplication_UnhandledErrorDetected;
Run Code Online (Sandbox Code Playgroud)

接收方法是:

try {               
   e.UnhandledError.Propagate();
}
catch (Exception ex){
   logChannel.LogMessage(string.Format("Unhandled Exception: {0}:{1}", ex.Message, ex.ToString()));
   SaveToFileAsync().Wait();
} 
Run Code Online (Sandbox Code Playgroud)

我可以做些什么来收集更多信息?谢谢!

win-universal-app windows-10-mobile uwp windows-10-universal

23
推荐指数
1
解决办法
684
查看次数

通用Windows 10应用程序的启动画面

我正在创建一个针对Windows Phone和Windows Desktop的Windows 10通用应用程序,我面临的问题是当通过package.manifest文件向应用程序添加启动画面时,没有选项添加适合手机的启动画面纵向(见下图),

在此输入图像描述

当我在手机上部署应用程序时,会出现如下所示的启动画面.

在此输入图像描述

splash-screen win-universal-app windows-10 windows-10-mobile uwp

22
推荐指数
2
解决办法
8522
查看次数

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

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

c# windows-store-apps windows-10-mobile uwp

20
推荐指数
2
解决办法
6267
查看次数

升级到最新的Windows Phone 8.1后无法发送证书

我有一个为8.1构建的Windows Phone应用程序,其中一个任务是客户端 - 服务器证书方案.我的应用程序工作正常,我可以发送客户端证书并登录到服务器.但升级到Windows 8.10.14xxxx之后无法实现.我接受了wireshark的痕迹,似乎证书永远不会发送.消息的内容长度为0.

我使用HttpClient.SendAsync(等待)并HttpBaseProtocolFilter输入证书.它在升级之前完美无缺.

任何的想法?有什么东西坏了?

首先我要安装pfx

async private void btnInstall_Click(object sender, RoutedEventArgs e)
{
    //Install the self signed client cert to the user certificate store

    string CACertificate = null;
    try
    {
        Uri uri = new Uri("ms-appx:///certificates/test.pfx");
        var file = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(uri);
        IBuffer buffer = await FileIO.ReadBufferAsync(file);
        using (DataReader dataReader = DataReader.FromBuffer(buffer))
        {
            byte[] bytes = new byte[buffer.Length];
            dataReader.ReadBytes(bytes);
            // convert to Base64 for using with ImportPfx
            CACertificate = System.Convert.ToBase64String(bytes);
        }
        await CertificateEnrollmentManager.UserCertificateEnrollmentManager.ImportPfxDataAsync(
            CACertificate,
            "xxxxx", …
Run Code Online (Sandbox Code Playgroud)

certificate windows-phone windows-phone-8.1 windows-10 windows-10-mobile

19
推荐指数
1
解决办法
449
查看次数

扩展执行无法正常工作?

我无法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 execution failed");
        else
        {
            Debug.WriteLine("Executing");
            await Task.Run(() => { Task.Delay(9000).Wait(); Debug.WriteLine("Finished the task"); });
            Debug.WriteLine("Executing finished");
        }
        Debug.WriteLine("Suspending after execution");
    }
    deferral.Complete();
} …
Run Code Online (Sandbox Code Playgroud)

c# win-universal-app windows-10-mobile

18
推荐指数
1
解决办法
882
查看次数

UWP检查文件是否存在

我目前正在开发Windows 10 UWP应用程序.应用程序需要检查是否存在名为"01-introduction"的某个PDF文件,如果存在则打开它.如果文件不存在,我已经有了代码.以下代码是我目前拥有的:

        try
        {
            var test = await DownloadsFolder.CreateFileAsync("01-Introduction.pdf", CreationCollisionOption.FailIfExists); 
        }
        catch
        {

        }
Run Code Online (Sandbox Code Playgroud)

此代码无法正常工作,因为检查文件是否存在此处,我尝试创建该文件.但是,如果该文件尚不存在,则将创建一个空文件.如果文件不存在,我不想创建任何内容,只要打开PDF就可以.

如果可能的话,我想查看名为"我的手册"的下载文件夹中的文件夹.

任何帮助将不胜感激.

c# pdf win-universal-app windows-10-mobile windows-10-universal

16
推荐指数
3
解决办法
2万
查看次数

处理后退导航Windows 10(UWP)

在我的Xaml页面中,我有一个Frame.

我正在尝试使用backButton事件来在框架内导航.

所以我试着用这段代码

public MainPage(){
    this.InitializeComponent();
    if(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")) {
        Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed;
    }
}
private void HardwareButtons_BackPressed(object sender,BackPressedEventArgs e) {
    if(insideFrame.CanGoBack())insideFrame.GoBack();
    else  Application.Current.Exit();
}
Run Code Online (Sandbox Code Playgroud)

但是在做完HardwareButtons_BackPressed活动后的电话中关闭了应用程序.

它似乎在MainPage上运行一些默认的后退按钮行为...

我该如何解决?在Windows10中,他们是否添加新事件来处理后退导航?


[更新]

现在我发现最好SystemNavigationManager在Windows 10中使用而不是Input.HardwareButtons.BackPressed.

SystemNavigationManager currentView = SystemNavigationManager.GetForCurrentView();
Run Code Online (Sandbox Code Playgroud)

c# navigation windows-10 windows-10-mobile

15
推荐指数
2
解决办法
1万
查看次数

如何在Windows 10 UWP中实现图表控件

我需要实现线性图.Windows 10 UWP是否有任何图表控件?有什么建议?

谢谢

win-universal-app windows-10 windows-10-mobile

15
推荐指数
2
解决办法
1万
查看次数

x:使用空字符串绑定图像

在XAML中,我有以下行:

<Image x:Name="MainImage" 
       Source="{x:Bind ViewModel.MainPic,Mode=OneWay,TargetNullValue={x:Null}}"
       Stretch="UniformToFill"/>
Run Code Online (Sandbox Code Playgroud)

在ViewModel中:

public string MainPic
{
    get
    {
        if (Data == null)
            return default(string);
        else
            return Data.Photos.ElementAtOrDefault(0).url;
    }
}
Run Code Online (Sandbox Code Playgroud)

应用程序编译正常但在执行期间(因为数据在几秒钟后填充),应用程序崩溃时出现以下异常:

System.ArgumentException:参数不正确.

调试器中断:

            private void Update_ViewModel_MainPic(global::System.String obj, int phase)
            {
                if((phase & ((1 << 0) | NOT_PHASED | DATA_CHANGED)) != 0)
                {
 /*HERE>>*/          XamlBindingSetters.Set_Windows_UI_Xaml_Controls_Image_Source(this.obj23, (global::Windows.UI.Xaml.Media.ImageSource) global::Windows.UI.Xaml.Markup.XamlBindingHelper.ConvertValue(typeof(global::Windows.UI.Xaml.Media.ImageSource), obj), null);
                }
            }
Run Code Online (Sandbox Code Playgroud)

显然,这是因为MainPic返回null.

现在,这段代码在WP8.1中运行良好.我试过返回uri导致编译时间错误.我相信只有字符串可以绑定到Win 10中的图像源(?)我只想要一个空白区域,直到填充数据,因此我不希望将本地图像源作为后备.有人可以帮我为Win 10移植吗?


更新:

感谢回答的用户,得出以下结论(针对UWP):

  • 如果您将图像源绑定到a string,则它不能为null空或为空"".单个字符"x"或空格" "可以工作.
  • 如果绑定到a BitmapImage,则返回null作品.
  • 您可以使用@ Justin-xl提到的任何方法.对我来说,更改所有vm以停止返回null很难.因此,向xaml添加一个简单的转换器也可以解决问题.

这是转换器代码: …

c# windows windows-10 windows-10-mobile uwp

14
推荐指数
1
解决办法
2821
查看次数

从UWP XAML中的HyperlinkBut​​ton中删除下划线


我需要删除内容中的下划线HyperLinkButton. TextDecorations在此XAML元素中不存在.

<HyperlinkButton x:Name="BtnTeste"
                Width="100" Height="50" BorderThickness="1" 
                HorizontalAlignment="Center"
                Foreground="Black" Background="#ffffff"
                NavigateUri="www.google.com"
                Content="Execute" />
Run Code Online (Sandbox Code Playgroud)

c# xaml windows-10-mobile uwp uwp-xaml

14
推荐指数
2
解决办法
3665
查看次数