54 lines
1.1 KiB
C#
54 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using TBF.BenchControl;
|
|
|
|
namespace TBF.BenchControl.Operations
|
|
{
|
|
public class AskYesNoOp : IOperation
|
|
{
|
|
AskYesNoForm modelessDlg;
|
|
|
|
string question;
|
|
|
|
/// <returns>Reference to the operation</returns>
|
|
public AskYesNoOp()
|
|
{
|
|
}
|
|
|
|
public AskYesNoOp(string question)
|
|
{
|
|
this.question = question;
|
|
}
|
|
|
|
delegate void AskYesNoFormDlgt(AskYesNoOp myRef);
|
|
///
|
|
void OpenFormDlg(AskYesNoOp myRef)
|
|
{
|
|
myRef.modelessDlg = new AskYesNoForm();
|
|
myRef.modelessDlg.Question = this.question;
|
|
modelessDlg.Show();
|
|
}
|
|
|
|
/// <summary>Start this operation</summary>
|
|
public void Start()
|
|
{
|
|
Program.MainWnd.Invoke(new AskYesNoFormDlgt(OpenFormDlg), this);
|
|
}
|
|
|
|
/// <summary>Run this operation</summary>
|
|
/// <returns>Event.ResultsPrinted</returns>
|
|
public Event Run()
|
|
{
|
|
if (modelessDlg.CompletedYes) return Event.Yes;
|
|
if (modelessDlg.CompletedNo) return Event.No;
|
|
return Event.None;
|
|
}
|
|
|
|
/// <summary>Stop this operation</summary>
|
|
public void Stop()
|
|
{
|
|
modelessDlg = null;
|
|
}
|
|
}
|
|
}
|