init
This commit is contained in:
1
DataPRO/Modules/Hardware/AddEditHardware/.svn/entries
Normal file
1
DataPRO/Modules/Hardware/AddEditHardware/.svn/entries
Normal file
@@ -0,0 +1 @@
|
||||
12
|
||||
1
DataPRO/Modules/Hardware/AddEditHardware/.svn/format
Normal file
1
DataPRO/Modules/Hardware/AddEditHardware/.svn/format
Normal file
@@ -0,0 +1 @@
|
||||
12
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("AddEditHardware")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("DTS")]
|
||||
[assembly: AssemblyProduct("AddEditHardware")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("79856d8f-191f-4528-b78f-892283e21e7b")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace AddEditHardware.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.10.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,352 @@
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Threading.Tasks;
|
||||
using DTS.Common.Events;
|
||||
using DTS.Common.Interface.Hardware.AddEditHardware;
|
||||
using DTS.Common.Interface.DataRecorders;
|
||||
using DTS.Common.Interface.DASFactory.Diagnostics;
|
||||
using System.Collections.Generic;
|
||||
using DTS.Common.Events.Hardware.HardwareList;
|
||||
using System.Linq;
|
||||
using System;
|
||||
using DTS.Common.Utilities.Logging;
|
||||
using DTS.Common.Interface.DASFactory.Diagnostics.HardwareList;
|
||||
using Prism.Events;
|
||||
using Prism.Regions;
|
||||
using Unity;
|
||||
using DTS.Common.Interactivity;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace AddEditHardware
|
||||
{
|
||||
/// <summary>
|
||||
/// this class handles AddEditHardware functionality
|
||||
/// </summary>
|
||||
[PartCreationPolicy(CreationPolicy.Shared)]
|
||||
public class AddEditHardwareViewModel : IAddEditHardwareViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether StandIn hardware is allowed or not
|
||||
/// datarecorders tile does not allow standin hardware, TestSetup and Group do
|
||||
/// </summary>
|
||||
public bool AllowStandin { get; set; } = true;
|
||||
/// <summary>
|
||||
/// The AddEditHardware View
|
||||
/// </summary>
|
||||
public IAddEditHardwareView View { get; set; }
|
||||
|
||||
private IEventAggregator _eventAggregator { get; }
|
||||
private IRegionManager _regionManager;
|
||||
private IUnityContainer UnityContainer { get; }
|
||||
|
||||
public InteractionRequest<Notification> NotificationRequest { get; }
|
||||
public InteractionRequest<Confirmation> ConfirmationRequest { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Occurs when a property value changes.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
public void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
#region constructors and initializers
|
||||
/// <summary>
|
||||
/// Creates a new instance of the HardwareListViewModel
|
||||
/// </summary>
|
||||
/// <param name="view"></param>
|
||||
/// <param name="regionManager">The logical placeholder defined within the application's UI (in the shell or within views) into which views are displayed.</param>
|
||||
/// <param name="eventAggregator">The EventAggregator which allows different components to publish/subscribe to events without being coupled to each other.</param>
|
||||
/// <param name="unityContainer">The unityContainer.</param>
|
||||
public AddEditHardwareViewModel(IAddEditHardwareView view, IRegionManager regionManager,
|
||||
IEventAggregator eventAggregator, IUnityContainer unityContainer)
|
||||
{
|
||||
View = view;
|
||||
View.DataContext = this;
|
||||
|
||||
NotificationRequest = new InteractionRequest<Notification>();
|
||||
ConfirmationRequest = new InteractionRequest<Confirmation>();
|
||||
|
||||
_eventAggregator = eventAggregator;
|
||||
UnityContainer = unityContainer;
|
||||
_regionManager = regionManager;
|
||||
_eventAggregator.GetEvent<RaiseNotification>().Subscribe(OnRaiseNotification);
|
||||
_eventAggregator.GetEvent<BusyIndicatorChangeNotification>()
|
||||
.Subscribe(OnBusyIndicatorNotification, ThreadOption.PublisherThread, true);
|
||||
}
|
||||
//required if you want to use the vm in the view xaml
|
||||
public AddEditHardwareViewModel()
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
/// <summary>
|
||||
/// used to pass in access to SLICE6TreeView module
|
||||
/// </summary>
|
||||
public void SetSLICE6TreeView(ISLICE6TreeView treeView, IHardwareListViewModel treeViewModel)
|
||||
{
|
||||
SLICE6TreeView = treeView;
|
||||
SLICE6TreeViewModel = treeViewModel;
|
||||
}
|
||||
public void Unset()
|
||||
{
|
||||
}
|
||||
public void Cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
public Task CleanupAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(object parameter)
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(object parameter, object model)
|
||||
{
|
||||
}
|
||||
|
||||
public Task InitializeAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task InitializeAsync(object parameter)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
/// <summary>
|
||||
/// SLICE6TreeView interface
|
||||
/// can be null [not shown in test setups/groups currently]
|
||||
/// </summary>
|
||||
public ISLICE6TreeView SLICE6TreeView { get; private set; }
|
||||
/// <summary>
|
||||
/// SLICE6TreeViewModule, can be null
|
||||
/// </summary>
|
||||
public IHardwareListViewModel SLICE6TreeViewModel { get; private set; }
|
||||
public void Activated()
|
||||
{
|
||||
View?.Activated();
|
||||
if (null != _hardware && !AllowStandin)
|
||||
{
|
||||
_hardware.StandIn = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnBusyIndicatorNotification(bool eventArg)
|
||||
{
|
||||
IsBusy = eventArg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)
|
||||
{
|
||||
// The NotificationRequest.Raise triggers the Invoke() method of the PopupWindowAction object to show the NotificationWindow window
|
||||
// Notification object expects a NotificationContentEventArgsWithoutTitle object and a Title string.
|
||||
var eventArgsWithoutTitle = new NotificationContentEventArgs(eventArgsWithTitle.Message, "",
|
||||
eventArgsWithTitle.Image, string.Empty);
|
||||
|
||||
NotificationRequest.Raise(new Notification
|
||||
{
|
||||
Content = eventArgsWithoutTitle,
|
||||
Title = eventArgsWithTitle.Title
|
||||
});
|
||||
}
|
||||
|
||||
public void SetHardware(IDASHardware hw, IISOHardware isoHW)
|
||||
{
|
||||
NotificationsOn = false;
|
||||
if (null == hw)
|
||||
{
|
||||
Hardware = new Model.Hardware();
|
||||
}
|
||||
else
|
||||
{
|
||||
Hardware = new Model.Hardware(hw, isoHW);
|
||||
}
|
||||
}
|
||||
|
||||
public void NotifyModified()
|
||||
{
|
||||
if (!NotificationsOn)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_eventAggregator.GetEvent<PageModifiedEvent>()
|
||||
.Publish(new PageModifiedArg(PageModifiedArg.Status.Modified, null));
|
||||
}
|
||||
public IISOHardware GetISOHardware()
|
||||
{
|
||||
var isoHW = Hardware.ToISOHardware();
|
||||
if ((isoHW != null) && Hardware.StandIn && !Guid.TryParse(Hardware.SerialNumber, out var guid))
|
||||
{
|
||||
guid = Guid.NewGuid();
|
||||
Hardware.SerialNumber = guid.ToString();
|
||||
isoHW.SerialNumber = guid.ToString();
|
||||
isoHW.FirstUseDate = null;
|
||||
isoHW.IsFirstUseValid = true;
|
||||
isoHW.CalDate = DateTime.Today;
|
||||
}
|
||||
return isoHW;
|
||||
}
|
||||
public bool Validate(IISOHardware isoHW, ref List<string> errors, ref List<string> warnings, bool displayWindow,
|
||||
bool IsAdd)
|
||||
{
|
||||
var bValid = true;
|
||||
|
||||
if (!isoHW.ValidateSerialNumber(ref errors))
|
||||
{
|
||||
bValid = false;
|
||||
}
|
||||
//17639 Adding non-Stand-in DAS from Test Setups tab doesn't warn if DAS already exists
|
||||
if (IsAdd)
|
||||
{
|
||||
try
|
||||
{
|
||||
//17639 Adding non-Stand-in DAS from Test Setups tab doesn't warn if DAS already exists
|
||||
if (!Model.Hardware.CheckUniqueSN(isoHW.SerialNumber))
|
||||
{
|
||||
errors.Add(Resources.StringResources.UniqueSNCheckFail);
|
||||
bValid = false;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
APILogger.Log(ex);
|
||||
bValid = true;
|
||||
errors.Add($"{Resources.StringResources.CheckUniqueSNError}{ex.Message}");
|
||||
}
|
||||
}
|
||||
if (!isoHW.ValidateIPAddress(ref errors))
|
||||
{
|
||||
bValid = false;
|
||||
}
|
||||
|
||||
PublishPageError(displayWindow, errors, warnings);
|
||||
return bValid;
|
||||
}
|
||||
public void PublishPageError(bool displayWindow, List<string> errors, List<string> warnings)
|
||||
{
|
||||
if (displayWindow && (errors.Any() || warnings.Any()))
|
||||
{
|
||||
var newList = errors.ToList();
|
||||
newList.AddRange(warnings.ToArray());
|
||||
_eventAggregator.GetEvent<PageErrorEvent>().Publish(new PageErrorArg(newList.ToArray(), null));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Updates all SLICE6 associations related to a SLICE6DB
|
||||
/// </summary>
|
||||
public void SaveSLICE6Associations()
|
||||
{
|
||||
switch (Hardware.HardwareType)
|
||||
{
|
||||
case DTS.Common.Enums.Hardware.HardwareTypes.SLICE6DB:
|
||||
case DTS.Common.Enums.Hardware.HardwareTypes.SLICE6DB3:
|
||||
case DTS.Common.Enums.Hardware.HardwareTypes.SLICE6DB_InDummy:
|
||||
SLICE6TreeViewModel?.SaveSLICE6Associations(Hardware.SerialNumber);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
if (!(Hardware is Model.Hardware model)) { return; }
|
||||
|
||||
Model.Hardware.Save(model, TestId, model.IsAdd);
|
||||
|
||||
SaveSLICE6Associations();
|
||||
_eventAggregator.GetEvent<HardwareSavedEvent>()
|
||||
.Publish(new Tuple<int, string>(model.ISOHardware.DASId, model.SerialNumber));
|
||||
SLICE6TreeViewModel?.LoadTreeView(model.SerialNumber);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
public int? TestId { get; set; }
|
||||
public bool NotificationsOn { get; set; } = false;
|
||||
private IAddEditHardwareHardware _hardware = new Model.Hardware();
|
||||
|
||||
/// <summary>
|
||||
/// hardware being operated on in viewmodel
|
||||
/// </summary>
|
||||
public IAddEditHardwareHardware Hardware
|
||||
{
|
||||
get => _hardware;
|
||||
set
|
||||
{
|
||||
_hardware = value;
|
||||
OnPropertyChanged("Hardware");
|
||||
OnPropertyChanged("SerialNumber"); //In case modules were added
|
||||
OnPropertyChanged("FirmwareVersion");
|
||||
OnPropertyChanged("IPAddress");
|
||||
SLICE6TreeViewModel?.LoadTreeView(_hardware.SerialNumber);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsDirty { get; private set; }
|
||||
private bool _isBusy;
|
||||
|
||||
public bool IsBusy
|
||||
{
|
||||
get => _isBusy;
|
||||
set
|
||||
{
|
||||
_isBusy = value;
|
||||
OnPropertyChanged("IsBusy");
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isMenuIncluded;
|
||||
|
||||
public bool IsMenuIncluded
|
||||
{
|
||||
get => _isMenuIncluded;
|
||||
set
|
||||
{
|
||||
_isMenuIncluded = value;
|
||||
OnPropertyChanged("IsMenuIncluded");
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isNavigationIncluded;
|
||||
|
||||
public bool IsNavigationIncluded
|
||||
{
|
||||
get => _isNavigationIncluded;
|
||||
set
|
||||
{
|
||||
_isNavigationIncluded = value;
|
||||
OnPropertyChanged("IsNavigationIncluded");
|
||||
}
|
||||
}
|
||||
|
||||
//public string ListViewId => "HardwareListView";
|
||||
|
||||
#endregion Properties
|
||||
|
||||
#region Commands
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=ad8e64c4ca55c2f5">
|
||||
<section name="AddEditHardware.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=ad8e64c4ca55c2f5" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<userSettings>
|
||||
<HardwareList.Properties.Settings>
|
||||
</HardwareList.Properties.Settings>
|
||||
</userSettings>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
@@ -0,0 +1,198 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace AddEditHardware.Resources {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class StringResources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal StringResources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AddEditHardware.Resources.StringResources", typeof(StringResources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Add.
|
||||
/// </summary>
|
||||
internal static string Add {
|
||||
get {
|
||||
return ResourceManager.GetString("Add", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Warning: Couldn't check for unique serial number: .
|
||||
/// </summary>
|
||||
internal static string CheckUniqueSNError {
|
||||
get {
|
||||
return ResourceManager.GetString("CheckUniqueSNError", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Configuration.
|
||||
/// </summary>
|
||||
internal static string Configuration {
|
||||
get {
|
||||
return ResourceManager.GetString("Configuration", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Type.
|
||||
/// </summary>
|
||||
internal static string DAS_Type {
|
||||
get {
|
||||
return ResourceManager.GetString("DAS_Type", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Generic/Stand-in hardware.
|
||||
/// </summary>
|
||||
internal static string DummyHardware {
|
||||
get {
|
||||
return ResourceManager.GetString("DummyHardware", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Firmware.
|
||||
/// </summary>
|
||||
internal static string Firmware {
|
||||
get {
|
||||
return ResourceManager.GetString("Firmware", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Empty.
|
||||
/// </summary>
|
||||
internal static string HardwareType_EMPTY {
|
||||
get {
|
||||
return ResourceManager.GetString("HardwareType_EMPTY", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to IP address.
|
||||
/// </summary>
|
||||
internal static string IPAddress {
|
||||
get {
|
||||
return ResourceManager.GetString("IPAddress", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Rack size.
|
||||
/// </summary>
|
||||
internal static string RackSize {
|
||||
get {
|
||||
return ResourceManager.GetString("RackSize", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Remove.
|
||||
/// </summary>
|
||||
internal static string Remove {
|
||||
get {
|
||||
return ResourceManager.GetString("Remove", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Serial number.
|
||||
/// </summary>
|
||||
internal static string SerialNumber {
|
||||
get {
|
||||
return ResourceManager.GetString("SerialNumber", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Error: Serial number is not unique, please provide a unique serial number when adding hardware.
|
||||
/// </summary>
|
||||
internal static string UniqueSNCheckFail {
|
||||
get {
|
||||
return ResourceManager.GetString("UniqueSNCheckFail", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to X-Module 1.
|
||||
/// </summary>
|
||||
internal static string XModule1 {
|
||||
get {
|
||||
return ResourceManager.GetString("XModule1", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to X-Module 2.
|
||||
/// </summary>
|
||||
internal static string XModule2 {
|
||||
get {
|
||||
return ResourceManager.GetString("XModule2", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to X-Module 3.
|
||||
/// </summary>
|
||||
internal static string XModule3 {
|
||||
get {
|
||||
return ResourceManager.GetString("XModule3", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Add" xml:space="preserve">
|
||||
<value>Add</value>
|
||||
</data>
|
||||
<data name="CheckUniqueSNError" xml:space="preserve">
|
||||
<value>Warning: Couldn't check for unique serial number: </value>
|
||||
</data>
|
||||
<data name="Configuration" xml:space="preserve">
|
||||
<value>Configuration</value>
|
||||
</data>
|
||||
<data name="DAS_Type" xml:space="preserve">
|
||||
<value>Type</value>
|
||||
</data>
|
||||
<data name="DummyHardware" xml:space="preserve">
|
||||
<value>Generic/Stand-in hardware</value>
|
||||
</data>
|
||||
<data name="Firmware" xml:space="preserve">
|
||||
<value>Firmware</value>
|
||||
</data>
|
||||
<data name="HardwareType_EMPTY" xml:space="preserve">
|
||||
<value>Empty</value>
|
||||
</data>
|
||||
<data name="IPAddress" xml:space="preserve">
|
||||
<value>IP address</value>
|
||||
</data>
|
||||
<data name="RackSize" xml:space="preserve">
|
||||
<value>Rack size</value>
|
||||
</data>
|
||||
<data name="Remove" xml:space="preserve">
|
||||
<value>Remove</value>
|
||||
</data>
|
||||
<data name="SerialNumber" xml:space="preserve">
|
||||
<value>Serial number</value>
|
||||
</data>
|
||||
<data name="UniqueSNCheckFail" xml:space="preserve">
|
||||
<value>Error: Serial number is not unique, please provide a unique serial number when adding hardware</value>
|
||||
</data>
|
||||
<data name="TC" xml:space="preserve">
|
||||
<value>TC-0{0}</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -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,165 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Add" xml:space="preserve">
|
||||
<value>Add</value>
|
||||
</data>
|
||||
<data name="CheckUniqueSNError" xml:space="preserve">
|
||||
<value>Warning: Couldn't check for unique serial number: </value>
|
||||
</data>
|
||||
<data name="Configuration" xml:space="preserve">
|
||||
<value>Configuration</value>
|
||||
</data>
|
||||
<data name="DAS_Type" xml:space="preserve">
|
||||
<value>Type</value>
|
||||
</data>
|
||||
<data name="DummyHardware" xml:space="preserve">
|
||||
<value>Generic/Stand-in hardware</value>
|
||||
</data>
|
||||
<data name="Firmware" xml:space="preserve">
|
||||
<value>Firmware</value>
|
||||
</data>
|
||||
<data name="HardwareType_EMPTY" xml:space="preserve">
|
||||
<value>Empty</value>
|
||||
</data>
|
||||
<data name="IPAddress" xml:space="preserve">
|
||||
<value>IP address</value>
|
||||
</data>
|
||||
<data name="RackSize" xml:space="preserve">
|
||||
<value>Rack size</value>
|
||||
</data>
|
||||
<data name="Remove" xml:space="preserve">
|
||||
<value>Remove</value>
|
||||
</data>
|
||||
<data name="SerialNumber" xml:space="preserve">
|
||||
<value>Serial number</value>
|
||||
</data>
|
||||
<data name="UniqueSNCheckFail" xml:space="preserve">
|
||||
<value>Error: Serial number is not unique, please provide a unique serial number when adding hardware</value>
|
||||
</data>
|
||||
<data name="XModule1" xml:space="preserve">
|
||||
<value>X-Module 1</value>
|
||||
</data>
|
||||
<data name="XModule2" xml:space="preserve">
|
||||
<value>X-Module 2</value>
|
||||
</data>
|
||||
<data name="XModule3" xml:space="preserve">
|
||||
<value>X-Module 3</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,167 @@
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using DTS.Common.Base;
|
||||
using DTS.Common.Enums.Hardware;
|
||||
using DTS.Common.Interface.Hardware.AddEditHardware;
|
||||
using DTS.Common.Utilities.Logging;
|
||||
|
||||
namespace HardwareList.Model
|
||||
{
|
||||
public class DASModule : BasePropertyChanged, IAddEditHardwareDASModule
|
||||
{
|
||||
public bool Disabled { get; set; } = false;
|
||||
|
||||
private SLICEBridgeTypes _sliceBridgeType = SLICEBridgeTypes.Bridge;
|
||||
|
||||
public SLICEBridgeTypes SLICEBridgeType
|
||||
{
|
||||
get => _sliceBridgeType;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _sliceBridgeType, value, "SLICEBridgeType");
|
||||
SetImage();
|
||||
}
|
||||
}
|
||||
|
||||
private HardwareTypes _moduleType = HardwareTypes.UNDEFINED;
|
||||
public HardwareTypes ModuleType
|
||||
{
|
||||
get => _moduleType;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _moduleType, value, "ModuleType");
|
||||
SetImage();
|
||||
}
|
||||
}
|
||||
|
||||
private string _serialNumber = "";
|
||||
public string SerialNumber
|
||||
{
|
||||
get => _serialNumber;
|
||||
set => SetProperty(ref _serialNumber, value, "SerialNumber");
|
||||
}
|
||||
|
||||
private ImageSource _dasImage = null;
|
||||
|
||||
public ImageSource DASImage
|
||||
{
|
||||
get => _dasImage;
|
||||
set => SetProperty(ref _dasImage, value, "DASImage");
|
||||
}
|
||||
|
||||
private static readonly SLICEBridgeTypes[] _availableNanoBridges = new SLICEBridgeTypes[]
|
||||
{
|
||||
SLICEBridgeTypes.Bridge,
|
||||
SLICEBridgeTypes.IEPE
|
||||
};
|
||||
|
||||
public SLICEBridgeTypes[] AvailableNanoBridges => _availableNanoBridges;
|
||||
|
||||
private static readonly SLICEBridgeTypes[] _availableMicroBridges = new SLICEBridgeTypes[]
|
||||
{
|
||||
SLICEBridgeTypes.Bridge,
|
||||
SLICEBridgeTypes.IEPE,
|
||||
SLICEBridgeTypes.ARS,
|
||||
SLICEBridgeTypes.ACC
|
||||
};
|
||||
|
||||
public SLICEBridgeTypes[] AvailableMicroBridges => _availableMicroBridges;
|
||||
|
||||
private static readonly HardwareTypes[] _availableRackModules = new HardwareTypes[]
|
||||
{
|
||||
HardwareTypes.UNDEFINED,
|
||||
HardwareTypes.SIM,
|
||||
HardwareTypes.TOM,
|
||||
HardwareTypes.DIM
|
||||
};
|
||||
public HardwareTypes[] AvailableRACKModules => _availableRackModules;
|
||||
|
||||
/// <summary>
|
||||
/// Uri for finding images using the application resources
|
||||
/// </summary>
|
||||
private static readonly Uri _baseUri = new Uri("pack://application:,,,/ResourceFile.xaml");
|
||||
private void SetImage()
|
||||
{
|
||||
var fileName = string.Empty;
|
||||
switch (ModuleType)
|
||||
{
|
||||
case HardwareTypes.SLICE_Bridge:
|
||||
switch (SLICEBridgeType)
|
||||
{
|
||||
case SLICEBridgeTypes.ACC:
|
||||
fileName = @"Assets/Hardware/SLICEACC_Side.png";
|
||||
break;
|
||||
case SLICEBridgeTypes.ARS:
|
||||
fileName = @"Assets/Hardware/SLICEARS_Side.png";
|
||||
break;
|
||||
case SLICEBridgeTypes.Bridge:
|
||||
fileName = @"Assets/Hardware/SLICEBridge_Side.png";
|
||||
break;
|
||||
case SLICEBridgeTypes.IEPE:
|
||||
fileName = @"Assets/Hardware/SLICEIEPE_Side.png";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case HardwareTypes.TOM:
|
||||
fileName = @"Assets/Hardware/TDAS_TOM_Front.jpg";
|
||||
break;
|
||||
case HardwareTypes.SIM:
|
||||
fileName = @"Assets/Hardware/TDAS_SIM_Front.jpg";
|
||||
break;
|
||||
case HardwareTypes.DIM:
|
||||
fileName = @"Assets/Hardware/TDAS_DIM_Front.jpg";
|
||||
break;
|
||||
default:
|
||||
fileName = @"Assets/Hardware/TDAS_Rack_Cover.png";
|
||||
break;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(fileName))
|
||||
{
|
||||
DASImage = null;
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var image = new BitmapImage(new Uri(_baseUri, fileName));
|
||||
image.Freeze();
|
||||
DASImage = image;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
APILogger.Log(
|
||||
$"Failed to get image: {fileName} for type: {ModuleType.ToString()} exception: {ex.Message.ToString()}");
|
||||
}
|
||||
}
|
||||
public IAddEditHardwareHardware OwningHardware { get; set; }
|
||||
|
||||
public string GetSerialNumberPrefix()
|
||||
{
|
||||
switch (ModuleType)
|
||||
{
|
||||
case HardwareTypes.DIM: return "DIM";
|
||||
case HardwareTypes.SIM: return "SIM";
|
||||
case HardwareTypes.SLICE_Bridge:
|
||||
{
|
||||
switch (SLICEBridgeType)
|
||||
{
|
||||
case SLICEBridgeTypes.ACC: return "AC";
|
||||
case SLICEBridgeTypes.ARS: return "AR";
|
||||
case SLICEBridgeTypes.Bridge: return "BR";
|
||||
case SLICEBridgeTypes.IEPE: return "IEPE";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HardwareTypes.TOM:
|
||||
return "TOM";
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
public DASModule()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Windows.Media.Imaging;
|
||||
using DTS.Common;
|
||||
using DTS.Common.Interface;
|
||||
using AddEditHardware;
|
||||
using DTS.Common.Interface.Hardware.AddEditHardware;
|
||||
using Prism.Modularity;
|
||||
using Unity;
|
||||
using Prism.Ioc;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
// ReSharper disable RedundantAttributeUsageProperty
|
||||
// ReSharper disable UnusedParameter.Local
|
||||
|
||||
[assembly: AddEditHardwareModuleName]
|
||||
[assembly: AddEditHardwareModuleImageAttribute]
|
||||
namespace AddEditHardware
|
||||
{
|
||||
[Export(typeof(IModule))]
|
||||
[Module(ModuleName = "AddEditHardwareModule")]
|
||||
public class AddEditHardwareModule : IModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Injected unity container
|
||||
/// </summary>
|
||||
private readonly IUnityContainer _unityContainer;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AddEditHardwareModule"/> class.
|
||||
/// </summary>
|
||||
/// <param name="unityContainer">Obtained reference of the unity container by using dependency injection.</param>
|
||||
public AddEditHardwareModule(IUnityContainer unityContainer)
|
||||
{
|
||||
_unityContainer = unityContainer;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
// Register View & View-Model with Unity dependency injection container as a singleton.
|
||||
_unityContainer.RegisterType<IAddEditHardwareView, AddEditHardwareView>();
|
||||
_unityContainer.RegisterType<IAddEditHardwareViewModel, AddEditHardwareViewModel>();
|
||||
}
|
||||
|
||||
public void OnInitialized(IContainerProvider containerProvider)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void RegisterTypes(IContainerRegistry containerRegistry)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attribute class contains assembly name
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
|
||||
public class AddEditHardwareModuleNameAttribute : TextAttribute
|
||||
{
|
||||
public AddEditHardwareModuleNameAttribute() : this(null) { }
|
||||
|
||||
public AddEditHardwareModuleNameAttribute(string s)
|
||||
{
|
||||
AssemblyName = AssemblyNames.AddEditHardware.ToString();
|
||||
}
|
||||
|
||||
public override string AssemblyName { get; }
|
||||
|
||||
public override Type GetAttributeType()
|
||||
{
|
||||
return typeof(TextAttribute);
|
||||
}
|
||||
|
||||
public override string GetAssemblyName()
|
||||
{
|
||||
return AssemblyName;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attribute class contains assembly image and name - used on the Main screen to SummaryModule available components
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
|
||||
public class AddEditHardwareModuleImageAttribute : ImageAttribute
|
||||
{
|
||||
private BitmapImage _img;
|
||||
|
||||
public AddEditHardwareModuleImageAttribute() : this(null) { }
|
||||
public override BitmapImage AssemblyImage
|
||||
{
|
||||
get { _img = AssemblyInfo.GetImage(AssemblyNames.AddEditHardware.ToString()); return _img; }
|
||||
}
|
||||
public AddEditHardwareModuleImageAttribute(string s)
|
||||
{
|
||||
_img = AssemblyInfo.GetImage(AssemblyNames.AddEditHardware.ToString());
|
||||
}
|
||||
|
||||
public override Type GetAttributeType()
|
||||
{
|
||||
return typeof(ImageAttribute);
|
||||
}
|
||||
public override BitmapImage GetAssemblyImage()
|
||||
{
|
||||
return AssemblyImage;
|
||||
}
|
||||
private string _name;
|
||||
public override string AssemblyName
|
||||
{
|
||||
get { _name = AssemblyNames.AddEditHardware.ToString(); return _name; }
|
||||
}
|
||||
|
||||
public override string GetAssemblyName()
|
||||
{
|
||||
return AssemblyName;
|
||||
}
|
||||
private string _group;
|
||||
public override string AssemblyGroup
|
||||
{
|
||||
get { _group = eAssemblyGroups.Prepare.ToString(); return _group; }
|
||||
}
|
||||
|
||||
public override string GetAssemblyGroup()
|
||||
{
|
||||
return AssemblyGroup;
|
||||
}
|
||||
|
||||
private eAssemblyRegion _region;
|
||||
public override eAssemblyRegion AssemblyRegion
|
||||
{
|
||||
get { _region = eAssemblyRegion.AddEditHardwareRegion; return _region; }
|
||||
}
|
||||
public override eAssemblyRegion GetAssemblyRegion()
|
||||
{
|
||||
return AssemblyRegion;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="AddEditHardware.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@@ -0,0 +1,180 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace AddEditHardware.Resources {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class StringResources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal StringResources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AddEditHardware.Resources.StringResources", typeof(StringResources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Add.
|
||||
/// </summary>
|
||||
internal static string Add {
|
||||
get {
|
||||
return ResourceManager.GetString("Add", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Warning: Couldn't check for unique serial number: .
|
||||
/// </summary>
|
||||
internal static string CheckUniqueSNError {
|
||||
get {
|
||||
return ResourceManager.GetString("CheckUniqueSNError", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Configuration.
|
||||
/// </summary>
|
||||
internal static string Configuration {
|
||||
get {
|
||||
return ResourceManager.GetString("Configuration", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Type.
|
||||
/// </summary>
|
||||
internal static string DAS_Type {
|
||||
get {
|
||||
return ResourceManager.GetString("DAS_Type", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Generic/Stand-in hardware.
|
||||
/// </summary>
|
||||
internal static string DummyHardware {
|
||||
get {
|
||||
return ResourceManager.GetString("DummyHardware", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Firmware.
|
||||
/// </summary>
|
||||
internal static string Firmware {
|
||||
get {
|
||||
return ResourceManager.GetString("Firmware", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Empty.
|
||||
/// </summary>
|
||||
internal static string HardwareType_EMPTY {
|
||||
get {
|
||||
return ResourceManager.GetString("HardwareType_EMPTY", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to IP address.
|
||||
/// </summary>
|
||||
internal static string IPAddress {
|
||||
get {
|
||||
return ResourceManager.GetString("IPAddress", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Rack size.
|
||||
/// </summary>
|
||||
internal static string RackSize {
|
||||
get {
|
||||
return ResourceManager.GetString("RackSize", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Remove.
|
||||
/// </summary>
|
||||
internal static string Remove {
|
||||
get {
|
||||
return ResourceManager.GetString("Remove", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Serial number.
|
||||
/// </summary>
|
||||
internal static string SerialNumber {
|
||||
get {
|
||||
return ResourceManager.GetString("SerialNumber", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to TC-0{0}.
|
||||
/// </summary>
|
||||
internal static string TC {
|
||||
get {
|
||||
return ResourceManager.GetString("TC", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Error: Serial number is not unique, please provide a unique serial number when adding hardware.
|
||||
/// </summary>
|
||||
internal static string UniqueSNCheckFail {
|
||||
get {
|
||||
return ResourceManager.GetString("UniqueSNCheckFail", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
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);
|
||||
}
|
||||
_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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Windows.Markup;
|
||||
using AddEditHardware.Resources;
|
||||
|
||||
namespace AddEditHardware
|
||||
{
|
||||
[MarkupExtensionReturnType(typeof(string))]
|
||||
public class TranslateExtension : MarkupExtension
|
||||
{
|
||||
private readonly string _key;
|
||||
public TranslateExtension(string key) { _key = key; }
|
||||
|
||||
private const string NotFound = "#stringnotfound#";
|
||||
|
||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_key)) { return NotFound; }
|
||||
return StringResources.ResourceManager.GetString(_key) ?? NotFound + " " + _key;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{C3971121-D99E-4C60-B575-CB822DE33FC1}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>AddEditHardware</RootNamespace>
|
||||
<AssemblyName>AddEditHardware</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>CODE_ANALYSIS;DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>CODE_ANALYSIS;DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Expression.Interactions, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Microsoft.Expression.Interactions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<Reference Include="Microsoft.Xaml.Behaviors">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Microsoft.Xaml.Behaviors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="Prism">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Prism.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Prism.Unity.Wpf">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Prism.Unity.Wpf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Prism.Wpf">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Prism.Wpf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Unity.Abstractions">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Unity.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Unity.Container">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Unity.Container.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="Xceed.Wpf.Toolkit">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\Xceed.Wpf.Toolkit\Xceed.Wpf.Toolkit.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Model\Hardware.cs" />
|
||||
<Compile Include="Model\DASModule.cs" />
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="AddEditHardwareModule.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Resources\StringResources.Designer.cs">
|
||||
<DependentUpon>StringResources.resx</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<Compile Include="Resources\TranslateExtension.cs" />
|
||||
<Compile Include="ViewModel\AddEditHardwareViewModel.cs" />
|
||||
<Compile Include="View\AddEditHardwareView.xaml.cs">
|
||||
<DependentUpon>AddEditHardwareView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\StringResources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>StringResources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common.Core\DTS.Common.Core.csproj">
|
||||
<Project>{fab1f470-1574-4301-b56e-d3364aa93679}</Project>
|
||||
<Name>DTS.Common.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common.DAS.Concepts\DTS.Common.DAS.Concepts.csproj">
|
||||
<Project>{03D8C736-36EB-4CD1-A6D9-130452B23239}</Project>
|
||||
<Name>DTS.Common.DAS.Concepts</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common.ISO\DTS.Common.ISO.csproj">
|
||||
<Project>{4dccddd1-032f-430c-9a6f-231daca4fbd0}</Project>
|
||||
<Name>DTS.Common.ISO</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common.Storage\DTS.Common.Storage.csproj">
|
||||
<Project>{e0d1a7d0-dce8-403d-ba85-5a5d66ba1313}</Project>
|
||||
<Name>DTS.Common.Storage</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common.Utilities\DTS.Common.Utilities.csproj">
|
||||
<Project>{03eace47-ea59-44ac-b49d-956e4dc4d618}</Project>
|
||||
<Name>DTS.Common.Utilities</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common\DTS.Common.csproj">
|
||||
<Project>{114edc77-f3b5-4576-a91b-40818d503b55}</Project>
|
||||
<Name>DTS.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\IService\IService.csproj">
|
||||
<Project>{c9c45b72-05a3-4962-bc13-a78b1f4b1925}</Project>
|
||||
<Name>IService</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\SensorDB\SensorDB.csproj">
|
||||
<Project>{444ef10c-046e-47ad-a9a5-17318d488723}</Project>
|
||||
<Name>SensorDB</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Users\Users.csproj">
|
||||
<Project>{BE8D217D-6DA9-4BCA-B62A-A82325B33979}</Project>
|
||||
<Name>Users</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="View\AddEditHardwareView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
BIN
DataPRO/Modules/Hardware/AddEditHardware/.svn/wc.db
Normal file
BIN
DataPRO/Modules/Hardware/AddEditHardware/.svn/wc.db
Normal file
Binary file not shown.
182
DataPRO/Modules/Hardware/AddEditHardware/AddEditHardware.csproj
Normal file
182
DataPRO/Modules/Hardware/AddEditHardware/AddEditHardware.csproj
Normal file
@@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{C3971121-D99E-4C60-B575-CB822DE33FC1}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>AddEditHardware</RootNamespace>
|
||||
<AssemblyName>AddEditHardware</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>CODE_ANALYSIS;DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>CODE_ANALYSIS;DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Expression.Interactions, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Microsoft.Expression.Interactions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<Reference Include="Microsoft.Xaml.Behaviors">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Microsoft.Xaml.Behaviors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="Prism">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Prism.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Prism.Unity.Wpf">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Prism.Unity.Wpf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Prism.Wpf">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Prism.Wpf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Unity.Abstractions">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Unity.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Unity.Container">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Unity.Container.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="Xceed.Wpf.Toolkit">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\Xceed.Wpf.Toolkit\Xceed.Wpf.Toolkit.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Model\Hardware.cs" />
|
||||
<Compile Include="Model\DASModule.cs" />
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="AddEditHardwareModule.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Resources\StringResources.Designer.cs">
|
||||
<DependentUpon>StringResources.resx</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<Compile Include="Resources\TranslateExtension.cs" />
|
||||
<Compile Include="ViewModel\AddEditHardwareViewModel.cs" />
|
||||
<Compile Include="View\AddEditHardwareView.xaml.cs">
|
||||
<DependentUpon>AddEditHardwareView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\StringResources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>StringResources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common.Core\DTS.Common.Core.csproj">
|
||||
<Project>{fab1f470-1574-4301-b56e-d3364aa93679}</Project>
|
||||
<Name>DTS.Common.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common.DAS.Concepts\DTS.Common.DAS.Concepts.csproj">
|
||||
<Project>{03D8C736-36EB-4CD1-A6D9-130452B23239}</Project>
|
||||
<Name>DTS.Common.DAS.Concepts</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common.ISO\DTS.Common.ISO.csproj">
|
||||
<Project>{4dccddd1-032f-430c-9a6f-231daca4fbd0}</Project>
|
||||
<Name>DTS.Common.ISO</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common.Storage\DTS.Common.Storage.csproj">
|
||||
<Project>{e0d1a7d0-dce8-403d-ba85-5a5d66ba1313}</Project>
|
||||
<Name>DTS.Common.Storage</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common.Utilities\DTS.Common.Utilities.csproj">
|
||||
<Project>{03eace47-ea59-44ac-b49d-956e4dc4d618}</Project>
|
||||
<Name>DTS.Common.Utilities</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common\DTS.Common.csproj">
|
||||
<Project>{114edc77-f3b5-4576-a91b-40818d503b55}</Project>
|
||||
<Name>DTS.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\IService\IService.csproj">
|
||||
<Project>{c9c45b72-05a3-4962-bc13-a78b1f4b1925}</Project>
|
||||
<Name>IService</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\SensorDB\SensorDB.csproj">
|
||||
<Project>{444ef10c-046e-47ad-a9a5-17318d488723}</Project>
|
||||
<Name>SensorDB</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Users\Users.csproj">
|
||||
<Project>{BE8D217D-6DA9-4BCA-B62A-A82325B33979}</Project>
|
||||
<Name>Users</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="View\AddEditHardwareView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,139 @@
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Windows.Media.Imaging;
|
||||
using DTS.Common;
|
||||
using DTS.Common.Interface;
|
||||
using AddEditHardware;
|
||||
using DTS.Common.Interface.Hardware.AddEditHardware;
|
||||
using Prism.Modularity;
|
||||
using Unity;
|
||||
using Prism.Ioc;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
// ReSharper disable RedundantAttributeUsageProperty
|
||||
// ReSharper disable UnusedParameter.Local
|
||||
|
||||
[assembly: AddEditHardwareModuleName]
|
||||
[assembly: AddEditHardwareModuleImageAttribute]
|
||||
namespace AddEditHardware
|
||||
{
|
||||
[Export(typeof(IModule))]
|
||||
[Module(ModuleName = "AddEditHardwareModule")]
|
||||
public class AddEditHardwareModule : IModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Injected unity container
|
||||
/// </summary>
|
||||
private readonly IUnityContainer _unityContainer;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AddEditHardwareModule"/> class.
|
||||
/// </summary>
|
||||
/// <param name="unityContainer">Obtained reference of the unity container by using dependency injection.</param>
|
||||
public AddEditHardwareModule(IUnityContainer unityContainer)
|
||||
{
|
||||
_unityContainer = unityContainer;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
// Register View & View-Model with Unity dependency injection container as a singleton.
|
||||
_unityContainer.RegisterType<IAddEditHardwareView, AddEditHardwareView>();
|
||||
_unityContainer.RegisterType<IAddEditHardwareViewModel, AddEditHardwareViewModel>();
|
||||
}
|
||||
|
||||
public void OnInitialized(IContainerProvider containerProvider)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void RegisterTypes(IContainerRegistry containerRegistry)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attribute class contains assembly name
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
|
||||
public class AddEditHardwareModuleNameAttribute : TextAttribute
|
||||
{
|
||||
public AddEditHardwareModuleNameAttribute() : this(null) { }
|
||||
|
||||
public AddEditHardwareModuleNameAttribute(string s)
|
||||
{
|
||||
AssemblyName = AssemblyNames.AddEditHardware.ToString();
|
||||
}
|
||||
|
||||
public override string AssemblyName { get; }
|
||||
|
||||
public override Type GetAttributeType()
|
||||
{
|
||||
return typeof(TextAttribute);
|
||||
}
|
||||
|
||||
public override string GetAssemblyName()
|
||||
{
|
||||
return AssemblyName;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attribute class contains assembly image and name - used on the Main screen to SummaryModule available components
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
|
||||
public class AddEditHardwareModuleImageAttribute : ImageAttribute
|
||||
{
|
||||
private BitmapImage _img;
|
||||
|
||||
public AddEditHardwareModuleImageAttribute() : this(null) { }
|
||||
public override BitmapImage AssemblyImage
|
||||
{
|
||||
get { _img = AssemblyInfo.GetImage(AssemblyNames.AddEditHardware.ToString()); return _img; }
|
||||
}
|
||||
public AddEditHardwareModuleImageAttribute(string s)
|
||||
{
|
||||
_img = AssemblyInfo.GetImage(AssemblyNames.AddEditHardware.ToString());
|
||||
}
|
||||
|
||||
public override Type GetAttributeType()
|
||||
{
|
||||
return typeof(ImageAttribute);
|
||||
}
|
||||
public override BitmapImage GetAssemblyImage()
|
||||
{
|
||||
return AssemblyImage;
|
||||
}
|
||||
private string _name;
|
||||
public override string AssemblyName
|
||||
{
|
||||
get { _name = AssemblyNames.AddEditHardware.ToString(); return _name; }
|
||||
}
|
||||
|
||||
public override string GetAssemblyName()
|
||||
{
|
||||
return AssemblyName;
|
||||
}
|
||||
private string _group;
|
||||
public override string AssemblyGroup
|
||||
{
|
||||
get { _group = eAssemblyGroups.Prepare.ToString(); return _group; }
|
||||
}
|
||||
|
||||
public override string GetAssemblyGroup()
|
||||
{
|
||||
return AssemblyGroup;
|
||||
}
|
||||
|
||||
private eAssemblyRegion _region;
|
||||
public override eAssemblyRegion AssemblyRegion
|
||||
{
|
||||
get { _region = eAssemblyRegion.AddEditHardwareRegion; return _region; }
|
||||
}
|
||||
public override eAssemblyRegion GetAssemblyRegion()
|
||||
{
|
||||
return AssemblyRegion;
|
||||
}
|
||||
}
|
||||
}
|
||||
12
DataPRO/Modules/Hardware/AddEditHardware/App.config
Normal file
12
DataPRO/Modules/Hardware/AddEditHardware/App.config
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=ad8e64c4ca55c2f5">
|
||||
<section name="AddEditHardware.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=ad8e64c4ca55c2f5" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<userSettings>
|
||||
<HardwareList.Properties.Settings>
|
||||
</HardwareList.Properties.Settings>
|
||||
</userSettings>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
167
DataPRO/Modules/Hardware/AddEditHardware/Model/DASModule.cs
Normal file
167
DataPRO/Modules/Hardware/AddEditHardware/Model/DASModule.cs
Normal file
@@ -0,0 +1,167 @@
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using DTS.Common.Base;
|
||||
using DTS.Common.Enums.Hardware;
|
||||
using DTS.Common.Interface.Hardware.AddEditHardware;
|
||||
using DTS.Common.Utilities.Logging;
|
||||
|
||||
namespace HardwareList.Model
|
||||
{
|
||||
public class DASModule : BasePropertyChanged, IAddEditHardwareDASModule
|
||||
{
|
||||
public bool Disabled { get; set; } = false;
|
||||
|
||||
private SLICEBridgeTypes _sliceBridgeType = SLICEBridgeTypes.Bridge;
|
||||
|
||||
public SLICEBridgeTypes SLICEBridgeType
|
||||
{
|
||||
get => _sliceBridgeType;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _sliceBridgeType, value, "SLICEBridgeType");
|
||||
SetImage();
|
||||
}
|
||||
}
|
||||
|
||||
private HardwareTypes _moduleType = HardwareTypes.UNDEFINED;
|
||||
public HardwareTypes ModuleType
|
||||
{
|
||||
get => _moduleType;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _moduleType, value, "ModuleType");
|
||||
SetImage();
|
||||
}
|
||||
}
|
||||
|
||||
private string _serialNumber = "";
|
||||
public string SerialNumber
|
||||
{
|
||||
get => _serialNumber;
|
||||
set => SetProperty(ref _serialNumber, value, "SerialNumber");
|
||||
}
|
||||
|
||||
private ImageSource _dasImage = null;
|
||||
|
||||
public ImageSource DASImage
|
||||
{
|
||||
get => _dasImage;
|
||||
set => SetProperty(ref _dasImage, value, "DASImage");
|
||||
}
|
||||
|
||||
private static readonly SLICEBridgeTypes[] _availableNanoBridges = new SLICEBridgeTypes[]
|
||||
{
|
||||
SLICEBridgeTypes.Bridge,
|
||||
SLICEBridgeTypes.IEPE
|
||||
};
|
||||
|
||||
public SLICEBridgeTypes[] AvailableNanoBridges => _availableNanoBridges;
|
||||
|
||||
private static readonly SLICEBridgeTypes[] _availableMicroBridges = new SLICEBridgeTypes[]
|
||||
{
|
||||
SLICEBridgeTypes.Bridge,
|
||||
SLICEBridgeTypes.IEPE,
|
||||
SLICEBridgeTypes.ARS,
|
||||
SLICEBridgeTypes.ACC
|
||||
};
|
||||
|
||||
public SLICEBridgeTypes[] AvailableMicroBridges => _availableMicroBridges;
|
||||
|
||||
private static readonly HardwareTypes[] _availableRackModules = new HardwareTypes[]
|
||||
{
|
||||
HardwareTypes.UNDEFINED,
|
||||
HardwareTypes.SIM,
|
||||
HardwareTypes.TOM,
|
||||
HardwareTypes.DIM
|
||||
};
|
||||
public HardwareTypes[] AvailableRACKModules => _availableRackModules;
|
||||
|
||||
/// <summary>
|
||||
/// Uri for finding images using the application resources
|
||||
/// </summary>
|
||||
private static readonly Uri _baseUri = new Uri("pack://application:,,,/ResourceFile.xaml");
|
||||
private void SetImage()
|
||||
{
|
||||
var fileName = string.Empty;
|
||||
switch (ModuleType)
|
||||
{
|
||||
case HardwareTypes.SLICE_Bridge:
|
||||
switch (SLICEBridgeType)
|
||||
{
|
||||
case SLICEBridgeTypes.ACC:
|
||||
fileName = @"Assets/Hardware/SLICEACC_Side.png";
|
||||
break;
|
||||
case SLICEBridgeTypes.ARS:
|
||||
fileName = @"Assets/Hardware/SLICEARS_Side.png";
|
||||
break;
|
||||
case SLICEBridgeTypes.Bridge:
|
||||
fileName = @"Assets/Hardware/SLICEBridge_Side.png";
|
||||
break;
|
||||
case SLICEBridgeTypes.IEPE:
|
||||
fileName = @"Assets/Hardware/SLICEIEPE_Side.png";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case HardwareTypes.TOM:
|
||||
fileName = @"Assets/Hardware/TDAS_TOM_Front.jpg";
|
||||
break;
|
||||
case HardwareTypes.SIM:
|
||||
fileName = @"Assets/Hardware/TDAS_SIM_Front.jpg";
|
||||
break;
|
||||
case HardwareTypes.DIM:
|
||||
fileName = @"Assets/Hardware/TDAS_DIM_Front.jpg";
|
||||
break;
|
||||
default:
|
||||
fileName = @"Assets/Hardware/TDAS_Rack_Cover.png";
|
||||
break;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(fileName))
|
||||
{
|
||||
DASImage = null;
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var image = new BitmapImage(new Uri(_baseUri, fileName));
|
||||
image.Freeze();
|
||||
DASImage = image;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
APILogger.Log(
|
||||
$"Failed to get image: {fileName} for type: {ModuleType.ToString()} exception: {ex.Message.ToString()}");
|
||||
}
|
||||
}
|
||||
public IAddEditHardwareHardware OwningHardware { get; set; }
|
||||
|
||||
public string GetSerialNumberPrefix()
|
||||
{
|
||||
switch (ModuleType)
|
||||
{
|
||||
case HardwareTypes.DIM: return "DIM";
|
||||
case HardwareTypes.SIM: return "SIM";
|
||||
case HardwareTypes.SLICE_Bridge:
|
||||
{
|
||||
switch (SLICEBridgeType)
|
||||
{
|
||||
case SLICEBridgeTypes.ACC: return "AC";
|
||||
case SLICEBridgeTypes.ARS: return "AR";
|
||||
case SLICEBridgeTypes.Bridge: return "BR";
|
||||
case SLICEBridgeTypes.IEPE: return "IEPE";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HardwareTypes.TOM:
|
||||
return "TOM";
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
public DASModule()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
1699
DataPRO/Modules/Hardware/AddEditHardware/Model/Hardware.cs
Normal file
1699
DataPRO/Modules/Hardware/AddEditHardware/Model/Hardware.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("AddEditHardware")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("DTS")]
|
||||
[assembly: AssemblyProduct("AddEditHardware")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("79856d8f-191f-4528-b78f-892283e21e7b")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
26
DataPRO/Modules/Hardware/AddEditHardware/Properties/Settings.Designer.cs
generated
Normal file
26
DataPRO/Modules/Hardware/AddEditHardware/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace AddEditHardware.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.10.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="AddEditHardware.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
180
DataPRO/Modules/Hardware/AddEditHardware/Resources/StringResources.Designer.cs
generated
Normal file
180
DataPRO/Modules/Hardware/AddEditHardware/Resources/StringResources.Designer.cs
generated
Normal file
@@ -0,0 +1,180 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace AddEditHardware.Resources {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class StringResources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal StringResources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AddEditHardware.Resources.StringResources", typeof(StringResources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Add.
|
||||
/// </summary>
|
||||
internal static string Add {
|
||||
get {
|
||||
return ResourceManager.GetString("Add", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Warning: Couldn't check for unique serial number: .
|
||||
/// </summary>
|
||||
internal static string CheckUniqueSNError {
|
||||
get {
|
||||
return ResourceManager.GetString("CheckUniqueSNError", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Configuration.
|
||||
/// </summary>
|
||||
internal static string Configuration {
|
||||
get {
|
||||
return ResourceManager.GetString("Configuration", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Type.
|
||||
/// </summary>
|
||||
internal static string DAS_Type {
|
||||
get {
|
||||
return ResourceManager.GetString("DAS_Type", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Generic/Stand-in hardware.
|
||||
/// </summary>
|
||||
internal static string DummyHardware {
|
||||
get {
|
||||
return ResourceManager.GetString("DummyHardware", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Firmware.
|
||||
/// </summary>
|
||||
internal static string Firmware {
|
||||
get {
|
||||
return ResourceManager.GetString("Firmware", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Empty.
|
||||
/// </summary>
|
||||
internal static string HardwareType_EMPTY {
|
||||
get {
|
||||
return ResourceManager.GetString("HardwareType_EMPTY", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to IP address.
|
||||
/// </summary>
|
||||
internal static string IPAddress {
|
||||
get {
|
||||
return ResourceManager.GetString("IPAddress", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Rack size.
|
||||
/// </summary>
|
||||
internal static string RackSize {
|
||||
get {
|
||||
return ResourceManager.GetString("RackSize", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Remove.
|
||||
/// </summary>
|
||||
internal static string Remove {
|
||||
get {
|
||||
return ResourceManager.GetString("Remove", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Serial number.
|
||||
/// </summary>
|
||||
internal static string SerialNumber {
|
||||
get {
|
||||
return ResourceManager.GetString("SerialNumber", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to TC-0{0}.
|
||||
/// </summary>
|
||||
internal static string TC {
|
||||
get {
|
||||
return ResourceManager.GetString("TC", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Error: Serial number is not unique, please provide a unique serial number when adding hardware.
|
||||
/// </summary>
|
||||
internal static string UniqueSNCheckFail {
|
||||
get {
|
||||
return ResourceManager.GetString("UniqueSNCheckFail", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Add" xml:space="preserve">
|
||||
<value>Add</value>
|
||||
</data>
|
||||
<data name="CheckUniqueSNError" xml:space="preserve">
|
||||
<value>Warning: Couldn't check for unique serial number: </value>
|
||||
</data>
|
||||
<data name="Configuration" xml:space="preserve">
|
||||
<value>Configuration</value>
|
||||
</data>
|
||||
<data name="DAS_Type" xml:space="preserve">
|
||||
<value>Type</value>
|
||||
</data>
|
||||
<data name="DummyHardware" xml:space="preserve">
|
||||
<value>Generic/Stand-in hardware</value>
|
||||
</data>
|
||||
<data name="Firmware" xml:space="preserve">
|
||||
<value>Firmware</value>
|
||||
</data>
|
||||
<data name="HardwareType_EMPTY" xml:space="preserve">
|
||||
<value>Empty</value>
|
||||
</data>
|
||||
<data name="IPAddress" xml:space="preserve">
|
||||
<value>IP address</value>
|
||||
</data>
|
||||
<data name="RackSize" xml:space="preserve">
|
||||
<value>Rack size</value>
|
||||
</data>
|
||||
<data name="Remove" xml:space="preserve">
|
||||
<value>Remove</value>
|
||||
</data>
|
||||
<data name="SerialNumber" xml:space="preserve">
|
||||
<value>Serial number</value>
|
||||
</data>
|
||||
<data name="UniqueSNCheckFail" xml:space="preserve">
|
||||
<value>Error: Serial number is not unique, please provide a unique serial number when adding hardware</value>
|
||||
</data>
|
||||
<data name="TC" xml:space="preserve">
|
||||
<value>TC-0{0}</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Windows.Markup;
|
||||
using AddEditHardware.Resources;
|
||||
|
||||
namespace AddEditHardware
|
||||
{
|
||||
[MarkupExtensionReturnType(typeof(string))]
|
||||
public class TranslateExtension : MarkupExtension
|
||||
{
|
||||
private readonly string _key;
|
||||
public TranslateExtension(string key) { _key = key; }
|
||||
|
||||
private const string NotFound = "#stringnotfound#";
|
||||
|
||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_key)) { return NotFound; }
|
||||
return StringResources.ResourceManager.GetString(_key) ?? NotFound + " " + _key;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,352 @@
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Threading.Tasks;
|
||||
using DTS.Common.Events;
|
||||
using DTS.Common.Interface.Hardware.AddEditHardware;
|
||||
using DTS.Common.Interface.DataRecorders;
|
||||
using DTS.Common.Interface.DASFactory.Diagnostics;
|
||||
using System.Collections.Generic;
|
||||
using DTS.Common.Events.Hardware.HardwareList;
|
||||
using System.Linq;
|
||||
using System;
|
||||
using DTS.Common.Utilities.Logging;
|
||||
using DTS.Common.Interface.DASFactory.Diagnostics.HardwareList;
|
||||
using Prism.Events;
|
||||
using Prism.Regions;
|
||||
using Unity;
|
||||
using DTS.Common.Interactivity;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace AddEditHardware
|
||||
{
|
||||
/// <summary>
|
||||
/// this class handles AddEditHardware functionality
|
||||
/// </summary>
|
||||
[PartCreationPolicy(CreationPolicy.Shared)]
|
||||
public class AddEditHardwareViewModel : IAddEditHardwareViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether StandIn hardware is allowed or not
|
||||
/// datarecorders tile does not allow standin hardware, TestSetup and Group do
|
||||
/// </summary>
|
||||
public bool AllowStandin { get; set; } = true;
|
||||
/// <summary>
|
||||
/// The AddEditHardware View
|
||||
/// </summary>
|
||||
public IAddEditHardwareView View { get; set; }
|
||||
|
||||
private IEventAggregator _eventAggregator { get; }
|
||||
private IRegionManager _regionManager;
|
||||
private IUnityContainer UnityContainer { get; }
|
||||
|
||||
public InteractionRequest<Notification> NotificationRequest { get; }
|
||||
public InteractionRequest<Confirmation> ConfirmationRequest { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Occurs when a property value changes.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
public void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
#region constructors and initializers
|
||||
/// <summary>
|
||||
/// Creates a new instance of the HardwareListViewModel
|
||||
/// </summary>
|
||||
/// <param name="view"></param>
|
||||
/// <param name="regionManager">The logical placeholder defined within the application's UI (in the shell or within views) into which views are displayed.</param>
|
||||
/// <param name="eventAggregator">The EventAggregator which allows different components to publish/subscribe to events without being coupled to each other.</param>
|
||||
/// <param name="unityContainer">The unityContainer.</param>
|
||||
public AddEditHardwareViewModel(IAddEditHardwareView view, IRegionManager regionManager,
|
||||
IEventAggregator eventAggregator, IUnityContainer unityContainer)
|
||||
{
|
||||
View = view;
|
||||
View.DataContext = this;
|
||||
|
||||
NotificationRequest = new InteractionRequest<Notification>();
|
||||
ConfirmationRequest = new InteractionRequest<Confirmation>();
|
||||
|
||||
_eventAggregator = eventAggregator;
|
||||
UnityContainer = unityContainer;
|
||||
_regionManager = regionManager;
|
||||
_eventAggregator.GetEvent<RaiseNotification>().Subscribe(OnRaiseNotification);
|
||||
_eventAggregator.GetEvent<BusyIndicatorChangeNotification>()
|
||||
.Subscribe(OnBusyIndicatorNotification, ThreadOption.PublisherThread, true);
|
||||
}
|
||||
//required if you want to use the vm in the view xaml
|
||||
public AddEditHardwareViewModel()
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
/// <summary>
|
||||
/// used to pass in access to SLICE6TreeView module
|
||||
/// </summary>
|
||||
public void SetSLICE6TreeView(ISLICE6TreeView treeView, IHardwareListViewModel treeViewModel)
|
||||
{
|
||||
SLICE6TreeView = treeView;
|
||||
SLICE6TreeViewModel = treeViewModel;
|
||||
}
|
||||
public void Unset()
|
||||
{
|
||||
}
|
||||
public void Cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
public Task CleanupAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(object parameter)
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(object parameter, object model)
|
||||
{
|
||||
}
|
||||
|
||||
public Task InitializeAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task InitializeAsync(object parameter)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
/// <summary>
|
||||
/// SLICE6TreeView interface
|
||||
/// can be null [not shown in test setups/groups currently]
|
||||
/// </summary>
|
||||
public ISLICE6TreeView SLICE6TreeView { get; private set; }
|
||||
/// <summary>
|
||||
/// SLICE6TreeViewModule, can be null
|
||||
/// </summary>
|
||||
public IHardwareListViewModel SLICE6TreeViewModel { get; private set; }
|
||||
public void Activated()
|
||||
{
|
||||
View?.Activated();
|
||||
if (null != _hardware && !AllowStandin)
|
||||
{
|
||||
_hardware.StandIn = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnBusyIndicatorNotification(bool eventArg)
|
||||
{
|
||||
IsBusy = eventArg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)
|
||||
{
|
||||
// The NotificationRequest.Raise triggers the Invoke() method of the PopupWindowAction object to show the NotificationWindow window
|
||||
// Notification object expects a NotificationContentEventArgsWithoutTitle object and a Title string.
|
||||
var eventArgsWithoutTitle = new NotificationContentEventArgs(eventArgsWithTitle.Message, "",
|
||||
eventArgsWithTitle.Image, string.Empty);
|
||||
|
||||
NotificationRequest.Raise(new Notification
|
||||
{
|
||||
Content = eventArgsWithoutTitle,
|
||||
Title = eventArgsWithTitle.Title
|
||||
});
|
||||
}
|
||||
|
||||
public void SetHardware(IDASHardware hw, IISOHardware isoHW)
|
||||
{
|
||||
NotificationsOn = false;
|
||||
if (null == hw)
|
||||
{
|
||||
Hardware = new Model.Hardware();
|
||||
}
|
||||
else
|
||||
{
|
||||
Hardware = new Model.Hardware(hw, isoHW);
|
||||
}
|
||||
}
|
||||
|
||||
public void NotifyModified()
|
||||
{
|
||||
if (!NotificationsOn)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_eventAggregator.GetEvent<PageModifiedEvent>()
|
||||
.Publish(new PageModifiedArg(PageModifiedArg.Status.Modified, null));
|
||||
}
|
||||
public IISOHardware GetISOHardware()
|
||||
{
|
||||
var isoHW = Hardware.ToISOHardware();
|
||||
if ((isoHW != null) && Hardware.StandIn && !Guid.TryParse(Hardware.SerialNumber, out var guid))
|
||||
{
|
||||
guid = Guid.NewGuid();
|
||||
Hardware.SerialNumber = guid.ToString();
|
||||
isoHW.SerialNumber = guid.ToString();
|
||||
isoHW.FirstUseDate = null;
|
||||
isoHW.IsFirstUseValid = true;
|
||||
isoHW.CalDate = DateTime.Today;
|
||||
}
|
||||
return isoHW;
|
||||
}
|
||||
public bool Validate(IISOHardware isoHW, ref List<string> errors, ref List<string> warnings, bool displayWindow,
|
||||
bool IsAdd)
|
||||
{
|
||||
var bValid = true;
|
||||
|
||||
if (!isoHW.ValidateSerialNumber(ref errors))
|
||||
{
|
||||
bValid = false;
|
||||
}
|
||||
//17639 Adding non-Stand-in DAS from Test Setups tab doesn't warn if DAS already exists
|
||||
if (IsAdd)
|
||||
{
|
||||
try
|
||||
{
|
||||
//17639 Adding non-Stand-in DAS from Test Setups tab doesn't warn if DAS already exists
|
||||
if (!Model.Hardware.CheckUniqueSN(isoHW.SerialNumber))
|
||||
{
|
||||
errors.Add(Resources.StringResources.UniqueSNCheckFail);
|
||||
bValid = false;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
APILogger.Log(ex);
|
||||
bValid = true;
|
||||
errors.Add($"{Resources.StringResources.CheckUniqueSNError}{ex.Message}");
|
||||
}
|
||||
}
|
||||
if (!isoHW.ValidateIPAddress(ref errors))
|
||||
{
|
||||
bValid = false;
|
||||
}
|
||||
|
||||
PublishPageError(displayWindow, errors, warnings);
|
||||
return bValid;
|
||||
}
|
||||
public void PublishPageError(bool displayWindow, List<string> errors, List<string> warnings)
|
||||
{
|
||||
if (displayWindow && (errors.Any() || warnings.Any()))
|
||||
{
|
||||
var newList = errors.ToList();
|
||||
newList.AddRange(warnings.ToArray());
|
||||
_eventAggregator.GetEvent<PageErrorEvent>().Publish(new PageErrorArg(newList.ToArray(), null));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Updates all SLICE6 associations related to a SLICE6DB
|
||||
/// </summary>
|
||||
public void SaveSLICE6Associations()
|
||||
{
|
||||
switch (Hardware.HardwareType)
|
||||
{
|
||||
case DTS.Common.Enums.Hardware.HardwareTypes.SLICE6DB:
|
||||
case DTS.Common.Enums.Hardware.HardwareTypes.SLICE6DB3:
|
||||
case DTS.Common.Enums.Hardware.HardwareTypes.SLICE6DB_InDummy:
|
||||
SLICE6TreeViewModel?.SaveSLICE6Associations(Hardware.SerialNumber);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
if (!(Hardware is Model.Hardware model)) { return; }
|
||||
|
||||
Model.Hardware.Save(model, TestId, model.IsAdd);
|
||||
|
||||
SaveSLICE6Associations();
|
||||
_eventAggregator.GetEvent<HardwareSavedEvent>()
|
||||
.Publish(new Tuple<int, string>(model.ISOHardware.DASId, model.SerialNumber));
|
||||
SLICE6TreeViewModel?.LoadTreeView(model.SerialNumber);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
public int? TestId { get; set; }
|
||||
public bool NotificationsOn { get; set; } = false;
|
||||
private IAddEditHardwareHardware _hardware = new Model.Hardware();
|
||||
|
||||
/// <summary>
|
||||
/// hardware being operated on in viewmodel
|
||||
/// </summary>
|
||||
public IAddEditHardwareHardware Hardware
|
||||
{
|
||||
get => _hardware;
|
||||
set
|
||||
{
|
||||
_hardware = value;
|
||||
OnPropertyChanged("Hardware");
|
||||
OnPropertyChanged("SerialNumber"); //In case modules were added
|
||||
OnPropertyChanged("FirmwareVersion");
|
||||
OnPropertyChanged("IPAddress");
|
||||
SLICE6TreeViewModel?.LoadTreeView(_hardware.SerialNumber);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsDirty { get; private set; }
|
||||
private bool _isBusy;
|
||||
|
||||
public bool IsBusy
|
||||
{
|
||||
get => _isBusy;
|
||||
set
|
||||
{
|
||||
_isBusy = value;
|
||||
OnPropertyChanged("IsBusy");
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isMenuIncluded;
|
||||
|
||||
public bool IsMenuIncluded
|
||||
{
|
||||
get => _isMenuIncluded;
|
||||
set
|
||||
{
|
||||
_isMenuIncluded = value;
|
||||
OnPropertyChanged("IsMenuIncluded");
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isNavigationIncluded;
|
||||
|
||||
public bool IsNavigationIncluded
|
||||
{
|
||||
get => _isNavigationIncluded;
|
||||
set
|
||||
{
|
||||
_isNavigationIncluded = value;
|
||||
OnPropertyChanged("IsNavigationIncluded");
|
||||
}
|
||||
}
|
||||
|
||||
//public string ListViewId => "HardwareListView";
|
||||
|
||||
#endregion Properties
|
||||
|
||||
#region Commands
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = "")]
|
||||
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user