init
This commit is contained in:
@@ -0,0 +1,293 @@
|
||||
<base:BaseView x:Class="AddEditHardware.AddEditHardwareView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:base="clr-namespace:DTS.Common.Base;assembly=DTS.Common"
|
||||
xmlns:strings="clr-namespace:AddEditHardware"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:vm="clr-namespace:AddEditHardware"
|
||||
xmlns:converters="clr-namespace:DTS.Common.Converters;assembly=DTS.Common"
|
||||
mc:Ignorable="d"
|
||||
xmlns:enums="clr-namespace:DTS.Common.Enums.Hardware;assembly=DTS.Common"
|
||||
d:DesignHeight="768" d:DesignWidth="1366" x:Name="ctrlView">
|
||||
<base:BaseView.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Themes/CommonStyles.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Controls/combobox.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style TargetType="ListView">
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource TTS_ListViewItemStyle}"/>
|
||||
</Style>
|
||||
<Style TargetType="TextBox" BasedOn="{StaticResource TTS_TextBoxStyle}"/>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource TTS_TextBlockStyle}"/>
|
||||
<Style TargetType="CheckBox" BasedOn="{StaticResource PageContentCheckBoxStyle}" />
|
||||
<Style TargetType="ComboBox" BasedOn="{StaticResource TTS_ComboBoxStyle}"/>
|
||||
<Style TargetType="Button" BasedOn="{StaticResource TTS_ButtonStyle}"/>
|
||||
<Style TargetType="GridViewColumnHeader" BasedOn="{StaticResource Gray_GridViewColumnHeaderStyle}"/>
|
||||
<converters:BooleanToVisibilityConverter x:Key="BoolToVisConverter" />
|
||||
<converters:InverseBooleanConverter x:Key="InverseBoolConverter" />
|
||||
<converters:InverseBooleanToVisibilityConverter x:Key="InverseBoolVisConverter" />
|
||||
<converters:EnumVisibilityConverter x:Key="EnumVisibilityConverter" />
|
||||
</ResourceDictionary>
|
||||
</base:BaseView.Resources>
|
||||
<base:BaseView.DataContext>
|
||||
<vm:AddEditHardwareViewModel />
|
||||
</base:BaseView.DataContext>
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"
|
||||
Background="{DynamicResource Brush_ApplicationContentBackground}" DataContext="{Binding Hardware, Mode=OneWay}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0" Grid.Column="0" AutomationProperties.AutomationId="MainGrid">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition MaxWidth="200"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<!--0 DAS TYPE-->
|
||||
<RowDefinition Height="Auto" />
|
||||
<!--1 Dummy Hardware -->
|
||||
<RowDefinition Height="Auto" />
|
||||
<!--2 IP Address-->
|
||||
<RowDefinition Height="Auto" />
|
||||
<!--3 Serial Number-->
|
||||
<RowDefinition Height="Auto" />
|
||||
<!--4 Firmware-->
|
||||
<RowDefinition Height="Auto" />
|
||||
<!--5 Racksize-->
|
||||
<RowDefinition Height="Auto" />
|
||||
<!--6 Configuration-->
|
||||
<RowDefinition Height="Auto" />
|
||||
<!--7 SLICE6 TreeView -->
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<!-- das type-->
|
||||
<TextBlock Grid.Row="0" Text="{strings:TranslateExtension DAS_Type}" />
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" HorizontalAlignment="Stretch" MinWidth="300" MaxWidth="300"
|
||||
SelectedItem="{Binding HardwareType}"
|
||||
x:Name="cbHardwareTypes" SelectionChanged="cb_SelectionChanged" AutomationProperties.AutomationId="ddlDASType"
|
||||
IsEnabled="{Binding IsAdd}"/>
|
||||
|
||||
<!-- dummy hardware -->
|
||||
<TextBlock Grid.Row="1" Text="{strings:TranslateExtension DummyHardware}"
|
||||
Visibility="{Binding ElementName=ctrlView, Path=AllowStandin,Converter={StaticResource BoolToVisConverter}}"/>
|
||||
<CheckBox Grid.Row="1" Grid.Column="1" IsChecked="{Binding StandIn}" Checked="cb_Checked" Unchecked="cb_Unchecked" AutomationProperties.AutomationId="StandInHardwareCheckBox"
|
||||
IsEnabled="{Binding IsAdd}"
|
||||
Visibility="{Binding ElementName=ctrlView, Path=AllowStandin,Converter={StaticResource BoolToVisConverter}}"/>
|
||||
|
||||
<!-- ip address -->
|
||||
<TextBlock Grid.Row="2" Text="{strings:TranslateExtension IPAddress}" Visibility="{Binding SupportsIPAddress, Converter={StaticResource BoolToVisConverter}}"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" MinWidth="300" MaxWidth="300" MaxLength="50" Visibility="{Binding SupportsIPAddress, Converter={StaticResource BoolToVisConverter}}"
|
||||
TextChanged="tb_TextChanged" Text="{Binding IPAddress}" AutomationProperties.AutomationId="tbIPAddress"/>
|
||||
|
||||
<!-- serial number -->
|
||||
<TextBlock Grid.Row="3" Text="{strings:TranslateExtension SerialNumber}" Visibility="{Binding StandIn, Converter={StaticResource InverseBoolVisConverter}}"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" MinWidth="300" MaxWidth="300" MaxLength="50" Visibility="{Binding StandIn, Converter={StaticResource InverseBoolVisConverter}}"
|
||||
Text="{Binding SerialNumber}" TextChanged="tb_TextChanged" AutomationProperties.AutomationId="tbSerialNumber"
|
||||
IsEnabled="{Binding IsAdd}"/>
|
||||
|
||||
<!-- firmware -->
|
||||
<TextBlock Grid.Row="4" Text="{strings:TranslateExtension Firmware}" Visibility="{Binding StandIn, Converter={StaticResource InverseBoolVisConverter}}"/>
|
||||
<TextBox Grid.Row="4" Text="{Binding FirmwareVersion}" Grid.Column="1" MinWidth="300" MaxWidth="300" MaxLength="50" Visibility="{Binding StandIn, Converter={StaticResource InverseBoolVisConverter}}"
|
||||
TextChanged="tb_TextChanged" AutomationProperties.AutomationId="tbFirmware"/>
|
||||
|
||||
<!-- rack size -->
|
||||
<TextBlock Grid.Row="5" Text="{strings:TranslateExtension RackSize}" Visibility="{Binding SupportsRackSize, Converter={StaticResource BoolToVisConverter}}" />
|
||||
<ComboBox Grid.Row="5" Grid.Column="1" MinWidth="300" MaxWidth="300" Visibility="{Binding SupportsRackSize, Converter={StaticResource BoolToVisConverter}}"
|
||||
SelectedItem="{Binding RackSize}" x:Name="cbRackSize" SelectionChanged="cb_SelectionChanged" AutomationProperties.AutomationId="CboBxRackSize"/>
|
||||
|
||||
<!-- configuration -->
|
||||
<TextBlock Grid.Row="6" Grid.Column="0" Text="{strings:TranslateExtension Configuration}" Visibility="{Binding SupportsConfiguration, Converter={StaticResource BoolToVisConverter}}" />
|
||||
<ComboBox Grid.Row="6" Grid.Column="1" Visibility="{Binding SupportsSLICEPROSIMConfiguration, Converter={StaticResource BoolToVisConverter}}" x:Name="cbSliceProSimConfigurations"
|
||||
SelectedItem="{Binding SLICEPROSIMConfiguration}" MinWidth="300" MaxWidth="300" SelectionChanged="cb_SelectionChanged" AutomationProperties.AutomationId="ConfigurationCboBx"/>
|
||||
<ComboBox Grid.Row="6" Grid.Column="1" Visibility="{Binding SupportsSLICETCConfiguration, Converter={StaticResource BoolToVisConverter}}" x:Name="cbSliceTCConfigurations"
|
||||
SelectedItem="{Binding SLICETCConfiguration}" MinWidth="300" MaxWidth="300" SelectionChanged="cb_SelectionChanged" AutomationProperties.AutomationId="ConfigurationCboBx"/>
|
||||
|
||||
<!-- SLICE6TreeView -->
|
||||
<ContentControl Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="3" x:Name="SLICE6TreeView" Visibility="{Binding ShowTreeView, Converter={StaticResource BoolToVisConverter}}"/>
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="0" Grid.Column="1"
|
||||
Width="150" Height="150" Margin="10,2,5,2"
|
||||
VerticalAlignment="Top" HorizontalAlignment="Left">
|
||||
<Image Stretch="Uniform" Source="{Binding DASImage}" />
|
||||
</Grid>
|
||||
<!-- MICRO BASE -->
|
||||
<StackPanel Grid.Row="1" Grid.ColumnSpan="3" Grid.Column="0" Orientation="Vertical" Visibility="{Binding HardwareType, Converter={StaticResource EnumVisibilityConverter}, ConverterParameter={x:Static enums:HardwareTypes.SLICE_Micro_Base}}" AutomationProperties.AutomationId="SLICEMicroBasePanel">
|
||||
<Button Content="{strings:TranslateExtension Add}" Visibility="{Binding RackFull, Converter={StaticResource InverseBoolVisConverter}}" HorizontalAlignment="Left"
|
||||
Click="btnAdd_Click" AutomationProperties.AutomationId="AddButton"/>
|
||||
<ListView ItemsSource="{Binding Modules}" HorizontalAlignment="Left" AutomationProperties.AutomationId="ModulesListView">
|
||||
<ListView.ItemContainerStyle>
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image HorizontalAlignment="Left" Stretch="Fill" Width="100" Source="{Binding DASImage}" />
|
||||
<ComboBox SelectedItem="{Binding SLICEBridgeType}" ItemsSource="{Binding AvailableMicroBridges}" SelectionChanged="cb_SelectionChanged"
|
||||
AutomationProperties.AutomationId="SLICEBridgeTypeComboBox"/>
|
||||
<Button Content="{strings:TranslateExtension Remove}" Click="btnRemoveModule_Click" AutomationProperties.AutomationId="RemoveButton"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
<Image Grid.Column="0" Source="/DataPRO;component/Assets/Hardware/SLICEBase_Side.png" HorizontalAlignment="Left" Stretch="Fill" Width="100"/>
|
||||
</StackPanel>
|
||||
<!-- NANO BASE-->
|
||||
<StackPanel Grid.Row="1" Grid.ColumnSpan="3" Grid.Column="0" Orientation="Vertical" Visibility="{Binding HardwareType, Converter={StaticResource EnumVisibilityConverter}, ConverterParameter={x:Static enums:HardwareTypes.SLICE_NANO_Base}}"
|
||||
AutomationProperties.AutomationId="SLICENanoPanel">
|
||||
<Button Content="{strings:TranslateExtension Add}" Visibility="{Binding RackFull, Converter={StaticResource InverseBoolVisConverter}}" HorizontalAlignment="Left"
|
||||
Click="btnAdd_Click" AutomationProperties.AutomationId="ButtonAdd"/>
|
||||
<ListView ItemsSource="{Binding Modules}" HorizontalAlignment="Left" AutomationProperties.AutomationId="ModulesListView">
|
||||
<ListView.ItemContainerStyle>
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image HorizontalAlignment="Left" Stretch="Fill" Width="100" Source="{Binding DASImage}" />
|
||||
<ComboBox SelectedItem="{Binding SLICEBridgeType}" ItemsSource="{Binding AvailableNanoBridges}" SelectionChanged="cb_SelectionChanged"
|
||||
AutomationProperties.AutomationId="SLICEBridgeTypeComboBox" />
|
||||
<Button Content="{strings:TranslateExtension Remove}" Click="btnRemoveModule_Click" AutomationProperties.AutomationId="RemoveButton"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
<Image Grid.Column="0" Source="/DataPRO;component/Assets/Hardware/SLICEBase_Side.png" HorizontalAlignment="Left" Stretch="Fill" Width="100"/>
|
||||
</StackPanel>
|
||||
<!-- SLICE 1.5 NANO -->
|
||||
<StackPanel Grid.Row="1" Grid.ColumnSpan="3" Grid.Column="0" Orientation="Vertical" Visibility="{Binding HardwareType, Converter={StaticResource EnumVisibilityConverter}, ConverterParameter={x:Static enums:HardwareTypes.SLICE1_5_Nano_Base}}"
|
||||
AutomationProperties.AutomationId="SLICE15NanoPanel">
|
||||
<Button Content="{strings:TranslateExtension Add}" Visibility="{Binding RackFull, Converter={StaticResource InverseBoolVisConverter}}" HorizontalAlignment="Left"
|
||||
Click="btnAdd_Click" AutomationProperties.AutomationId="AddButton" />
|
||||
<ListView ItemsSource="{Binding Modules}" HorizontalAlignment="Left" AutomationProperties.AutomationId="ModulesListView">
|
||||
<ListView.ItemContainerStyle>
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image HorizontalAlignment="Left" Stretch="Fill" Width="100" Source="{Binding DASImage}" />
|
||||
<ComboBox SelectedItem="{Binding SLICEBridgeType}" ItemsSource="{Binding AvailableNanoBridges}" SelectionChanged="cb_SelectionChanged"
|
||||
AutomationProperties.AutomationId="SLICEBridgeTypeComboBox"/>
|
||||
<Button Content="{strings:TranslateExtension Remove}" Click="btnRemoveModule_Click" AutomationProperties.AutomationId="RemoveButton"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
<Image Grid.Column="0" Source="/DataPRO;component/Assets/Hardware/SLICEBasePlus_Side.png" HorizontalAlignment="Left" Stretch="Fill" Width="100"/>
|
||||
</StackPanel>
|
||||
<!-- SLICE1.5 MICRO -->
|
||||
<StackPanel Grid.Row="1" Grid.ColumnSpan="3" Grid.Column="0" Orientation="Vertical" Visibility="{Binding HardwareType, Converter={StaticResource EnumVisibilityConverter}, ConverterParameter={x:Static enums:HardwareTypes.SLICE1_5_Micro_Base}}">
|
||||
<Button Content="{strings:TranslateExtension Add}" Visibility="{Binding RackFull, Converter={StaticResource InverseBoolVisConverter}}" HorizontalAlignment="Left"
|
||||
Click="btnAdd_Click" AutomationProperties.AutomationId="SLICE15MicroPanel" />
|
||||
<ListView ItemsSource="{Binding Modules}" HorizontalAlignment="Left" AutomationProperties.AutomationId="ModulesListView">
|
||||
<ListView.ItemContainerStyle>
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image HorizontalAlignment="Left" Stretch="Fill" Width="100" Source="{Binding DASImage}" />
|
||||
<ComboBox SelectedItem="{Binding SLICEBridgeType}" ItemsSource="{Binding AvailableMicroBridges}" SelectionChanged="cb_SelectionChanged"
|
||||
AutomationProperties.AutomationId="SLICEBridgeTypeComboBox"/>
|
||||
<Button Content="{strings:TranslateExtension Remove}" Click="btnRemoveModule_Click" AutomationProperties.AutomationId="RemoveButton"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
<Image Grid.Column="0" Source="/DataPRO;component/Assets/Hardware/SLICEBasePlus_Side.png" HorizontalAlignment="Left" Stretch="Fill" Width="100"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- TDAS PRO -->
|
||||
<StackPanel Grid.Row="1" Grid.ColumnSpan="3" Grid.Column="0" Orientation="Horizontal" Visibility="{Binding HardwareType, Converter={StaticResource EnumVisibilityConverter}, ConverterParameter={x:Static enums:HardwareTypes.TDAS_Pro_Rack}}"
|
||||
AutomationProperties.AutomationId="TDASPanel">
|
||||
<Image Grid.Column="0" Source="/DataPRO;component/Assets/Hardware/TDAS_Rack_FrontPlate.png" Height="400" Stretch="Fill" Width="120" HorizontalAlignment="Left" VerticalAlignment="Top"
|
||||
Margin="0,15,0,0" />
|
||||
<StackPanel Orientation="Horizontal" AutomationProperties.AutomationId="TDASProPanel">
|
||||
<ListView ItemsSource="{Binding Modules}" HorizontalAlignment="Left" VerticalAlignment="Top"
|
||||
AutomationProperties.AutomationId="ModulesListView">
|
||||
<ListView.ItemContainerStyle>
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>
|
||||
<ListView.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Top"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ListView.ItemsPanel>
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Top">
|
||||
<ComboBox SelectedItem="{Binding ModuleType}" ItemsSource="{Binding AvailableRACKModules}" SelectionChanged="cb_SelectionChanged"
|
||||
AutomationProperties.AutomationId="ModuleTypeComboBox"/>
|
||||
<Image Height="400" Stretch="Fill" Width="110" Source="{Binding DASImage}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<!-- LAB RACK -->
|
||||
<StackPanel Grid.Row="1" Grid.ColumnSpan="3" Grid.Column="0" Orientation="Horizontal" Visibility="{Binding HardwareType, Converter={StaticResource EnumVisibilityConverter}, ConverterParameter={x:Static enums:HardwareTypes.TDAS_LabRack}}"
|
||||
AutomationProperties.AutomationId="LabRackPanel">
|
||||
<Image Grid.Column="0" Source="/DataPRO;component/Assets/Hardware/LabRackFace.jpg" Height="400" Stretch="Fill" Width="320" HorizontalAlignment="Left" VerticalAlignment="Top"
|
||||
Margin="0,15,0,0"/>
|
||||
<StackPanel Orientation="Horizontal" AutomationProperties.AutomationId="ModulesPanel">
|
||||
<ListView ItemsSource="{Binding Modules}" HorizontalAlignment="Left" VerticalAlignment="Top" Padding="0"
|
||||
AutomationProperties.AutomationId="ModulesListView">
|
||||
<ListView.ItemContainerStyle>
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>
|
||||
<ListView.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ListView.ItemsPanel>
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Top">
|
||||
<ComboBox SelectedItem="{Binding ModuleType}" ItemsSource="{Binding AvailableRACKModules}" SelectionChanged="cb_SelectionChanged"
|
||||
AutomationProperties.AutomationId="ModuleTypeComboBox"/>
|
||||
<Image Height="400" Stretch="Fill" Width="110" Source="{Binding DASImage}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</base:BaseView>
|
||||
@@ -0,0 +1,235 @@
|
||||
using DTS.Common;
|
||||
using DTS.Common.Converters;
|
||||
using DTS.Common.Enums.Hardware;
|
||||
using DTS.Common.Interface.Hardware.AddEditHardware;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
|
||||
namespace AddEditHardware
|
||||
{
|
||||
/// <inheritdoc cref="IAddEditHardwareView" />
|
||||
/// <summary>
|
||||
/// Interaction logic for AddEditHardwareView.xaml
|
||||
/// </summary>
|
||||
public partial class AddEditHardwareView : IAddEditHardwareView, INotifyPropertyChanged
|
||||
{
|
||||
#region IPropertyNotified
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
protected bool SetProperty<T>(ref T storage, T value, string propertyName = null)
|
||||
{
|
||||
if (Equals(storage, value)) return false;
|
||||
|
||||
storage = value;
|
||||
OnPropertyChanged(propertyName);
|
||||
return true;
|
||||
}
|
||||
protected void OnPropertyChanged(string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
#endregion #PropertyNotified
|
||||
/// <summary>
|
||||
/// whether the SLICE6TreeView should be shown or not
|
||||
/// </summary>
|
||||
public bool AllowStandin
|
||||
{
|
||||
get
|
||||
{
|
||||
if (null == DataContext) { return true; }
|
||||
if (!(DataContext is IAddEditHardwareViewModel vm)) { return true; }
|
||||
return vm.AllowStandin;
|
||||
}
|
||||
}
|
||||
private static List<HardwareTypes> _allDASTypes = new List<HardwareTypes>();
|
||||
|
||||
private static HardwareTypes[] AvailableDASType(int ConnectionDbVersion)
|
||||
{
|
||||
lock (_allDASTypes)
|
||||
{
|
||||
if (!_allDASTypes.Any())
|
||||
{
|
||||
PopulateDASTypes(ConnectionDbVersion);
|
||||
}
|
||||
}
|
||||
|
||||
return _allDASTypes.ToArray();
|
||||
}
|
||||
|
||||
private static void PopulateDASTypes(int ConnectionDbVersion)
|
||||
{
|
||||
lock (_allDASTypes)
|
||||
{
|
||||
_allDASTypes.AddRange(new[]
|
||||
{
|
||||
HardwareTypes.TDAS_Pro_Rack,
|
||||
HardwareTypes.TDAS_LabRack,
|
||||
HardwareTypes.G5INDUMMY,
|
||||
HardwareTypes.G5VDS,
|
||||
HardwareTypes.SLICE_NANO_Base,
|
||||
HardwareTypes.SLICE_Micro_Base,
|
||||
HardwareTypes.SLICE_Distributor,
|
||||
HardwareTypes.SLICE_EthernetController,
|
||||
HardwareTypes.SLICE_Mini_Distributor,
|
||||
HardwareTypes.SLICE_LabEthernet,
|
||||
HardwareTypes.SLICE1_5_Nano_Base,
|
||||
HardwareTypes.SLICE1_5_Micro_Base,
|
||||
HardwareTypes.SLICE2_SIM,
|
||||
HardwareTypes.SLICE2_DIM,
|
||||
HardwareTypes.SLICE2_TOM,
|
||||
HardwareTypes.SLICE2_SLS,
|
||||
HardwareTypes.SLICE2_SLD,
|
||||
HardwareTypes.SLICE2_SLT,
|
||||
HardwareTypes.SLICE6DB,
|
||||
HardwareTypes.SLICE6DB3,
|
||||
HardwareTypes.SLICE_Pro_Distributor,
|
||||
HardwareTypes.SLICE6DB_InDummy,
|
||||
HardwareTypes.SLICE6_Base,
|
||||
HardwareTypes.SLICE6_AIR,
|
||||
HardwareTypes.PowerPro,
|
||||
HardwareTypes.TSR_AIR_RevB,
|
||||
HardwareTypes.SLICE1_G5Stack,
|
||||
HardwareTypes.S6A_EthernetRecorder
|
||||
});
|
||||
if (ConnectionDbVersion >= Constants.SLICE6AIR_BR_DB_VERSION)
|
||||
{
|
||||
_allDASTypes.Add(HardwareTypes.SLICE6_AIR_BR);
|
||||
}
|
||||
if (ConnectionDbVersion >= Constants.SLICE_TC_DB_VERSION)
|
||||
{
|
||||
_allDASTypes.Add(HardwareTypes.SLICE6_AIR_TC);
|
||||
}
|
||||
if (ConnectionDbVersion >= Constants.SLICE_PRO_CAN_FD_DB_VERSION)
|
||||
{
|
||||
_allDASTypes.Add(HardwareTypes.SLICE_PRO_CAN_FD);
|
||||
}
|
||||
_allDASTypes.Sort((a, b) =>
|
||||
{
|
||||
return EnumDescriptionTypeConverter.GetEnumDescription(a)
|
||||
.CompareTo(EnumDescriptionTypeConverter.GetEnumDescription(b));
|
||||
});
|
||||
}
|
||||
}
|
||||
private static SLICEPROSIMConfigurations[] _availableSliceProSimConfigurations = new[]
|
||||
{
|
||||
SLICEPROSIMConfigurations.MEGA,
|
||||
SLICEPROSIMConfigurations.EIGHT_HUNDRED,
|
||||
SLICEPROSIMConfigurations.SEVEN_HUNDRED,
|
||||
SLICEPROSIMConfigurations.SIX_HUNDRED
|
||||
};
|
||||
|
||||
private static SLICETCConfigurations[] _availableSliceTCConfigurations = new[]
|
||||
{
|
||||
SLICETCConfigurations.EIGHT,
|
||||
SLICETCConfigurations.SIXTEEN,
|
||||
SLICETCConfigurations.TWENTYFOUR
|
||||
};
|
||||
|
||||
private static RackSizes[] _availableRackSizes = new[]
|
||||
{
|
||||
RackSizes.FOUR,
|
||||
RackSizes.EIGHT
|
||||
};
|
||||
|
||||
public AddEditHardwareView()
|
||||
{
|
||||
InitializeComponent();
|
||||
cbHardwareTypes.ItemsSource = AvailableDASType(ViewDbVersion);
|
||||
cbSliceProSimConfigurations.ItemsSource = _availableSliceProSimConfigurations;
|
||||
cbSliceTCConfigurations.ItemsSource = _availableSliceTCConfigurations;
|
||||
cbRackSize.ItemsSource = _availableRackSizes;
|
||||
}
|
||||
|
||||
private void btnRemoveModule_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!(sender is Control control))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(control.DataContext is IAddEditHardwareDASModule dasModule))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
dasModule.OwningHardware.RemoveModule(dasModule);
|
||||
if (!(ctrlView.DataContext is AddEditHardwareViewModel vm)) { return; }
|
||||
vm.NotifyModified();
|
||||
}
|
||||
|
||||
private void btnAdd_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!(sender is Control control))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!(control.DataContext is IAddEditHardwareHardware hardware))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
hardware.AddModule();
|
||||
if (!(ctrlView.DataContext is AddEditHardwareViewModel vm)) { return; }
|
||||
vm.NotifyModified();
|
||||
}
|
||||
|
||||
private void cb_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!(ctrlView.DataContext is AddEditHardwareViewModel vm)) { return; }
|
||||
|
||||
vm.NotifyModified();
|
||||
}
|
||||
|
||||
private void cb_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!(ctrlView.DataContext is AddEditHardwareViewModel vm)) { return; }
|
||||
|
||||
vm.NotifyModified();
|
||||
}
|
||||
|
||||
private void cb_Unchecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!(ctrlView.DataContext is AddEditHardwareViewModel vm)) { return; }
|
||||
|
||||
vm.NotifyModified();
|
||||
}
|
||||
|
||||
private void tb_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (!(ctrlView.DataContext is AddEditHardwareViewModel vm)) { return; }
|
||||
|
||||
vm.NotifyModified();
|
||||
}
|
||||
/// <summary>
|
||||
/// handle any initialization that should occur when view is activated
|
||||
/// </summary>
|
||||
public void Activated()
|
||||
{
|
||||
OnPropertyChanged("AllowStandin");
|
||||
if (!(DataContext is IAddEditHardwareViewModel vm)) { return; }
|
||||
|
||||
if (null != vm.SLICE6TreeView)
|
||||
{
|
||||
SLICE6TreeView.Content = vm.SLICE6TreeView;
|
||||
}
|
||||
}
|
||||
private int _DbVersion = DTS.Common.Storage.DbOperations.MINIMUM_LTS_DB_VERSION;
|
||||
public int ViewDbVersion
|
||||
{
|
||||
get => _DbVersion;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _DbVersion, value, "ViewDbVersion");
|
||||
lock (_allDASTypes)
|
||||
{
|
||||
_allDASTypes.Clear();
|
||||
}
|
||||
cbHardwareTypes.ItemsSource = AvailableDASType(ViewDbVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user