Big changes
This commit is contained in:
13
Source/Program/GUI/Model/ImpedanceDataModel.cs
Normal file
13
Source/Program/GUI/Model/ImpedanceDataModel.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace ProgramLib.GUI.Model
|
||||
{
|
||||
internal partial class ImpedanceDataModel : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
private string passFailImagePath;
|
||||
|
||||
[ObservableProperty]
|
||||
private string description;
|
||||
}
|
||||
}
|
||||
76
Source/Program/GUI/Model/PassthroughData.Types.cs
Normal file
76
Source/Program/GUI/Model/PassthroughData.Types.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProgramLib.GUI.Model
|
||||
{
|
||||
internal partial class PassthroughData
|
||||
{
|
||||
private struct VariableInfo
|
||||
{
|
||||
// index into where the item is located in the dictionary
|
||||
public int passthroughDataModelDictIndex { get; set; }
|
||||
// index into where the item is located in the data model
|
||||
// the data model contains more than one item
|
||||
public int passthroughDataModelItemIndex { get; set; }
|
||||
}
|
||||
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,
|
||||
};
|
||||
|
||||
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" },
|
||||
};
|
||||
}
|
||||
}
|
||||
63
Source/Program/GUI/Model/PassthroughData.cs
Normal file
63
Source/Program/GUI/Model/PassthroughData.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
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
|
||||
{
|
||||
internal partial class PassthroughData
|
||||
{
|
||||
private int _datagridColumnCount = 0;
|
||||
// this dictionary stores variable and the info needed to locate it in the passthroughdatamodel dictionary which contains a 2-d array
|
||||
private Dictionary<Variables, VariableInfo> _variableEnumToVariableInfoDict = new Dictionary<Variables, VariableInfo>();
|
||||
|
||||
// this dictionary stores variable and its corresponding data model
|
||||
private Dictionary<int, ObservableCollection<string>> _rowNumberToPassthroughDataDict = new Dictionary<int, ObservableCollection<string>>();
|
||||
|
||||
public PassthroughData(int datagridColumnCount)
|
||||
{
|
||||
_datagridColumnCount = datagridColumnCount;
|
||||
VariableInfo variableInfo = new VariableInfo();
|
||||
|
||||
int dictIndex = 0;
|
||||
int colIndex = 0;
|
||||
// contruct a 2-d array of strings based on the list of Variables
|
||||
foreach (Variables enumVar in Enum.GetValues(typeof(Variables)))
|
||||
{
|
||||
if (_rowNumberToPassthroughDataDict.Count == 0 || colIndex == _datagridColumnCount)
|
||||
{
|
||||
dictIndex++;
|
||||
_rowNumberToPassthroughDataDict[dictIndex] = new ObservableCollection<string>(new string[_datagridColumnCount]);
|
||||
colIndex = 0;
|
||||
}
|
||||
|
||||
// name of the variable
|
||||
_rowNumberToPassthroughDataDict[dictIndex][colIndex] = String.Empty;
|
||||
variableInfo.passthroughDataModelItemIndex = colIndex++;
|
||||
|
||||
// value of the variable
|
||||
_rowNumberToPassthroughDataDict[dictIndex][colIndex++] = String.Empty;
|
||||
|
||||
// save the row index so we can refer to this item
|
||||
variableInfo.passthroughDataModelDictIndex = dictIndex;
|
||||
|
||||
// save the column index of this item so we can refer to this item
|
||||
_variableEnumToVariableInfoDict[enumVar] = variableInfo;
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<int, ObservableCollection<string>> GetPassthroughDataModelDict()
|
||||
{
|
||||
return _rowNumberToPassthroughDataDict;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
14
Source/Program/GUI/Model/PowerModuleDataModel.cs
Normal file
14
Source/Program/GUI/Model/PowerModuleDataModel.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace ProgramLib.GUI.Model
|
||||
{
|
||||
internal partial class PowerModuleDataModel : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
private string expectedVoltage;
|
||||
[ObservableProperty]
|
||||
private string actualVoltage;
|
||||
[ObservableProperty]
|
||||
private string actualCurrent;
|
||||
}
|
||||
}
|
||||
112
Source/Program/GUI/ProgramGuiManager.cs
Normal file
112
Source/Program/GUI/ProgramGuiManager.cs
Normal file
@@ -0,0 +1,112 @@
|
||||
using NLog;
|
||||
using ProgramLib.GUI.View;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace ProgramLib
|
||||
{
|
||||
internal class ProgramGuiManager : IDisposable
|
||||
{
|
||||
#region Private Members
|
||||
private Thread _guiManagerThread;
|
||||
private static NLog.ILogger _logger;
|
||||
private Dictionary<WINDOWS, Window> _windowDict = new Dictionary<WINDOWS, Window>();
|
||||
private ManualResetEvent _allGuiInitializedEvent = new ManualResetEvent(false);
|
||||
private bool _isDisposed = false;
|
||||
#endregion
|
||||
|
||||
#region Public Members
|
||||
public enum WINDOWS
|
||||
{
|
||||
LIVE_DATA,
|
||||
IMPEDANCE_CHECK
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
public ProgramGuiManager()
|
||||
{
|
||||
_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]; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialize all the GUIs
|
||||
/// </summary>
|
||||
public void Initialize()
|
||||
{
|
||||
_guiManagerThread = new Thread(new ThreadStart(GuiManagerThread));
|
||||
_guiManagerThread.SetApartmentState(ApartmentState.STA);
|
||||
_guiManagerThread.Start();
|
||||
|
||||
_allGuiInitializedEvent.WaitOne();
|
||||
}
|
||||
|
||||
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.IMPEDANCE_CHECK] = new ImpedanceCheckWindow();
|
||||
|
||||
_allGuiInitializedEvent.Set();
|
||||
|
||||
// Enter the event queue
|
||||
Dispatcher.Run();
|
||||
|
||||
_logger?.Debug($"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() is exiting...");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose of this object.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
_logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() ...");
|
||||
|
||||
try
|
||||
{
|
||||
if (!_isDisposed)
|
||||
{
|
||||
_logger?.Debug($"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() disposing");
|
||||
|
||||
_windowDict?.First().Value.Dispatcher.Invoke((Action)delegate
|
||||
{
|
||||
// shut down all windows
|
||||
foreach (var entry in _windowDict)
|
||||
{
|
||||
entry.Value.Close();
|
||||
}
|
||||
// kill the GuiManagerthread
|
||||
Dispatcher.CurrentDispatcher.InvokeShutdown();
|
||||
});
|
||||
|
||||
_isDisposed = true;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
84
Source/Program/GUI/View/ImpedanceCheckWindow.xaml
Normal file
84
Source/Program/GUI/View/ImpedanceCheckWindow.xaml
Normal file
@@ -0,0 +1,84 @@
|
||||
<Window x:Class="ProgramLib.GUI.View.ImpedanceCheckWindow"
|
||||
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="Impedance Check"
|
||||
WindowStyle="None"
|
||||
MouseLeftButtonDown="Window_MouseLeftButtonDown"
|
||||
Height="300"
|
||||
Width="400">
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome GlassFrameThickness="0" CornerRadius="0" 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>
|
||||
</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">Impedance Check</TextBlock>
|
||||
</WrapPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Row="0">
|
||||
<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.ItemContainerStyle>
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="Focusable" Value="false"/>
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image Source="{Binding PassFailImagePath}" Width="15" Height="15" />
|
||||
<TextBlock Text="{Binding Description}" Margin="5,0,0,0"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
59
Source/Program/GUI/View/ImpedanceCheckWindow.xaml.cs
Normal file
59
Source/Program/GUI/View/ImpedanceCheckWindow.xaml.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using ProgramLib.GUI.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace ProgramLib.GUI.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ImpedanceCheckWindow.xaml
|
||||
/// </summary>
|
||||
internal partial class ImpedanceCheckWindow : Window
|
||||
{
|
||||
internal ImpedanceCheckWindowViewModel ViewModel { get; set; }
|
||||
|
||||
public ImpedanceCheckWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Uri iconUri = new Uri("pack://application:,,,/Program;component/Resources/Icons/app.ico");
|
||||
this.Icon = BitmapFrame.Create(iconUri);
|
||||
|
||||
WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
|
||||
|
||||
btnClose.Visibility = Visibility.Hidden;
|
||||
|
||||
((INotifyCollectionChanged)lvImpedanceCheck.Items).CollectionChanged += ListView_CollectionChanged;
|
||||
|
||||
ViewModel = new ImpedanceCheckWindowViewModel(this);
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
|
||||
protected override void OnContentRendered(EventArgs e)
|
||||
{
|
||||
base.OnContentRendered(e);
|
||||
|
||||
// call the delegate to perform STTO
|
||||
}
|
||||
|
||||
private void Window_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
DragMove();
|
||||
}
|
||||
|
||||
private void btnClose_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
}
|
||||
|
||||
private void ListView_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if (e.Action == NotifyCollectionChangedAction.Add)
|
||||
{
|
||||
// scroll the new item into view
|
||||
lvImpedanceCheck.ScrollIntoView(e.NewItems[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
772
Source/Program/GUI/View/LiveDataWindow.xaml
Normal file
772
Source/Program/GUI/View/LiveDataWindow.xaml
Normal file
@@ -0,0 +1,772 @@
|
||||
<Window x:Class="ProgramLib.GUI.View.LiveDataWindow"
|
||||
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="Missile Test Set"
|
||||
WindowStyle="None"
|
||||
ResizeMode="CanResizeWithGrip"
|
||||
MouseLeftButtonDown="Window_MouseLeftButtonDown"
|
||||
Height="650"
|
||||
Width="1000">
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome GlassFrameThickness="0" CornerRadius="0" 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>
|
||||
|
||||
<!-- 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 -->
|
||||
<BitmapImage x:Key="DesignSourceBlackLed" UriSource="pack://application:,,,/Program;component/Resources/Images/black-led.png"/>
|
||||
|
||||
<!-- Style for the Menu control -->
|
||||
<!-- There are multiple styles for the Menu control which are generated from built-in Menu style templte -->
|
||||
<!-- Only thing that was changed in the Menu template is the line below, to change the color of "Menu.Static.Background"-->
|
||||
<SolidColorBrush x:Key="Menu.Static.Background" Color="#f4f6fd"/>
|
||||
<SolidColorBrush x:Key="Menu.Static.Border" Color="#FF999999"/>
|
||||
<SolidColorBrush x:Key="Menu.Static.Foreground" Color="#FF212121"/>
|
||||
<SolidColorBrush x:Key="Menu.Static.Separator" Color="#FFD7D7D7"/>
|
||||
<SolidColorBrush x:Key="Menu.Disabled.Foreground" Color="#FF707070"/>
|
||||
<SolidColorBrush x:Key="MenuItem.Selected.Background" Color="#3D26A0DA"/>
|
||||
<SolidColorBrush x:Key="MenuItem.Selected.Border" Color="#FF26A0DA"/>
|
||||
<SolidColorBrush x:Key="MenuItem.Highlight.Background" Color="#3D26A0DA"/>
|
||||
<SolidColorBrush x:Key="MenuItem.Highlight.Border" Color="#FF26A0DA"/>
|
||||
<SolidColorBrush x:Key="MenuItem.Highlight.Disabled.Background" Color="#0A000000"/>
|
||||
<SolidColorBrush x:Key="MenuItem.Highlight.Disabled.Border" Color="#21000000"/>
|
||||
<MenuScrollingVisibilityConverter x:Key="MenuScrollingVisibilityConverter"/>
|
||||
<Geometry x:Key="DownArrow">M 0,0 L 3.5,4 L 7,0 Z</Geometry>
|
||||
<Geometry x:Key="UpArrow">M 0,4 L 3.5,0 L 7,4 Z</Geometry>
|
||||
<Geometry x:Key="RightArrow">M 0,0 L 4,3.5 L 0,7 Z</Geometry>
|
||||
<Geometry x:Key="Checkmark">F1 M 10.0,1.2 L 4.7,9.1 L 4.5,9.1 L 0,5.2 L 1.3,3.5 L 4.3,6.1L 8.3,0 L 10.0,1.2 Z</Geometry>
|
||||
<!-- Built-in style for the Menu control continued... -->
|
||||
<Style x:Key="MenuScrollButton" BasedOn="{x:Null}" TargetType="{x:Type RepeatButton}">
|
||||
<Setter Property="ClickMode" Value="Hover"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type RepeatButton}">
|
||||
<Border x:Name="templateRoot" Background="Transparent" BorderBrush="Transparent" BorderThickness="1" SnapsToDevicePixels="true">
|
||||
<ContentPresenter HorizontalAlignment="Center" Margin="6" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<!-- Built-in style for the Menu control continued... -->
|
||||
<Style x:Key="{ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}" BasedOn="{x:Null}" TargetType="{x:Type ScrollViewer}">
|
||||
<Setter Property="HorizontalScrollBarVisibility" Value="Hidden"/>
|
||||
<Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ScrollViewer}">
|
||||
<Grid SnapsToDevicePixels="true">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Grid.Column="0" Grid.Row="1">
|
||||
<ScrollContentPresenter CanContentScroll="{TemplateBinding CanContentScroll}" Margin="{TemplateBinding Padding}"/>
|
||||
</Border>
|
||||
<RepeatButton Command="{x:Static ScrollBar.LineUpCommand}" CommandTarget="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}}" Grid.Column="0" Focusable="false" Grid.Row="0" Style="{StaticResource MenuScrollButton}">
|
||||
<RepeatButton.Visibility>
|
||||
<MultiBinding ConverterParameter="0" Converter="{StaticResource MenuScrollingVisibilityConverter}" FallbackValue="Visibility.Collapsed">
|
||||
<Binding Path="ComputedVerticalScrollBarVisibility" RelativeSource="{RelativeSource Mode=TemplatedParent}"/>
|
||||
<Binding Path="VerticalOffset" RelativeSource="{RelativeSource Mode=TemplatedParent}"/>
|
||||
<Binding Path="ExtentHeight" RelativeSource="{RelativeSource Mode=TemplatedParent}"/>
|
||||
<Binding Path="ViewportHeight" RelativeSource="{RelativeSource Mode=TemplatedParent}"/>
|
||||
</MultiBinding>
|
||||
</RepeatButton.Visibility>
|
||||
<Path Data="{StaticResource UpArrow}" Fill="{StaticResource Menu.Static.Foreground}"/>
|
||||
</RepeatButton>
|
||||
<RepeatButton Command="{x:Static ScrollBar.LineDownCommand}" CommandTarget="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}}" Grid.Column="0" Focusable="false" Grid.Row="2" Style="{StaticResource MenuScrollButton}">
|
||||
<RepeatButton.Visibility>
|
||||
<MultiBinding ConverterParameter="100" Converter="{StaticResource MenuScrollingVisibilityConverter}" FallbackValue="Visibility.Collapsed">
|
||||
<Binding Path="ComputedVerticalScrollBarVisibility" RelativeSource="{RelativeSource Mode=TemplatedParent}"/>
|
||||
<Binding Path="VerticalOffset" RelativeSource="{RelativeSource Mode=TemplatedParent}"/>
|
||||
<Binding Path="ExtentHeight" RelativeSource="{RelativeSource Mode=TemplatedParent}"/>
|
||||
<Binding Path="ViewportHeight" RelativeSource="{RelativeSource Mode=TemplatedParent}"/>
|
||||
</MultiBinding>
|
||||
</RepeatButton.Visibility>
|
||||
<Path Data="{StaticResource DownArrow}" Fill="{StaticResource Menu.Static.Foreground}"/>
|
||||
</RepeatButton>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<!-- Built-in ControlTemplate for the Menu control continued... -->
|
||||
<ControlTemplate x:Key="{ComponentResourceKey ResourceId=TopLevelItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
|
||||
<Border x:Name="templateRoot" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true">
|
||||
<Grid VerticalAlignment="Center">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentPresenter x:Name="Icon" ContentSource="Icon" HorizontalAlignment="Center" Height="16" Margin="3" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" Width="16"/>
|
||||
<Path x:Name="GlyphPanel" Data="{StaticResource Checkmark}" FlowDirection="LeftToRight" Fill="{StaticResource Menu.Static.Foreground}" Margin="3" VerticalAlignment="Center" Visibility="Collapsed"/>
|
||||
<ContentPresenter ContentSource="Header" Grid.Column="1" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="Icon" Value="{x:Null}">
|
||||
<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsChecked" Value="true">
|
||||
<Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible"/>
|
||||
<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsHighlighted" Value="True">
|
||||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource MenuItem.Highlight.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource MenuItem.Highlight.Border}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="TextElement.Foreground" TargetName="templateRoot" Value="{StaticResource Menu.Disabled.Foreground}"/>
|
||||
<Setter Property="Fill" TargetName="GlyphPanel" Value="{StaticResource Menu.Disabled.Foreground}"/>
|
||||
</Trigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsHighlighted" Value="True"/>
|
||||
<Condition Property="IsEnabled" Value="False"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource MenuItem.Highlight.Disabled.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource MenuItem.Highlight.Disabled.Border}"/>
|
||||
</MultiTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
<!-- Built-in ControlTemplate for the Menu control continued... -->
|
||||
<ControlTemplate x:Key="{ComponentResourceKey ResourceId=TopLevelHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
|
||||
<Border x:Name="templateRoot" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true">
|
||||
<Grid VerticalAlignment="Center">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentPresenter x:Name="Icon" ContentSource="Icon" HorizontalAlignment="Center" Height="16" Margin="3" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" Width="16"/>
|
||||
<Path x:Name="GlyphPanel" Data="{StaticResource Checkmark}" FlowDirection="LeftToRight" Fill="{TemplateBinding Foreground}" Margin="3" VerticalAlignment="Center" Visibility="Collapsed"/>
|
||||
<ContentPresenter ContentSource="Header" Grid.Column="1" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
<Popup x:Name="PART_Popup" AllowsTransparency="true" Focusable="false" IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource Mode=TemplatedParent}}" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" PlacementTarget="{Binding ElementName=templateRoot}">
|
||||
<Border x:Name="SubMenuBorder" Background="{StaticResource Menu.Static.Background}" BorderBrush="{StaticResource Menu.Static.Border}" BorderThickness="1" Padding="2">
|
||||
<ScrollViewer x:Name="SubMenuScrollViewer" Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}">
|
||||
<Grid RenderOptions.ClearTypeHint="Enabled">
|
||||
<Canvas HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
|
||||
<Rectangle x:Name="OpaqueRect" Fill="{Binding Background, ElementName=SubMenuBorder}" Height="{Binding ActualHeight, ElementName=SubMenuBorder}" Width="{Binding ActualWidth, ElementName=SubMenuBorder}"/>
|
||||
</Canvas>
|
||||
<Rectangle Fill="{StaticResource Menu.Static.Separator}" HorizontalAlignment="Left" Margin="29,2,0,2" Width="1"/>
|
||||
<ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Cycle" Grid.IsSharedSizeScope="true" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.TabNavigation="Cycle"/>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Popup>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsSuspendingPopupAnimation" Value="true">
|
||||
<Setter Property="PopupAnimation" TargetName="PART_Popup" Value="None"/>
|
||||
</Trigger>
|
||||
<Trigger Property="Icon" Value="{x:Null}">
|
||||
<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsChecked" Value="true">
|
||||
<Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible"/>
|
||||
<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsHighlighted" Value="True">
|
||||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource MenuItem.Highlight.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource MenuItem.Highlight.Border}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="TextElement.Foreground" TargetName="templateRoot" Value="{StaticResource Menu.Disabled.Foreground}"/>
|
||||
<Setter Property="Fill" TargetName="GlyphPanel" Value="{StaticResource Menu.Disabled.Foreground}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="ScrollViewer.CanContentScroll" SourceName="SubMenuScrollViewer" Value="false">
|
||||
<Setter Property="Canvas.Top" TargetName="OpaqueRect" Value="{Binding VerticalOffset, ElementName=SubMenuScrollViewer}"/>
|
||||
<Setter Property="Canvas.Left" TargetName="OpaqueRect" Value="{Binding HorizontalOffset, ElementName=SubMenuScrollViewer}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
<!-- Built-in ControlTemplate for the Menu control continued... -->
|
||||
<ControlTemplate x:Key="{ComponentResourceKey ResourceId=SubmenuItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
|
||||
<Border x:Name="templateRoot" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Height="22" SnapsToDevicePixels="true">
|
||||
<Grid Margin="-1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition MinWidth="22" SharedSizeGroup="MenuItemIconColumnGroup" Width="Auto"/>
|
||||
<ColumnDefinition Width="13"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="30"/>
|
||||
<ColumnDefinition SharedSizeGroup="MenuItemIGTColumnGroup" Width="Auto"/>
|
||||
<ColumnDefinition Width="20"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentPresenter x:Name="Icon" ContentSource="Icon" HorizontalAlignment="Center" Height="16" Margin="3" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" Width="16"/>
|
||||
<Border x:Name="GlyphPanel" Background="{StaticResource MenuItem.Selected.Background}" BorderBrush="{StaticResource MenuItem.Selected.Border}" BorderThickness="1" ClipToBounds="False" HorizontalAlignment="Center" Height="22" Margin="-1,0,0,0" VerticalAlignment="Center" Visibility="Hidden" Width="22">
|
||||
<Path x:Name="Glyph" Data="{StaticResource Checkmark}" FlowDirection="LeftToRight" Fill="{StaticResource Menu.Static.Foreground}" Height="11" Width="10"/>
|
||||
</Border>
|
||||
<ContentPresenter x:Name="menuHeaderContainer" ContentSource="Header" Grid.Column="2" HorizontalAlignment="Left" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>
|
||||
<TextBlock x:Name="menuGestureText" Grid.Column="4" Margin="{TemplateBinding Padding}" Opacity="0.7" Text="{TemplateBinding InputGestureText}" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="Icon" Value="{x:Null}">
|
||||
<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible"/>
|
||||
<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsHighlighted" Value="True">
|
||||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource MenuItem.Highlight.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource MenuItem.Highlight.Border}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="TextElement.Foreground" TargetName="templateRoot" Value="{StaticResource Menu.Disabled.Foreground}"/>
|
||||
<Setter Property="Fill" TargetName="Glyph" Value="{StaticResource Menu.Disabled.Foreground}"/>
|
||||
</Trigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsHighlighted" Value="True"/>
|
||||
<Condition Property="IsEnabled" Value="False"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource MenuItem.Highlight.Disabled.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource MenuItem.Highlight.Disabled.Border}"/>
|
||||
</MultiTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
<!-- Built-in ControlTemplate for the Menu control continued... -->
|
||||
<ControlTemplate x:Key="{ComponentResourceKey ResourceId=SubmenuHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
|
||||
<Border x:Name="templateRoot" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Height="22" SnapsToDevicePixels="true">
|
||||
<Grid Margin="-1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition MinWidth="22" SharedSizeGroup="MenuItemIconColumnGroup" Width="Auto"/>
|
||||
<ColumnDefinition Width="13"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="30"/>
|
||||
<ColumnDefinition SharedSizeGroup="MenuItemIGTColumnGroup" Width="Auto"/>
|
||||
<ColumnDefinition Width="20"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentPresenter x:Name="Icon" ContentSource="Icon" HorizontalAlignment="Center" Height="16" Margin="3" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" Width="16"/>
|
||||
<Border x:Name="GlyphPanel" Background="{StaticResource MenuItem.Highlight.Background}" BorderBrush="{StaticResource MenuItem.Highlight.Border}" BorderThickness="1" Height="22" Margin="-1,0,0,0" VerticalAlignment="Center" Visibility="Hidden" Width="22">
|
||||
<Path x:Name="Glyph" Data="{DynamicResource Checkmark}" FlowDirection="LeftToRight" Fill="{StaticResource Menu.Static.Foreground}" Height="11" Width="9"/>
|
||||
</Border>
|
||||
<ContentPresenter ContentSource="Header" Grid.Column="2" HorizontalAlignment="Left" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>
|
||||
<TextBlock Grid.Column="4" Margin="{TemplateBinding Padding}" Opacity="0.7" Text="{TemplateBinding InputGestureText}" VerticalAlignment="Center"/>
|
||||
<Path x:Name="RightArrow" Grid.Column="5" Data="{StaticResource RightArrow}" Fill="{StaticResource Menu.Static.Foreground}" HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Center"/>
|
||||
<Popup x:Name="PART_Popup" AllowsTransparency="true" Focusable="false" HorizontalOffset="-2" IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource Mode=TemplatedParent}}" Placement="Right" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" VerticalOffset="-3">
|
||||
<Border x:Name="SubMenuBorder" Background="{StaticResource Menu.Static.Background}" BorderBrush="{StaticResource Menu.Static.Border}" BorderThickness="1" Padding="2">
|
||||
<ScrollViewer x:Name="SubMenuScrollViewer" Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}">
|
||||
<Grid RenderOptions.ClearTypeHint="Enabled">
|
||||
<Canvas HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
|
||||
<Rectangle x:Name="OpaqueRect" Fill="{Binding Background, ElementName=SubMenuBorder}" Height="{Binding ActualHeight, ElementName=SubMenuBorder}" Width="{Binding ActualWidth, ElementName=SubMenuBorder}"/>
|
||||
</Canvas>
|
||||
<Rectangle Fill="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" HorizontalAlignment="Left" Margin="29,2,0,2" Width="1"/>
|
||||
<ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Cycle" Grid.IsSharedSizeScope="true" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.TabNavigation="Cycle"/>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Popup>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsSuspendingPopupAnimation" Value="true">
|
||||
<Setter Property="PopupAnimation" TargetName="PART_Popup" Value="None"/>
|
||||
</Trigger>
|
||||
<Trigger Property="Icon" Value="{x:Null}">
|
||||
<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible"/>
|
||||
<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsHighlighted" Value="True">
|
||||
<Setter Property="Background" TargetName="templateRoot" Value="Transparent"/>
|
||||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource MenuItem.Highlight.Border}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="TextElement.Foreground" TargetName="templateRoot" Value="{StaticResource Menu.Disabled.Foreground}"/>
|
||||
<Setter Property="Fill" TargetName="Glyph" Value="{StaticResource Menu.Disabled.Foreground}"/>
|
||||
<Setter Property="Fill" TargetName="RightArrow" Value="{StaticResource Menu.Disabled.Foreground}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="ScrollViewer.CanContentScroll" SourceName="SubMenuScrollViewer" Value="false">
|
||||
<Setter Property="Canvas.Top" TargetName="OpaqueRect" Value="{Binding VerticalOffset, ElementName=SubMenuScrollViewer}"/>
|
||||
<Setter Property="Canvas.Left" TargetName="OpaqueRect" Value="{Binding HorizontalOffset, ElementName=SubMenuScrollViewer}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
<!-- Built-in style for the Menu control continued... -->
|
||||
<Style x:Key="MenuItemStyle" TargetType="{x:Type MenuItem}">
|
||||
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="ScrollViewer.PanningMode" Value="Both"/>
|
||||
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
|
||||
<Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=SubmenuItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="Role" Value="TopLevelHeader">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource Menu.Static.Foreground}"/>
|
||||
<Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=TopLevelHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
|
||||
<Setter Property="Padding" Value="6,0"/>
|
||||
</Trigger>
|
||||
<Trigger Property="Role" Value="TopLevelItem">
|
||||
<Setter Property="Background" Value="{StaticResource Menu.Static.Background}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource Menu.Static.Border}"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource Menu.Static.Foreground}"/>
|
||||
<Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=TopLevelItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
|
||||
<Setter Property="Padding" Value="6,0"/>
|
||||
</Trigger>
|
||||
<Trigger Property="Role" Value="SubmenuHeader">
|
||||
<Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=SubmenuHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</Window.Resources>
|
||||
|
||||
<!-- Main Grid that contains everything -->
|
||||
<Grid Background="#f4f6fd">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30px"/>
|
||||
<RowDefinition Height="30px"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="28px"/>
|
||||
</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>
|
||||
</WrapPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Row="0">
|
||||
<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 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>
|
||||
|
||||
<!-- Menu bar -->
|
||||
<DockPanel Grid.Row="1" HorizontalAlignment="left" VerticalAlignment="Center">
|
||||
<Menu DockPanel.Dock="Top" Background="#f4f6fd">
|
||||
<MenuItem Style="{DynamicResource MenuItemStyle}" Header="Help" Background="Transparent">
|
||||
<MenuItem Header="Data Location"/>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
</DockPanel>
|
||||
|
||||
<!-- Body -->
|
||||
<Grid Grid.Row="2" Background="#f0f0f0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="6*" />
|
||||
<ColumnDefinition Width="10" />
|
||||
<ColumnDefinition Width="4*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="4.1*" />
|
||||
<RowDefinition Height="5.9*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 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>
|
||||
|
||||
<Grid Grid.Row="1" Grid.Column="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22" />
|
||||
<RowDefinition Height="20" />
|
||||
<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"/>
|
||||
|
||||
<!-- 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.Resources>
|
||||
<Style x:Key="CellStyle" TargetType="DataGridCell">
|
||||
<Setter Property="TextBlock.TextAlignment" 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>
|
||||
</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="actualCurrent" Width="2*" Binding="{Binding ActualCurrent}"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="2" Grid.ColumnSpan="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="4*" />
|
||||
<ColumnDefinition Width="6*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="25" />
|
||||
<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>
|
||||
|
||||
<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">
|
||||
<StackPanel Margin="0,0,35,0">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="IDA" 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,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"/>
|
||||
</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"/>
|
||||
<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="80" Content="VIP I2C Board" 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="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"/>
|
||||
</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"/>
|
||||
<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="80" Content="MCC Board" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<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"/>
|
||||
</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"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<!-- Contains indicators -->
|
||||
<Grid Grid.Column="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="4*" />
|
||||
<ColumnDefinition Width="6*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="25" />
|
||||
<RowDefinition Height="5*" />
|
||||
<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>
|
||||
|
||||
<Border Grid.Row="1" BorderThickness="1,0,0,1" BorderBrush="#bdbcbd" Margin="0,0,0,5">
|
||||
<StackPanel Margin="5,0,0,0">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,5,0,10">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="100" Content="TE Power" HorizontalAlignment="Left" VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Image Source="{Binding TePowerLedImagePath, FallbackValue={StaticResource DesignSourceBlackLed}}" Width="15" Height="15"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,10">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="100" Content="UUT Power" HorizontalAlignment="Left" VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Image Source="{Binding UutPowerLedImagePath, FallbackValue={StaticResource DesignSourceBlackLed}}" Width="15" Height="15"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,10">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="100" Content="Indicator 2" HorizontalAlignment="Left" VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="100" Content="Indicator 3" HorizontalAlignment="Left" VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
|
||||
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<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"/>
|
||||
</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"/>
|
||||
</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"/>
|
||||
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="100" Content="---" 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 5" 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"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Grid Grid.Row="2" Grid.ColumnSpan="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="4*" />
|
||||
<ColumnDefinition Width="6*" />
|
||||
</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>
|
||||
|
||||
<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"/>
|
||||
</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>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<!-- Contains headers and datagrid for the passthrough data -->
|
||||
<Grid Grid.Row="1" Grid.ColumnSpan="3">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="25" />
|
||||
<RowDefinition Height="25" />
|
||||
<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.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"/>
|
||||
<Label Grid.Row="1" Grid.Column="3" 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="4" 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="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.Resources>
|
||||
<Style x:Key="CellStyle" TargetType="DataGridCell">
|
||||
<Setter Property="TextBlock.TextAlignment" 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>
|
||||
</DataGrid.Resources>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn CellStyle="{StaticResource CellStyle}" Header="item1Name" Width="1*" Binding="{Binding [0]}"/>
|
||||
<DataGridTextColumn CellStyle="{StaticResource CellStyle}" Header="item1Value" Width="1*" Binding="{Binding [1]}"/>
|
||||
<DataGridTextColumn CellStyle="{StaticResource CellStyle}" Header="item2Name" Width="1*" Binding="{Binding [2]}"/>
|
||||
<DataGridTextColumn CellStyle="{StaticResource CellStyle}" Header="item2Value" Width="1*" Binding="{Binding [3]}"/>
|
||||
<DataGridTextColumn CellStyle="{StaticResource CellStyle}" Header="item3Name" Width="1*" Binding="{Binding [4]}"/>
|
||||
<DataGridTextColumn CellStyle="{StaticResource CellStyle}" Header="item3Value" Width="1*" Binding="{Binding [5]}"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<StatusBar Grid.Row="3" BorderThickness="0,1,0,0" BorderBrush="#bdbcbd">
|
||||
<StatusBarItem FontSize="16">Placeholder</StatusBarItem>
|
||||
<StatusBarItem>
|
||||
<TextBlock FontSize="16">Placeholder</TextBlock>
|
||||
</StatusBarItem>
|
||||
</StatusBar>
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
</Window>
|
||||
57
Source/Program/GUI/View/LiveDataWindow.xaml.cs
Normal file
57
Source/Program/GUI/View/LiveDataWindow.xaml.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using ProgramLib.GUI.ViewModel;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace ProgramLib.GUI.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
internal partial class LiveDataWindow : Window
|
||||
{
|
||||
internal LiveDataWindowViewModel LiveDataWindowViewModel { get; set; }
|
||||
|
||||
public LiveDataWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Uri iconUri = new Uri("pack://application:,,,/Program;component/Resources/Icons/app.ico");
|
||||
this.Icon = BitmapFrame.Create(iconUri);
|
||||
|
||||
WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
|
||||
|
||||
LiveDataWindowViewModel = new LiveDataWindowViewModel(this);
|
||||
DataContext = LiveDataWindowViewModel;
|
||||
}
|
||||
|
||||
private void btnClose_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
}
|
||||
|
||||
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:,,,/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"));
|
||||
}
|
||||
}
|
||||
|
||||
private void btnMin_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.WindowState = WindowState.Minimized;
|
||||
}
|
||||
|
||||
private void Window_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
DragMove();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using ProgramLib.GUI.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace ProgramLib.GUI.ViewModel
|
||||
{
|
||||
internal class ImpedanceCheckWindowViewModel : ObservableObject
|
||||
{
|
||||
private Window _window;
|
||||
public enum Images
|
||||
{
|
||||
PASS_CHECK,
|
||||
FAIL_CHECK
|
||||
}
|
||||
|
||||
public Dictionary<Images, string> ImageToResourcePathDict
|
||||
{
|
||||
get
|
||||
{
|
||||
return _imageToResourcePathDict;
|
||||
}
|
||||
|
||||
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" }
|
||||
};
|
||||
|
||||
#region Data Bindings
|
||||
public ObservableCollection<ImpedanceDataModel> _listviewImpedanceDatatems { get; set; }
|
||||
|
||||
#endregion Data Bindings
|
||||
|
||||
public ImpedanceCheckWindowViewModel(Window window)
|
||||
{
|
||||
_window = window;
|
||||
_listviewImpedanceDatatems = new ObservableCollection<ImpedanceDataModel>();
|
||||
}
|
||||
|
||||
public void AddData(ImpedanceDataModel item)
|
||||
{
|
||||
_window.Dispatcher.Invoke((Action)delegate
|
||||
{
|
||||
_listviewImpedanceDatatems.Add(item);
|
||||
});
|
||||
}
|
||||
|
||||
public void ClearData()
|
||||
{
|
||||
_window.Dispatcher.Invoke((Action)delegate
|
||||
{
|
||||
_listviewImpedanceDatatems.Clear();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
84
Source/Program/GUI/ViewModel/LiveDataWindowViewModel.cs
Normal file
84
Source/Program/GUI/ViewModel/LiveDataWindowViewModel.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using ProgramLib.GUI.Model;
|
||||
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.ViewModel
|
||||
{
|
||||
internal partial class LiveDataWindowViewModel : ObservableObject
|
||||
{
|
||||
public enum Images
|
||||
{
|
||||
LED_ON,
|
||||
LED_OFF
|
||||
}
|
||||
|
||||
private Window _window;
|
||||
|
||||
public Dictionary<Images, string> ImageToResourcePathDict
|
||||
{
|
||||
get
|
||||
{
|
||||
return _imageToResourcePathDict;
|
||||
}
|
||||
|
||||
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" }
|
||||
};
|
||||
|
||||
#region Data Bindings
|
||||
public ObservableCollection<PowerModuleDataModel> _dataGridPowerDatatems { get; set; }
|
||||
|
||||
// 2-dimensional data array
|
||||
// inner ObservableCollection<> is the columns
|
||||
// outer ObservableCollection is the row
|
||||
public ObservableCollection<ObservableCollection<string>> _dataGridPassthroughDatatems { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
private string uutPowerLedImagePath;
|
||||
|
||||
[ObservableProperty]
|
||||
private string tePowerLedImagePath;
|
||||
|
||||
#endregion Data Bindings
|
||||
|
||||
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];
|
||||
}
|
||||
|
||||
public void AddPowerData(Dictionary<string, PowerModuleDataModel> powerModuleToPowerDataModelDict)
|
||||
{
|
||||
foreach (var item in powerModuleToPowerDataModelDict)
|
||||
{
|
||||
_dataGridPowerDatatems.Add(item.Value);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddPassthroughData(Dictionary<int, ObservableCollection<string>> rowNumberToPassthroughDataDict)
|
||||
{
|
||||
_window.Dispatcher.Invoke((Action)delegate
|
||||
{
|
||||
foreach (var item in rowNumberToPassthroughDataDict)
|
||||
{
|
||||
_dataGridPassthroughDatatems.Add(item.Value);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user