66 lines
2.5 KiB
C#
66 lines
2.5 KiB
C#
///
|
|
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
|
///
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using log4net;
|
|
using Common;
|
|
using Config.Entities;
|
|
using TBF.UiBridge;
|
|
|
|
namespace TBF.Rig.TestMethods.Dummy
|
|
{
|
|
public class DummySeq : Sequences.SequenceBase
|
|
{
|
|
private static readonly ILog log = LogManager.GetLogger(typeof(DummySeq));
|
|
|
|
/// <summary>
|
|
/// Adjustment method sequence
|
|
/// </summary>
|
|
/// <param name="test">Test entity</param>
|
|
/// <returns>
|
|
/// Event.Done . . . . . . . OK
|
|
/// Event.UiCmdStop . . . . Stopped by the user using the on-screen button STOP
|
|
/// Event.OpArgumentError . Target flow is out of range
|
|
/// Event.Error . . . . . . Unspecified error
|
|
/// </returns>
|
|
public IList<Event> Execute(Test test, int repetitionNr, bool isLastRepetition, DebugMode mode)
|
|
{
|
|
IList<Event> e = new List<Event>(); /// Events from currently running operations
|
|
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
|
|
|
/// Start the test, initialize test results
|
|
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, 0));
|
|
string testName = Common.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
|
TestStartTime = DateTime.Now;
|
|
|
|
///
|
|
/// Show a dialog with OK button and an appropriate message
|
|
///
|
|
Bridge.OnAdjustmentInProgress(this, new AdjustmentInProgressEventArgs(testName));
|
|
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.Test));
|
|
Bridge.OnActivity(this, test.Method);
|
|
State.Create(string.Format("{0}({1}) : Dummy", test.Method, test.Name))
|
|
.AddOperation(checkUiOp)
|
|
.AddOperation(StateMachine.BenchWaitingOp)
|
|
.AddOperation(new Operations.MessageBoxOp(string.Format("Dummy test {0}", test.Name)))
|
|
.EnterState();
|
|
do
|
|
{
|
|
e = StateMachine.WaitRunDevsRunOps();
|
|
|
|
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Progress.Test));
|
|
|
|
if (e.Contains(Event.Error)) goto stopTest;
|
|
if (TestAndLogUiCmdStop(test, e)) goto stopTest;
|
|
}
|
|
while (!e.Contains(Event.OK));
|
|
|
|
return new List<Event> { Event.Done };
|
|
|
|
stopTest:
|
|
return new List<Event> { Event.UiCmdStop };
|
|
}
|
|
}
|
|
}
|