Major upgrade
This commit is contained in:
58
Source/Program/GUI/Common/Util.cs
Normal file
58
Source/Program/GUI/Common/Util.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace ProgramLib.GUI
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides utility functions related to GUI
|
||||
/// </summary>
|
||||
internal class Util
|
||||
{
|
||||
public enum StandardButtons
|
||||
{
|
||||
OK_YES,
|
||||
CANCEL_NO,
|
||||
|
||||
NOT_SET
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculate the width and height of a string in pixels.
|
||||
/// This is useful if we want to resize window to fit dynamic text
|
||||
/// </summary>
|
||||
public static Size MeasureString(string text)
|
||||
{
|
||||
TextBlock tb = new TextBlock();
|
||||
var formattedText = new FormattedText(
|
||||
text,
|
||||
CultureInfo.CurrentCulture,
|
||||
FlowDirection.LeftToRight,
|
||||
new Typeface(tb.FontFamily, tb.FontStyle, tb.FontWeight, tb.FontStretch),
|
||||
tb.FontSize,
|
||||
Brushes.Black,
|
||||
new NumberSubstitution(),
|
||||
VisualTreeHelper.GetDpi(tb).PixelsPerDip);
|
||||
|
||||
return new Size(formattedText.Width, formattedText.Height);
|
||||
}
|
||||
}
|
||||
}
|
||||
54
Source/Program/GUI/Model/CoeMessageDataModel.cs
Normal file
54
Source/Program/GUI/Model/CoeMessageDataModel.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace ProgramLib.GUI.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// Coe Message Data model used for data binding
|
||||
/// </summary>
|
||||
internal partial class CoeMessageDataModel : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
private string name;
|
||||
[ObservableProperty]
|
||||
private string value;
|
||||
[ObservableProperty]
|
||||
private string type;
|
||||
[ObservableProperty]
|
||||
private string isFocusable;
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<CoeMessageDataModel> subItems;
|
||||
|
||||
public CoeMessageDataModel(string aName, string aValue, string aType)
|
||||
{
|
||||
name = aName;
|
||||
value = aValue;
|
||||
type = aType;
|
||||
isFocusable = Boolean.TrueString;
|
||||
subItems = new ObservableCollection<CoeMessageDataModel>();
|
||||
}
|
||||
|
||||
public CoeMessageDataModel()
|
||||
{
|
||||
subItems = new ObservableCollection<CoeMessageDataModel>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,27 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
/*-------------------------------------------------------------------------
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace ProgramLib.GUI.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// Impedance Data model used for data binding
|
||||
/// </summary>
|
||||
internal partial class ImpedanceDataModel : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
|
||||
@@ -1,11 +1,27 @@
|
||||
using System;
|
||||
/*-------------------------------------------------------------------------
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProgramLib.GUI.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// Data types for Passthrough Data model
|
||||
/// </summary>
|
||||
internal partial class PassthroughData
|
||||
{
|
||||
private struct VariableInfo
|
||||
@@ -18,59 +34,24 @@ namespace ProgramLib.GUI.Model
|
||||
}
|
||||
public enum Variables
|
||||
{
|
||||
VAR1,
|
||||
VAR2,
|
||||
VAR3,
|
||||
VAR4,
|
||||
VAR5,
|
||||
VAR6,
|
||||
VAR7,
|
||||
VAR8,
|
||||
VAR9,
|
||||
VAR10,
|
||||
VAR11,
|
||||
VAR12,
|
||||
VAR13,
|
||||
VAR14,
|
||||
VAR15,
|
||||
VAR16,
|
||||
VAR17,
|
||||
VAR18,
|
||||
VAR19,
|
||||
VAR20,
|
||||
VAR21,
|
||||
VAR22,
|
||||
VAR23,
|
||||
VAR24,
|
||||
VAR25,
|
||||
VAR26,
|
||||
VAR27,
|
||||
VAR28,
|
||||
VAR29,
|
||||
VAR30,
|
||||
VAR31,
|
||||
VAR32,
|
||||
VAR33,
|
||||
VAR34,
|
||||
VAR35,
|
||||
VAR36,
|
||||
VAR37,
|
||||
VAR38,
|
||||
VAR39,
|
||||
VAR40,
|
||||
VAR41,
|
||||
VAR42,
|
||||
VAR01, VAR02, VAR03, VAR04, VAR05, VAR06,
|
||||
VAR07, VAR08, VAR09, VAR10, VAR11, VAR12,
|
||||
VAR13, VAR14, VAR15, VAR16, VAR17, VAR18,
|
||||
VAR19, VAR20, VAR21, VAR22, VAR23, VAR24,
|
||||
VAR25, VAR26, VAR27, VAR28, VAR29, VAR30,
|
||||
VAR31, VAR32, VAR33, VAR34, VAR35, VAR36,
|
||||
VAR37, VAR38, VAR39, VAR40, VAR41, VAR42,
|
||||
};
|
||||
|
||||
private Dictionary<Variables, string> _variableEnumToDescriptionDict = new Dictionary<Variables, string>
|
||||
{
|
||||
{ Variables.VAR1, "IDA Temp" },
|
||||
{ Variables.VAR2, "FPGA Temp" },
|
||||
{ Variables.VAR3, "IDA Bias" },
|
||||
{ Variables.VAR4, "TINT" },
|
||||
{ Variables.VAR5, "Pitch" },
|
||||
{ Variables.VAR6, "Yaw" },
|
||||
{ Variables.VAR7, "Roll" },
|
||||
{ Variables.VAR01, "IDA Temp" },
|
||||
{ Variables.VAR02, "FPGA Temp" },
|
||||
{ Variables.VAR03, "IDA Bias" },
|
||||
{ Variables.VAR04, "TINT" },
|
||||
{ Variables.VAR05, "Pitch" },
|
||||
{ Variables.VAR06, "Yaw" },
|
||||
{ Variables.VAR07, "Roll" },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,29 @@
|
||||
using System;
|
||||
/*-------------------------------------------------------------------------
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace ProgramLib.GUI.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// Passthrough Data model used for data binding
|
||||
/// </summary>
|
||||
internal partial class PassthroughData
|
||||
{
|
||||
private int _datagridColumnCount = 0;
|
||||
@@ -49,15 +65,35 @@ namespace ProgramLib.GUI.Model
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get data model dictionary
|
||||
/// </summary>
|
||||
public Dictionary<int, ObservableCollection<string>> GetPassthroughDataModelDict()
|
||||
{
|
||||
return _rowNumberToPassthroughDataDict;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set value for a variable
|
||||
/// </summary>
|
||||
public void SetValue(Variables variableName, string val)
|
||||
{
|
||||
_rowNumberToPassthroughDataDict[_variableEnumToVariableInfoDict[variableName].passthroughDataModelDictIndex][_variableEnumToVariableInfoDict[variableName].passthroughDataModelItemIndex] = _variableEnumToDescriptionDict[variableName];
|
||||
_rowNumberToPassthroughDataDict[_variableEnumToVariableInfoDict[variableName].passthroughDataModelDictIndex][_variableEnumToVariableInfoDict[variableName].passthroughDataModelItemIndex + 1] = val;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Blank all data for every variable
|
||||
/// </summary>
|
||||
public void BlankAllData()
|
||||
{
|
||||
foreach (KeyValuePair<int, ObservableCollection<string>> item in _rowNumberToPassthroughDataDict)
|
||||
{
|
||||
for (int i = 0; i < item.Value.Count; i++)
|
||||
{
|
||||
item.Value[i] = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,38 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
/*-------------------------------------------------------------------------
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace ProgramLib.GUI.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// Power module data model used for data binding
|
||||
/// </summary>
|
||||
internal partial class PowerModuleDataModel : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
private string name;
|
||||
[ObservableProperty]
|
||||
private string powerLed;
|
||||
[ObservableProperty]
|
||||
private string expectedVoltage;
|
||||
[ObservableProperty]
|
||||
private string actualVoltage;
|
||||
[ObservableProperty]
|
||||
private string actualCurrent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,34 @@
|
||||
using NLog;
|
||||
using ProgramLib.GUI.View;
|
||||
/*-------------------------------------------------------------------------
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
using NLog;
|
||||
using ProgramLib.GUI.View;
|
||||
|
||||
namespace ProgramLib
|
||||
{
|
||||
/// <summary>
|
||||
/// Class that manages all GUIs
|
||||
/// </summary>
|
||||
internal class ProgramGuiManager : IDisposable
|
||||
{
|
||||
#region Private Members
|
||||
@@ -23,7 +43,13 @@ namespace ProgramLib
|
||||
public enum WINDOWS
|
||||
{
|
||||
LIVE_DATA,
|
||||
IMPEDANCE_CHECK
|
||||
MANUAL_CONTROL,
|
||||
IMPEDANCE_CHECK,
|
||||
MSFR_TEST_CASES,
|
||||
CONFIRMATION,
|
||||
|
||||
// DO NOT modify this.
|
||||
DEFAULT
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -35,18 +61,16 @@ namespace ProgramLib
|
||||
_logger = LogManager.GetCurrentClassLogger();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Finalizer
|
||||
/// Do not call Dispose() in here
|
||||
/// </summary>
|
||||
~ProgramGuiManager()
|
||||
{
|
||||
_logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() ...");
|
||||
}
|
||||
|
||||
public Window this[WINDOWS window]
|
||||
{
|
||||
get { return _windowDict[window]; }
|
||||
get
|
||||
{
|
||||
if (window == WINDOWS.DEFAULT)
|
||||
{
|
||||
return _windowDict[(WINDOWS)0];
|
||||
}
|
||||
return _windowDict[window];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -61,13 +85,19 @@ namespace ProgramLib
|
||||
_allGuiInitializedEvent.WaitOne();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
private void GuiManagerThread()
|
||||
{
|
||||
_logger?.Debug($"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() is running...");
|
||||
|
||||
// instantiate all the windows here
|
||||
_windowDict[WINDOWS.LIVE_DATA] = new LiveDataWindow();
|
||||
_windowDict[WINDOWS.MANUAL_CONTROL] = new ManualControlWindow();
|
||||
_windowDict[WINDOWS.IMPEDANCE_CHECK] = new ImpedanceCheckWindow();
|
||||
_windowDict[WINDOWS.MSFR_TEST_CASES] = new MsfrTestCasesWindow();
|
||||
_windowDict[WINDOWS.CONFIRMATION] = new ConfirmationWindow();
|
||||
|
||||
_allGuiInitializedEvent.Set();
|
||||
|
||||
@@ -77,6 +107,29 @@ namespace ProgramLib
|
||||
_logger?.Debug($"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() is exiting...");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Destructor
|
||||
/// </summary>
|
||||
~ProgramGuiManager()
|
||||
{
|
||||
_logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() ...");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Open a wait window with countdown timer
|
||||
/// </summary>
|
||||
/// <param name="message">message to display</param>
|
||||
/// <param name="delaySec">number to seconds to wait</param>
|
||||
/// <returns></returns>
|
||||
public void DisplayWaitMessage(string message, double delaySec)
|
||||
{
|
||||
this[ProgramGuiManager.WINDOWS.DEFAULT].Dispatcher.Invoke((Action)delegate
|
||||
{
|
||||
WaitWindow waitWindow = new WaitWindow(message, delaySec);
|
||||
waitWindow.ShowDialog();
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose of this object.
|
||||
/// </summary>
|
||||
|
||||
128
Source/Program/GUI/View/ConfirmationWindow.xaml
Normal file
128
Source/Program/GUI/View/ConfirmationWindow.xaml
Normal file
@@ -0,0 +1,128 @@
|
||||
<Window x:Class="ProgramLib.GUI.View.ConfirmationWindow"
|
||||
x:ClassModifier="internal"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ProgramLib.GUI.View"
|
||||
mc:Ignorable="d"
|
||||
Title="Confirmation"
|
||||
WindowStyle="None"
|
||||
SizeToContent="WidthAndHeight"
|
||||
Topmost="True"
|
||||
MouseLeftButtonDown="Window_MouseLeftButtonDown"
|
||||
Height="150">
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome GlassFrameThickness="1" CornerRadius="13,13,13,13" CaptionHeight="0"/>
|
||||
</WindowChrome.WindowChrome>
|
||||
<Window.Resources>
|
||||
<!-- Style for the close button -->
|
||||
<Style x:Key="TitleBarCloseButtonStyle" TargetType="{x:Type Button}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border x:Name="bdr_main" BorderThickness="1" BorderBrush="Transparent" Background="Transparent">
|
||||
<ContentPresenter x:Name="bdr_main2" VerticalAlignment="Center" HorizontalAlignment="Center" ContentSource="Content"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="bdr_main" Property="Background" Value="#e94856"/>
|
||||
<Setter TargetName="bdr_main" Property="BorderBrush" Value="#ba1245"/>
|
||||
<Setter TargetName="bdr_main2" Property="Content">
|
||||
<Setter.Value>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/Title_Bar_Buttons/close_white.png" Width="20" Height="20" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="bdr_main" Property="Background" Value="#ff829a"/>
|
||||
<Setter TargetName="bdr_main" Property="BorderBrush" Value="#e94856"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="FocusVisual1">
|
||||
<Setter Property="Control.Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<Rectangle Margin="2" StrokeDashArray="1 2" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" SnapsToDevicePixels="true" StrokeThickness="1"/>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<SolidColorBrush x:Key="Button.Static.Background" Color="#FFDDDDDD"/>
|
||||
<SolidColorBrush x:Key="Button.Static.Border" Color="#FF707070"/>
|
||||
<SolidColorBrush x:Key="Button.MouseOver.Background" Color="#FFBEE6FD"/>
|
||||
<SolidColorBrush x:Key="Button.MouseOver.Border" Color="#FF3C7FB1"/>
|
||||
<SolidColorBrush x:Key="Button.Pressed.Background" Color="#FFC4E5F6"/>
|
||||
<SolidColorBrush x:Key="Button.Pressed.Border" Color="#FF2C628B"/>
|
||||
<SolidColorBrush x:Key="Button.Disabled.Background" Color="#E5E5E5"/>
|
||||
<SolidColorBrush x:Key="Button.Disabled.Border" Color="#DFDFDF"/>
|
||||
<SolidColorBrush x:Key="Button.Disabled.Foreground" Color="#A6A6A6"/>
|
||||
<Style x:Key="ButtonStyle1" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" TargetType="{x:Type Button}">
|
||||
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual1}"/>
|
||||
<Setter Property="Background" Value="{StaticResource Button.Static.Background}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Padding" Value="1"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Microsoft_Windows_Themes:ButtonChrome SnapsToDevicePixels="true"
|
||||
x:Name="Chrome" Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}" RenderDefaulted="{TemplateBinding IsDefaulted}"
|
||||
RenderMouseOver="{TemplateBinding IsMouseOver}" RenderPressed="{TemplateBinding IsPressed}">
|
||||
<ContentPresenter Name="contentPresenter" Margin="{TemplateBinding Padding}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</Microsoft_Windows_Themes:ButtonChrome>
|
||||
<ControlTemplate.Triggers>
|
||||
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Background" TargetName="Chrome" Value="{StaticResource Button.Disabled.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="Chrome" Value="{StaticResource Button.Disabled.Border}"/>
|
||||
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource Button.Disabled.Foreground}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
|
||||
<!-- Main Grid that contains everything -->
|
||||
<Grid Background="#f4f6fd">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30px"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Title bar which has the app icon, app title, minimize button, maximize button and close button -->
|
||||
<Grid>
|
||||
<WrapPanel HorizontalAlignment="left" VerticalAlignment="Center">
|
||||
<Image x:Name="imgAppIcon" Source="pack://application:,,,/Program;component/Resources/Images/missile.png" Width="20" Height="20" Margin="10,0,10,0"/>
|
||||
<TextBlock x:Name="txtBlockAppTitle">Confirmation</TextBlock>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
|
||||
<Border Grid.Row="1" Margin="5" Background="White" BorderBrush="#bdbcbd" BorderThickness="1">
|
||||
<StackPanel>
|
||||
<Label x:Name="lblMessage" HorizontalAlignment="Center" FontSize="13">Message</Label>
|
||||
<WrapPanel HorizontalAlignment="Center">
|
||||
<Button x:Name="btnOK" IsDefault="True" Style="{DynamicResource ButtonStyle1}" Margin="5,10,0,5" Width="100" Height="25" VerticalAlignment="Bottom" Click="btnOK_Click">OK</Button>
|
||||
<Button x:Name="btnCancel" IsCancel="True" Style="{DynamicResource ButtonStyle1}" Margin="20,10,5,5" Width="100" Height="25" VerticalAlignment="Bottom" Click="btnCancel_Click">Cancel</Button>
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
111
Source/Program/GUI/View/ConfirmationWindow.xaml.cs
Normal file
111
Source/Program/GUI/View/ConfirmationWindow.xaml.cs
Normal file
@@ -0,0 +1,111 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
using NLog;
|
||||
|
||||
namespace ProgramLib.GUI.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ConfirmationWindow.xaml
|
||||
/// </summary>
|
||||
internal partial class ConfirmationWindow : Window
|
||||
{
|
||||
private ILogger _logger;
|
||||
public GUI.Util.StandardButtons ClickedButton { get; private set; }
|
||||
public string ConfirmationMessage
|
||||
{
|
||||
private get
|
||||
{
|
||||
return lblMessage.Content.ToString();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
lblMessage.Content = value;
|
||||
}
|
||||
}
|
||||
public string OkButtonText
|
||||
{
|
||||
private get
|
||||
{
|
||||
return btnOK.Content.ToString();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
btnOK.Content = value;
|
||||
}
|
||||
}
|
||||
public string CancelButtonText
|
||||
{
|
||||
private get
|
||||
{
|
||||
return btnCancel.Content.ToString();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
btnCancel.Content = value;
|
||||
}
|
||||
}
|
||||
|
||||
public ConfirmationWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
Uri iconUri = new Uri($"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Icons/app.ico");
|
||||
this.Icon = BitmapFrame.Create(iconUri);
|
||||
|
||||
ClickedButton = Util.StandardButtons.NOT_SET;
|
||||
|
||||
WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
|
||||
}
|
||||
|
||||
protected override void OnContentRendered(EventArgs e)
|
||||
{
|
||||
base.OnContentRendered(e);
|
||||
|
||||
// Content of window may be black in case of SizeToContent is set.
|
||||
// This eliminates the problem.
|
||||
// Do not use InvalidateVisual because it may implicitly break your markup.
|
||||
InvalidateMeasure();
|
||||
}
|
||||
|
||||
private void Window_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
DragMove();
|
||||
}
|
||||
|
||||
private void btnOK_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ClickedButton = Util.StandardButtons.OK_YES;
|
||||
this.Hide();
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ClickedButton = Util.StandardButtons.CANCEL_NO;
|
||||
this.Hide();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
173
Source/Program/GUI/View/DataLocationWindow.xaml
Normal file
173
Source/Program/GUI/View/DataLocationWindow.xaml
Normal file
@@ -0,0 +1,173 @@
|
||||
<Window x:Class="ProgramLib.GUI.View.DataLocationWindow"
|
||||
x:ClassModifier="internal"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ProgramLib.GUI.View"
|
||||
mc:Ignorable="d"
|
||||
Title="Data Locations"
|
||||
WindowStyle="None"
|
||||
MouseLeftButtonDown="Window_MouseLeftButtonDown"
|
||||
Height="155"
|
||||
Width="550">
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome GlassFrameThickness="1" CornerRadius="13,13,13,13" CaptionHeight="0"/>
|
||||
</WindowChrome.WindowChrome>
|
||||
<Window.Resources>
|
||||
<!-- Style for the close button -->
|
||||
<Style x:Key="TitleBarCloseButtonStyle" TargetType="{x:Type Button}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border x:Name="bdr_main" BorderThickness="1" BorderBrush="Transparent" Background="Transparent">
|
||||
<ContentPresenter x:Name="bdr_main2" VerticalAlignment="Center" HorizontalAlignment="Center" ContentSource="Content"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="bdr_main" Property="Background" Value="#e94856"/>
|
||||
<Setter TargetName="bdr_main" Property="BorderBrush" Value="#ba1245"/>
|
||||
<Setter TargetName="bdr_main2" Property="Content">
|
||||
<Setter.Value>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/Title_Bar_Buttons/close_white.png" Width="20" Height="20" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="bdr_main" Property="Background" Value="#ff829a"/>
|
||||
<Setter TargetName="bdr_main" Property="BorderBrush" Value="#e94856"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- Style for minimize and maximize buttons -->
|
||||
<Style x:Key="TitleBarButtonStyle" TargetType="{x:Type Button}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border x:Name="bdr_main" BorderThickness="1" BorderBrush="Transparent" Background="Transparent">
|
||||
<ContentPresenter x:Name="bdr_main2" VerticalAlignment="Center" HorizontalAlignment="Center" ContentSource="Content"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="bdr_main" Property="Background" Value="#bee6fd"/>
|
||||
<Setter TargetName="bdr_main" Property="BorderBrush" Value="#7fb1cd"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="bdr_main" Property="Background" Value="#a1bfd0"/>
|
||||
<Setter TargetName="bdr_main" Property="BorderBrush" Value="#4c778f"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="FocusVisual1">
|
||||
<Setter Property="Control.Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<Rectangle Margin="2" StrokeDashArray="1 2" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" SnapsToDevicePixels="true" StrokeThickness="1"/>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<SolidColorBrush x:Key="Button.Static.Background" Color="#FFDDDDDD"/>
|
||||
<SolidColorBrush x:Key="Button.Static.Border" Color="#FF707070"/>
|
||||
<SolidColorBrush x:Key="Button.MouseOver.Background" Color="#FFBEE6FD"/>
|
||||
<SolidColorBrush x:Key="Button.MouseOver.Border" Color="#FF3C7FB1"/>
|
||||
<SolidColorBrush x:Key="Button.Pressed.Background" Color="#FFC4E5F6"/>
|
||||
<SolidColorBrush x:Key="Button.Pressed.Border" Color="#FF2C628B"/>
|
||||
<SolidColorBrush x:Key="Button.Disabled.Background" Color="#E5E5E5"/>
|
||||
<SolidColorBrush x:Key="Button.Disabled.Border" Color="#DFDFDF"/>
|
||||
<SolidColorBrush x:Key="Button.Disabled.Foreground" Color="#A6A6A6"/>
|
||||
<Style x:Key="ButtonStyle1" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" TargetType="{x:Type Button}">
|
||||
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual1}"/>
|
||||
<Setter Property="Background" Value="{StaticResource Button.Static.Background}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Padding" Value="1"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Microsoft_Windows_Themes:ButtonChrome SnapsToDevicePixels="true"
|
||||
x:Name="Chrome" Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}" RenderDefaulted="{TemplateBinding IsDefaulted}"
|
||||
RenderMouseOver="{TemplateBinding IsMouseOver}" RenderPressed="{TemplateBinding IsPressed}">
|
||||
<ContentPresenter Name="contentPresenter" Margin="{TemplateBinding Padding}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</Microsoft_Windows_Themes:ButtonChrome>
|
||||
<ControlTemplate.Triggers>
|
||||
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Background" TargetName="Chrome" Value="{StaticResource Button.Disabled.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="Chrome" Value="{StaticResource Button.Disabled.Border}"/>
|
||||
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource Button.Disabled.Foreground}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
|
||||
<Grid Background="#f4f6fd">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30px"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Title bar which has the app icon, app title, minimize button, maximize button and close button -->
|
||||
<Grid>
|
||||
<WrapPanel HorizontalAlignment="left" VerticalAlignment="Center">
|
||||
<Image x:Name="imgAppIcon" Source="pack://application:,,,/Program;component/Resources/Images/missile.png" Width="20" Height="20" Margin="10,0,10,0"/>
|
||||
<TextBlock x:Name="txtBlockAppTitle">Data Locations</TextBlock>
|
||||
</WrapPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Style="{StaticResource TitleBarButtonStyle}" x:Name="btnMin" Width="44" Background="Transparent" BorderBrush="Transparent" Click="btnMin_Click">
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/Title_Bar_Buttons/minimize.png" Width="12" Height="12"/>
|
||||
</Button>
|
||||
<Button Style="{StaticResource TitleBarButtonStyle}" x:Name="btnMax" Width="44" Background="Transparent" BorderBrush="Transparent" Click="btnMax_Click">
|
||||
<Image x:Name="imgMax" Source="pack://application:,,,/Program;component/Resources/Images/Title_Bar_Buttons/maximize.png" Width="13" Height="13"/>
|
||||
</Button>
|
||||
<Button x:FieldModifier="public" Style="{StaticResource TitleBarCloseButtonStyle}" x:Name="btnClose" Width="44" Background="Transparent" BorderBrush="Transparent" Click="btnClose_Click">
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/Title_Bar_Buttons/close_black.png" Width="20" Height="20"/>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<DockPanel Grid.Row="1" Height="120" VerticalAlignment="Top" Margin="5,0,5,5">
|
||||
<Border DockPanel.Dock="Top" BorderThickness="1" BorderBrush="#bdbcbd" Background="#f0f0f0">
|
||||
<WrapPanel>
|
||||
<StackPanel Margin="10">
|
||||
<Label Padding="0">UUT Data Location:</Label>
|
||||
<TextBox x:Name="uutDataLocationTb" Width="400" IsReadOnly="True"/>
|
||||
</StackPanel>
|
||||
<Button x:Name="uutDataLocationBtn" Style="{DynamicResource ButtonStyle1}" Height="20" Width="80" Padding="0" VerticalAlignment="Bottom" Margin="10,0,0,10" Click="uutDataLocationBtn_Click">Open</Button>
|
||||
</WrapPanel>
|
||||
</Border>
|
||||
|
||||
<Border DockPanel.Dock="Top" Margin="0,5,0,0" BorderThickness="1" BorderBrush="#bdbcbd" Background="#f0f0f0">
|
||||
<WrapPanel>
|
||||
<StackPanel Margin="10">
|
||||
<Label Padding="0">Placeholder Location:</Label>
|
||||
<TextBox x:Name="placeHolderTb" Width="400" IsReadOnly="True"/>
|
||||
</StackPanel>
|
||||
<Button x:Name="placeHolderBtn" Style="{DynamicResource ButtonStyle1}" Height="20" Width="80" Padding="0" VerticalAlignment="Bottom" Margin="10,0,0,10">Open</Button>
|
||||
</WrapPanel>
|
||||
</Border>
|
||||
|
||||
</DockPanel>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
81
Source/Program/GUI/View/DataLocationWindow.xaml.cs
Normal file
81
Source/Program/GUI/View/DataLocationWindow.xaml.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
using NLog;
|
||||
|
||||
namespace ProgramLib.GUI.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for DataLocationWindow.xaml
|
||||
/// </summary>
|
||||
internal partial class DataLocationWindow : Window
|
||||
{
|
||||
private ILogger _logger;
|
||||
|
||||
public DataLocationWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
Uri iconUri = new Uri($"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Icons/app.ico");
|
||||
this.Icon = BitmapFrame.Create(iconUri);
|
||||
|
||||
WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
|
||||
|
||||
uutDataLocationTb.Text = Program.Instance().FileAndFolderManager.GetFolder(FileAndFolderManager.Folders.DATA_TEST);
|
||||
}
|
||||
|
||||
private void btnClose_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btnMax_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (this.WindowState == WindowState.Maximized)
|
||||
{
|
||||
this.WindowState = WindowState.Normal;
|
||||
imgMax.Source = new BitmapImage(new System.Uri($"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Images/Title_Bar_Buttons/maximize.png"));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.WindowState = WindowState.Maximized;
|
||||
imgMax.Source = new BitmapImage(new System.Uri($"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Images/Title_Bar_Buttons/restore.png"));
|
||||
}
|
||||
}
|
||||
|
||||
private void btnMin_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.WindowState = WindowState.Minimized;
|
||||
}
|
||||
|
||||
private void Window_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
DragMove();
|
||||
}
|
||||
|
||||
private void uutDataLocationBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Process.Start(@$"{uutDataLocationTb.Text}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,11 +8,12 @@
|
||||
mc:Ignorable="d"
|
||||
Title="Impedance Check"
|
||||
WindowStyle="None"
|
||||
Topmost="True"
|
||||
MouseLeftButtonDown="Window_MouseLeftButtonDown"
|
||||
Height="300"
|
||||
Width="400">
|
||||
Height="500"
|
||||
Width="720">
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome GlassFrameThickness="0" CornerRadius="0" CaptionHeight="0"/>
|
||||
<WindowChrome GlassFrameThickness="1" CornerRadius="13,13,13,13" CaptionHeight="0"/>
|
||||
</WindowChrome.WindowChrome>
|
||||
<Window.Resources>
|
||||
<!-- Style for the close button -->
|
||||
@@ -57,14 +58,14 @@
|
||||
<Image x:Name="imgAppIcon" Source="pack://application:,,,/Program;component/Resources/Images/missile.png" Width="20" Height="20" Margin="10,0,10,0"/>
|
||||
<TextBlock x:Name="txtBlockAppTitle">Impedance Check</TextBlock>
|
||||
</WrapPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Row="0">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button x:FieldModifier="public" Style="{StaticResource TitleBarCloseButtonStyle}" x:Name="btnClose" Width="44" Background="Transparent" BorderBrush="Transparent" Click="btnClose_Click">
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/Title_Bar_Buttons/close_black.png" Width="20" Height="20"/>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<ListView Grid.Row="1" x:Name="lvImpedanceCheck" ItemsSource="{Binding _listviewImpedanceDatatems}" Margin="15,5,15,15">
|
||||
<ListView Grid.Row="1" x:Name="lvImpedanceCheck" ItemsSource="{Binding _listviewImpedanceDataItems}" Margin="15,5,15,15" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
|
||||
<ListView.ItemContainerStyle>
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="Focusable" Value="false"/>
|
||||
|
||||
@@ -1,8 +1,26 @@
|
||||
using ProgramLib.GUI.ViewModel;
|
||||
/*-------------------------------------------------------------------------
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
using ProgramLib.GUI.Model;
|
||||
using ProgramLib.GUI.ViewModel;
|
||||
|
||||
namespace ProgramLib.GUI.View
|
||||
{
|
||||
@@ -13,11 +31,13 @@ namespace ProgramLib.GUI.View
|
||||
{
|
||||
internal ImpedanceCheckWindowViewModel ViewModel { get; set; }
|
||||
|
||||
private double _previousWindowWidth = -1.0;
|
||||
|
||||
public ImpedanceCheckWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Uri iconUri = new Uri("pack://application:,,,/Program;component/Resources/Icons/app.ico");
|
||||
Uri iconUri = new Uri($"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Icons/app.ico");
|
||||
this.Icon = BitmapFrame.Create(iconUri);
|
||||
|
||||
WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
|
||||
@@ -53,7 +73,35 @@ namespace ProgramLib.GUI.View
|
||||
{
|
||||
// scroll the new item into view
|
||||
lvImpedanceCheck.ScrollIntoView(e.NewItems[0]);
|
||||
|
||||
ResizeWindowToFitContent();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resize window to fit variable text length
|
||||
/// </summary>
|
||||
private void ResizeWindowToFitContent()
|
||||
{
|
||||
bool resizeWindow = false;
|
||||
|
||||
double textLength = ProgramLib.GUI.Util.MeasureString(((ImpedanceDataModel)lvImpedanceCheck.Items[lvImpedanceCheck.Items.Count - 1]).Description).Width;
|
||||
double padding = 90.0;
|
||||
double requiredWith = textLength + padding;
|
||||
|
||||
if (lvImpedanceCheck.Items.Count > 1)
|
||||
{
|
||||
if (requiredWith > this.Width)
|
||||
resizeWindow = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_previousWindowWidth = this.Width;
|
||||
resizeWindow = true;
|
||||
}
|
||||
|
||||
if (resizeWindow)
|
||||
this.Width = requiredWith;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
WindowStyle="None"
|
||||
ResizeMode="CanResizeWithGrip"
|
||||
MouseLeftButtonDown="Window_MouseLeftButtonDown"
|
||||
Height="650"
|
||||
Height="644"
|
||||
Width="1000">
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome GlassFrameThickness="0" CornerRadius="0" CaptionHeight="0"/>
|
||||
<WindowChrome GlassFrameThickness="1" CornerRadius="13,13,13,13" CaptionHeight="0"/>
|
||||
</WindowChrome.WindowChrome>
|
||||
<Window.Resources>
|
||||
|
||||
@@ -68,6 +68,31 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="LabelBackgroundGradientAppControlledUnControlledStyle" TargetType="{x:Type Label}">
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
|
||||
<GradientStop Color="#1959b1" Offset="0.31" />
|
||||
<GradientStop Color="#1959b1" Offset="0.09" />
|
||||
<GradientStop Color="white" Offset="1.1" />
|
||||
</LinearGradientBrush>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding LabelGradientAppControlledOrUnControlled}" Value="UnControlled">
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
|
||||
<GradientStop Color="#B01818" Offset="0.31" />
|
||||
<GradientStop Color="#B01818" Offset="0.09" />
|
||||
<GradientStop Color="white" Offset="1.1" />
|
||||
</LinearGradientBrush>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!-- Define all image paths here for images that are binded to data model -->
|
||||
<!-- Images that are binded to data models are not displayed at design time -->
|
||||
<!-- So we use these images to display at design time -->
|
||||
@@ -386,16 +411,21 @@
|
||||
<RowDefinition Height="30px"/>
|
||||
<RowDefinition Height="30px"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="28px"/>
|
||||
<RowDefinition Height="32px"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Title bar which has the app icon, app title, minimize button, maximize button and close button -->
|
||||
<Grid>
|
||||
<WrapPanel HorizontalAlignment="left" VerticalAlignment="Center">
|
||||
<Image x:Name="imgAppIcon" Source="pack://application:,,,/Program;component/Resources/Images/missile.png" Width="20" Height="20" Margin="10,0,10,0"/>
|
||||
<TextBlock x:Name="txtBlockAppTitle">[App Title Here]</TextBlock>
|
||||
<TextBlock x:Name="txtBlockAppTitle">Missile Test Set (MTS)</TextBlock>
|
||||
</WrapPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Row="0">
|
||||
<WrapPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<Border x:Name="simModeBdr" BorderBrush="#DA9E59" Background="#FDE6AE">
|
||||
<TextBlock x:Name="runModeTb" FontSize="15" FontWeight="DemiBold" Foreground="#A4530D"></TextBlock>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Style="{StaticResource TitleBarButtonStyle}" x:Name="btnMin" Width="44" Background="Transparent" BorderBrush="Transparent" Click="btnMin_Click">
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/Title_Bar_Buttons/minimize.png" Width="12" Height="12"/>
|
||||
</Button>
|
||||
@@ -411,8 +441,19 @@
|
||||
<!-- Menu bar -->
|
||||
<DockPanel Grid.Row="1" HorizontalAlignment="left" VerticalAlignment="Center">
|
||||
<Menu DockPanel.Dock="Top" Background="#f4f6fd">
|
||||
<MenuItem Style="{DynamicResource MenuItemStyle}" Header="Options" Background="Transparent">
|
||||
<MenuItem x:Name="manualControlGuiMi" Header="Manual Control" Click="manualControlGuiMi_Click">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/game_controller.png"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem Style="{DynamicResource MenuItemStyle}" Header="Help" Background="Transparent">
|
||||
<MenuItem Header="Data Location"/>
|
||||
<MenuItem x:Name="dataLocationMi" Header="Data Location" Click="dataLocationMi_Click">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/folders.png"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
</DockPanel>
|
||||
@@ -431,36 +472,19 @@
|
||||
|
||||
<!-- Contains headers and datagrid for the power data -->
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="70" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="25" />
|
||||
<RowDefinition Height="4*" />
|
||||
<RowDefinition Height="6*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.ColumnSpan="2" FontSize="14" Foreground="White" FontWeight="Bold" Content="UUT Power Supply Monitor" Padding="5,0,0,2" VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd">
|
||||
<Label.Background>
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
|
||||
<GradientStop Color="#1959b1" Offset="0.31" />
|
||||
<GradientStop Color="#1959b1" Offset="0.09" />
|
||||
<GradientStop Color="white" Offset="1.1" />
|
||||
</LinearGradientBrush>
|
||||
</Label.Background>
|
||||
</Label>
|
||||
|
||||
<StackPanel Grid.Row="1">
|
||||
<Label FontSize="13" FontWeight="Bold" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Height="42" BorderThickness="0,1,1,1" BorderBrush="#bdbcbd">PS</Label>
|
||||
<Label Height="19" FontSize="10" FontWeight="Bold" Content="UMB +20V" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderThickness="0,0,1,1" BorderBrush="#bdbcbd"/>
|
||||
<Label Height="19" FontSize="10" FontWeight="Bold" Content="-20V" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderThickness="0,0,1,1" BorderBrush="#bdbcbd"/>
|
||||
</StackPanel>
|
||||
<Label Style="{StaticResource LabelBackgroundGradientAppControlledUnControlledStyle}" Grid.ColumnSpan="2" FontSize="14" Foreground="White" FontWeight="Bold" Content="UUT Power Supply Monitor" Padding="5,0,0,2" VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
|
||||
<Grid Grid.Row="1" Grid.Column="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1.5*" />
|
||||
<ColumnDefinition Width="1.5*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
@@ -470,14 +494,15 @@
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.ColumnSpan="2" FontSize="10" FontWeight="Bold" Content="Voltage (V)" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderThickness="0,1,1,1" BorderBrush="#bdbcbd"/>
|
||||
<Label Grid.Column="2" Grid.ColumnSpan="2" FontSize="10" FontWeight="Bold" Content="Current (A)" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderThickness="0,1,1,1" BorderBrush="#bdbcbd"/>
|
||||
<Label Grid.Row="1" FontSize="10" FontWeight="Bold" Content="Expected" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderThickness="0,0,1,1" BorderBrush="#bdbcbd"/>
|
||||
<Label Grid.Row="1" Grid.Column="1" FontSize="10" FontWeight="Bold" Content="Actual" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderThickness="0,0,1,1" BorderBrush="#bdbcbd"/>
|
||||
<Label Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="2" FontSize="10" FontWeight="Bold" Content="Actual" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderThickness="0,0,1,1" BorderBrush="#bdbcbd"/>
|
||||
<Label Grid.RowSpan="2" FontSize="13" FontWeight="Bold" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Height="42" BorderThickness="0,1,1,1" BorderBrush="#bdbcbd">PS</Label>
|
||||
<Label Grid.Column="1" Grid.ColumnSpan="2" FontSize="10" FontWeight="Bold" Content="Voltage (V)" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderThickness="0,1,1,1" BorderBrush="#bdbcbd"/>
|
||||
<Label Grid.Column="3" Grid.ColumnSpan="2" FontSize="10" FontWeight="Bold" Content="Current (A)" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderThickness="0,1,1,1" BorderBrush="#bdbcbd"/>
|
||||
<Label Grid.Row="1" Grid.Column="1" FontSize="10" FontWeight="Bold" Content="Expected" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderThickness="0,0,1,1" BorderBrush="#bdbcbd"/>
|
||||
<Label Grid.Row="1" Grid.Column="2" FontSize="10" FontWeight="Bold" Content="Actual" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderThickness="0,0,1,1" BorderBrush="#bdbcbd"/>
|
||||
<Label Grid.Row="1" Grid.Column="3" Grid.ColumnSpan="2" FontSize="10" FontWeight="Bold" Content="Actual" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderThickness="0,0,1,1" BorderBrush="#bdbcbd"/>
|
||||
|
||||
<!-- DataGrid for Power Data-->
|
||||
<DataGrid Grid.Row="2" Grid.ColumnSpan="4" Name="datagridPowerData" AutoGenerateColumns="False" CanUserAddRows="False" IsReadOnly="True" SelectionMode="Extended" SelectionUnit="FullRow" ItemsSource="{Binding _dataGridPowerDatatems}" Width="auto" HorizontalGridLinesBrush="#e9e9e9" VerticalGridLinesBrush="#e9e9e9" HeadersVisibility="None" BorderThickness="0">
|
||||
<DataGrid Grid.Row="2" Grid.ColumnSpan="5" Name="datagridPowerData" AutoGenerateColumns="False" CanUserAddRows="False" IsReadOnly="True" SelectionMode="Extended" SelectionUnit="FullRow" ItemsSource="{Binding _dataGridPowerDatatems}" Width="auto" HorizontalGridLinesBrush="#e9e9e9" VerticalGridLinesBrush="#e9e9e9" HeadersVisibility="None" BorderThickness="0">
|
||||
<DataGrid.Resources>
|
||||
<Style x:Key="CellStyle" TargetType="DataGridCell">
|
||||
<Setter Property="TextBlock.TextAlignment" Value="Center" />
|
||||
@@ -491,14 +516,15 @@
|
||||
</Style>
|
||||
</DataGrid.Resources>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn CellStyle="{StaticResource CellStyle}" Header="expectedVoltage" Width="1*" Binding="{Binding ExpectedVoltage}"/>
|
||||
<DataGridTextColumn CellStyle="{StaticResource CellStyle}" Header="actualVoltage" Width="1*" Binding="{Binding ActualVoltage}"/>
|
||||
<DataGridTextColumn CellStyle="{StaticResource CellStyle}" Header="powerModule" Width="1*" Binding="{Binding Name}"/>
|
||||
<DataGridTextColumn CellStyle="{StaticResource CellStyle}" Header="expectedVoltage" Width="1.5*" Binding="{Binding ExpectedVoltage}"/>
|
||||
<DataGridTextColumn CellStyle="{StaticResource CellStyle}" Header="actualVoltage" Width="1.5*" Binding="{Binding ActualVoltage}"/>
|
||||
<DataGridTextColumn CellStyle="{StaticResource CellStyle}" Header="actualCurrent" Width="2*" Binding="{Binding ActualCurrent}"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="2" Grid.ColumnSpan="2">
|
||||
<Grid Grid.Row="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="4*" />
|
||||
<ColumnDefinition Width="6*" />
|
||||
@@ -508,16 +534,7 @@
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.ColumnSpan="2" FontSize="14" FontWeight="Bold" Foreground="White" Content="Temperature Monitor" Padding="5,0,0,2" Margin="0,5,0,0" VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd">
|
||||
<Label.Background>
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
|
||||
<GradientStop Color="#1959b1" Offset="0.31" />
|
||||
<GradientStop Color="#1959b1" Offset="0.09" />
|
||||
<GradientStop Color="white" Offset="1.1" />
|
||||
</LinearGradientBrush>
|
||||
</Label.Background>
|
||||
</Label>
|
||||
|
||||
<Label Style="{StaticResource LabelBackgroundGradientAppControlledUnControlledStyle}" Grid.ColumnSpan="2" FontSize="14" FontWeight="Bold" Foreground="White" Content="Temperature Monitor" Padding="5,0,0,2" Margin="0,5,0,0" VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Border Grid.Row="1" Grid.ColumnSpan="2" BorderThickness="0,1,1,1" BorderBrush="#bdbcbd" Margin="0,0,0,5">
|
||||
<StackPanel Margin="5,5,0,0">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
@@ -527,7 +544,7 @@
|
||||
</StackPanel>
|
||||
<StackPanel Margin="0,0,35,0">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="50" Content="SIC ADC" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/green-led.png" Width="15" Height="15"/>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="0,0,35,0">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="50" Content="VIP Versal" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
@@ -539,7 +556,7 @@
|
||||
</StackPanel>
|
||||
<StackPanel Margin="0,0,15,0">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="100" Content="VIP PolarFire FPGA" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/yellow-led.png" Width="15" Height="15"/>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="0,0,15,0">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="50" Content="MCC DSP" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
@@ -553,11 +570,11 @@
|
||||
<StackPanel Orientation="Horizontal" Margin="0,20,0,0">
|
||||
<StackPanel Margin="0,0,15,0">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="100" Content="CAS ACU DSP" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/red-led.png" Width="15" Height="15"/>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="0,0,35,0">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="50" Content="CAS ACU" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/green-led.png" Width="15" Height="15"/>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
@@ -577,15 +594,7 @@
|
||||
<RowDefinition Height="5*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.ColumnSpan="2" FontSize="14" FontWeight="Bold" Foreground="White" Content="Key Indicators" Padding="5,0,0,2" VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd">
|
||||
<Label.Background>
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
|
||||
<GradientStop Color="#1959b1" Offset="0.31" />
|
||||
<GradientStop Color="#1959b1" Offset="0.09" />
|
||||
<GradientStop Color="white" Offset="1.1" />
|
||||
</LinearGradientBrush>
|
||||
</Label.Background>
|
||||
</Label>
|
||||
<Label Style="{StaticResource LabelBackgroundGradientAppControlledUnControlledStyle}" Grid.ColumnSpan="2" FontSize="14" FontWeight="Bold" Foreground="White" Content="Key Indicators" Padding="5,0,0,2" VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
|
||||
<Border Grid.Row="1" BorderThickness="1,0,0,1" BorderBrush="#bdbcbd" Margin="0,0,0,5">
|
||||
<StackPanel Margin="5,0,0,0">
|
||||
@@ -611,12 +620,12 @@
|
||||
<Border Grid.Row="1" Grid.Column="1" BorderThickness="0,0,0,1" BorderBrush="#bdbcbd" Margin="0,0,0,5">
|
||||
<StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,5,0,10">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="100" Content="Test Time" VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="100" Content="---" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd" Background="White"/>
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="100" Content="Test time" VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="100" Content="{Binding TestTimeStr}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd" Background="White"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,10">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="100" Content="Coolant Flow" HorizontalAlignment="Left" VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="100" Content="---" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd" Background="White"/>
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="100" Content="Power on time" HorizontalAlignment="Left" VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="100" Content="{Binding PowerOnTimeStr}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd" Background="White"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,10">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="100" Content="Indicator 4" HorizontalAlignment="Left" VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
@@ -631,71 +640,50 @@
|
||||
|
||||
<Grid Grid.Row="2" Grid.ColumnSpan="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="4*" />
|
||||
<ColumnDefinition Width="6*" />
|
||||
<ColumnDefinition Width="5.5*" />
|
||||
<ColumnDefinition Width="4.5*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="25" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.ColumnSpan="2" FontSize="14" FontWeight="Bold" Foreground="White" Content="Connectors" Padding="5,0,0,2" VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd">
|
||||
<Label.Background>
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
|
||||
<GradientStop Color="#1959b1" Offset="0.31" />
|
||||
<GradientStop Color="#1959b1" Offset="0.09" />
|
||||
<GradientStop Color="white" Offset="1.1" />
|
||||
</LinearGradientBrush>
|
||||
</Label.Background>
|
||||
</Label>
|
||||
<Label Style="{StaticResource LabelBackgroundGradientAppControlledUnControlledStyle}" Grid.Column="0" FontSize="14" FontWeight="Bold" Foreground="White" Content="Connected UUT" Padding="5,0,0,2" VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
|
||||
<Border Grid.Row="1" Grid.ColumnSpan="2" BorderThickness="1,0,0,1" BorderBrush="#bdbcbd" Margin="0,5,0,5">
|
||||
<StackPanel Margin="5,0,0,0" Orientation="Horizontal">
|
||||
<StackPanel Margin="0,0,15,0">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="J1" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/green-led.png" Width="15" Height="15"/>
|
||||
<Label Style="{StaticResource LabelBackgroundGradientAppControlledUnControlledStyle}" Grid.Column="1" FontSize="14" FontWeight="Bold" Foreground="White" Content="Connected Cable" Padding="5,0,0,2" VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
|
||||
<Border Grid.Row="1" Grid.Column="0" BorderThickness="1,0,0,1" BorderBrush="#bdbcbd" Margin="0,0,0,5">
|
||||
<StackPanel x:Name="connectedUutSp" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Border>
|
||||
|
||||
<Border Grid.Row="1" Grid.Column="1" BorderThickness="1,0,0,1" BorderBrush="#bdbcbd" Margin="0,0,0,5">
|
||||
<DockPanel>
|
||||
<Border DockPanel.Dock="Bottom" x:Name="missileModeBdr">
|
||||
<TextBlock x:Name="missileModeTb" FontSize="15" FontWeight="DemiBold" HorizontalAlignment="Center" Foreground="#A4530D"></TextBlock>
|
||||
</Border>
|
||||
<StackPanel Margin="0,0,0,0" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<StackPanel Margin="15,0,15,0">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="W1" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Image x:Name="w1CableLedImg" Source="{Binding W1CableImagePath, FallbackValue={StaticResource DesignSourceBlackLed}}" Width="15" Height="15"/>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="0,0,15,0">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="W2" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Image x:Name="w2CableLedImg" Source="{Binding W2CableImagePath, FallbackValue={StaticResource DesignSourceBlackLed}}" Width="15" Height="15"/>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="0,0,15,0">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="W3" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Image x:Name="w3CableLedImg" Source="{Binding W3CableImagePath, FallbackValue={StaticResource DesignSourceBlackLed}}" Width="15" Height="15"/>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="0,0,15,0">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="W4" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Image x:Name="w4CableLedImg" Source="{Binding W4CableImagePath, FallbackValue={StaticResource DesignSourceBlackLed}}" Width="15" Height="15"/>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="0,0,15,0">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="W5" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Image x:Name="w5CableLedImg" Source="{Binding W5CableImagePath, FallbackValue={StaticResource DesignSourceBlackLed}}" Width="15" Height="15"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="0,0,15,0">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="J2" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="0,0,15,0">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="J3" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="0,0,15,0">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="J4" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="0,0,15,0">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="J5" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="0,0,15,0">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="J6" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="0,0,15,0">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="J7" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/green-led.png" Width="15" Height="15"/>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="0,0,15,0">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="J8" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="0,0,15,0">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="J9" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="0,0,15,0">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="J10" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="J11" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
@@ -717,15 +705,7 @@
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.ColumnSpan="6" FontSize="14" FontWeight="Bold" Foreground="White" Content="Passthrough" Padding="5,0,0,2" VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd">
|
||||
<Label.Background>
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
|
||||
<GradientStop Color="#1959b1" Offset="0.31" />
|
||||
<GradientStop Color="#1959b1" Offset="0.09" />
|
||||
<GradientStop Color="white" Offset="1.1" />
|
||||
</LinearGradientBrush>
|
||||
</Label.Background>
|
||||
</Label>
|
||||
<Label Grid.ColumnSpan="6" Style="{StaticResource LabelBackgroundGradientAppControlledUnControlledStyle}" FontSize="14" FontWeight="Bold" Foreground="White" Content="Passthrough" Padding="5,0,0,2" VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Label Grid.Row="1" FontSize="10" FontWeight="Bold" Content="Variable" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderThickness="0,1,1,1" BorderBrush="#bdbcbd"/>
|
||||
<Label Grid.Row="1" Grid.Column="1" FontSize="10" FontWeight="Bold" Content="Value" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderThickness="0,1,1,1" BorderBrush="#bdbcbd"/>
|
||||
<Label Grid.Row="1" Grid.Column="2" FontSize="10" FontWeight="Bold" Content="Variable" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderThickness="0,1,1,1" BorderBrush="#bdbcbd"/>
|
||||
@@ -734,7 +714,7 @@
|
||||
<Label Grid.Row="1" Grid.Column="5" FontSize="10" FontWeight="Bold" Content="Value" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderThickness="0,1,0,1" BorderBrush="#bdbcbd"/>
|
||||
|
||||
<!-- DataGrid for Passthrough Data -->
|
||||
<DataGrid Grid.Row="2" Grid.ColumnSpan="6" x:FieldModifier="public" Name="datagridPassthroughData" ItemsSource="{Binding _dataGridPassthroughDatatems}" AutoGenerateColumns="False" CanUserAddRows="False" IsReadOnly="True" SelectionMode="Extended" SelectionUnit="FullRow" Width="auto" HorizontalGridLinesBrush="#e9e9e9" VerticalGridLinesBrush="#e9e9e9" HeadersVisibility="None" BorderThickness="1,0,0,0" BorderBrush="#e9e9e9">
|
||||
<DataGrid Grid.Row="2" Grid.ColumnSpan="6" x:FieldModifier="public" Name="datagridPassthroughData" ItemsSource="{Binding _dataGridPassthroughDatatems}" AutoGenerateColumns="False" CanUserAddRows="False" IsReadOnly="True" SelectionMode="Extended" SelectionUnit="FullRow" Width="auto" HorizontalGridLinesBrush="#e9e9e9" VerticalGridLinesBrush="#e9e9e9" HeadersVisibility="None" BorderThickness="0" BorderBrush="#e9e9e9">
|
||||
<DataGrid.Resources>
|
||||
<Style x:Key="CellStyle" TargetType="DataGridCell">
|
||||
<Setter Property="TextBlock.TextAlignment" Value="Center" />
|
||||
@@ -760,9 +740,13 @@
|
||||
</Grid>
|
||||
|
||||
<StatusBar Grid.Row="3" BorderThickness="0,1,0,0" BorderBrush="#bdbcbd">
|
||||
<StatusBarItem FontSize="16">Placeholder</StatusBarItem>
|
||||
<StatusBarItem>
|
||||
<TextBlock FontSize="16">Placeholder</TextBlock>
|
||||
<StatusBarItem Width="200" HorizontalAlignment="Left">
|
||||
<StackPanel>
|
||||
<Border x:Name="bDataDriveTotalCapacityBarGraph" Background="#EBEBEB" BorderThickness="1" BorderBrush="#bdbcbd" Width="190" Height="15">
|
||||
<TextBlock x:Name="tbDataDriveUsedCapacityBarGraph" FontSize="10" Width="190" HorizontalAlignment="Left" TextAlignment="Center" Background="#EBEBEB">---</TextBlock>
|
||||
</Border>
|
||||
<TextBlock x:Name="tbDataDriveCapacityDetails" FontSize="9">---</TextBlock>
|
||||
</StackPanel>
|
||||
</StatusBarItem>
|
||||
</StatusBar>
|
||||
|
||||
|
||||
@@ -1,7 +1,31 @@
|
||||
using ProgramLib.GUI.ViewModel;
|
||||
/*-------------------------------------------------------------------------
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Threading;
|
||||
using ProgramLib.GUI.ViewModel;
|
||||
|
||||
namespace ProgramLib.GUI.View
|
||||
{
|
||||
@@ -10,19 +34,297 @@ namespace ProgramLib.GUI.View
|
||||
/// </summary>
|
||||
internal partial class LiveDataWindow : Window
|
||||
{
|
||||
private enum Events
|
||||
{
|
||||
GLOBAL_QUIT,
|
||||
QUIT,
|
||||
UUT_POWER_ON,
|
||||
UUT_POWER_OFF,
|
||||
|
||||
// DO NOT change the name
|
||||
// This must be the last member in the enum
|
||||
EVENT_TIMED_OUT
|
||||
}
|
||||
|
||||
internal LiveDataWindowViewModel LiveDataWindowViewModel { get; set; }
|
||||
private DispatcherTimer _oneSecTimer;
|
||||
private DateTime _testDateTime;
|
||||
private DateTime? _powerOnDateTime = null;
|
||||
EventGroup<Events, EventWaitHandle> _eventGroup;
|
||||
|
||||
public LiveDataWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Uri iconUri = new Uri("pack://application:,,,/Program;component/Resources/Icons/app.ico");
|
||||
Uri iconUri = new Uri($"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Icons/app.ico");
|
||||
this.Icon = BitmapFrame.Create(iconUri);
|
||||
|
||||
WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
|
||||
|
||||
DateTime assemblyBuildDateTime = File.GetLastWriteTime(GetType().Assembly.Location);
|
||||
string assemblyBuildDateTimeStr = assemblyBuildDateTime.ToString("MM/dd/yyyy");
|
||||
|
||||
Version appVersion = GetType().Assembly.GetName().Version;
|
||||
this.txtBlockAppTitle.Text += $" - {assemblyBuildDateTimeStr} - Version " + appVersion.Major.ToString() + "." + appVersion.Minor.ToString();
|
||||
|
||||
LiveDataWindowViewModel = new LiveDataWindowViewModel(this);
|
||||
DataContext = LiveDataWindowViewModel;
|
||||
|
||||
LiveDataWindowViewModel.LabelGradientAppControlledOrUnControlled = "Controlled";
|
||||
if (!Program.Instance().IsAppControlled)
|
||||
{
|
||||
LiveDataWindowViewModel.LabelGradientAppControlledOrUnControlled = "UnControlled";
|
||||
}
|
||||
|
||||
LiveDataWindowViewModel.UutPowerLedImagePath = LiveDataWindowViewModel.ImageToResourcePathDict[LiveDataWindowViewModel.Images.LED_OFF];
|
||||
LiveDataWindowViewModel.W1CableImagePath = LiveDataWindowViewModel.ImageToResourcePathDict[LiveDataWindowViewModel.Images.LED_OFF];
|
||||
LiveDataWindowViewModel.W2CableImagePath = LiveDataWindowViewModel.ImageToResourcePathDict[LiveDataWindowViewModel.Images.LED_OFF];
|
||||
LiveDataWindowViewModel.W3CableImagePath = LiveDataWindowViewModel.ImageToResourcePathDict[LiveDataWindowViewModel.Images.LED_OFF];
|
||||
LiveDataWindowViewModel.W4CableImagePath = LiveDataWindowViewModel.ImageToResourcePathDict[LiveDataWindowViewModel.Images.LED_OFF];
|
||||
LiveDataWindowViewModel.W5CableImagePath = LiveDataWindowViewModel.ImageToResourcePathDict[LiveDataWindowViewModel.Images.LED_OFF];
|
||||
|
||||
if (Program.Instance().IsThereHardware)
|
||||
{
|
||||
LiveDataWindowViewModel.TePowerLedImagePath = LiveDataWindowViewModel.ImageToResourcePathDict[LiveDataWindowViewModel.Images.LED_ON];
|
||||
}
|
||||
else
|
||||
{
|
||||
simModeBdr.BorderThickness = new Thickness(1);
|
||||
runModeTb.Margin = new Thickness(5, 0, 5, 0);
|
||||
runModeTb.Text = "Simulation Mode";
|
||||
LiveDataWindowViewModel.TePowerLedImagePath = LiveDataWindowViewModel.ImageToResourcePathDict[LiveDataWindowViewModel.Images.LED_OFF];
|
||||
}
|
||||
|
||||
Dictionary<Events, EventWaitHandle> eventDict = new Dictionary<Events, EventWaitHandle>();
|
||||
eventDict = new Dictionary<Events, EventWaitHandle>();
|
||||
eventDict[Events.UUT_POWER_ON] = Program.Instance().EventManager[EventManager.Events.UUT_POWER_ON];
|
||||
eventDict[Events.UUT_POWER_OFF] = Program.Instance().EventManager[EventManager.Events.UUT_POWER_OFF];
|
||||
eventDict[Events.EVENT_TIMED_OUT] = null;
|
||||
|
||||
_eventGroup = new EventGroup<Events, EventWaitHandle>(eventDict);
|
||||
|
||||
_oneSecTimer = new DispatcherTimer();
|
||||
_oneSecTimer.Interval = TimeSpan.FromMilliseconds(1000);
|
||||
_oneSecTimer.Tick += new EventHandler(Timer_Tick);
|
||||
_oneSecTimer.Start();
|
||||
|
||||
_testDateTime = DateTime.Now;
|
||||
|
||||
CheckDriveCapacity(Program.Instance().FileAndFolderManager.GetFolder(FileAndFolderManager.Folders.DATA_TEST));
|
||||
ShowConnecterdUut();
|
||||
ShowConnecterdCable();
|
||||
}
|
||||
|
||||
~LiveDataWindow()
|
||||
{
|
||||
_oneSecTimer?.Stop();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Show drive capacity
|
||||
/// </summary>
|
||||
private void CheckDriveCapacity(string driveNameOrPath)
|
||||
{
|
||||
bDataDriveTotalCapacityBarGraph.Width = 190;
|
||||
tbDataDriveUsedCapacityBarGraph.Text = $"Can't get info for {driveNameOrPath}";
|
||||
tbDataDriveUsedCapacityBarGraph.Foreground = new SolidColorBrush(Colors.Red);
|
||||
string freeSpaceColorCode = "#007AD7";
|
||||
if (driveNameOrPath.Length < 3)
|
||||
{
|
||||
driveNameOrPath += "\\";
|
||||
}
|
||||
foreach (DriveInfo drive in DriveInfo.GetDrives())
|
||||
{
|
||||
if (drive.IsReady && Regex.IsMatch(driveNameOrPath, Regex.Escape(drive.Name), RegexOptions.IgnoreCase))
|
||||
{
|
||||
// text color
|
||||
tbDataDriveUsedCapacityBarGraph.Foreground = new SolidColorBrush(Colors.White);
|
||||
|
||||
long freeSpacePercentage = (long)(((double)drive.TotalFreeSpace / (double)drive.TotalSize) * 100.0);
|
||||
int freeSpaceThreadHoldPercent = 20;
|
||||
tbDataDriveUsedCapacityBarGraph.Width = ((double)(100 - freeSpacePercentage) / 100.0) * bDataDriveTotalCapacityBarGraph.Width;
|
||||
if (freeSpacePercentage >= freeSpaceThreadHoldPercent)
|
||||
{
|
||||
tbDataDriveUsedCapacityBarGraph.Background = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString(freeSpaceColorCode));
|
||||
}
|
||||
else
|
||||
{
|
||||
tbDataDriveUsedCapacityBarGraph.Background = new SolidColorBrush(Colors.Red);
|
||||
|
||||
}
|
||||
|
||||
tbDataDriveUsedCapacityBarGraph.Text = driveNameOrPath.Substring(0, 2) + "\\";
|
||||
|
||||
tbDataDriveCapacityDetails.Text = $"{DescribeLargestDriveStorageSize(drive.TotalFreeSpace)} free of {DescribeLargestDriveStorageSize(drive.TotalSize)}";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Describe largest unit size of drive storage
|
||||
/// </summary>
|
||||
private string DescribeLargestDriveStorageSize(long byteCount)
|
||||
{
|
||||
string size = "";
|
||||
|
||||
UInt64 oneKb = 1024;
|
||||
UInt64 oneMb = oneKb * oneKb;
|
||||
UInt64 oneGb = oneMb * oneKb;
|
||||
UInt64 oneTb = oneGb * oneKb;
|
||||
|
||||
long kilobytes = (long)((double)((ulong)byteCount % oneMb) / (double)oneKb);
|
||||
long megabytes = (long)((double)((ulong)byteCount % oneGb) / (double)oneMb);
|
||||
long gigabytes = (long)((double)((ulong)byteCount % oneTb) / (double)oneGb);
|
||||
long terabytes = (long)((double)(ulong)byteCount / (double)oneTb);
|
||||
|
||||
if (terabytes > 0)
|
||||
{
|
||||
size = $"{terabytes.ToString()} TB";
|
||||
}
|
||||
else if (gigabytes > 0)
|
||||
{
|
||||
size = $"{gigabytes.ToString()} GB";
|
||||
}
|
||||
else if (megabytes > 0)
|
||||
{
|
||||
size = $"{megabytes.ToString()} MB";
|
||||
}
|
||||
else if (kilobytes > 0)
|
||||
{
|
||||
size = $"{kilobytes.ToString()} KB";
|
||||
}
|
||||
else
|
||||
size = $"{byteCount.ToString()} B";
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Show running test time and power on time
|
||||
/// </summary>
|
||||
private void Timer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
TimeSpan ts = DateTime.Now - _testDateTime;
|
||||
LiveDataWindowViewModel.TestTimeStr = ProgramLib.Util.DescribeTimeElapsed(ts);
|
||||
|
||||
Events id = _eventGroup.WaitAny(0);
|
||||
if (id == Events.UUT_POWER_ON)
|
||||
{
|
||||
if (_powerOnDateTime == null)
|
||||
{
|
||||
_powerOnDateTime = DateTime.Now;
|
||||
}
|
||||
ts = DateTime.Now - (DateTime)_powerOnDateTime;
|
||||
LiveDataWindowViewModel.PowerOnTimeStr = ProgramLib.Util.DescribeTimeElapsed(ts);
|
||||
}
|
||||
else if (id == Events.UUT_POWER_OFF && _powerOnDateTime != null)
|
||||
{
|
||||
_powerOnDateTime = null;
|
||||
LiveDataWindowViewModel.PowerOnTimeStr = "---";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Show which UUT is connected on th GUI
|
||||
/// </summary>
|
||||
private void ShowConnecterdUut()
|
||||
{
|
||||
string uutBuildLevel = "NO UUT";
|
||||
if (Program.Instance().UutInfo.UutBuildLevel == UutInfo.BuildLevel.GMA)
|
||||
{
|
||||
uutBuildLevel = "Guided Missile Assem. (GMA)";
|
||||
}
|
||||
else if (Program.Instance().UutInfo.UutBuildLevel == UutInfo.BuildLevel.AUR)
|
||||
{
|
||||
uutBuildLevel = "All-Up-Round (AUR)";
|
||||
}
|
||||
else if (Program.Instance().UutInfo.UutBuildLevel == UutInfo.BuildLevel.SELF_TEST)
|
||||
{
|
||||
uutBuildLevel = "Self-Test Cable";
|
||||
}
|
||||
TextBlock textBlock = new TextBlock();
|
||||
textBlock.Text = uutBuildLevel;
|
||||
textBlock.FontWeight = FontWeights.Bold;
|
||||
textBlock.FontSize = 16;
|
||||
textBlock.HorizontalAlignment = HorizontalAlignment.Center;
|
||||
|
||||
connectedUutSp.Children.Add(textBlock);
|
||||
|
||||
if (Program.Instance().UutInfo.UutBuildLevel == UutInfo.BuildLevel.AUR || Program.Instance().UutInfo.UutBuildLevel == UutInfo.BuildLevel.GMA)
|
||||
{
|
||||
System.Windows.Controls.Image image = new System.Windows.Controls.Image();
|
||||
BitmapImage myImageSource = new BitmapImage();
|
||||
myImageSource.BeginInit();
|
||||
|
||||
textBlock.FontSize = 14;
|
||||
|
||||
int imageWidth = 154;
|
||||
int imageHeight = 30;
|
||||
if (Program.Instance().UutInfo.UutBuildLevel == UutInfo.BuildLevel.GMA)
|
||||
{
|
||||
myImageSource.UriSource = new Uri($"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Images/gma.png");
|
||||
imageWidth = 148;
|
||||
imageHeight = 20;
|
||||
}
|
||||
else
|
||||
myImageSource.UriSource = new Uri($"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Images/aur.png");
|
||||
|
||||
myImageSource.EndInit();
|
||||
image.Source = myImageSource;
|
||||
|
||||
image.Width = imageWidth;
|
||||
image.Height = imageHeight;
|
||||
image.Margin = new Thickness(0, 5, 0, 0);
|
||||
|
||||
connectedUutSp.Children.Add(image);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Show which cable is connected on th GUI
|
||||
/// </summary>
|
||||
private void ShowConnecterdCable()
|
||||
{
|
||||
var brushConverter = new BrushConverter();
|
||||
|
||||
missileModeBdr.BorderThickness = new Thickness(0, 1, 0, 0);
|
||||
if (Program.Instance().UutInfo.UniversalCableId == UutInfo.UniversalCable.W1)
|
||||
{
|
||||
LiveDataWindowViewModel.W1CableImagePath = LiveDataWindowViewModel.ImageToResourcePathDict[LiveDataWindowViewModel.Images.LED_ON];
|
||||
|
||||
missileModeBdr.BorderBrush = (System.Windows.Media.Brush)brushConverter.ConvertFrom("#DCC3AD");
|
||||
missileModeBdr.Background = (System.Windows.Media.Brush)brushConverter.ConvertFrom("#FDE6AE");
|
||||
|
||||
missileModeTb.Foreground = (System.Windows.Media.Brush)brushConverter.ConvertFrom("#A4530D");
|
||||
|
||||
missileModeTb.Text = "Maintenance Mode";
|
||||
}
|
||||
else if (Program.Instance().UutInfo.UniversalCableId == UutInfo.UniversalCable.W2)
|
||||
{
|
||||
LiveDataWindowViewModel.W2CableImagePath = LiveDataWindowViewModel.ImageToResourcePathDict[LiveDataWindowViewModel.Images.LED_ON];
|
||||
|
||||
missileModeBdr.BorderBrush = (System.Windows.Media.Brush)brushConverter.ConvertFrom("#94D487");
|
||||
missileModeBdr.Background = (System.Windows.Media.Brush)brushConverter.ConvertFrom("#DBFFD7");
|
||||
|
||||
missileModeTb.Foreground = (System.Windows.Media.Brush)brushConverter.ConvertFrom("#1C7F08");
|
||||
|
||||
missileModeTb.Text = "Tactical Mode";
|
||||
}
|
||||
|
||||
if (Program.Instance().UutInfo.UutBuildLevel == UutInfo.BuildLevel.SELF_TEST)
|
||||
{
|
||||
LiveDataWindowViewModel.W5CableImagePath = LiveDataWindowViewModel.ImageToResourcePathDict[LiveDataWindowViewModel.Images.LED_ON];
|
||||
}
|
||||
|
||||
if (Program.Instance().UutInfo.SacrificialCableId == UutInfo.SacrificialCable.W3)
|
||||
{
|
||||
LiveDataWindowViewModel.W3CableImagePath = LiveDataWindowViewModel.ImageToResourcePathDict[LiveDataWindowViewModel.Images.LED_ON];
|
||||
}
|
||||
else if (Program.Instance().UutInfo.SacrificialCableId == UutInfo.SacrificialCable.W4)
|
||||
{
|
||||
LiveDataWindowViewModel.W4CableImagePath = LiveDataWindowViewModel.ImageToResourcePathDict[LiveDataWindowViewModel.Images.LED_ON];
|
||||
}
|
||||
}
|
||||
|
||||
private void btnClose_Click(object sender, RoutedEventArgs e)
|
||||
@@ -35,12 +337,12 @@ namespace ProgramLib.GUI.View
|
||||
if (this.WindowState == WindowState.Maximized)
|
||||
{
|
||||
this.WindowState = WindowState.Normal;
|
||||
imgMax.Source = new BitmapImage(new System.Uri("pack://application:,,,/Resources/Images/Title_Bar_Buttons/maximize.png"));
|
||||
imgMax.Source = new BitmapImage(new System.Uri($"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Images/Title_Bar_Buttons/maximize.png"));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.WindowState = WindowState.Maximized;
|
||||
imgMax.Source = new BitmapImage(new System.Uri("pack://application:,,,/Resources/Images/Title_Bar_Buttons/restore.png"));
|
||||
imgMax.Source = new BitmapImage(new System.Uri($"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Images/Title_Bar_Buttons/restore.png"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,5 +355,18 @@ namespace ProgramLib.GUI.View
|
||||
{
|
||||
DragMove();
|
||||
}
|
||||
|
||||
private void dataLocationMi_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DataLocationWindow window = new DataLocationWindow();
|
||||
window.ShowDialog();
|
||||
}
|
||||
|
||||
private void manualControlGuiMi_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
((ManualControlWindow)Program.Instance().GuiManager[ProgramGuiManager.WINDOWS.MANUAL_CONTROL]).LiveDataWindow = this;
|
||||
Program.Instance().GuiManager[ProgramGuiManager.WINDOWS.MANUAL_CONTROL].Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
579
Source/Program/GUI/View/ManualControlWindow.xaml
Normal file
579
Source/Program/GUI/View/ManualControlWindow.xaml
Normal file
@@ -0,0 +1,579 @@
|
||||
<Window x:Class="ProgramLib.GUI.View.ManualControlWindow"
|
||||
x:ClassModifier="internal"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:local="clr-namespace:ProgramLib.GUI.View"
|
||||
mc:Ignorable="d"
|
||||
Title="Manual Control"
|
||||
WindowStyle="None"
|
||||
MouseLeftButtonDown="Window_MouseLeftButtonDown"
|
||||
KeyDown="Window_KeyDown"
|
||||
Loaded="Window_Loaded"
|
||||
IsVisibleChanged="Window_IsVisibleChanged"
|
||||
Height="550"
|
||||
Width="650">
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome GlassFrameThickness="1" CornerRadius="13,13,13,13" CaptionHeight="0"/>
|
||||
</WindowChrome.WindowChrome>
|
||||
<Window.Resources>
|
||||
|
||||
<!-- Style for the close button -->
|
||||
<Style x:Key="TitleBarCloseButtonStyle" TargetType="{x:Type Button}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border x:Name="bdr_main" BorderThickness="1" BorderBrush="Transparent" Background="Transparent">
|
||||
<ContentPresenter x:Name="bdr_main2" VerticalAlignment="Center" HorizontalAlignment="Center" ContentSource="Content"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="bdr_main" Property="Background" Value="#e94856"/>
|
||||
<Setter TargetName="bdr_main" Property="BorderBrush" Value="#ba1245"/>
|
||||
<Setter TargetName="bdr_main2" Property="Content">
|
||||
<Setter.Value>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/Title_Bar_Buttons/close_white.png" Width="20" Height="20" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="bdr_main" Property="Background" Value="#ff829a"/>
|
||||
<Setter TargetName="bdr_main" Property="BorderBrush" Value="#e94856"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- Style for minimize and maximize buttons -->
|
||||
<Style x:Key="TitleBarButtonStyle" TargetType="{x:Type Button}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border x:Name="bdr_main" BorderThickness="1" BorderBrush="Transparent" Background="Transparent">
|
||||
<ContentPresenter x:Name="bdr_main2" VerticalAlignment="Center" HorizontalAlignment="Center" ContentSource="Content"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="bdr_main" Property="Background" Value="#bee6fd"/>
|
||||
<Setter TargetName="bdr_main" Property="BorderBrush" Value="#7fb1cd"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="bdr_main" Property="Background" Value="#a1bfd0"/>
|
||||
<Setter TargetName="bdr_main" Property="BorderBrush" Value="#4c778f"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="TextBoxAsTextBlock" TargetType="{x:Type TextBox}">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsFocused" Value="False">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TextBox}">
|
||||
<TextBlock Text="{TemplateBinding Text}" />
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<SolidColorBrush x:Key="TabItem.Selected.Background" Color="#F9F9F9"/>
|
||||
<SolidColorBrush x:Key="TabItem.Selected.Border" Color="#ACACAC"/>
|
||||
<Style x:Key="TabControlStyle1" TargetType="{x:Type TabControl}">
|
||||
<Setter Property="Padding" Value="2"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Background" Value="{StaticResource TabItem.Selected.Background}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource TabItem.Selected.Border}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TabControl}">
|
||||
<Grid x:Name="templateRoot" ClipToBounds="true" SnapsToDevicePixels="true" KeyboardNavigation.TabNavigation="Local">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition x:Name="ColumnDefinition0"/>
|
||||
<ColumnDefinition x:Name="ColumnDefinition1" Width="0"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition x:Name="RowDefinition0" Height="Auto"/>
|
||||
<RowDefinition x:Name="RowDefinition1" Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TabPanel x:Name="headerPanel" Background="Transparent" Grid.Column="0" IsItemsHost="true" Margin="2,2,2,0" Grid.Row="0" KeyboardNavigation.TabIndex="1" Panel.ZIndex="1"/>
|
||||
<Border x:Name="contentPanel" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Grid.Column="0" KeyboardNavigation.DirectionalNavigation="Contained" Grid.Row="1" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local">
|
||||
<ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="TabStripPlacement" Value="Bottom">
|
||||
<Setter Property="Grid.Row" TargetName="headerPanel" Value="1"/>
|
||||
<Setter Property="Grid.Row" TargetName="contentPanel" Value="0"/>
|
||||
<Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
|
||||
<Setter Property="Height" TargetName="RowDefinition1" Value="Auto"/>
|
||||
<Setter Property="Margin" TargetName="headerPanel" Value="2,0,2,2"/>
|
||||
</Trigger>
|
||||
<Trigger Property="TabStripPlacement" Value="Left">
|
||||
<Setter Property="Grid.Row" TargetName="headerPanel" Value="0"/>
|
||||
<Setter Property="Grid.Row" TargetName="contentPanel" Value="0"/>
|
||||
<Setter Property="Grid.Column" TargetName="headerPanel" Value="0"/>
|
||||
<Setter Property="Grid.Column" TargetName="contentPanel" Value="1"/>
|
||||
<Setter Property="Width" TargetName="ColumnDefinition0" Value="Auto"/>
|
||||
<Setter Property="Width" TargetName="ColumnDefinition1" Value="*"/>
|
||||
<Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
|
||||
<Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
|
||||
<Setter Property="Margin" TargetName="headerPanel" Value="2,2,0,2"/>
|
||||
</Trigger>
|
||||
<Trigger Property="TabStripPlacement" Value="Right">
|
||||
<Setter Property="Grid.Row" TargetName="headerPanel" Value="0"/>
|
||||
<Setter Property="Grid.Row" TargetName="contentPanel" Value="0"/>
|
||||
<Setter Property="Grid.Column" TargetName="headerPanel" Value="1"/>
|
||||
<Setter Property="Grid.Column" TargetName="contentPanel" Value="0"/>
|
||||
<Setter Property="Width" TargetName="ColumnDefinition0" Value="*"/>
|
||||
<Setter Property="Width" TargetName="ColumnDefinition1" Value="Auto"/>
|
||||
<Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
|
||||
<Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
|
||||
<Setter Property="Margin" TargetName="headerPanel" Value="0,2,2,2"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="TextElement.Foreground" TargetName="templateRoot" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="FocusVisual1">
|
||||
<Setter Property="Control.Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<Rectangle Margin="2" StrokeDashArray="1 2" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" SnapsToDevicePixels="true" StrokeThickness="1"/>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<SolidColorBrush x:Key="Button.Static.Background" Color="#FFDDDDDD"/>
|
||||
<SolidColorBrush x:Key="Button.Static.Border" Color="#FF707070"/>
|
||||
<SolidColorBrush x:Key="Button.MouseOver.Background" Color="#FFBEE6FD"/>
|
||||
<SolidColorBrush x:Key="Button.MouseOver.Border" Color="#FF3C7FB1"/>
|
||||
<SolidColorBrush x:Key="Button.Pressed.Background" Color="#FFC4E5F6"/>
|
||||
<SolidColorBrush x:Key="Button.Pressed.Border" Color="#FF2C628B"/>
|
||||
<SolidColorBrush x:Key="Button.Disabled.Background" Color="#E5E5E5"/>
|
||||
<SolidColorBrush x:Key="Button.Disabled.Border" Color="#DFDFDF"/>
|
||||
<SolidColorBrush x:Key="Button.Disabled.Foreground" Color="#A6A6A6"/>
|
||||
<Style x:Key="ButtonStyle1" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" TargetType="{x:Type Button}">
|
||||
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual1}"/>
|
||||
<Setter Property="Background" Value="{StaticResource Button.Static.Background}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Padding" Value="1"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Microsoft_Windows_Themes:ButtonChrome SnapsToDevicePixels="true"
|
||||
x:Name="Chrome" Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}" RenderDefaulted="{TemplateBinding IsDefaulted}"
|
||||
RenderMouseOver="{TemplateBinding IsMouseOver}" RenderPressed="{TemplateBinding IsPressed}">
|
||||
<ContentPresenter Name="contentPresenter" Margin="{TemplateBinding Padding}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</Microsoft_Windows_Themes:ButtonChrome>
|
||||
<ControlTemplate.Triggers>
|
||||
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Background" TargetName="Chrome" Value="{StaticResource Button.Disabled.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="Chrome" Value="{StaticResource Button.Disabled.Border}"/>
|
||||
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource Button.Disabled.Foreground}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="TextBox">
|
||||
<EventSetter Event="GotKeyboardFocus" Handler="TextBox_GotKeyboardFocus"/>
|
||||
</Style>
|
||||
|
||||
</Window.Resources>
|
||||
<Grid Background="#f4f6fd">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30px"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Title bar which has the app icon, app title, minimize button, maximize button and close button -->
|
||||
<Grid>
|
||||
<WrapPanel HorizontalAlignment="left" VerticalAlignment="Center">
|
||||
<Image x:Name="imgAppIcon" Source="pack://application:,,,/Program;component/Resources/Images/missile.png" Width="20" Height="20" Margin="10,0,10,0"/>
|
||||
<TextBlock x:Name="txtBlockAppTitle">Manual Control</TextBlock>
|
||||
</WrapPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Style="{StaticResource TitleBarButtonStyle}" x:Name="btnMin" Width="44" Background="Transparent" BorderBrush="Transparent" Click="btnMin_Click">
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/Title_Bar_Buttons/minimize.png" Width="12" Height="12"/>
|
||||
</Button>
|
||||
<Button Style="{StaticResource TitleBarButtonStyle}" x:Name="btnMax" Width="44" Background="Transparent" BorderBrush="Transparent" Click="btnMax_Click">
|
||||
<Image x:Name="imgMax" Source="pack://application:,,,/Program;component/Resources/Images/Title_Bar_Buttons/maximize.png" Width="13" Height="13"/>
|
||||
</Button>
|
||||
<Button x:FieldModifier="public" Style="{StaticResource TitleBarCloseButtonStyle}" x:Name="btnClose" Width="44" Background="Transparent" BorderBrush="Transparent" Click="btnClose_Click">
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/Title_Bar_Buttons/close_black.png" Width="20" Height="20"/>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<TabControl x:Name="manualGuiTc" Style="{DynamicResource TabControlStyle1}" Grid.Row="1" Margin="15,5,15,15">
|
||||
<TabItem x:Name="powerSupplyTcTi" Header="Power Supply">
|
||||
<Grid Margin="0,10,0,10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<DockPanel Margin="20,0,0,10">
|
||||
<StackPanel>
|
||||
<Label HorizontalAlignment="Center">Power Modules</Label>
|
||||
<ComboBox Name="powerModuleCb" Width="150" Height="26" ItemsSource="{Binding _powerModuleComboBoxDataItems}" SelectionChanged="powerModuleCb_SelectionChanged">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal" Height="22">
|
||||
<Image Source="{Binding PowerLed}" Width="15" Height="15" />
|
||||
<TextBlock Text="{Binding Name}" Margin="5,0,0,0" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="30,0,0,0">
|
||||
<Label HorizontalAlignment="Center">Voltage Setpoint</Label>
|
||||
<TextBox Name="voltageSetpointTb" Width="90" Height="22" LostFocus="voltageSetpointTb_LostFocus"></TextBox>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="30,0,0,0">
|
||||
<Label HorizontalAlignment="Center">OVP</Label>
|
||||
<TextBox Name="ovpTb" Width="50" Height="22"></TextBox>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="30,0,0,0">
|
||||
<Label HorizontalAlignment="Center">OCP</Label>
|
||||
<TextBox Name="ocpTb" Width="50" Height="22"></TextBox>
|
||||
</StackPanel>
|
||||
<Button x:Name="powerOnBtn" Style="{DynamicResource ButtonStyle1}" Width="100" Height="25" VerticalAlignment="Bottom" Click="powerOnBtn_Click">Power on</Button>
|
||||
</DockPanel>
|
||||
|
||||
<Border Grid.Row="1" Margin="20,0,20,0" BorderThickness="1,0,0,1" BorderBrush="#bdbcbd">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="25" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label FontSize="14" Foreground="White" FontWeight="Bold" Content="Power Supply Monitor" Padding="5,0,0,2" VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd">
|
||||
<Label.Background>
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
|
||||
<GradientStop Color="#1959b1" Offset="0.31" />
|
||||
<GradientStop Color="#1959b1" Offset="0.09" />
|
||||
<GradientStop Color="white" Offset="1.1" />
|
||||
</LinearGradientBrush>
|
||||
</Label.Background>
|
||||
</Label>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1.5*" />
|
||||
<ColumnDefinition Width="1.5*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.RowSpan="2" FontSize="13" FontWeight="Bold" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Height="42" BorderThickness="0,1,1,1" BorderBrush="#bdbcbd">PS</Label>
|
||||
<Label Grid.Column="1" Grid.ColumnSpan="2" FontSize="10" FontWeight="Bold" Content="Voltage (V)" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderThickness="0,1,1,1" BorderBrush="#bdbcbd"/>
|
||||
<Label Grid.Column="3" Grid.ColumnSpan="2" FontSize="10" FontWeight="Bold" Content="Current (A)" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderThickness="0,1,1,1" BorderBrush="#bdbcbd"/>
|
||||
<Label Grid.Row="1" Grid.Column="1" FontSize="10" FontWeight="Bold" Content="Expected" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderThickness="0,0,1,1" BorderBrush="#bdbcbd"/>
|
||||
<Label Grid.Row="1" Grid.Column="2" FontSize="10" FontWeight="Bold" Content="Actual" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderThickness="0,0,1,1" BorderBrush="#bdbcbd"/>
|
||||
<Label Grid.Row="1" Grid.Column="3" Grid.ColumnSpan="2" FontSize="10" FontWeight="Bold" Content="Actual" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderThickness="0,0,1,1" BorderBrush="#bdbcbd"/>
|
||||
|
||||
<!-- DataGrid for Power Data-->
|
||||
<DataGrid Grid.Row="2" Grid.ColumnSpan="5" Name="datagridPowerData" AutoGenerateColumns="False" CanUserAddRows="False" IsReadOnly="True" SelectionMode="Extended" SelectionUnit="FullRow" ItemsSource="{Binding _poweredModuleDataItems}" Width="auto" HorizontalGridLinesBrush="#e9e9e9" VerticalGridLinesBrush="#e9e9e9" HeadersVisibility="None" BorderThickness="0,0,0,0">
|
||||
<DataGrid.Resources>
|
||||
<Style x:Key="CellStyle" TargetType="DataGridCell">
|
||||
<Setter Property="TextBlock.TextAlignment" Value="Center" />
|
||||
<Setter Property="TextBlock.VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="Foreground" Value="Black" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="{x:Null}" />
|
||||
<Setter Property="BorderBrush" Value="{x:Null}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style x:Key="CellStyle_2" TargetType="DataGridCell">
|
||||
<Setter Property="TextBlock.TextAlignment" Value="Center" />
|
||||
<Setter Property="TextBlock.VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="TextBlock.Height" Value="25"/>
|
||||
<Setter Property="Foreground" Value="Black" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="{x:Null}" />
|
||||
<Setter Property="BorderBrush" Value="{x:Null}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.Resources>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn CellStyle="{StaticResource CellStyle}" Header="powerModule" Width="1*">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal" Height="22">
|
||||
<Image Source="{Binding PowerLed}" Width="15" Height="15" Margin="3,0,0,0" />
|
||||
<TextBlock Text="{Binding Name}" Margin="6,0,0,0" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn CellStyle="{StaticResource CellStyle_2}" Header="expectedVoltage" Width="1.5*" Binding="{Binding ExpectedVoltage}"/>
|
||||
<DataGridTextColumn CellStyle="{StaticResource CellStyle_2}" Header="actualVoltage" Width="1.5*" Binding="{Binding ActualVoltage}"/>
|
||||
<DataGridTextColumn CellStyle="{StaticResource CellStyle_2}" Header="actualCurrent" Width="2*" Binding="{Binding ActualCurrent}"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem x:Name="dioTiTc" Header="DIO">
|
||||
<StackPanel Focusable="true">
|
||||
<GroupBox Header="Digital Input" BorderThickness="2" Margin="0,25,0,0" Width="474">
|
||||
<WrapPanel Margin="20,20,0,25">
|
||||
<StackPanel VerticalAlignment="Bottom">
|
||||
<Label HorizontalAlignment="Center">Input Signals</Label>
|
||||
<ComboBox Name="inputDiscretesCb" Width="120"/>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="20,0,0,0">
|
||||
<Label HorizontalAlignment="Center">Read State</Label>
|
||||
<TextBlock x:Name="inputDiscreteStatusTb" HorizontalAlignment="Center" TextAlignment="Center" Background="Black" Width="40" Height="20" Foreground="LightGreen" FontWeight="DemiBold">---</TextBlock>
|
||||
</StackPanel>
|
||||
<WrapPanel VerticalAlignment="Bottom">
|
||||
<Button Style="{DynamicResource ButtonStyle1}" Name="inputDiscreteReadBtn" Width="100" Height="25" Margin="40,0,0,0" Cursor="Hand" FontSize="15" Click="inputDiscreteReadBtn_Click">Read</Button>
|
||||
</WrapPanel>
|
||||
</WrapPanel>
|
||||
</GroupBox>
|
||||
<GroupBox Header="Digital Output" BorderThickness="2" Margin="0,45,0,0" Width="474">
|
||||
<WrapPanel Margin="20,20,0,25">
|
||||
<StackPanel>
|
||||
<Label HorizontalAlignment="Center">Output Signals</Label>
|
||||
<ComboBox Name="outputDiscretesCb" Width="120"/>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="40,0,0,0">
|
||||
<Label HorizontalAlignment="Center">Write State</Label>
|
||||
<ComboBox Name="outputDiscreteStateCb" Width="120">
|
||||
<ComboBoxItem>Low</ComboBoxItem>
|
||||
<ComboBoxItem>High</ComboBoxItem>
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
<WrapPanel VerticalAlignment="Bottom" Margin="40,0,0,0">
|
||||
<Button Style="{DynamicResource ButtonStyle1}" Name="outputDiscreteWriteBtn" Width="100" Height="25" Margin="10,0,0,0" Cursor="Hand" FontSize="15" Click="outputDiscreteWriteBtn_Click">Write</Button>
|
||||
</WrapPanel>
|
||||
</WrapPanel>
|
||||
</GroupBox>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
<TabItem x:Name="coeTcTi" Header="COE">
|
||||
<DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="Auto" Margin="20,0,20,0" Focusable="true">
|
||||
<DockPanel DockPanel.Dock="Bottom" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="Auto" Margin="0,5,0,0">
|
||||
<WrapPanel DockPanel.Dock="Left">
|
||||
<Label Padding="0,5,5,5">Rate (Hz):</Label>
|
||||
<TextBox x:Name="coeSendRate" Width="100" Height="20"></TextBox>
|
||||
</WrapPanel>
|
||||
<WrapPanel HorizontalAlignment="Right">
|
||||
<Button x:Name="coeSendBtn" Style="{DynamicResource ButtonStyle1}" Width="100" Click="coeSendBtn_Click">Send</Button>
|
||||
</WrapPanel>
|
||||
</DockPanel>
|
||||
<WrapPanel DockPanel.Dock="Top" Height="Auto" HorizontalAlignment="Center">
|
||||
<StackPanel>
|
||||
<Label HorizontalAlignment="Center">COE Device</Label>
|
||||
<ComboBox Name="coeDeviceCb" Width="200" SelectionChanged="coeDeviceCb_SelectionChanged"/>
|
||||
</StackPanel>
|
||||
</WrapPanel>
|
||||
<WrapPanel DockPanel.Dock="Top" Margin="0,0,0,10" Height="Auto" HorizontalAlignment="Center">
|
||||
<StackPanel>
|
||||
<Label HorizontalAlignment="Center">XML Files</Label>
|
||||
<ComboBox Name="xmlFileCb" Width="200" SelectionChanged="xmlFileCb_SelectionChanged"/>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="40,0,0,0">
|
||||
<Label HorizontalAlignment="Center">COE Messages</Label>
|
||||
<ComboBox Name="coeMessagesCb" Width="200" SelectionChanged="coeMessagesCb_SelectionChanged"/>
|
||||
</StackPanel>
|
||||
</WrapPanel>
|
||||
<Label DockPanel.Dock="Top" HorizontalAlignment="Center" FontSize="16">Message Definition</Label>
|
||||
<!-- TreeGrid "Control" -->
|
||||
<Border DockPanel.Dock="Top" BorderBrush="Black" BorderThickness="0.5">
|
||||
|
||||
<!-- Resources -->
|
||||
<Border.Resources>
|
||||
<Style x:Key="TextBlockStyle" TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Margin" Value="3 0 3 0"/>
|
||||
</Style>
|
||||
<Style x:Key="TextBlockBoldStyle" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource TextBlockStyle}">
|
||||
<!--<Setter Property="FontWeight" Value="Bold"/>-->
|
||||
</Style>
|
||||
</Border.Resources>
|
||||
|
||||
<!-- Content -->
|
||||
<Grid Grid.IsSharedSizeScope="True">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Column headers -->
|
||||
<TreeViewItem Grid.Row="0" BorderThickness="1">
|
||||
<TreeViewItem.Header>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition SharedSizeGroup="Name"/>
|
||||
<!-- Placeholders for four columns of ToggleButton -->
|
||||
<ColumnDefinition SharedSizeGroup="Toggle"/>
|
||||
<ColumnDefinition SharedSizeGroup="Toggle"/>
|
||||
<ColumnDefinition SharedSizeGroup="Toggle"/>
|
||||
<ColumnDefinition SharedSizeGroup="Toggle"/>
|
||||
<ColumnDefinition SharedSizeGroup="Value"/>
|
||||
<ColumnDefinition SharedSizeGroup="Type"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="Name" Style="{StaticResource TextBlockBoldStyle}"/>
|
||||
<!-- Empty TreeViewItem to measure the size of its ToggleButton into the "Toggle" group-->
|
||||
<TreeViewItem Grid.Column="1" Padding="0"/>
|
||||
<TextBlock Grid.Column="5" Text="Value" Margin="10,0,0,0" Style="{StaticResource TextBlockBoldStyle}"/>
|
||||
<TextBlock Grid.Column="6" Text="Type" Margin="30,0,0,0" Style="{StaticResource TextBlockBoldStyle}"/>
|
||||
</Grid>
|
||||
</TreeViewItem.Header>
|
||||
</TreeViewItem>
|
||||
|
||||
<!-- Data rows -->
|
||||
<TreeView Grid.Row="1" ItemsSource="{Binding _coeMessageDataItems}" BorderBrush="Gray" BorderThickness="0 1 0 0">
|
||||
<TreeView.ItemTemplate>
|
||||
|
||||
<!-- Level 0 template leaves space for 4 child "Toggle" levels -->
|
||||
<HierarchicalDataTemplate ItemsSource="{Binding SubItems}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition SharedSizeGroup="Name"/>
|
||||
<ColumnDefinition SharedSizeGroup="Toggle"/>
|
||||
<ColumnDefinition SharedSizeGroup="Toggle"/>
|
||||
<ColumnDefinition SharedSizeGroup="Toggle"/>
|
||||
<ColumnDefinition SharedSizeGroup="Toggle"/>
|
||||
<ColumnDefinition SharedSizeGroup="Value"/>
|
||||
<ColumnDefinition SharedSizeGroup="Type"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="{Binding Name}" Style="{StaticResource TextBlockStyle}"/>
|
||||
<TextBox Grid.Column="5" Style="{StaticResource TextBoxAsTextBlock}" Text="{Binding Value}" Margin="10,0,0,0" Focusable="{Binding IsFocusable}"/>
|
||||
<TextBlock Grid.Column="6" Text="{Binding Type}" Margin="30,0,0,0" Style="{StaticResource TextBlockStyle}"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Level 1 template leaves space for 3 child "Toggle" levels -->
|
||||
<HierarchicalDataTemplate.ItemTemplate>
|
||||
<HierarchicalDataTemplate ItemsSource="{Binding SubItems}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition SharedSizeGroup="Name"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition SharedSizeGroup="Toggle"/>
|
||||
<ColumnDefinition SharedSizeGroup="Toggle"/>
|
||||
<ColumnDefinition SharedSizeGroup="Toggle"/>
|
||||
<ColumnDefinition SharedSizeGroup="Value"/>
|
||||
<ColumnDefinition SharedSizeGroup="Type"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="{Binding Name}" Style="{StaticResource TextBlockStyle}"/>
|
||||
<TextBox Grid.Column="5" Style="{StaticResource TextBoxAsTextBlock}" Text="{Binding Value}" Margin="10,0,0,0" Focusable="{Binding IsFocusable}" GotFocus="TextBox_GotFocus"/>
|
||||
<TextBlock Grid.Column="6" Text="{Binding Type}" Margin="30,0,0,0" Style="{StaticResource TextBlockStyle}"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Level 2 template leaves space for 2 child "Toggle" levels -->
|
||||
<HierarchicalDataTemplate.ItemTemplate>
|
||||
<HierarchicalDataTemplate ItemsSource="{Binding SubItems}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition SharedSizeGroup="Name"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition SharedSizeGroup="Toggle"/>
|
||||
<ColumnDefinition SharedSizeGroup="Toggle"/>
|
||||
<ColumnDefinition SharedSizeGroup="Value"/>
|
||||
<ColumnDefinition SharedSizeGroup="Type"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="{Binding Name}" Style="{StaticResource TextBlockStyle}"/>
|
||||
<TextBox Grid.Column="5" Style="{StaticResource TextBoxAsTextBlock}" Text="{Binding Value}" Margin="10,0,0,0" Focusable="{Binding IsFocusable}" GotFocus="TextBox_GotFocus"/>
|
||||
<TextBlock Grid.Column="6" Text="{Binding Type}" Margin="30,0,0,0" Style="{StaticResource TextBlockStyle}"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Level 3 template leaves space for 1 child "Toggle" level -->
|
||||
<HierarchicalDataTemplate.ItemTemplate>
|
||||
<HierarchicalDataTemplate ItemsSource="{Binding SubItems}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition SharedSizeGroup="Name"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition SharedSizeGroup="Toggle"/>
|
||||
<ColumnDefinition SharedSizeGroup="Value"/>
|
||||
<ColumnDefinition SharedSizeGroup="Type"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="{Binding Name}" Style="{StaticResource TextBlockStyle}"/>
|
||||
<TextBox Grid.Column="5" Style="{StaticResource TextBoxAsTextBlock}" Text="{Binding Value}" Margin="10,0,0,0" Focusable="{Binding IsFocusable}" GotFocus="TextBox_GotFocus"/>
|
||||
<TextBlock Grid.Column="6" Text="{Binding Type}" Margin="30,0,0,0" Style="{StaticResource TextBlockStyle}"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Level 4 template has no children -->
|
||||
<HierarchicalDataTemplate.ItemTemplate>
|
||||
<HierarchicalDataTemplate ItemsSource="{Binding SubItems}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition SharedSizeGroup="Name"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition SharedSizeGroup="Value"/>
|
||||
<ColumnDefinition SharedSizeGroup="Type"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="{Binding Name}" Style="{StaticResource TextBlockStyle}"/>
|
||||
<TextBox Grid.Column="5" Style="{StaticResource TextBoxAsTextBlock}" Text="{Binding Value}" Margin="10,0,0,0" Focusable="{Binding IsFocusable}" GotFocus="TextBox_GotFocus"/>
|
||||
<TextBlock Grid.Column="6" Text="{Binding Type}" Margin="30,0,0,0" Style="{StaticResource TextBlockStyle}"/>
|
||||
</Grid>
|
||||
</HierarchicalDataTemplate>
|
||||
</HierarchicalDataTemplate.ItemTemplate>
|
||||
</HierarchicalDataTemplate>
|
||||
</HierarchicalDataTemplate.ItemTemplate>
|
||||
</HierarchicalDataTemplate>
|
||||
</HierarchicalDataTemplate.ItemTemplate>
|
||||
</HierarchicalDataTemplate>
|
||||
</HierarchicalDataTemplate.ItemTemplate>
|
||||
</HierarchicalDataTemplate>
|
||||
</TreeView.ItemTemplate>
|
||||
</TreeView>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DockPanel>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
728
Source/Program/GUI/View/ManualControlWindow.xaml.cs
Normal file
728
Source/Program/GUI/View/ManualControlWindow.xaml.cs
Normal file
@@ -0,0 +1,728 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Xml.XPath;
|
||||
using MeasurementManagerLib;
|
||||
using NLog;
|
||||
using ProgramGui.GUI.ViewModel;
|
||||
using ProgramLib.GUI.Model;
|
||||
using Raytheon.Common.Coe;
|
||||
using Raytheon.Instruments;
|
||||
using Raytheon.Instruments.PowerSupply;
|
||||
|
||||
namespace ProgramLib.GUI.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ManualControlWindow.xaml
|
||||
/// </summary>
|
||||
internal partial class ManualControlWindow : Window
|
||||
{
|
||||
public ManualWindowViewModel _manualWindowViewModel;
|
||||
|
||||
public LiveDataWindow LiveDataWindow { get; set; }
|
||||
|
||||
private ILogger _logger;
|
||||
|
||||
private Message _currentMsg;
|
||||
|
||||
private Dictionary<string, MessageXmlDocument> _xmlDocs = new Dictionary<string, MessageXmlDocument>();
|
||||
|
||||
private Dictionary<string, CoeMessageDataModel> _fieldNameToCoeMessageDataDict = new Dictionary<string, CoeMessageDataModel>();
|
||||
|
||||
private ManualGuiPowerSupplyReadThread _powerSupplyReadThread;
|
||||
|
||||
private CancellationTokenSource _coeSendMessageTaskCancellationSource = new CancellationTokenSource();
|
||||
|
||||
public ManualControlWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
Uri iconUri = new Uri($"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Icons/app.ico");
|
||||
this.Icon = BitmapFrame.Create(iconUri);
|
||||
|
||||
WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
|
||||
|
||||
_manualWindowViewModel = new ManualWindowViewModel();
|
||||
DataContext = _manualWindowViewModel;
|
||||
|
||||
_manualWindowViewModel._poweredModuleDataItems = new ObservableCollection<PowerModuleDataModel>();
|
||||
_manualWindowViewModel._powerModuleComboBoxDataItems = new ObservableCollection<PowerModuleDataModel>();
|
||||
}
|
||||
|
||||
~ManualControlWindow()
|
||||
{
|
||||
_logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() ...");
|
||||
|
||||
_coeSendMessageTaskCancellationSource.Cancel();
|
||||
|
||||
if (_powerSupplyReadThread != null)
|
||||
{
|
||||
_powerSupplyReadThread.Quit();
|
||||
_powerSupplyReadThread.WaitForExit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void btnClose_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_powerSupplyReadThread != null)
|
||||
{
|
||||
_powerSupplyReadThread.Quit();
|
||||
_powerSupplyReadThread.WaitForExit();
|
||||
_powerSupplyReadThread = null;
|
||||
}
|
||||
this.Hide();
|
||||
if (LiveDataWindow != null)
|
||||
{
|
||||
LiveDataWindow.Show();
|
||||
LiveDataWindow = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnMax_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (this.WindowState == WindowState.Maximized)
|
||||
{
|
||||
this.WindowState = WindowState.Normal;
|
||||
imgMax.Source = new BitmapImage(new System.Uri($"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Images/Title_Bar_Buttons/maximize.png"));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.WindowState = WindowState.Maximized;
|
||||
imgMax.Source = new BitmapImage(new System.Uri($"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Images/Title_Bar_Buttons/restore.png"));
|
||||
}
|
||||
}
|
||||
|
||||
private void btnMin_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.WindowState = WindowState.Minimized;
|
||||
}
|
||||
|
||||
private void Window_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
TextBox textBox = Keyboard.FocusedElement as TextBox;
|
||||
// unfocus text box if click outside of textbox
|
||||
if (textBox != null)
|
||||
{
|
||||
// Kill logical focus
|
||||
FocusManager.SetFocusedElement(FocusManager.GetFocusScope(textBox), null);
|
||||
// Kill keyboard focus
|
||||
Keyboard.ClearFocus();
|
||||
}
|
||||
|
||||
DragMove();
|
||||
}
|
||||
|
||||
private void Window_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
|
||||
{
|
||||
TextBox textBox = Keyboard.FocusedElement as TextBox;
|
||||
// unfocus text box if enter key is pressed
|
||||
if (textBox != null)
|
||||
{
|
||||
if (e.Key == Key.Return)
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
// Kill logical focus
|
||||
FocusManager.SetFocusedElement(FocusManager.GetFocusScope(textBox), null);
|
||||
// Kill keyboard focus
|
||||
Keyboard.ClearFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void TextBox_GotKeyboardFocus(Object sender, KeyboardFocusChangedEventArgs e)
|
||||
{
|
||||
TextBox tb = (TextBox)sender;
|
||||
tb.Dispatcher.BeginInvoke(new Action(() => tb.SelectAll()));
|
||||
}
|
||||
|
||||
private void TextBox_GotFocus(object sender, RoutedEventArgs e)
|
||||
{
|
||||
TextBox tb = (TextBox)sender;
|
||||
tb.SelectAll();
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
poppulatePowerSupplyTab();
|
||||
poppulateDiscreteTab();
|
||||
poppulateCoeTab();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex.Message + "\r\n" + ex.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (this.Visibility == Visibility.Visible)
|
||||
{
|
||||
List<string> moduleList = Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.GetPowerModuleList();
|
||||
|
||||
foreach (string module in moduleList)
|
||||
{
|
||||
PowerModuleDataModel powerData = GetPowerModuleDataFromDatagridDataItems(module);
|
||||
PowerModuleDataModel powerData2 = GetPowerModuleDataFromComboBoxDataItems(module);
|
||||
if (powerData != null && !Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.IsPowerSupplyOn(module))
|
||||
{
|
||||
// update datagrid
|
||||
_manualWindowViewModel._poweredModuleDataItems.Remove(powerData);
|
||||
|
||||
if (powerData2 != null)
|
||||
powerData2.PowerLed = _manualWindowViewModel._imageToResourcePathDict[ManualWindowViewModel.Images.LED_OFF];
|
||||
}
|
||||
else if (Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.IsPowerSupplyOn(module))
|
||||
{
|
||||
// update datagrid
|
||||
_manualWindowViewModel._poweredModuleDataItems.Add(powerData);
|
||||
|
||||
if (powerData2 != null)
|
||||
powerData2.PowerLed = _manualWindowViewModel._imageToResourcePathDict[ManualWindowViewModel.Images.LED_ON];
|
||||
}
|
||||
}
|
||||
|
||||
if (powerModuleCb.SelectedItem != null)
|
||||
{
|
||||
string powerModule = ((PowerModuleDataModel)powerModuleCb.SelectedItem).Name;
|
||||
if (Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.IsPowerSupplyOn(powerModule))
|
||||
{
|
||||
powerOnBtn.Content = "Power Off";
|
||||
}
|
||||
else
|
||||
powerOnBtn.Content = "Power On";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Populate power supply tab
|
||||
/// </summary>
|
||||
private void poppulatePowerSupplyTab()
|
||||
{
|
||||
string sectionName = "MANUAL_CONTROL_GUI.POWER_MODULES";
|
||||
|
||||
List<string> keys = Program.Instance().ProgramSpecificConfig.ReadAllKeys(sectionName);
|
||||
|
||||
try
|
||||
{
|
||||
List<string> moduleList = Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.GetPowerModuleList();
|
||||
|
||||
foreach (string module in moduleList)
|
||||
{
|
||||
PowerModuleDataModel data = new PowerModuleDataModel();
|
||||
data.PowerLed = _manualWindowViewModel._imageToResourcePathDict[ManualWindowViewModel.Images.LED_OFF];
|
||||
if (Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.IsPowerSupplyOn(module))
|
||||
{
|
||||
data.PowerLed = _manualWindowViewModel._imageToResourcePathDict[ManualWindowViewModel.Images.LED_ON];
|
||||
}
|
||||
data.Name = module;
|
||||
|
||||
data.ExpectedVoltage = Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.GetVoltageSetpoint(module).ToString("0.00");
|
||||
_manualWindowViewModel._powerModuleComboBoxDataItems.Add(data);
|
||||
}
|
||||
}
|
||||
catch (MalMeasurementManagerNullReferenceException ex)
|
||||
{
|
||||
_logger.Warn(ex.Message + "\r\n" + ex.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
private void powerOnBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
if (Program.Instance().IsUutPwrOn)
|
||||
{
|
||||
MessageBox.Show("Power to UUT is currently on. Please turn off power to UUT before manually controlling the power modules.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
((Button)sender).IsEnabled = false;
|
||||
|
||||
_manualWindowViewModel.GetPoweredModuleDataItemsSem().WaitOne();
|
||||
|
||||
string moduleName = ((PowerModuleDataModel)powerModuleCb.SelectedValue).Name;
|
||||
|
||||
PowerData data = Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.ReadPowerData(moduleName);
|
||||
|
||||
if (data.Voltage > 0.0)
|
||||
{
|
||||
Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.OutputDisable(moduleName);
|
||||
}
|
||||
|
||||
string text = ((Button)sender).Content.ToString();
|
||||
|
||||
if (Regex.IsMatch(text, "power on", RegexOptions.IgnoreCase))
|
||||
{
|
||||
double voltageSetpoint = 0.0;
|
||||
double ovp = 0.0;
|
||||
double ocp = 0.0;
|
||||
|
||||
if (!Double.TryParse(voltageSetpointTb.Text, out voltageSetpoint))
|
||||
{
|
||||
MessageBox.Show("Voltage setpoint is invalid.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
success = false;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
if (!Double.TryParse(ovpTb.Text, out ovp))
|
||||
{
|
||||
MessageBox.Show("OVP is invalid.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
if (!Double.TryParse(ocpTb.Text, out ocp))
|
||||
{
|
||||
MessageBox.Show("OCP is invalid.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.SetOverVoltageProtection(moduleName, ovp);
|
||||
Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.SetVoltageSetpoint(moduleName, voltageSetpoint);
|
||||
Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.SetOverCurrentProtection(moduleName, ocp);
|
||||
Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.OutputEnable(moduleName);
|
||||
|
||||
((Button)sender).Content = "Power Off";
|
||||
|
||||
if (_powerSupplyReadThread == null)
|
||||
{
|
||||
_powerSupplyReadThread = new ManualGuiPowerSupplyReadThread();
|
||||
_powerSupplyReadThread.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.OutputDisable(moduleName);
|
||||
((Button)sender).Content = "Power On";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex.Message + "\r\n" + ex.StackTrace);
|
||||
|
||||
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_manualWindowViewModel.GetPoweredModuleDataItemsSem().Release();
|
||||
|
||||
((Button)sender).IsEnabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void powerModuleCb_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
string moduleName = ((PowerModuleDataModel)((ComboBox)sender).SelectedValue).Name;
|
||||
|
||||
double voltageSetpoint = 0.0;
|
||||
double ovp = 0.0;
|
||||
double ocp = 0.0;
|
||||
|
||||
voltageSetpoint = Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.GetVoltageSetpoint(moduleName);
|
||||
ovp = Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.GetOverVoltageProtection(moduleName);
|
||||
ocp = Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.GetOverCurrentProtection(moduleName);
|
||||
|
||||
voltageSetpointTb.Text = voltageSetpoint.ToString("0.00");
|
||||
ovpTb.Text = ovp.ToString("0.00");
|
||||
ocpTb.Text = ocp.ToString("0.00");
|
||||
|
||||
if (Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.IsPowerSupplyOn(moduleName))
|
||||
{
|
||||
powerOnBtn.Content = "Power Off";
|
||||
}
|
||||
else
|
||||
powerOnBtn.Content = "Power On";
|
||||
}
|
||||
|
||||
private void voltageSetpointTb_LostFocus(object sender, RoutedEventArgs e)
|
||||
{
|
||||
double voltageSetpoint = 0.0;
|
||||
|
||||
if (Double.TryParse(((TextBox)sender).Text, out voltageSetpoint) && powerModuleCb.SelectedItem != null)
|
||||
{
|
||||
string moduleName = ((PowerModuleDataModel)powerModuleCb.SelectedValue).Name;
|
||||
PowerModuleDataModel data = GetPowerModuleDataFromComboBoxDataItems(moduleName);
|
||||
string currentVoltageSetpoint = data.ExpectedVoltage;
|
||||
if (voltageSetpoint.ToString("0.00") != currentVoltageSetpoint)
|
||||
{
|
||||
data.ExpectedVoltage = voltageSetpoint.ToString("0.00");
|
||||
double ovp = voltageSetpoint + 0.5;
|
||||
ovpTb.Text = ovp.ToString("0.00");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get power module data from ComboBox
|
||||
/// </summary>
|
||||
public PowerModuleDataModel GetPowerModuleDataFromComboBoxDataItems(string powerModuleName)
|
||||
{
|
||||
PowerModuleDataModel data = null;
|
||||
foreach (PowerModuleDataModel item in _manualWindowViewModel._powerModuleComboBoxDataItems)
|
||||
{
|
||||
if (item.Name == powerModuleName)
|
||||
data = item;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get power module data from datagrid
|
||||
/// </summary>
|
||||
public PowerModuleDataModel GetPowerModuleDataFromDatagridDataItems(string powerModuleName)
|
||||
{
|
||||
PowerModuleDataModel data = null;
|
||||
foreach (PowerModuleDataModel item in _manualWindowViewModel._poweredModuleDataItems)
|
||||
{
|
||||
if (item.Name == powerModuleName)
|
||||
data = item;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Populate Discrete tab
|
||||
/// </summary>
|
||||
private void poppulateDiscreteTab()
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (KeyValuePair<string, IODatatypes.DIOChannelInfo> item in Program.Instance().MalMeasurementLibManager.DioMeasurementManager.SignalNameToChannelInfoMap)
|
||||
{
|
||||
if (item.Value.ioType == IODatatypes.IOType.DigitalInput)
|
||||
{
|
||||
inputDiscretesCb.Items.Add(item.Key);
|
||||
}
|
||||
else
|
||||
outputDiscretesCb.Items.Add(item.Key);
|
||||
}
|
||||
}
|
||||
catch (MalMeasurementManagerNullReferenceException ex)
|
||||
{
|
||||
_logger.Warn(ex.Message + "\r\n" + ex.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
private void inputDiscreteReadBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (inputDiscretesCb.SelectedItem != null)
|
||||
{
|
||||
if (Program.Instance().MalMeasurementLibManager != null && Program.Instance().MalMeasurementLibManager.DioMeasurementManager != null)
|
||||
{
|
||||
IODatatypes.BitState state = Program.Instance().MalMeasurementLibManager.DioMeasurementManager.GetInputSignalState(inputDiscretesCb.SelectedValue.ToString());
|
||||
|
||||
inputDiscreteStatusTb.Text = state.ToString();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Please select an input signal.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex.Message + "\r\n" + ex.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
private void outputDiscreteWriteBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
bool success = true;
|
||||
try
|
||||
{
|
||||
if (outputDiscretesCb.SelectedItem == null)
|
||||
{
|
||||
MessageBox.Show("Please select an output signal.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
success = false;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
if (outputDiscreteStateCb.SelectedItem == null)
|
||||
{
|
||||
MessageBox.Show("Please select an output signal state.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
if (Program.Instance().MalMeasurementLibManager != null && Program.Instance().MalMeasurementLibManager.DioMeasurementManager != null)
|
||||
{
|
||||
IODatatypes.BitState state;
|
||||
if (Enum.TryParse(outputDiscreteStateCb.SelectedValue.ToString(), out state))
|
||||
{
|
||||
Program.Instance().MalMeasurementLibManager.DioMeasurementManager.SetOutputSignalState(outputDiscretesCb.SelectedValue.ToString(), state);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex.Message + "\r\n" + ex.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Populate COE tab
|
||||
/// </summary>
|
||||
private void poppulateCoeTab()
|
||||
{
|
||||
try
|
||||
{
|
||||
ICollection<object> coeDeviceList = Program.Instance().InstrumentManager.GetInstruments(typeof(CoeComm));
|
||||
foreach (CoeComm coeDevice in coeDeviceList)
|
||||
{
|
||||
coeDeviceCb.Items.Add(Path.GetFileName(coeDevice.Name));
|
||||
}
|
||||
|
||||
}
|
||||
catch (MalMeasurementManagerNullReferenceException ex)
|
||||
{
|
||||
_logger.Warn(ex.Message + "\r\n" + ex.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
private void coeDeviceCb_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
xmlFileCb.Items.Clear();
|
||||
|
||||
var xmlDocObject = Program.Instance().MalMeasurementLibManager.CoeMeasurementManager.GetXmlDocs(coeDeviceCb.SelectedValue.ToString());
|
||||
|
||||
if (xmlDocObject != null && xmlDocObject.GetType() == _xmlDocs.GetType())
|
||||
{
|
||||
_xmlDocs = (Dictionary<string, MessageXmlDocument>)xmlDocObject;
|
||||
|
||||
foreach (KeyValuePair<string, MessageXmlDocument> item in _xmlDocs)
|
||||
{
|
||||
xmlFileCb.Items.Add(Path.GetFileName(item.Key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void xmlFileCb_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
coeMessagesCb.Items.Clear();
|
||||
_manualWindowViewModel._coeMessageDataItems.Clear();
|
||||
string coeXmlFolderPath = Path.GetDirectoryName(_xmlDocs.First().Key.ToString());
|
||||
string coeXmlFilePath = Path.Combine(coeXmlFolderPath, ((ComboBox)sender).SelectedValue.ToString());
|
||||
XPathNavigator Node = _xmlDocs[coeXmlFilePath].CreateNavigator();
|
||||
XPathNodeIterator Nodeset = Node.Select("interface/message/name");
|
||||
while (Nodeset.MoveNext())
|
||||
{
|
||||
coeMessagesCb.Items.Add(Nodeset.Current.Value);
|
||||
}
|
||||
}
|
||||
|
||||
private void coeMessagesCb_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (((ComboBox)sender).SelectedItem != null)
|
||||
{
|
||||
string coeXmlFolderPath = Path.GetDirectoryName(_xmlDocs.First().Key.ToString());
|
||||
string coeXmlFilePath = Path.Combine(coeXmlFolderPath, xmlFileCb.SelectedValue.ToString());
|
||||
_currentMsg = new Message(((ComboBox)sender).SelectedValue.ToString(), _xmlDocs[coeXmlFilePath]);
|
||||
_currentMsg.Default();
|
||||
List<MessageData> visibleData = new List<MessageData>();
|
||||
visibleData.AddRange(_currentMsg.MessageDataArray);
|
||||
|
||||
_manualWindowViewModel._coeMessageDataItems.Clear();
|
||||
_fieldNameToCoeMessageDataDict.Clear();
|
||||
CoeMessageDataModel coeMessage;
|
||||
foreach (MessageData messageData in visibleData)
|
||||
{
|
||||
coeMessage = new CoeMessageDataModel(messageData.FieldName, messageData.FieldValue, messageData.FieldType);
|
||||
if (!String.IsNullOrEmpty(messageData.FormattedValue) && Regex.IsMatch(messageData.FormattedValue, @"^0x.+", RegexOptions.IgnoreCase))
|
||||
{
|
||||
coeMessage.Value = messageData.FormattedValue;
|
||||
}
|
||||
_fieldNameToCoeMessageDataDict[messageData.FieldName] = coeMessage;
|
||||
if (messageData.FieldName[0] == '$')
|
||||
{
|
||||
coeMessage.IsFocusable = Boolean.FalseString;
|
||||
}
|
||||
// add data item to TreeView control
|
||||
_manualWindowViewModel._coeMessageDataItems.Add(coeMessage);
|
||||
ProcessChildMessage(messageData.MessageArray, coeMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Process child message
|
||||
/// </summary>
|
||||
private void ProcessChildMessage(MessageData[] messageArray, CoeMessageDataModel coeMessageParent)
|
||||
{
|
||||
if (messageArray != null && messageArray.Count() > 0)
|
||||
{
|
||||
coeMessageParent.SubItems = new ObservableCollection<CoeMessageDataModel>();
|
||||
foreach (var message in messageArray)
|
||||
{
|
||||
string simpliedFiledName = message.FieldName;
|
||||
Match regexMatch = Regex.Match(message.FieldName, @"([^\\.]+)$", RegexOptions.IgnoreCase);
|
||||
|
||||
if (regexMatch.Success)
|
||||
{
|
||||
simpliedFiledName = regexMatch.Groups[1].Value;
|
||||
}
|
||||
CoeMessageDataModel coeMessage = new CoeMessageDataModel(simpliedFiledName, message.FieldValue, message.FieldType);
|
||||
_fieldNameToCoeMessageDataDict[message.FieldName] = coeMessage;
|
||||
if (String.IsNullOrEmpty(message.FieldValue))
|
||||
{
|
||||
coeMessage.IsFocusable = Boolean.FalseString;
|
||||
}
|
||||
coeMessageParent.SubItems.Add(coeMessage);
|
||||
ProcessChildMessage(message.MessageArray, coeMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void coeSendBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_currentMsg != null)
|
||||
{
|
||||
string text = ((Button)sender).Content.ToString();
|
||||
|
||||
if (Regex.IsMatch(text, "send", RegexOptions.IgnoreCase))
|
||||
{
|
||||
var parms = GetParameters(_currentMsg.MessageDataArray);
|
||||
int rateHz = -1;
|
||||
if (int.TryParse(coeSendRate.Text, out rateHz))
|
||||
{
|
||||
int minRateHz = 1;
|
||||
int maxRateHz = 60;
|
||||
if (rateHz < minRateHz || rateHz > maxRateHz)
|
||||
{
|
||||
MessageBox.Show($"Rate {rateHz} Hz is out of range. Must be between {minRateHz} and {maxRateHz} Hz");
|
||||
}
|
||||
else
|
||||
{
|
||||
_coeSendMessageTaskCancellationSource = new CancellationTokenSource();
|
||||
string instr = coeDeviceCb.SelectedValue.ToString();
|
||||
Task.Factory.StartNew(() => SendCoeMessageTask(instr, _currentMsg.Name, parms, rateHz));
|
||||
((Button)sender).Content = "Stop";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
Program.Instance().MalMeasurementLibManager.CoeMeasurementManager.SendMessage(coeDeviceCb.SelectedValue.ToString(), _currentMsg.Name, parms);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex.Message + "\r\n" + ex.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_coeSendMessageTaskCancellationSource.Cancel();
|
||||
((Button)sender).Content = "Send";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send COE message periodically
|
||||
/// </summary>
|
||||
private async void SendCoeMessageTask(string instr, string msgName, List<KeyValuePair<string, string>> parms, int rateHz)
|
||||
{
|
||||
_logger?.Debug($"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() is running...");
|
||||
|
||||
int sleepIntervalMs = 1000 / rateHz;
|
||||
|
||||
try
|
||||
{
|
||||
while (!_coeSendMessageTaskCancellationSource.Token.IsCancellationRequested)
|
||||
{
|
||||
Program.Instance().MalMeasurementLibManager.CoeMeasurementManager.SendMessage(instr, msgName, parms);
|
||||
|
||||
await Task.Delay(sleepIntervalMs);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex.Message + "\r\n" + ex.StackTrace);
|
||||
}
|
||||
|
||||
_logger?.Debug($"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() is exiting...");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get parameters in the message
|
||||
/// </summary>
|
||||
private List<KeyValuePair<string, string>> GetParameters(MessageData[] array)
|
||||
{
|
||||
if (array == null || array.Length == 0)
|
||||
return null;
|
||||
|
||||
List<KeyValuePair<string, string>> parms = new List<KeyValuePair<string, string>>();
|
||||
|
||||
foreach (var item in array.Where(m => !m.FieldName.StartsWith("$")))
|
||||
{
|
||||
if (_fieldNameToCoeMessageDataDict.ContainsKey(item.FieldName))
|
||||
{
|
||||
parms.Add(new KeyValuePair<string, string>(item.FieldName, _fieldNameToCoeMessageDataDict[item.FieldName].Value));
|
||||
}
|
||||
if (item.MessageArray != null && item.MessageArray.Any())
|
||||
{
|
||||
var innerParams = GetParameters(item.MessageArray);
|
||||
if (innerParams != null)
|
||||
{
|
||||
parms.AddRange(innerParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return parms;
|
||||
}
|
||||
}
|
||||
}
|
||||
130
Source/Program/GUI/View/MsfrTestCasesWindow.xaml
Normal file
130
Source/Program/GUI/View/MsfrTestCasesWindow.xaml
Normal file
@@ -0,0 +1,130 @@
|
||||
<Window x:Class="ProgramLib.GUI.View.MsfrTestCasesWindow"
|
||||
x:ClassModifier="internal"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ProgramLib.GUI.View"
|
||||
mc:Ignorable="d"
|
||||
Title="MSFR Test Cases"
|
||||
WindowStyle="None"
|
||||
Topmost="True"
|
||||
MouseLeftButtonDown="Window_MouseLeftButtonDown"
|
||||
Loaded="Window_Loaded"
|
||||
Height="150"
|
||||
Width="420">
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome GlassFrameThickness="1" CornerRadius="13,13,13,13" CaptionHeight="0"/>
|
||||
</WindowChrome.WindowChrome>
|
||||
<Window.Resources>
|
||||
<!-- Style for the close button -->
|
||||
<Style x:Key="TitleBarCloseButtonStyle" TargetType="{x:Type Button}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border x:Name="bdr_main" BorderThickness="1" BorderBrush="Transparent" Background="Transparent">
|
||||
<ContentPresenter x:Name="bdr_main2" VerticalAlignment="Center" HorizontalAlignment="Center" ContentSource="Content"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="bdr_main" Property="Background" Value="#e94856"/>
|
||||
<Setter TargetName="bdr_main" Property="BorderBrush" Value="#ba1245"/>
|
||||
<Setter TargetName="bdr_main2" Property="Content">
|
||||
<Setter.Value>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/Title_Bar_Buttons/close_white.png" Width="20" Height="20" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="bdr_main" Property="Background" Value="#ff829a"/>
|
||||
<Setter TargetName="bdr_main" Property="BorderBrush" Value="#e94856"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="FocusVisual1">
|
||||
<Setter Property="Control.Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<Rectangle Margin="2" StrokeDashArray="1 2" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" SnapsToDevicePixels="true" StrokeThickness="1"/>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<SolidColorBrush x:Key="Button.Static.Background" Color="#FFDDDDDD"/>
|
||||
<SolidColorBrush x:Key="Button.Static.Border" Color="#FF707070"/>
|
||||
<SolidColorBrush x:Key="Button.MouseOver.Background" Color="#FFBEE6FD"/>
|
||||
<SolidColorBrush x:Key="Button.MouseOver.Border" Color="#FF3C7FB1"/>
|
||||
<SolidColorBrush x:Key="Button.Pressed.Background" Color="#FFC4E5F6"/>
|
||||
<SolidColorBrush x:Key="Button.Pressed.Border" Color="#FF2C628B"/>
|
||||
<SolidColorBrush x:Key="Button.Disabled.Background" Color="#E5E5E5"/>
|
||||
<SolidColorBrush x:Key="Button.Disabled.Border" Color="#DFDFDF"/>
|
||||
<SolidColorBrush x:Key="Button.Disabled.Foreground" Color="#A6A6A6"/>
|
||||
<Style x:Key="ButtonStyle1" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" TargetType="{x:Type Button}">
|
||||
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual1}"/>
|
||||
<Setter Property="Background" Value="{StaticResource Button.Static.Background}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Padding" Value="1"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Microsoft_Windows_Themes:ButtonChrome SnapsToDevicePixels="true"
|
||||
x:Name="Chrome" Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}" RenderDefaulted="{TemplateBinding IsDefaulted}"
|
||||
RenderMouseOver="{TemplateBinding IsMouseOver}" RenderPressed="{TemplateBinding IsPressed}">
|
||||
<ContentPresenter Name="contentPresenter" Margin="{TemplateBinding Padding}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</Microsoft_Windows_Themes:ButtonChrome>
|
||||
<ControlTemplate.Triggers>
|
||||
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Background" TargetName="Chrome" Value="{StaticResource Button.Disabled.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="Chrome" Value="{StaticResource Button.Disabled.Border}"/>
|
||||
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource Button.Disabled.Foreground}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
|
||||
<!-- Main Grid that contains everything -->
|
||||
<Grid Background="#f4f6fd">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30px"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Title bar which has the app icon, app title, minimize button, maximize button and close button -->
|
||||
<Grid>
|
||||
<WrapPanel HorizontalAlignment="left" VerticalAlignment="Center">
|
||||
<Image x:Name="imgAppIcon" Source="pack://application:,,,/Program;component/Resources/Images/missile.png" Width="20" Height="20" Margin="10,0,10,0"/>
|
||||
<TextBlock x:Name="txtBlockAppTitle">MSFR Test Cases</TextBlock>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
|
||||
<Border Grid.Row="1" Margin="5" Background="White" BorderBrush="#bdbcbd" BorderThickness="1">
|
||||
<StackPanel>
|
||||
<Label HorizontalAlignment="Center">MSFR Test Case</Label>
|
||||
<ComboBox Name="cbMsfrTestCases" Width="350" Height="26"/>
|
||||
<WrapPanel HorizontalAlignment="Center">
|
||||
<Button x:Name="btnOK" IsDefault="True" Style="{DynamicResource ButtonStyle1}" Margin="0,20,0,0" Width="100" Height="25" VerticalAlignment="Bottom" Click="btnOK_Click">OK</Button>
|
||||
<Button x:Name="btnCancel" IsCancel="True" Style="{DynamicResource ButtonStyle1}" Margin="20,20,0,0" Width="100" Height="25" VerticalAlignment="Bottom" Click="btnCancel_Click">Cancel</Button>
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
95
Source/Program/GUI/View/MsfrTestCasesWindow.xaml.cs
Normal file
95
Source/Program/GUI/View/MsfrTestCasesWindow.xaml.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
using NLog;
|
||||
|
||||
namespace ProgramLib.GUI.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MsfrTestCasesWindow.xaml
|
||||
/// </summary>
|
||||
internal partial class MsfrTestCasesWindow : Window
|
||||
{
|
||||
private ILogger _logger;
|
||||
public GUI.Util.StandardButtons ClickedButton { get; private set; }
|
||||
|
||||
public MsfrTestCasesWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
Uri iconUri = new Uri($"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Icons/app.ico");
|
||||
this.Icon = BitmapFrame.Create(iconUri);
|
||||
|
||||
ClickedButton = Util.StandardButtons.NOT_SET;
|
||||
|
||||
WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
|
||||
}
|
||||
|
||||
private void Window_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
DragMove();
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
PopulateTestCaseComboBox();
|
||||
}
|
||||
|
||||
private void btnOK_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (cbMsfrTestCases.SelectedItem == null)
|
||||
{
|
||||
MessageBox.Show("Please select a test case", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
else
|
||||
{
|
||||
ClickedButton = Util.StandardButtons.OK_YES;
|
||||
_logger.Info($"Selected MSFR test case: {cbMsfrTestCases.SelectedValue.ToString()}");
|
||||
this.Hide();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ClickedButton = Util.StandardButtons.CANCEL_NO;
|
||||
|
||||
this.Hide();
|
||||
|
||||
}
|
||||
|
||||
private void PopulateTestCaseComboBox()
|
||||
{
|
||||
const string MSFR_TEST_CASE_SECTION_NAME = "MSFRParameterMsg";
|
||||
List<string> keys = Program.Instance().ProgramSpecificConfig.ReadAllKeys(MSFR_TEST_CASE_SECTION_NAME);
|
||||
foreach (string key in keys)
|
||||
{
|
||||
string val = Program.Instance().ProgramSpecificConfig.ReadValue(MSFR_TEST_CASE_SECTION_NAME, key);
|
||||
int index = val.IndexOf(',');
|
||||
string testCaseId = Regex.Replace(key, @"test_case_", @"", RegexOptions.IgnoreCase);
|
||||
string testCaseDescription = $"{testCaseId}. {val.Substring(0, index)}";
|
||||
cbMsfrTestCases.Items.Add(testCaseDescription);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
129
Source/Program/GUI/View/WaitWindow.xaml
Normal file
129
Source/Program/GUI/View/WaitWindow.xaml
Normal file
@@ -0,0 +1,129 @@
|
||||
<Window x:Class="ProgramLib.GUI.View.WaitWindow"
|
||||
x:ClassModifier="internal"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ProgramLib.GUI.View"
|
||||
mc:Ignorable="d"
|
||||
Title="Wait"
|
||||
WindowStyle="None"
|
||||
SizeToContent="WidthAndHeight"
|
||||
Topmost="True"
|
||||
MouseLeftButtonDown="Window_MouseLeftButtonDown"
|
||||
Height="115">
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome GlassFrameThickness="1" CornerRadius="13,13,13,13" CaptionHeight="0"/>
|
||||
</WindowChrome.WindowChrome>
|
||||
<Window.Resources>
|
||||
<FontFamily x:Key="Digital_7_Mono">pack://application:,,,/Program;component/Resources/Fonts/#Digital-7 Mono</FontFamily>
|
||||
|
||||
<!-- Style for the close button -->
|
||||
<Style x:Key="TitleBarCloseButtonStyle" TargetType="{x:Type Button}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border x:Name="bdr_main" BorderThickness="1" BorderBrush="Transparent" Background="Transparent">
|
||||
<ContentPresenter x:Name="bdr_main2" VerticalAlignment="Center" HorizontalAlignment="Center" ContentSource="Content"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="bdr_main" Property="Background" Value="#e94856"/>
|
||||
<Setter TargetName="bdr_main" Property="BorderBrush" Value="#ba1245"/>
|
||||
<Setter TargetName="bdr_main2" Property="Content">
|
||||
<Setter.Value>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/Title_Bar_Buttons/close_white.png" Width="20" Height="20" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="bdr_main" Property="Background" Value="#ff829a"/>
|
||||
<Setter TargetName="bdr_main" Property="BorderBrush" Value="#e94856"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="FocusVisual1">
|
||||
<Setter Property="Control.Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<Rectangle Margin="2" StrokeDashArray="1 2" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" SnapsToDevicePixels="true" StrokeThickness="1"/>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<SolidColorBrush x:Key="Button.Static.Background" Color="#FFDDDDDD"/>
|
||||
<SolidColorBrush x:Key="Button.Static.Border" Color="#FF707070"/>
|
||||
<SolidColorBrush x:Key="Button.MouseOver.Background" Color="#FFBEE6FD"/>
|
||||
<SolidColorBrush x:Key="Button.MouseOver.Border" Color="#FF3C7FB1"/>
|
||||
<SolidColorBrush x:Key="Button.Pressed.Background" Color="#FFC4E5F6"/>
|
||||
<SolidColorBrush x:Key="Button.Pressed.Border" Color="#FF2C628B"/>
|
||||
<SolidColorBrush x:Key="Button.Disabled.Background" Color="#E5E5E5"/>
|
||||
<SolidColorBrush x:Key="Button.Disabled.Border" Color="#DFDFDF"/>
|
||||
<SolidColorBrush x:Key="Button.Disabled.Foreground" Color="#A6A6A6"/>
|
||||
<Style x:Key="ButtonStyle1" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" TargetType="{x:Type Button}">
|
||||
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual1}"/>
|
||||
<Setter Property="Background" Value="{StaticResource Button.Static.Background}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Padding" Value="1"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Microsoft_Windows_Themes:ButtonChrome SnapsToDevicePixels="true"
|
||||
x:Name="Chrome" Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}" RenderDefaulted="{TemplateBinding IsDefaulted}"
|
||||
RenderMouseOver="{TemplateBinding IsMouseOver}" RenderPressed="{TemplateBinding IsPressed}">
|
||||
<ContentPresenter Name="contentPresenter" Margin="{TemplateBinding Padding}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</Microsoft_Windows_Themes:ButtonChrome>
|
||||
<ControlTemplate.Triggers>
|
||||
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Background" TargetName="Chrome" Value="{StaticResource Button.Disabled.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="Chrome" Value="{StaticResource Button.Disabled.Border}"/>
|
||||
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource Button.Disabled.Foreground}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
|
||||
<!-- Main Grid that contains everything -->
|
||||
<Grid Background="#f4f6fd">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30px"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Title bar which has the app icon, app title, minimize button, maximize button and close button -->
|
||||
<Grid>
|
||||
<WrapPanel HorizontalAlignment="left" VerticalAlignment="Center">
|
||||
<Image x:Name="imgAppIcon" Source="pack://application:,,,/Program;component/Resources/Images/missile.png" Width="20" Height="20" Margin="10,0,10,0"/>
|
||||
<TextBlock x:Name="txtBlockAppTitle">Wait</TextBlock>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
|
||||
<Border Grid.Row="1" Margin="5" Background="White" BorderBrush="#bdbcbd" BorderThickness="1">
|
||||
<StackPanel>
|
||||
<TextBlock x:Name="tbMessage" Margin="5,0,5,0" HorizontalAlignment="Center" FontSize="13">Message</TextBlock>
|
||||
<Border Grid.Row="1" Margin="5" Background="White" BorderBrush="Black" BorderThickness="1">
|
||||
<TextBlock x:Name="tbCountDownTimer" Margin="30,0,30,0" HorizontalAlignment="Center" FontSize="40" FontFamily="{StaticResource Digital_7_Mono}">00:00.00</TextBlock>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
90
Source/Program/GUI/View/WaitWindow.xaml.cs
Normal file
90
Source/Program/GUI/View/WaitWindow.xaml.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace ProgramLib.GUI.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for WaitWindow.xaml
|
||||
/// </summary>
|
||||
internal partial class WaitWindow : Window
|
||||
{
|
||||
private DispatcherTimer _timer;
|
||||
private int _delayMs;
|
||||
private const int _timerTickIntervalMs = 25;
|
||||
private DateTime _startDateTime;
|
||||
|
||||
public WaitWindow(string message, double delaySec)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Uri iconUri = new Uri($"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Icons/app.ico");
|
||||
this.Icon = BitmapFrame.Create(iconUri);
|
||||
|
||||
WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
|
||||
|
||||
tbMessage.Text = message;
|
||||
|
||||
_delayMs = (int)(delaySec * 1000.0);
|
||||
|
||||
_timer = new DispatcherTimer();
|
||||
_timer.Interval = TimeSpan.FromMilliseconds(_timerTickIntervalMs);
|
||||
_timer.Tick += new EventHandler(Timer_Tick);
|
||||
_timer.Start();
|
||||
|
||||
_startDateTime = DateTime.Now;
|
||||
}
|
||||
|
||||
private void Window_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
DragMove();
|
||||
}
|
||||
|
||||
protected override void OnContentRendered(EventArgs e)
|
||||
{
|
||||
base.OnContentRendered(e);
|
||||
|
||||
// Content of window may be black in case of SizeToContent is set.
|
||||
// This eliminates the problem.
|
||||
// Do not use InvalidateVisual because it may implicitly break your markup.
|
||||
InvalidateMeasure();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Show count down timer
|
||||
/// </summary>
|
||||
private void Timer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
TimeSpan ts = DateTime.Now - _startDateTime;
|
||||
int remainingMs = _delayMs - (int)ts.TotalMilliseconds;
|
||||
if (remainingMs >= 0)
|
||||
{
|
||||
TimeSpan ts2 = TimeSpan.FromMilliseconds(remainingMs);
|
||||
tbCountDownTimer.Text = String.Format(@"{0:mm\:ss\.ff}", ts2);
|
||||
}
|
||||
else
|
||||
{
|
||||
_timer.Stop();
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using ProgramLib.GUI.Model;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using ProgramLib.GUI.Model;
|
||||
|
||||
namespace ProgramLib.GUI.ViewModel
|
||||
{
|
||||
@@ -17,38 +16,39 @@ namespace ProgramLib.GUI.ViewModel
|
||||
FAIL_CHECK
|
||||
}
|
||||
|
||||
public Dictionary<Images, string> ImageToResourcePathDict
|
||||
{
|
||||
public Dictionary<Images, string> ImageToResourcePathDict
|
||||
{
|
||||
get
|
||||
{
|
||||
return _imageToResourcePathDict;
|
||||
}
|
||||
|
||||
private set { }
|
||||
private set { }
|
||||
}
|
||||
|
||||
private Dictionary<Images, string> _imageToResourcePathDict = new Dictionary<Images, string>()
|
||||
{
|
||||
{Images.PASS_CHECK, @"pack://application:,,,/Program;component/Resources/Images/green-check-mark.png" },
|
||||
{Images.FAIL_CHECK, @"pack://application:,,,/Program;component/Resources/Images/red-cross-mark.png" }
|
||||
};
|
||||
|
||||
private Dictionary<Images, string> _imageToResourcePathDict;
|
||||
#region Data Bindings
|
||||
public ObservableCollection<ImpedanceDataModel> _listviewImpedanceDatatems { get; set; }
|
||||
public ObservableCollection<ImpedanceDataModel> _listviewImpedanceDataItems { get; set; }
|
||||
|
||||
#endregion Data Bindings
|
||||
|
||||
public ImpedanceCheckWindowViewModel(Window window)
|
||||
{
|
||||
_window = window;
|
||||
_listviewImpedanceDatatems = new ObservableCollection<ImpedanceDataModel>();
|
||||
_listviewImpedanceDataItems = new ObservableCollection<ImpedanceDataModel>();
|
||||
|
||||
_imageToResourcePathDict = new Dictionary<Images, string>()
|
||||
{
|
||||
{Images.PASS_CHECK, @$"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Images/green-check-mark.png" },
|
||||
{Images.FAIL_CHECK, @$"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Images/red-cross-mark.png" }
|
||||
};
|
||||
}
|
||||
|
||||
public void AddData(ImpedanceDataModel item)
|
||||
{
|
||||
_window.Dispatcher.Invoke((Action)delegate
|
||||
{
|
||||
_listviewImpedanceDatatems.Add(item);
|
||||
_listviewImpedanceDataItems.Add(item);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace ProgramLib.GUI.ViewModel
|
||||
{
|
||||
_window.Dispatcher.Invoke((Action)delegate
|
||||
{
|
||||
_listviewImpedanceDatatems.Clear();
|
||||
_listviewImpedanceDataItems.Clear();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using ProgramLib.GUI.Model;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using ProgramLib.GUI.Model;
|
||||
|
||||
namespace ProgramLib.GUI.ViewModel
|
||||
{
|
||||
@@ -30,11 +27,7 @@ namespace ProgramLib.GUI.ViewModel
|
||||
private set { }
|
||||
}
|
||||
|
||||
private Dictionary<Images, string> _imageToResourcePathDict = new Dictionary<Images, string>()
|
||||
{
|
||||
{Images.LED_ON, @"pack://application:,,,/ProgramGui;component/Resources/Images/green-led.png" },
|
||||
{Images.LED_OFF, @"pack://application:,,,/ProgramGui;component/Resources/Images/black-led.png" }
|
||||
};
|
||||
private Dictionary<Images, string> _imageToResourcePathDict;
|
||||
|
||||
#region Data Bindings
|
||||
public ObservableCollection<PowerModuleDataModel> _dataGridPowerDatatems { get; set; }
|
||||
@@ -50,24 +43,48 @@ namespace ProgramLib.GUI.ViewModel
|
||||
[ObservableProperty]
|
||||
private string tePowerLedImagePath;
|
||||
|
||||
[ObservableProperty]
|
||||
private string w1CableImagePath;
|
||||
|
||||
[ObservableProperty]
|
||||
private string w2CableImagePath;
|
||||
|
||||
[ObservableProperty]
|
||||
private string w3CableImagePath;
|
||||
|
||||
[ObservableProperty]
|
||||
private string w4CableImagePath;
|
||||
|
||||
[ObservableProperty]
|
||||
private string w5CableImagePath;
|
||||
|
||||
[ObservableProperty]
|
||||
private string labelGradientAppControlledOrUnControlled;
|
||||
|
||||
[ObservableProperty]
|
||||
private string testTimeStr;
|
||||
|
||||
[ObservableProperty]
|
||||
private string powerOnTimeStr;
|
||||
|
||||
#endregion Data Bindings
|
||||
|
||||
public LiveDataWindowViewModel(Window window)
|
||||
{
|
||||
public LiveDataWindowViewModel(Window window)
|
||||
{
|
||||
_window = window;
|
||||
_dataGridPowerDatatems = new ObservableCollection<PowerModuleDataModel>();
|
||||
_dataGridPassthroughDatatems = new ObservableCollection<ObservableCollection<string>>();
|
||||
|
||||
UutPowerLedImagePath = _imageToResourcePathDict[Images.LED_OFF];
|
||||
TePowerLedImagePath = _imageToResourcePathDict[Images.LED_ON];
|
||||
_imageToResourcePathDict = new Dictionary<Images, string>()
|
||||
{
|
||||
{Images.LED_ON, @$"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Images/green-led.png" },
|
||||
{Images.LED_OFF, @$"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Images/black-led.png" }
|
||||
};
|
||||
}
|
||||
|
||||
public void AddPowerData(Dictionary<string, PowerModuleDataModel> powerModuleToPowerDataModelDict)
|
||||
public void AddPowerData(PowerModuleDataModel powerData)
|
||||
{
|
||||
foreach (var item in powerModuleToPowerDataModelDict)
|
||||
{
|
||||
_dataGridPowerDatatems.Add(item.Value);
|
||||
}
|
||||
_dataGridPowerDatatems.Add(powerData);
|
||||
}
|
||||
|
||||
public void AddPassthroughData(Dictionary<int, ObservableCollection<string>> rowNumberToPassthroughDataDict)
|
||||
|
||||
41
Source/Program/GUI/ViewModel/ManualWindowViewModel.cs
Normal file
41
Source/Program/GUI/ViewModel/ManualWindowViewModel.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading;
|
||||
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using ProgramLib.GUI.Model;
|
||||
|
||||
namespace ProgramGui.GUI.ViewModel
|
||||
{
|
||||
internal partial class ManualWindowViewModel : ObservableObject
|
||||
{
|
||||
public enum Images
|
||||
{
|
||||
LED_ON,
|
||||
LED_OFF
|
||||
}
|
||||
|
||||
public Dictionary<Images, string> _imageToResourcePathDict;
|
||||
|
||||
public ObservableCollection<CoeMessageDataModel> _coeMessageDataItems { get; set; }
|
||||
|
||||
public ObservableCollection<PowerModuleDataModel> _poweredModuleDataItems { get; set; }
|
||||
|
||||
public ObservableCollection<PowerModuleDataModel> _powerModuleComboBoxDataItems { get; set; }
|
||||
|
||||
private Semaphore _poweredModuleDataItemsSemObj = new Semaphore(initialCount: 1, maximumCount: 1);
|
||||
|
||||
public ManualWindowViewModel()
|
||||
{
|
||||
_coeMessageDataItems = new ObservableCollection<CoeMessageDataModel>();
|
||||
|
||||
_imageToResourcePathDict = new Dictionary<Images, string>()
|
||||
{
|
||||
{Images.LED_ON, @$"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Images/green-led.png" },
|
||||
{Images.LED_OFF, @$"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Images/black-led.png" }
|
||||
};
|
||||
}
|
||||
|
||||
public Semaphore GetPoweredModuleDataItemsSem() { return _poweredModuleDataItemsSemObj; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user