59 lines
1.2 KiB
C#
59 lines
1.2 KiB
C#
///
|
|
/// 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;
|
|
|
|
/// <returns>Reference to the operation</returns>
|
|
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();
|
|
}
|
|
|
|
/// <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;
|
|
}
|
|
}
|
|
}
|