2017-02-03 39 views

回答

0

但由於某種原因,沒有啓動日曆的選項..怎麼辦?

您也可以通過URL啓動日曆。代碼如下:

await Launcher.LaunchUriAsync(new Uri("outlookcal:")); 

你不知道如何啓動的原因是你沒有找到日曆協議 - 「Url:outlookcal」。實際上,您可以通過打開「設置 - >默認應用程序 - >按協議選擇默認應用程序」來找到應用程序協議。

enter image description here

另外,如果我想要的東西推出的x86程序?

對於其他的Win32應用程序,甚至UWP的應用程序,是不是默認的應用程序,他們沒有在默認Url協議,您可能需要註冊一個協議的應用程序和處理URI激活。然後你可以用類似的方式通過Launcher類來啓動它。更多詳情請參考Handle URI activation。例如,您可以按以下方式註冊Url以進行WPF項目:

private void InstallProtocol_Click(object sender, RoutedEventArgs e) 
{ 
    using (var hkcr = Registry.ClassesRoot) 
    { 
     if (hkcr.GetSubKeyNames().Contains(SchemeName.Text)) 
     { 
      MessageBox.Show(string.Format("Looks like {0} is already installed.", SchemeName.Text)); 
      return; 
     } 

     using (var schemeKey = hkcr.CreateSubKey(SchemeName.Text)) 
     { 
      //[HKEY_CLASSES_ROOT\com.aruntalkstech.wpftarget] 
      //@="Url:WPF Target Protocol" 
      //"URL Protocol"="" 
      //"UseOriginalUrlEncoding"=dword:00000001 
      schemeKey.SetValue(string.Empty, "Url: WPF Target Protocol"); 
      schemeKey.SetValue("URL Protocol", string.Empty); 
      schemeKey.SetValue("UseOriginalUrlEncoding", 1, RegistryValueKind.DWord); 

      //[HKEY_CLASSES_ROOT\com.aruntalkstech.wpf\shell] 
      using (var shellKey = schemeKey.CreateSubKey("shell")) 
      { 
       //[HKEY_CLASSES_ROOT\com.aruntalkstech.wpf\shell\open] 
       using (var openKey = shellKey.CreateSubKey("open")) 
       { 
        //[HKEY_CLASSES_ROOT\com.aruntalkstech.wpf\shell\open\command] 
        using (var commandKey = openKey.CreateSubKey("command")) 
        { 
         //@="C:\\github\\SampleCode\\UniversalAppLaunchingWPFApp\\WPFProtocolHandler\\bin\\Debug\\WPFProtocolHandler.exe \"%1\"" 
         commandKey.SetValue(string.Empty, Assembly.GetExecutingAssembly().Location + " %1"); 
         commandKey.Close(); 
        } 
        openKey.Close(); 
       } 
       shellKey.Close(); 
      } 
      schemeKey.Close(); 
     } 
     hkcr.Close(); 
    } 

    MessageBox.Show(string.Format("Custom scheme {0}: installed.", SchemeName.Text)); 
}