在WP8中启动应用程序时如何防止黑白屏幕?

时间:2014-02-17 16:29:38

标签: windows-phone-8 ibm-mobilefirst

我为Windows Phone 8创建了一个IBM Worklight 6.1应用程序 我构建了应用程序并将其部署到设备上。

我收到以下屏幕:

  1. IBM Splash Screen
  2. 黑屏
  3. 白色屏幕
  4. 应用程序用户界面
  5. 如何不显示2和3?

    enter image description here

    enter image description here

    enter image description here

    enter image description here

    enter image description here

2 个答案:

答案 0 :(得分:0)

问题中报告的问题的一些更新:

  1. "启动图像后的黑屏"

    此问题已得到解决。没有可用的本地解决方法 可以通过opening a PMR为Worklight 6.1和6.2请求iFix。

  2. "黑屏后的白屏"

    此问题尚未解决,但预计会解决 可以应用以下临时解决方法:

    • 在生成的Visual Studio项目中,打开MainPage.xaml> MainPage.xaml.cs中
    • 执行以下操作并在Visual Studio中运行

    查找

    void CordovaView_Loaded(object sender, RoutedEventArgs e)
    {
    
    }
    

    替换为:

    private async void CordovaView_Loaded(object sender, RoutedEventArgs e)
    {
        var frame = App.Current.RootVisual as PhoneApplicationFrame;
    
        PhoneApplicationPage page = frame.Content as PhoneApplicationPage;
        WebBrowser br = (page.FindName("CordovaView") as CordovaView).Browser;
        double savedHeight = br.ActualHeight;
        br.Height = 0; // make the browser height to 0 until the html is loaded
    
        BitmapImage b1 = new BitmapImage(new Uri("SplashScreenImage.jpg", UriKind.Relative));
        ImageBrush imgBrush = new ImageBrush();
        imgBrush.ImageSource = b1;
        frame.Background = imgBrush;
        await Task.Delay(TimeSpan.FromSeconds(3)); // avoid flickering
        br.Height = savedHeight;
    }
    

答案 1 :(得分:-1)

对于黑暗主题 - 框架背景为黑色;对于浅色主题 - 框架背景为白色。

一种可能的解决方法是将Frame的颜色与第一页的颜色相匹配。

要更改框架背景颜色,必须将以下行放在app.xaml.cs的InitializePhoneApplication()中(创建RootFrame实例后)

 RootFrame.Background = new SolidColorBrush(Colors.White);