Initial check-in
This commit is contained in:
83
Source/ProgramGUI/View/ImpedanceCheckWindow.xaml
Normal file
83
Source/ProgramGUI/View/ImpedanceCheckWindow.xaml
Normal file
@@ -0,0 +1,83 @@
|
||||
<Window x:Class="ProgramGui.View.ImpedanceCheckWindow"
|
||||
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:ProgramGui.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:,,,/ProgramGui;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:,,,/ProgramGui;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:,,,/ProgramGui;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>
|
||||
62
Source/ProgramGUI/View/ImpedanceCheckWindow.xaml.cs
Normal file
62
Source/ProgramGUI/View/ImpedanceCheckWindow.xaml.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using ProgramGui.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace ProgramGui.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ImpedanceCheckWindow.xaml
|
||||
/// </summary>
|
||||
public partial class ImpedanceCheckWindow : Window
|
||||
{
|
||||
public ImpedanceCheckWindowViewModel _viewModel;
|
||||
|
||||
public ImpedanceCheckWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Uri iconUri = new Uri("pack://application:,,,/ProgramGui;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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user