private bool CommitSelection() { foreach (int invalidIndex in this._invalidIndices) { if (this._handler.GetState(invalidIndex)) { FrmMsgBox.ShowError(this, $"One or more items marked \"{MISSING_LABEL}\" have been selected. Please review and deselect these items before continuing."); return(false); } } if (!this._multiSelect) { if (!this.GetStates().Any(z => z)) { FrmMsgBox.ShowError(this, "Please make a selection before continuing."); return(false); } } this._result = this._objects.At(this.GetStates()).ToArray(); this.DialogResult = DialogResult.OK; this.Close(); return(true); }
internal static void ShowHint(Form owner, string text, EDontShowAgainId id, Image image = null) { if (image == null) { image = Resources.MsgHelp; } FrmMsgBox.Show(owner, "Hint", null, text, image, new[] { new MsgBoxButton(DialogResult.OK) }, id, DialogResult.OK); }
internal static void Show(Form owner, ELogLevel level, string message) { switch (level) { case ELogLevel.Information: FrmMsgBox.ShowInfo(owner, level.ToUiString(), message); break; case ELogLevel.Error: FrmMsgBox.ShowError(owner, level.ToUiString(), message); break; case ELogLevel.Warning: FrmMsgBox.ShowWarning(owner, level.ToUiString(), message); break; } }
/// <summary> /// Shows something /// </summary> /// <returns>Dialog result of selected button, or <see cref="MsgBox.DontShowAgainValue"/> if previously set to not show again.</returns> public static DialogResult Show(MsgBox e) { string key = null; if (e.DontShowAgainId != null) { int v; key = GetKey(e.DontShowAgainId); if (MainSettings.Instance.DoNotShowAgain.TryGetValue(key, out v)) { // User said "don't show again" if (e.DontShowAgainValue.HasValue) { // Always use the same result return(e.DontShowAgainValue.Value); } else { // Use the user's last selection return((DialogResult)v); } } } using (FrmMsgBox frm = new FrmMsgBox(e)) { DialogResult result = UiControls.ShowWithDim(e.Owner, frm); if (frm._chkNotAgain.Checked) { MainSettings.Instance.DoNotShowAgain.Add(key, (int)result); MainSettings.Instance.Save(MainSettings.EFlags.DoNotShowAgain); } return(result); } }
public DialogResult Show(IWin32Window owner) { this.Owner = owner; return(FrmMsgBox.Show(this)); }