init
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
using Prism.Events;
|
||||
|
||||
namespace DTS.Common.Events
|
||||
{
|
||||
public class LoadExportModuleEvent : PubSubEvent<LoadExportModuleArg> { }
|
||||
public class LoadExportModuleArg : EventBase
|
||||
{
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 387 B |
@@ -0,0 +1,27 @@
|
||||
using Prism.Events;
|
||||
|
||||
namespace DTS.Common.Events.Hardware.HardwareList
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// The HardwareListHardwareSelectedEvent event.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>This event is used to indicate hardware was selected.</remarks>
|
||||
///
|
||||
public class HardwareListHardwareIncludedEvent : PubSubEvent<HardwareListHardwareIncludedEventArgs> { }
|
||||
|
||||
public class HardwareListHardwareIncludedEventArgs
|
||||
{
|
||||
public string SerialNumber { get; private set; }
|
||||
public int DASId { get; private set; }
|
||||
public bool Included { get; private set; }
|
||||
|
||||
public HardwareListHardwareIncludedEventArgs(string serial, bool included, int dasId)
|
||||
{
|
||||
DASId = dasId;
|
||||
SerialNumber = serial;
|
||||
Included = included;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using DTS.Common.Enums;
|
||||
|
||||
namespace DTS.Common.Interface.Sensors
|
||||
{
|
||||
/// <summary>
|
||||
/// this interface describes the default properties and methods for a squib
|
||||
/// It's intended to allow interaction with squib defaults
|
||||
/// 13574 Design for Default squib config file settings
|
||||
/// </summary>
|
||||
public interface ISquibSettingDefaults
|
||||
{
|
||||
/// <summary>
|
||||
/// gets/sets the squib tolerance low default
|
||||
/// the low tolerance for squib resistance in ohms
|
||||
/// this is the minimum resistance value for a valid squib load
|
||||
/// </summary>
|
||||
double ToleranceLowDefault { get; set; }
|
||||
/// <summary>
|
||||
/// gets/sets the squib tolerance high default
|
||||
/// the high tolerance for squib resistance in ohms
|
||||
/// this is the maximum resistance value for a valid squib load
|
||||
/// </summary>
|
||||
double ToleranceHighDefault { get; set; }
|
||||
/// <summary>
|
||||
/// gets/sets the squib output current default
|
||||
/// the squib output current in amps
|
||||
/// this is the current outputted by a squib in constant current
|
||||
/// mode. It is only observed in constant current
|
||||
/// </summary>
|
||||
double OutputCurrentDefault { get; set; }
|
||||
/// <summary>
|
||||
/// gets/sets the squib measurement type default
|
||||
/// the squib measurement type controls the alternate measurement type of
|
||||
/// of a squib
|
||||
/// </summary>
|
||||
SquibMeasurementType MeasurementTypeDefault { get; set; }
|
||||
/// <summary>
|
||||
/// gets/sets the squib firemode default
|
||||
/// the squib fire mode determines how the squib is fired
|
||||
/// [cap discharge/constant current/ac discharge]
|
||||
/// </summary>
|
||||
SquibFireMode FireModeDefault { get; set; }
|
||||
/// <summary>
|
||||
/// gets/sets whether to limit squib output duration default
|
||||
/// Limit duration allows for duration of output to be constrained
|
||||
/// </summary>
|
||||
bool LimitDurationDefault { get; set; }
|
||||
/// <summary>
|
||||
/// gets/sets the squib output duration in ms default
|
||||
/// the squib fire duration is the amount of time to output current
|
||||
/// It is only valid if the output is being limited
|
||||
/// </summary>
|
||||
double FireDurationMS { get; set; }
|
||||
/// <summary>
|
||||
/// gets/sets the delay before firing squib in ms default
|
||||
/// the squib fire delay is the amount of time after a trigger is received
|
||||
/// before output begins
|
||||
/// </summary>
|
||||
double FireDelayMS { get; set; }
|
||||
/// <summary>
|
||||
/// indicates whether the setting is valid or not
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool Validate();
|
||||
/// <summary>
|
||||
/// indicates whether tolerance value is valid
|
||||
/// </summary>
|
||||
bool ToleranceValid { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using DTS.Common.Interface.DASFactory.Diagnostics.HardwareList;
|
||||
using Prism.Events;
|
||||
|
||||
namespace DTS.Common.Events.Hardware.HardwareList
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// The HardwareListHardwareSelectedEvent event.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>This event is used to indicate hardware was selected.</remarks>
|
||||
///
|
||||
public class HardwareListEditHardwareEvent : PubSubEvent<string> { }
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1,203 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using DTS.Common.Base;
|
||||
using Prism.Regions;
|
||||
|
||||
namespace DTS.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides extention for the RegionManager .
|
||||
/// </summary>
|
||||
public static class RegionManagerExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Clears the specified region.
|
||||
/// </summary>
|
||||
/// <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="regionName">The region name.</param>
|
||||
public static void ClearRegion(this IRegionManager regionManager, string regionName)
|
||||
{
|
||||
regionManager.Regions[regionName].Views.ToList()
|
||||
.ForEach(view => RemoveView(regionManager, view));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of views from the specified region.
|
||||
/// </summary>
|
||||
/// <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="regionName">The region name.</param>
|
||||
/// <param name="interfaceForView">Type of the views' interface.</param>
|
||||
/// <returns>A list of views.</returns>
|
||||
public static IList<object> GetViews(this IRegionManager regionManager, string regionName, Type interfaceForView)
|
||||
{
|
||||
var views = new List<object>();
|
||||
|
||||
regionManager.Regions[regionName].Views.ToList()
|
||||
.ForEach(view =>
|
||||
{
|
||||
if (interfaceForView.IsInstanceOfType(view))
|
||||
views.Add(view);
|
||||
});
|
||||
|
||||
return views;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a View from the specified region.
|
||||
/// </summary>
|
||||
/// <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="regionName">The region name.</param>
|
||||
/// <param name="interfaceForView">Type of the View's interface.</param>
|
||||
/// <returns>A View.</returns>
|
||||
public static object GetView(this IRegionManager regionManager, string regionName, Type interfaceForView)
|
||||
{
|
||||
object view = null;
|
||||
regionManager.Regions[regionName].Views.ToList()
|
||||
.ForEach(aView =>
|
||||
{
|
||||
if (interfaceForView.IsInstanceOfType(aView))
|
||||
view = aView;
|
||||
});
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Activates a View in the specified region in case View exists.
|
||||
/// </summary>
|
||||
/// <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="regionName">The region name.</param>
|
||||
/// <param name="viewType">Type of the View.</param>
|
||||
/// <returns></returns>
|
||||
public static bool ActivateViewIfExists(this IRegionManager regionManager, string regionName, Type viewType)
|
||||
{
|
||||
var returnValue = false;
|
||||
var existingView = regionManager.GetView(regionName, viewType) as IBaseView;
|
||||
if (existingView != null)
|
||||
{
|
||||
returnValue = true;
|
||||
regionManager.ActivateSingleView(regionName, existingView);
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
private static void ActivateSingleView(this IRegionManager regionManager, string regionName, IBaseView existingView)
|
||||
{
|
||||
regionManager.Regions[regionName].Activate(existingView);
|
||||
var viewModel = existingView.DataContext as IBaseViewModel;
|
||||
if (viewModel != null)
|
||||
{
|
||||
viewModel.Activated();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deactivates views in the specified region.
|
||||
/// </summary>
|
||||
/// <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="regionName">The region name.</param>
|
||||
public static void DeactivateViews(this IRegionManager regionManager, string regionName)
|
||||
{
|
||||
var activeViews = regionManager.Regions[regionName].ActiveViews.ToList();
|
||||
if (activeViews.Count > 0)
|
||||
{
|
||||
activeViews.ForEach(one => regionManager.Regions[regionName].Deactivate(one));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes views from the specified region.
|
||||
/// </summary>
|
||||
/// <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="regionName">The region name.</param>
|
||||
public static void RemoveViews(this IRegionManager regionManager, string regionName)
|
||||
{
|
||||
var activeViews = regionManager.Regions[regionName].ActiveViews.ToList();
|
||||
if (activeViews.Count > 0)
|
||||
{
|
||||
activeViews.ForEach(one => regionManager.Regions[regionName].Remove(one));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Activates a single View in the specified region.
|
||||
/// </summary>
|
||||
/// <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="regionName">The region name.</param>
|
||||
public static void ActivateLastView(this IRegionManager regionManager, string regionName)
|
||||
{
|
||||
var activeViews = regionManager.Regions[regionName].ActiveViews.ToList();
|
||||
if (activeViews.Count > 0)
|
||||
{
|
||||
var existingView = activeViews.Last() as IBaseView;
|
||||
if (existingView != null)
|
||||
{
|
||||
regionManager.ActivateSingleView(regionName, existingView);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
activeViews = regionManager.Regions[regionName].Views.ToList();
|
||||
if (activeViews.Count > 0)
|
||||
{
|
||||
var existingView = activeViews.Last() as IBaseView;
|
||||
if (existingView != null)
|
||||
{
|
||||
regionManager.ActivateSingleView(regionName, existingView);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a View to the specified region.
|
||||
/// </summary>
|
||||
/// <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="regionName">The region name.</param>
|
||||
/// <param name="view">A View.</param>
|
||||
public static void AddViewToRegion(this IRegionManager regionManager, string regionName, object view)
|
||||
{
|
||||
regionManager.Regions[regionName].Add(view);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a View to the specified region and activates it.
|
||||
/// </summary>
|
||||
/// <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="regionName">The region name.</param>
|
||||
/// <param name="view">A View.</param>
|
||||
public static void AddViewToRegionActivate(this IRegionManager regionManager, string regionName, object view)
|
||||
{
|
||||
regionManager.Regions[regionName].Add(view);
|
||||
regionManager.Regions[regionName].Activate(view);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified View from all regions.
|
||||
/// </summary>
|
||||
/// <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="view">A View to be removed.</param>
|
||||
public static void RemoveView(this IRegionManager regionManager, object view)
|
||||
{
|
||||
foreach (var region in regionManager.Regions)
|
||||
{
|
||||
if (region.Views.Contains(view))
|
||||
region.Remove(view);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified View from the specified region.
|
||||
/// </summary>
|
||||
/// <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="regionName">The region name.</param>
|
||||
/// <param name="view">A View to be removed.</param>
|
||||
public static void RemoveView(this IRegionManager regionManager, string regionName, object view)
|
||||
{
|
||||
var region = regionManager.Regions[regionName];
|
||||
region.Deactivate(view);
|
||||
region.Remove(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user