2014-09-20 68 views
1

我正在使用Windows默認設置彈出窗口添加一些自定義命令。但是現在我需要打開一個本地存儲的HTML文件?我怎樣才能做到這一點 ?我想從app.xaml.cs動我彈出代碼的App.xaml 任何幫助 第二件事可以理解 下面是我的代碼:如何在彈出窗口中打開本地存儲的html文件?

protected override void OnInitialize(IActivatedEventArgs args){ 

SettingsPane.GetForCurrentView()CommandsRequested + = App_CommandsRequested; }

void App_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) 
    { 
     SettingsCommand settingsCommand = new SettingsCommand(
     "About", 
     "About",  
     command => 
     { 
     var flyout = new SettingsFlyout(); 
     flyout.Title = "About"; 

     string file = "ms-appx-web:///assets/about/about.html"; 


     flyout.Show(); 
     } 
    ); 
    args.Request.ApplicationCommands.Add(settingsCommand); 

    } 

回答

0

關於你提到的第一個問題,是你絕對可以打開設置彈出按鈕本地存儲的HTML頁面。

下面是你的樣品,我修改了一點:

private void App_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) 
    { 
     SettingsCommand settingsCommand = new SettingsCommand(
      "About", 
      "About", 
      command => 
      { 
       var flyout = new SettingsFlyout(); 
       flyout.Title = "About"; 

       WebView wView = new WebView(); 
       wView.Height = 700; 
       wView.Width = 300; 
       wView.Navigate(new Uri("ms-appx-web:///assets/About.html", UriKind.Absolute)); 

       flyout.Content = wView; 

       flyout.Show(); 
      } 
      ); 
     args.Request.ApplicationCommands.Add(settingsCommand); 

    } 

不知道你問題的第二部分。也許你應該提出一個單獨的問題。

相關問題