private bool DoesUserWantToApplyFix(CheckEventArgs args) { //if there is a fix and a request handler for whether or not to apply the fix if (args.ProposedFix != null) { if (args.Result == CheckResult.Success) { throw new Exception("Why did you propose the fix " + args.ProposedFix + " when there is was no problem " + "(dont specify a proposedFix if you are passing in CheckResult.Success)"); } //there is a suggested fix, see if the user has subscribed to the fix handler (i.e. the fix handler tells the class whether the user wants to apply this specific fix, like maybe a messagebox or something gets shown and it returns true to apply the fix) bool applyFix = MakeChangePopup.ShowYesNoMessageBoxToApplyFix(AllowsYesNoToAll ? yesNoYesToAllDialog : null, args.Message, args.ProposedFix); //user wants to apply fix so don't raise any more events if (applyFix) { return(true); } } //do not apply fix return(false); }
public bool OnCheckPerformed(CheckEventArgs args) { if (args.ProposedFix != null) { return(MakeChangePopup.ShowYesNoMessageBoxToApplyFix(null, args.Message, args.ProposedFix)); } else { //if it is sucessful user doesn't need to be spammed with messages if (args.Result == CheckResult.Success) { return(true); } //its a warning or an error possibly with an exception attached if (args.Ex != null) { ExceptionViewer.Show(args.Message, args.Ex); } else { MessageBox.Show(args.Message); } return(false); } }
public bool OnCheckPerformed(CheckEventArgs args) { //if it has proposed fix it will be an SQL select query - probably if (args.ProposedFix != null) { if (_yesToAll) { return(true); } //we will handle this one instead of the checksui SQLPreviewWindow window = new SQLPreviewWindow("Send Query?", "The following query is about to be submitted:", args.ProposedFix); try { return(window.ShowDialog() == DialogResult.OK); } finally { _yesToAll = window.YesToAll; } } if (args.Result == CheckResult.Fail) { fetchDataResultedInNoErrors = false;//don't tell them everything was fine because it wasn't } return(checksUI1.OnCheckPerformed(args)); }
public bool OnCheckPerformed(CheckEventArgs args) { if (_host.InvokeRequired) { return((bool)_host.Invoke((Func <bool>)(() => OnCheckPerformed(args)))); } //record in memory memoryCheckNotifier.OnCheckPerformed(args); Enabled = true; if (dialog != null) { if (!string.IsNullOrWhiteSpace(args.ProposedFix)) { if (dialog.ShowDialog(string.Format("Problem:{0}\r\n\r\nFix:{1}", args.Message, args.ProposedFix), "Apply Fix?") == DialogResult.Yes) { ElevateState(CheckResult.Warning); memoryCheckNotifier.OnCheckPerformed(new CheckEventArgs("Fix will be applied", CheckResult.Warning)); return(true); } } } ElevateState(args.Result); if (args.Ex != null) { Tag = args.Ex; } return(false); }
public bool OnCheckPerformed(CheckEventArgs args) { _listener.OnNotify(this, args.ToNotifyEventArgs()); //reject all proposed fixes return(false); }
public bool OnCheckPerformed(CheckEventArgs args) { //record in memory memoryCheckNotifier.OnCheckPerformed(args); if (dialog != null) { if (!string.IsNullOrWhiteSpace(args.ProposedFix)) { if (dialog.ShowDialog(string.Format("Problem:{0}\r\n\r\nFix:{1}", args.Message, args.ProposedFix), "Apply Fix?") == DialogResult.Yes) { ElevateState(CheckResult.Warning); memoryCheckNotifier.OnCheckPerformed(new CheckEventArgs("Fix will be applied", CheckResult.Warning)); return(true); } } } ElevateState(args.Result); if (args.Ex != null) { _exception = args.Ex; } return(false); }
public bool OnCheckPerformed(CheckEventArgs args) { if (InvokeRequired) { Invoke(new MethodInvoker(() => OnCheckPerformed(args))); return(false); } //record in memory memoryCheckNotifier.OnCheckPerformed(args); ElevateState(args.Result); if (args.Ex != null) { if (args.Result == CheckResult.Fail) { pbRed.Tag = args.Ex; } else { pbYellow.Tag = args.Ex; } } SetCorrectCursor(); return(false); }
internal bool Check(Node n) { CheckEventArgs ev = new CheckEventArgs(n); if (OnBeginCheck != null) { OnBeginCheck(this, ev); } if (ev.CanCheck) { if (!ChecksAreIndependant) { Node child = n.FirstChild; while (child != null) { if (Set.Contains(child.State, NodeState.HasCheck) && child.IsVisible) { Check(child); } child = child.NextSibling; } } if (!Set.Contains(n.State, NodeState.Checked)) { Set.Include(ref n.State, NodeState.Checked); if (n.IsVisible) { Node.UpdateTotalCheckedCount(n.Parent, 1, ChecksAreIndependant); } } Debug.WriteLine(String.Format("{2} (check :{0}, checked{1}", n.TotalCheck, n.TotalChecked, n.Text)); Debug.WriteLine(String.Format("{2} (check :{0}, checked{1}", n.Parent.TotalCheck, n.Parent.TotalChecked, n.Parent.Text)); } return(ev.CanCheck); }
protected virtual bool OnCheck(string command) { if (String.IsNullOrEmpty(command)) { return(false); } if (null != _checks && _checks.ContainsKey(command)) { List <CheckDefinition> list = _checks[command]; if (list == null || list.Count == 0) { return(true); } else { foreach (CheckDefinition check in list) { string error = check.Error; if (string.IsNullOrEmpty(error)) { throw new InvalidOperationException(string.Format("Check on command '{0}' has no error message", command)); } IExpression expression = check.Expression; if (null != expression && !expression.Evaluate().IsSuccessful()) { _monitor.Register(this.Reporter, this._monitor.NewEventInstance(string.Format("container check '{0}' error", command), null, new ApplicationException(error), EVENT_TYPE.Error)); return(false); } else if (!String.IsNullOrEmpty(check.Milestone)) { this.PassLastCheck = true; OnMilestone(check.Milestone); if (!this.PassLastCheck) { _monitor.Register(this.Reporter, this._monitor.NewEventInstance(string.Format("container check '{0}' error", command), null, new ApplicationException(error), EVENT_TYPE.Error)); } return(this.PassLastCheck); } } } } if (null != this.Check) { CheckEventArgs cea = new CheckEventArgs(command); Check(this, cea); if (!cea.Pass) { return(false); } } return(true); }
public bool OnCheckPerformed(CheckEventArgs args) { if (args.Result >= CheckResult.Fail) { FatalCalls.Add(args); } return(false); }
public bool OnCheckPerformed(CheckEventArgs args) { if (args.Result == CheckResult.Fail) { FailureMessages.Add(args.Message); } //accept all proposed changes return(true); }
private void AddToListbox(CheckEventArgs args) { if (InvokeRequired && !IsDisposed) { BeginInvoke(new MethodInvoker(() => AddToListbox(args))); return; } olvChecks.AddObject(args); }
public bool OnCheckPerformed(CheckEventArgs args) { bool shouldApplyFix = DoesUserWantToApplyFix(args); AddToListbox(shouldApplyFix ? new CheckEventArgs("Fix will be applied for message:" + args.Message, CheckResult.Warning, args.Ex) : args); return(shouldApplyFix); }
private void OnBlackKingCheckedChangedEvent(CheckEventArgs e) { if (context is not null) { context.Send(delegate { OnBlackKingCheckedChanged(this, e); }, null); } else { OnBlackKingCheckedChanged(this, e); } }
/// <summary> /// Reports the supplied exception in the RAG checks smiley on the top toolbar. This will result in rag checks becomming /// visible if it was not visible before. /// </summary> /// <param name="s"></param> /// <param name="exception"></param> public void Fatal(string s, Exception exception) { var args = new CheckEventArgs(s, CheckResult.Fail, exception); if (OnFatal != null) { OnFatal(this, args); } _ragSmileyToolStrip.OnCheckPerformed(args); }
private void OnInvalidMoveKingCheckedEvent(CheckEventArgs e) { if (context is not null) { context.Send(delegate { OnInvalidMoveKingChecked(this, e); }, null); } else { OnInvalidMoveKingChecked(this, e); } }
public bool OnCheckPerformed(CheckEventArgs args) { //record in memory memoryCheckNotifier.OnCheckPerformed(args); ElevateState(args.Result); if (args.Ex != null) { _exception = args.Ex; } return(false); }
public bool OnCheckPerformed(CheckEventArgs args) { var level = args.ToLogLevel(); if (args.ProposedFix != null && AcceptFixes) { //downgrade it to warning if we are accepting the fix if (level > LogLevel.Warn) { level = LogLevel.Warn; } } Log("Checks", level, args.Ex, args.Message); return(AcceptFixes); }
public static LogLevel ToLogLevel(this CheckEventArgs args) { switch (args.Result) { case CheckResult.Success: return(LogLevel.Info); case CheckResult.Warning: return(LogLevel.Warn); case CheckResult.Fail: return(LogLevel.Error); default: throw new ArgumentOutOfRangeException(); } }
private void enAddJunk_CheckChanged(object sender, CheckEventArgs e) { if (enAddJunk.Checked) { DefaultInputForm input = new DefaultInputForm("enter size to add (MB):", "10"); input.ShowDialog(); if (!Checking.CheckConvertInt(input.results[0])) { MessageBox.Show("Please enter a valid number"); enAddJunk.Checked = false; return; } enAddJunk.optionalValue = (int.Parse(input.results[0]) * 1048576).ToString(); } }
public bool OnCheckPerformed(CheckEventArgs args) { if (_worstSeen < args.Result) { _worstSeen = args.Result; } if (args.Result == CheckResult.Fail || args.Result == CheckResult.Warning) { if (!haveDemandedVisibility) { haveDemandedVisibility = true; Invoke(new MethodInvoker(Show)); } } return(checksUI1.OnCheckPerformed(args)); }
/// <summary> /// CheckBox2点击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CheckBox2_CheckChanged(object sender, CheckEventArgs e) { try { if (CheckBox2.Checked) { CheckBox1.Checked = false; txtRB_REASON.Visible = true; } else { CheckBox1.Checked = true; txtRB_REASON.Visible = false; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Reports the supplied exception in the RAG checks smiley on the top toolbar. This will result in rag checks becomming /// visible if it was not visible before. /// </summary> /// <param name="s"></param> /// <param name="exception"></param> public void Fatal(string s, Exception exception) { var args = new CheckEventArgs(s, CheckResult.Fail, exception); if (OnFatal != null) { OnFatal(this, args); } if (_ragSmileyToolStrip == null) { _ragSmileyToolStrip = new RAGSmileyToolStrip((Control)_hostControl); } if (_ragSmileyToolStrip.GetCurrentParent() == null) { Add(_ragSmileyToolStrip); } _ragSmileyToolStrip.OnCheckPerformed(args); }
public bool OnCheckPerformed(CheckEventArgs args) { //if there is a fix suggest it to the user if (args.ProposedFix != null) { return(ShowYesNoMessageBoxToApplyFix(_dialog, args.Message, args.ProposedFix)); } //else show an Exception if (args.Ex != null) { ExceptionViewer.Show(args.Ex); } else if (args.Result == CheckResult.Fail) { WideMessageBox.Show(args.Message, "", environmentDotStackTrace: Environment.StackTrace); } return(false); }
public bool OnCheckPerformed(CheckEventArgs args) { if (args.ProposedFix != null) { return(basicActivator.YesNo(args.ProposedFix, "Apply fix?")); } if (args.Result >= CheckResult.Fail) { if (args.Ex == null) { basicActivator.Show(args.Message); } else { basicActivator.ShowException(args.Message, args.Ex); } } return(false); }
//MEF only! public bool OnCheckPerformed(CheckEventArgs args) { if (InvokeRequired) { Invoke(new MethodInvoker(() => OnCheckPerformed(args))); return(false); } //if the message starts with a percentage translate it into the progress bars movement Regex progressHackMessage = new Regex("^(\\d+)%"); var match = progressHackMessage.Match(args.Message); if (match.Success) { var percent = float.Parse(match.Groups[1].Value); pbLoadProgress.Value = (int)(500 + (percent * 2.5));//500-750 } switch (args.Result) { case CheckResult.Success: break; case CheckResult.Warning: case CheckResult.Fail: //MEF failures are only really warnings args.Result = CheckResult.Warning; break; default: throw new ArgumentOutOfRangeException(); } lblProgress.Text = args.Message; return(ragSmiley1.OnCheckPerformed(args)); }
public bool OnCheckPerformed(CheckEventArgs args) { //handle cross thread invocations var p = GetCurrentParent(); if (p != null && p.InvokeRequired) { p.BeginInvoke(new MethodInvoker(() => { OnCheckPerformed(args); })); return(false); } _events.OnCheckPerformed(args); try { Enabled = true; Invalidate(); } catch (Exception) { //thrown if cross thread } return(false); }
public bool OnCheckPerformed(CheckEventArgs args) { return(true); }
public void TermintateImporantProcess_TaskDialog_VerificationClick(object sender, CheckEventArgs e) { TaskDialog taskDialog = sender as TaskDialog; taskDialog.EnableButton(1, e.IsChecked); }
private static void T_TaskDialog_64Warn_VerificationClick(object sender, CheckEventArgs e) { NativeMethods.SetConfigBool("X32Warning", "AppSetting", !e.IsChecked); }