private void FullUpdate(object sender, DoWorkEventArgs e)
        {
            if (getPinnedItemsRequiresPowershellToolStripMenuItem.Checked)
            {
                try
                {
                    ShortcutItemListViewItemLibrary.RefreshList(true, true);
                }
                catch (Exception ex)
                {
                    FrmException.ShowExceptionHandler(ex);
                    Invoke(new Action(() => FormUtils.ShowMessage(this,
                                                                  Strings.PowershellErrorFull,
                                                                  Strings.PowershellFailure, MessageBoxButtons.OK,
                                                                  MessageBoxIcon.Error)));
                    Invoke(new Action(() => getPinnedItemsRequiresPowershellToolStripMenuItem_Click(this, null)));
                }
            }
            else
            {
                ShortcutItemListViewItemLibrary.RefreshList(true);
            }

            UpdateFilteredList();

            if (srtlstShortcuts.InvokeRequired)
            {
                srtlstShortcuts.Invoke(new Action(BuildListViewContent));
            }
            else
            {
                BuildListViewContent();
            }
        }
Exemplo n.º 2
0
        private void btnDeleteCustomShortcut_Click(object sender, EventArgs e)
        {
            if (
                MessageBox.Show(
                    string.Format(Strings.ConfirmDeleteCustomShortcut,
                                  Path.GetFileNameWithoutExtension(CurrentShortcutItem.ShortcutFileInfo.Name).QuoteWrap()),
                    Strings.AreYouSure,
                    MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }

            try
            {
                var customShortcut = CustomShortcut.Load(CurrentShortcutItem.TargetFilePath);
                customShortcut.Delete();
            }
            catch (Exception ex)
            {
                FrmException.ShowExceptionHandler(ex);
                MessageBox.Show(Strings.UnableToClearShortcuts);
            }

            StartFullUpdate();
        }
Exemplo n.º 3
0
        private void GenerateShortcut(BaseCustomShortcutBuilder baseCustomShortcutBuilder)
        {
            var shortcutName = txtShortcutName.Text.CleanInvalidFilenameChars();

            try
            {
                ValidateFields(shortcutName, baseCustomShortcutBuilder.Parameters.ShortcutTarget);
            }
            catch (ValidationFailureException)
            {
                return;
            }

            try
            {
                var customShortcut = baseCustomShortcutBuilder.GenerateCustomShortcut(shortcutName);

                BuildIconifiedTile(ImageUtils.ImageToByteArray(pctCurrentIcon.Image), customShortcut);

                //confirm to the user the shortcut has been created
                ConfirmToUser(shortcutName);
            }
            catch (FileNotFoundException ex)
            {
                MessageBox.Show(ex.Message, Strings.FileCouldNotBeFound,
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            catch (Exception ex)
            {
                FrmException.ShowExceptionHandler(ex);
            }
        }
 private void SetUpWindowsStoreListView()
 {
     lstWindowsStoreApps.Clear();
     BuildWindowsStoreListBoxColumns();
     try
     {
         lstWindowsStoreApps.Items.AddRange(
             WindowsStoreAppListViewItemLibrary.LibraryAsListViewItems.OrderBy(w => w.Text)
             .ToArray <ListViewItem>());
     }
     catch (Exception ex)
     {
         FrmException.ShowExceptionHandler(ex);
     }
 }
Exemplo n.º 5
0
 private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     FrmException.ShowExceptionHandler(e.ExceptionObject as Exception);
 }
Exemplo n.º 6
0
 private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
 {
     FrmException.ShowExceptionHandler(e.Exception);
 }