Ejemplo n.º 1
0
        private void FullUpdate(object sender, DoWorkEventArgs e)
        {
            if (getPinnedItemsRequiresPowershellToolStripMenuItem.Checked)
            {
                Exception pinningException;
                _shortcutsList = ShortcutItemEnumeration.TryGetShortcutsWithPinning(out pinningException, true)
                                 .Select(s => new ShortcutItemListViewItem(s))
                                 .ToList();
                if (pinningException != null)
                {
                    MessageBox.Show(
                        $"A problem occurred with PowerShell functionality. It has been disabled\r\n{pinningException}",
                        @"PowerShell failure", MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                    getPinnedItemsRequiresPowershellToolStripMenuItem_Click(this, null);
                }
            }
            else
            {
                _shortcutsList = ShortcutItemEnumeration.GetShortcuts(true)
                                 .Select(s => new ShortcutItemListViewItem(s))
                                 .ToList();
            }

            if (srtlstShortcuts.InvokeRequired)
            {
                srtlstShortcuts.Invoke(new Action(BuildShortcutList));
            }
            else
            {
                BuildShortcutList();
            }
        }
Ejemplo n.º 2
0
        public static void RefreshList(bool force = true, bool includePinned = false)
        {
            if (!force && _shortcutItems.Any())
            {
                return;
            }

            if (includePinned)
            {
                Exception pinningException;
                _shortcutItems = ShortcutItemEnumeration.TryGetShortcutsWithPinning(out pinningException, true);
                if (pinningException != null)
                {
                    throw pinningException;
                }
            }
            else
            {
                _shortcutItems = ShortcutItemEnumeration.GetShortcuts(true);
            }
        }