0

I'm trying to launch a uri from my windows 8.1 app but can't get it to launch in UseHalf mode I researched and found that it should be done like this

       LauncherOptions lo = new LauncherOptions();
       lo.DesiredRemainingView = ViewSizePreference.UseHalf;
       lo.DisplayApplicationPicker = true;
       await Windows.System.Launcher.LaunchUriAsync(new Uri("http://www.youtube.com"),lo);

but it keeps launching the web browser in full screen I read that the launch depends on many variables and it is not insured that these settings will be applied

my question is there a way to insure that my app and the browser will open side by side in half screen mode?

4

2 回答 2

0

它必须工作:

Uri uri = new Uri("http://www.youtube.com");
LauncherOptions options = new LauncherOptions
{
    DesiredRemainingView = ViewSizePreference.UseHalf
};

await Launcher.LaunchUriAsync(uri, options);

如果没有,请试试这个长代码:

ApplicationView currentAppView = ApplicationView.GetForCurrentView();  

CoreApplicationView newCoreAppView = CoreApplication.CreateNewView();  

newCoreAppView.Dispatcher.RunAsync(  
  CoreDispatcherPriority.Normal,  
  async () =>  
  {  
    // This executes on the new dispatcher so I assume that Window.Current and so on  
    // reflects the new Window associated with that dispatcher rather than the original  
    // dispatcher.  
    Window newWindow = Window.Current;  
    ApplicationView newAppView = ApplicationView.GetForCurrentView();  


    await ApplicationViewSwitcher.TryShowAsStandaloneAsync(  
      newAppView.Id,  
      ViewSizePreference.UseHalf,  
      currentAppView.Id,  
      ViewSizePreference.UseHalf);  
  });

这里

于 2013-10-21T18:11:25.457 回答
0

好吧,在咨询了 msdn 开发者论坛之后,事实证明这是唯一的方法,并且应用程序无法强制这种行为,此代码的结果取决于浏览器的设置和许多其他变量

于 2013-10-21T21:27:12.043 回答