/// /// Copyright (c) 2019 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; using System.Drawing; using TBF.BenchControl; using TBF.Resources; namespace TBF.BenchControl.Operations { public class LargeMessageBoxOp : IOperation { LargeMessageBoxForm form; string message; Color backColor; bool completed = false; /// Reference to the operation public LargeMessageBoxOp() : this(Strings.Message) { } public LargeMessageBoxOp(string message) : this (message, Color.Goldenrod) { } public LargeMessageBoxOp(string message, Color backColor) { this.message = message; this.backColor = backColor; } delegate void MessageBoxFormDlgt(LargeMessageBoxOp myRef); /// void OpenFormDlg(LargeMessageBoxOp myRef) { myRef.form = new LargeMessageBoxForm(message, backColor); form.Show(); } /// Start this operation public void Start() { completed = false; Program.MainWnd.Invoke(new MessageBoxFormDlgt(OpenFormDlg), this); } /// Run this operation /// Event.ResultsPrinted public Event Run() { if (form.CompletedContinue) return Event.Continue; if (form.CompletedAbort) return Event.Abort; return Event.None; } /// Stop this operation public void Stop() { if (form != null) { form.OnCloseThisForm(this, null); form = null; } } } }