Пример #1
0
        public static void ConfigureTaskbar(Form form, string name, string?subCommand = null, string?arguments = null)
        {
            #region Sanity checks
            if (form == null)
            {
                throw new ArgumentNullException(nameof(form));
            }
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException(nameof(name));
            }
            #endregion

            if (Locations.IsPortable || ZeroInstallInstance.IsRunningFromCache)
            {
                WindowsTaskbar.PreventPinning(form.Handle);
            }

            string appUserModelID = AppUserModelID;
            if (!string.IsNullOrEmpty(subCommand))
            {
                appUserModelID += "." + subCommand;
            }
            string exePath = Path.Combine(Locations.InstallBase, ExeName + ".exe");
            WindowsTaskbar.SetWindowAppID(form.Handle, appUserModelID, exePath.EscapeArgument() + " " + arguments, exePath, name);
        }
Пример #2
0
        //--------------------//

        #region Form
        private void MainForm_HandleCreated(object sender, EventArgs e)
        {
            if (Locations.IsPortable || ZeroInstallInstance.IsRunningFromCache)
            {
                WindowsTaskbar.PreventPinning(Handle);
            }
            else
            {
                string exePath     = Path.Combine(Locations.InstallBase, "ZeroInstall.exe");
                string commandsExe = Path.Combine(Locations.InstallBase, "0install-win.exe");
                WindowsTaskbar.SetWindowAppID(Handle, "ZeroInstall", exePath.EscapeArgument(), exePath, "Zero Install");
                WindowsTaskbar.AddTaskLinks("ZeroInstall", new[]
                {
                    new WindowsTaskbar.ShellLink(buttonSync.Text.Replace("&", ""), commandsExe, SyncApps.Name),
                    new WindowsTaskbar.ShellLink(buttonUpdateAll.Text.Replace("&", ""), commandsExe, UpdateApps.Name),
                    new WindowsTaskbar.ShellLink(buttonStoreManage.Text.Replace("&", ""), commandsExe, StoreMan.Name + " manage")
                });
            }
        }
Пример #3
0
        internal static void ConfigureTaskbar([NotNull] Form form, [NotNull] string name, [CanBeNull] string subCommand = null, [CanBeNull] string arguments = null)
        {
            #region Sanity checks
            if (form == null)
            {
                throw new ArgumentNullException("form");
            }
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }
            #endregion

            string appUserModelID = AppUserModelID;
            if (!string.IsNullOrEmpty(subCommand))
            {
                appUserModelID += "." + subCommand;
            }
            string exePath = Path.Combine(Locations.InstallBase, ExeName + ".exe");
            WindowsTaskbar.SetWindowAppID(form.Handle, appUserModelID, exePath.EscapeArgument() + " " + arguments, exePath, name);
        }
Пример #4
0
        internal static void ConfigureTaskbar([NotNull] Form form, [NotNull] string name)
        {
            #region Sanity checks
            if (form == null)
            {
                throw new ArgumentNullException(nameof(form));
            }
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException(nameof(name));
            }
            #endregion

            if (Locations.IsPortable || ProgramUtils.IsRunningFromCache)
            {
                WindowsTaskbar.PreventPinning(form.Handle);
            }

            string appUserModelID = AppUserModelID;
            string exePath        = Path.Combine(Locations.InstallBase, ExeName + ".exe");
            WindowsTaskbar.SetWindowAppID(form.Handle, appUserModelID, exePath.EscapeArgument(), exePath, name);
        }