Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions OpenTap.Plugins.Demo.Battery.UI/DemonstrationPanelTest.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,26 @@ public partial class DemonstrationPanelTest : UserControl
{
private readonly ITapDockContext _context;


bool CheckAllow(bool isRunningCheck, bool isOpenCheck)
{
if (_context.Plan.IsRunning && isRunningCheck)
{
ShowMessage("Error: Test plan is running",
"The action cannot be performance while the test plan is running.");
return false;
}
if (_context.Plan.IsOpen && isOpenCheck)
{
ShowMessage("Error: Test plan is open",
"The action cannot be performance while the test plan is in the open state.");
return false;
}

return true;

}

public DemonstrationPanelTest(ITapDockContext context)
{
_context = context;
Expand Down Expand Up @@ -47,6 +67,8 @@ private void LoadResources()

private void LoadTestPlan()
{
if (!CheckAllow(true, true))
return;
var plan = new TestPlan();
_context.Plan = plan;

Expand Down Expand Up @@ -82,6 +104,8 @@ private void LoadTestPlan()

private void OnRunTestPlan(object sender, RoutedEventArgs e)
{
if (!CheckAllow(true, false))
return;
_context.Run();
var testPlanGridType = TypeData.GetTypeData("Keysight.OpenTap.Gui.TestPlanPlugin");
TapPanel.Focus(testPlanGridType);
Expand All @@ -106,6 +130,9 @@ private void OnShowResultsViewer(object sender, RoutedEventArgs e)

private void OnLoadDemo(object sender, RoutedEventArgs e)
{
if (!CheckAllow(true, true))
return;

var response = ShowMessage("Load Demonstration?",
" Loading the battery test demonstration will cause the following changes:\n" +
" - New bench profile: a DUT, a power analyzer and a temperature chamber.\n" +
Expand Down