///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using TBF.BenchControl;
using TBF.Resources;
namespace TBF.BenchControl.Operations
{
public class AskYesNoOp : IOperation
{
AskYesNoForm modelessDlg;
string question;
/// Reference to the operation
public AskYesNoOp()
: this(Strings.Question)
{
}
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();
}
/// Start this operation
public void Start()
{
Program.MainWnd.Invoke(new AskYesNoFormDlgt(OpenFormDlg), this);
}
/// Run this operation
/// Event.ResultsPrinted
public Event Run()
{
if (modelessDlg.CompletedYes) return Event.Yes;
if (modelessDlg.CompletedNo) return Event.No;
return Event.None;
}
/// Stop this operation
public void Stop()
{
modelessDlg = null;
}
}
}