Пример #1
0
 private void inkCommand_action(object obj)
 {
     string msg = "创建桌面快捷方式失败!";
     if (ShortcutHelper.CreateDesktopShortcut())
     {
         msg = "创建桌面快捷方式成功!";
     }
     MessageBox.Show(msg, "提示");
 }
Пример #2
0
        private void inkCommand_action(object obj)
        {
            string msg = $"{Application.Current.Resources["Lang_Failed"]}";

            if (ShortcutHelper.CreateDesktopShortcut())
            {
                msg = $"{Application.Current.Resources["Lang_Success"]}";
            }
            Modal(msg);
        }
Пример #3
0
 private static void CreateAppShortcut(string vmName, string isUpdate)
 {
     try
     {
         Logger.Info("Creating app shortcut");
         string iconCompletePath = RegistryStrings.ProductIconCompletePath;
         string str1             = Path.Combine(RegistryStrings.GadgetDir, ApkInstall.sPackageName + ".png");
         string imagePath        = Path.Combine(RegistryStrings.GadgetDir, ApkInstall.sPackageName + "." + ApkInstall.sLaunchableActivityName + ".png");
         if (!System.IO.File.Exists(str1))
         {
             str1 = Path.Combine(RegistryStrings.GadgetDir, ApkInstall.sAppIcon);
         }
         Logger.Info("Image path " + str1);
         string str2;
         try
         {
             str2 = Utils.ConvertToIco(str1, RegistryStrings.GadgetDir);
         }
         catch (Exception ex)
         {
             Logger.Error(ex.ToString());
             str2 = Utils.ConvertToIco(imagePath, RegistryStrings.GadgetDir);
         }
         if (!System.IO.File.Exists(str2))
         {
             str2 = iconCompletePath;
         }
         if (string.Compare(isUpdate, "true", true) == 0 || !Oem.Instance.IsCreateDesktopIconForApp || (!RegistryManager.Instance.AddDesktopShortcuts || string.Compare(vmName, "Android", true) != 0))
         {
             return;
         }
         Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), ApkInstall.sAppName + ".lnk");
         string targetApplication = Path.Combine(RegistryStrings.InstallDir, "HD-RunApp.exe");
         string appRunAppJsonArg  = Utils.GetAppRunAppJsonArg(ApkInstall.sAppName, ApkInstall.sPackageName);
         ShortcutHelper.CreateDesktopShortcut(ApkInstall.sAppName, str2, targetApplication, appRunAppJsonArg, "", ApkInstall.sPackageName);
     }
     catch (Exception ex)
     {
         Logger.Warning("Couldn't create desktop shortcut, ex: " + ex.ToString());
     }
 }