protected override void WndProc(ref Message m) { try { switch (m.Msg) { // The tree grid will dispose this control on a MouseWheel // event, but the base control class does not handle the case // of the disappearing control correctly. The DefWndProc call // here will forward the call back up the parent chain. Uncomment // the following code to get to the OnMouseWheel override and/or // fire the event, or handle MOUSEWHEEL code in line at this point. case NativeMethods.WM_MOUSEWHEEL: DefWndProc(ref m); //if (!IsDisposed) //{ // Point p = new Point ((int)(short)m.LParam, (int)m.LParam >> 16); // p = PointToClient(p); // OnMouseWheel(new MouseEventArgs(MouseButtons.None, 0, p.X, p.Y, (int)m.WParam >> 16)); //} break; default: base.WndProc(ref m); break; } } catch (Exception e) { if (CriticalException.IsCriticalException(e)) { throw; } myInPlaceHelper.DisplayException(e); } }
internal void RaiseCriticalException(CriticalExceptionEventArgs e) { CriticalException?.InvokeAsync(this, e); }
static void Main(string[] args) { int option; do { try { Console.WriteLine("====Menu===="); Console.WriteLine("[1] Hacer algo"); Console.WriteLine("[2] Hacer algo mas"); Console.WriteLine("[3] Exception Number"); Console.WriteLine("[0] Salir"); if (!int.TryParse(Console.ReadLine(), out option)) { throw new InvalidInputException(2); } if (option == 1) { int i = 0; int j = 0; int y = i / j; Console.WriteLine("Una accion"); } else { if (option == 2) { var list = new List <int>(); var x = list[10]; } else { if (option == 3) { int cant = 50; int res = 1; for (int i = 1; i < cant; i++) { res = res * i; if (res > 1000) { throw new AbsoluteException(res); } } } } } } catch (Exception exception) { AbstractException catched; if (exception is AbstractException) { catched = exception as AbstractException; } else { catched = new CriticalException(exception); } Console.WriteLine(catched.FriendlyMessage); catched.LogException(); option = -1; } } while (option != 0); Console.ReadKey(); }
private void OnCriticalException(Exception ex) { CriticalException?.Invoke(ex); }
private static void TriggerCriticalExceptonEvent(Exception ex) { var criticalException = new CriticalException(ex.InnerException.Message, ex.InnerException); EventBus.Default.Trigger(new AbpHandledExceptionData(criticalException)); }
private bool RunCustomTool(ProjectItem item) { string customTool = GetCustomTool(item); VSProjectItem item2 = item.Object as VSProjectItem; VSWebProjectItem2 item3 = item.Object as VSWebProjectItem2; bool flag = true; bool flag2 = false; try { string text1 = (string)item.Properties.Item("FullPath").Value; } catch (ArgumentException) { flag = false; this.WriteLine(Microsoft.VisualStudio.TextTemplating.VSHost.Resources.OrchestrationSkippingNoPath, new object[] { item.Name }); } if ((flag && (item.ProjectItems != null)) && (item.ProjectItems.Count > 0)) { foreach (ProjectItem item4 in item.ProjectItems) { string str2 = ""; try { str2 = (string)item4.Properties.Item("FullPath").Value; } catch (ArgumentException) { flag = false; this.WriteLine(Microsoft.VisualStudio.TextTemplating.VSHost.Resources.OrchestrationSkippingNoPath, new object[] { item4.Name }); } if ((!string.IsNullOrEmpty(str2) && !this.Dte.SourceControl.IsItemUnderSCC(str2)) && (File.Exists(str2) && ((File.GetAttributes(str2) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly))) { flag = false; this.WriteLine(Microsoft.VisualStudio.TextTemplating.VSHost.Resources.OrchestrationSkippingReadOnly, new object[] { str2 }); } } } if (flag) { this.Write(Microsoft.VisualStudio.TextTemplating.VSHost.Resources.OrchestratorRunLine, new object[] { customTool, item.Name }); try { this.ClearCustomTextTemplatingToolErrorStatus(); if (item2 != null) { item2.RunCustomTool(); } else if (item3 != null) { item3.RunCustomTool(); } flag2 = this.FindCustomTextTemplatingToolErrorStatus(); if (flag2) { this.WriteLine(Microsoft.VisualStudio.TextTemplating.VSHost.Resources.OrchestrationLineFailed); } else { this.WriteLine(Microsoft.VisualStudio.TextTemplating.VSHost.Resources.OrchestrationLineSucceeded); } } catch (Exception exception) { if (CriticalException.IsCriticalException(exception)) { throw; } this.WriteLine(Microsoft.VisualStudio.TextTemplating.VSHost.Resources.OrchestrationLineFailed); flag2 = true; } } this.outputPane.Activate(); return(flag2); }