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(); } }
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 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(); }
/// <summary> /// 当前域异常 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { var ex = e.ExceptionObject as Exception; if (ex == null) { return; } if (ex is AggregateException) { var sb = new System.Text.StringBuilder(); foreach (var innerEx in (ex as AggregateException).Flatten().InnerExceptions) { LogHelper.WriteLog(LogLevel.LOG_LEVEL_EMERG, innerEx, typeof(Program)); sb.AppendLine(innerEx.Message); } FrmException.ShowBug(ex); MessageDxUtil.ShowError(sb.ToString()); // 捕捉异常图片 getScreenshot(); } else { LogHelper.WriteLog(LogLevel.LOG_LEVEL_EMERG, ex, typeof(Program)); FrmException.ShowBug(ex); // 捕捉异常图片 getScreenshot(); } }
private static void ShowThreadExceptionDialog(Exception exception) { using (var frm = new FrmException(exception, new CrashReportSender())) { var rsx = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain)); frm.Icon = ((System.Drawing.Icon)(rsx.GetObject("$this.Icon"))); frm.ShowDialog(); } }
/// <summary> /// 处理异常信息 /// </summary> /// <param name="ex">异常</param> public void ProcessException(Exception ex) { // 201400711 页面假死问题解决 new Thread(() => { Thread.Sleep(500); this.Invoke((EventHandler) delegate { // 显示异常页面 var frmException = new FrmException(ex); frmException.ShowDialog(); }); }).Start(); }
private void SetUpWindowsStoreListView() { lstWindowsStoreApps.Clear(); BuildWindowsStoreListBoxColumns(); try { lstWindowsStoreApps.Items.AddRange( WindowsStoreAppListViewItemLibrary.LibraryAsListViewItems.OrderBy(w => w.Text) .ToArray <ListViewItem>()); } catch (Exception ex) { FrmException.ShowExceptionHandler(ex); } }
/// <summary> /// 进程异常 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) { if (e.Exception == null) { return; } LogHelper.WriteLog(LogLevel.LOG_LEVEL_EMERG, e.Exception, typeof(Program)); Thread t = new Thread(getScreenshot); t.IsBackground = true; t.Start(); FrmException.ShowBug(e.Exception); }
private void ViewExceptionDetail() { if (dgvInfo.Rows.Count <= 0 || dgvInfo.CurrentCell == null) { return; } var exceptionEntity = new CiExceptionEntity { Message = dgvInfo.CurrentRow.Cells[CiExceptionTable.FieldMessage].Value.ToString(), FormattedMessage = dgvInfo.CurrentRow.Cells[CiExceptionTable.FieldFormattedMessage].Value.ToString(), CreateOn = BusinessLogic.ConvertToNullableDateTime(dgvInfo.CurrentRow.Cells[CiExceptionTable.FieldCreateOn].Value), CreateBy = dgvInfo.CurrentRow.Cells[CiExceptionTable.FieldCreateBy].Value.ToString() }; var frmException = new FrmException(exceptionEntity); frmException.ShowDialog(); }
private void PopulateAllTabs() { Invoke(new Action(() => { try { SetUpExplorer(); SetUpSteam(); SetUpChrome(); SetUpWindowsStore(); } catch (Exception ex) { var frmException = new FrmException(ex); frmException.ShowDialog(); } })); }
public void Application_ThreadException(object sender, ThreadExceptionEventArgs e) { try { var frmException = new FrmException(e.Exception); frmException.ShowDialog(); } catch { try { MessageBox.Show("严重错误", "严重错误", MessageBoxButtons.OK, MessageBoxIcon.Stop); } finally { Application.Exit(); } } }
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { FrmException.ShowExceptionHandler(e.ExceptionObject as Exception); }
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e) { FrmException.ShowExceptionHandler(e.Exception); }
private void btnException2_Click(object sender, EventArgs e) { FrmException frmException = new FrmException(new Exception("自己创建的异常窗体")); frmException.ShowDialog(); }