Пример #1
0
        private void ReorderPinnedButtons()
        {
            TaskbarPropertiesManager.Instance.Properties.PinnedPrograms.Clear();

            this._taskbarPinnedButtons.Sort((x, y) => this.Controls.GetChildIndex(x).CompareTo(this.Controls.GetChildIndex(y)));

            foreach (var item in this._taskbarPinnedButtons)
            {
                TaskbarPinnedButton pinnedButton = item as TaskbarPinnedButton;
                PinnedApp           pinnedApp    = pinnedButton.Tag as PinnedApp;
                TaskbarPropertiesManager.Instance.Properties.PinnedPrograms.Add(pinnedApp.Shortcut);
            }

            try
            {
                TaskbarPropertiesManager.Instance.Save();
            }
            catch
            {
                // bury... log ?
            }
        }
Пример #2
0
        /// <summary>
        /// Add a new pinned button
        /// </summary>
        /// <param name="app">Pinned application</param>
        /// <param name="processMenu">Context menu</param>
        private void AddPinnedButton(PinnedApp app, ContextMenuStrip processMenu, bool saveOrder)
        {
            var button = new TaskbarPinnedButton(app);

            this.Controls.Add(button);

            button.Tag = app;
            button.Init();
            button.AutoSize         = false;
            button.Padding          = new System.Windows.Forms.Padding(0);
            button.Margin           = new System.Windows.Forms.Padding(0);
            button.ContextMenuStrip = processMenu;

            _groups.AddToGroup(app.Path, button);
            _taskbarPinnedButtons.Add(button);
            ArrangeButtons();

            if (saveOrder)
            {
                ReorderPinnedButtons();
            }
        }