This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
using System.Collections.Generic;
using DTS.Common.Base;
using DTS.Common.Interface;
using Prism.Events;
// ReSharper disable CheckNamespace
namespace DTS.Common.Events
{
/// <summary>
/// The number of selected Tests changed event.
/// </summary>
public class GraphSelectedChannelsNotification : PubSubEvent<GraphSelectedChannelsNotificationArg> { }
public class GraphSelectedChannelsNotificationArg
{
public List<ITestChannel> SelectedChannels { get; set; }
/// <summary>
/// 24417 start pulling apart viewer to allow reuse for PSD reports
/// </summary>
public IBaseViewModel ParentVM { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
using System.Net.NetworkInformation;
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface INetworkAdapterViewModel : IBaseViewModel
{
NetworkInterface SelectedNetworkInterface { get; set; }
}
}

View File

@@ -0,0 +1,24 @@
using System;
using System.Windows.Data;
using System.Windows.Media;
namespace DTS.Common.Converters
{
public class FaultedTextConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value is bool b)
{
if (b) { return Strings.Strings.Faulted; }
else { return Strings.Strings.FaultsClear; }
}
return Strings.Strings.FaultsClear;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return null;
}
}
}

View File

@@ -0,0 +1,321 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.ComponentModel;
using DTS.Common.Events;
using Prism.Events;
using Prism.Ioc;
using Unity;
namespace DTS.Common.Controls
{
/// <summary>
/// Interaction logic for CommonStatusRibbon.xaml
/// this is a helper class for the status ribbon + status text shown on pages that have status feedback
/// </summary>
public partial class CommonStatusRibbon : UserControl, INotifyPropertyChanged
{
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));
}
private IUnityContainer _unityContainer { get; }
private IEventAggregator _eventAggregator { get; }
public CommonStatusRibbon()
{
InitializeComponent();
if (_unityContainer == null) { _unityContainer = ContainerLocator.Container.Resolve<IUnityContainer>(); }
if (_eventAggregator == null)
{
_eventAggregator = ContainerLocator.Container.Resolve<IEventAggregator>();
}
_eventAggregator.GetEvent<ProgressBarEvent>().Subscribe(OnProgressBarEvent, ThreadOption.PublisherThread);
}
private void OnProgressBarEvent(ProgressBarEventArg arg)
{
if (arg.ProgressBarName != ProgressBarName) { return; }
if (null != arg.ProgressBarText)
{
SetAggregateStatusText(arg.ProgressBarText);
}
if (!double.IsNaN(arg.ProgressBarPercentage))
{
SetProgressValue(Convert.ToInt32(arg.ProgressBarPercentage));
}
SetProgressBarVisibility(arg.ProgressBarVisibility);
SetAggregateStatusColor(arg.ProgressBarColor);
}
#region ProgressBarValue
public static readonly DependencyProperty SetProgressBarValueProperty =
DependencyProperty.Register("ProgressBarValue", typeof(int), typeof(CommonStatusRibbon),
new PropertyMetadata(0, OnProgressValueChanged));
private static void OnProgressValueChanged(DependencyObject d,
DependencyPropertyChangedEventArgs e)
{
var sr = d as CommonStatusRibbon;
sr?.OnProgressBarValueChanged(e);
}
private void OnProgressBarValueChanged(DependencyPropertyChangedEventArgs e)
{
SetProgressValue(Convert.ToInt32(e.NewValue));
}
private delegate void SetProgressValueDelegate(int value);
private int _progressBarValue;
/// <summary>
/// sets the progress bar progress. Not thread friendly, call SetProgressValue if coming from a background thread
/// </summary>
public int ProgressBarValue
{
get => _progressBarValue;
set => SetProperty(ref _progressBarValue, value, "ProgressBarValue");
}
/// <summary>
/// sets the progress bar progress
/// thread friendly
/// </summary>
/// <param name="value">progress from 0-100. values less than 0 or greater than 100 are normalized to 0 or 100</param>
public void SetProgressValue(int value)
{
if (!Dispatcher.CheckAccess())
{
Dispatcher.BeginInvoke(new SetProgressValueDelegate(SetProgressValue), value);
return;
}
if (value < 0) { value = 0; }
else if (value > 100) { value = 100; }
ProgressBarValue = value;
}
#endregion
#region ProgressBarVisibility
public static readonly DependencyProperty SetProgressBarVisibilityProperty =
DependencyProperty.Register("ProgressBarVisibility", typeof(Visibility), typeof(CommonStatusRibbon),
new PropertyMetadata(Visibility.Collapsed, OnProgressVisibilityChanged));
private static void OnProgressVisibilityChanged(DependencyObject d,
DependencyPropertyChangedEventArgs e)
{
var sr = d as CommonStatusRibbon;
sr?.OnProgressBarVisibilityChanged(e);
}
private void OnProgressBarVisibilityChanged(DependencyPropertyChangedEventArgs e)
{
SetProgressBarVisibility((Visibility)e.NewValue);
}
/// <summary>
/// controls the progress bar visibility.
/// SetProgressBarVisibility is thread friendly
/// </summary>
private Visibility _progressBarVisibility = Visibility.Hidden;
public Visibility ProgressBarVisibility
{
get => _progressBarVisibility;
set => SetProperty(ref _progressBarVisibility, value, "ProgressBarVisibility");
}
private delegate void SetProgressBarVisibilityDelegate(Visibility v);
/// <summary>
/// sets the progress bar visibility
/// thread friendly
/// </summary>
/// <param name="v"></param>
public void SetProgressBarVisibility(Visibility v)
{
if (!Dispatcher.CheckAccess())
{
Dispatcher.BeginInvoke(new SetProgressBarVisibilityDelegate(SetProgressBarVisibility), v);
}
else
{
ProgressBarVisibility = v;
}
}
#endregion
#region ProgressBarName
public static readonly DependencyProperty ProgressBarNameProperty =
DependencyProperty.Register("ProgressBarName", typeof(string), typeof(CommonStatusRibbon),
new PropertyMetadata("OverallStatus", OnProgressBarNameChanged));
private static void OnProgressBarNameChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var sr = d as CommonStatusRibbon;
sr?.OnProgressBarNameChanged(e);
}
private void OnProgressBarNameChanged(DependencyPropertyChangedEventArgs e)
{
SetProgressBarName(Convert.ToString(e.NewValue));
}
public void SetProgressBarName(string s)
{
if (!Dispatcher.CheckAccess())
{
Dispatcher.BeginInvoke(new Action(() => SetProgressBarName(s)));
}
else
{
ProgressBarName = s;
}
}
private string _progressBarName = "OverallStatus";
public string ProgressBarName
{
get => _progressBarName;
set => SetProperty(ref _progressBarName, value, "ProgressBarName");
}
#endregion ProgressBarName
#region AggregateStatusText
public static readonly DependencyProperty SetAggregateStatusTextProperty =
DependencyProperty.Register("AggregateStatusText", typeof(string), typeof(CommonStatusRibbon),
new PropertyMetadata("", OnAggregateStatusTextChanged));
private static void OnAggregateStatusTextChanged(DependencyObject d,
DependencyPropertyChangedEventArgs e)
{
var sr = d as CommonStatusRibbon;
sr?.OnAggregateStatusTextChanged(e);
}
private void OnAggregateStatusTextChanged(DependencyPropertyChangedEventArgs e)
{
SetAggregateStatusText(Convert.ToString(e.NewValue));
}
/// <summary>
/// retrieves the status text
/// to set status text use SetStatusTextNoTranslate or the property Status
/// </summary>
private string _aggregateStatusText = "---";
public string AggregateStatusText
{
get => _aggregateStatusText;
set => SetProperty(ref _aggregateStatusText, value, "AggregateStatusText");
}
public void SetAggregateStatusText(string s)
{
if (!Dispatcher.CheckAccess())
{
Dispatcher.BeginInvoke(new Action(() => SetAggregateStatusText(s)));
}
else
{
AggregateStatusText = s;
}
}
#endregion
#region AggregateStatusColor
public static readonly DependencyProperty SetAggregateStatusColorProperty =
DependencyProperty.Register("AggregateStatusColor", typeof(Color), typeof(CommonStatusRibbon),
new PropertyMetadata(Colors.AliceBlue, OnAggregateStatusColorChanged));
private static void OnAggregateStatusColorChanged(DependencyObject d,
DependencyPropertyChangedEventArgs e)
{
var sr = d as CommonStatusRibbon;
sr?.OnAggregateStatusColorChanged(e);
}
private void OnAggregateStatusColorChanged(DependencyPropertyChangedEventArgs e)
{
SetAggregateStatusColor((Color)e.NewValue);
}
private delegate void SetStatusColorDelegate(Color c);
/// <summary>
/// sets the color of the ribbon background
/// thread friendly
/// </summary>
/// <param name="c"></param>
public void SetAggregateStatusColor(Color c)
{
if (!Dispatcher.CheckAccess())
{
Dispatcher.BeginInvoke(new SetStatusColorDelegate(SetAggregateStatusColor), c);
return;
}
AggregateStatusColor = c;
}
private Color _aggregateStatusColor = Colors.AliceBlue;
/// <summary>
/// determines the color of the status background
/// not thread friendly
/// SetAggregateStatusColor is thread friendly
/// </summary>
public Color AggregateStatusColor
{
get => _aggregateStatusColor;
set
{
SetAlert(false);
SetProperty(ref _aggregateStatusColor, value, "AggregateStatusColor");
}
}
#endregion
private Visibility _alertVisibility = Visibility.Hidden;
public Visibility AlertVisibility
{
get => _alertVisibility;
set => SetProperty(ref _alertVisibility, value, "AlertVisibility");
}
private SolidColorBrush _textColor = new SolidColorBrush(Colors.Black);
public SolidColorBrush TextColor
{
get => _textColor;
set
{
SetProperty(ref _textColor, value, "TextColor");
OnPropertyChanged("TextColor");
}
}
private bool _isAlertSet;
public delegate void SetAlertDelegate(bool set);
public void SetAlert(bool set)
{
if (!Dispatcher.CheckAccess())
{
Dispatcher.BeginInvoke(new SetAlertDelegate(SetAlert), set);
return;
}
if (set == _isAlertSet) { return; }
_isAlertSet = set;
if (set)
{
//turn on alert
TextColor = BrushesAndColors.Brush_ArmSystemForeground;
AlertVisibility = Visibility.Visible;
}
else
{
//turn off alert
TextColor = new SolidColorBrush(Colors.Black);
AlertVisibility = Visibility.Hidden;
}
}
}
}

View File

@@ -0,0 +1,165 @@
using System.ComponentModel;
using System.Windows.Data;
using DTS.Common.Base.Classes;
using DTS.Common.Converters;
using DTS.Common.Enums.Sensors;
using DTS.Common.Interface.Sensors.SoftwareFilters;
using DTS.Common.Utils;
using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;
// ReSharper disable InconsistentNaming
// ReSharper disable CheckNamespace
namespace DTS.Common
{
[TypeConverter(typeof(EnumDescriptionTypeConverter))]
public enum CFCFilter
{
[Description("None")]
None = 0,
[Description("Unfiltered")]
Unfiltered = -2,
[Description("CFC 10")]
Class10 = 17,
[Description("CFC 60")]
Class60 = 100,
[Description("CFC 180")]
Class180 = 300,
[Description("CFC 600")]
Class600 = 1000,
[Description("CFC 1000")]
Class1000 = 1650
}
public class CFCFilterItemSource : IItemsSource
{
public ItemCollection GetValues()
{
return EnumUtil.GetValuesList<CFCFilter>();
}
}
/// <summary>
/// this class could be extended to become an IValueConverter, but for now it just serves as a mechanism for
/// going from the serialized in DTS files form of CFC filter to enum and vice versa.
/// </summary>
public class CFCFilterDTSFileStringConverter
{
//returns a string representing the isocode field for software filter given a software filter
//returns ? if filter is not known
public static string GetIsoCodeFromString(string s, bool bUseZeroForUnfiltered = false)
{
var filter = GetFilterFromString(s);
return CFCFilterToCFC(filter);
}
/// <summary>
/// converts from a string (like in ITestChannel) to the CFC enum
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static CFCFilter GetFilterFromString(string s)
{
if (string.IsNullOrEmpty(s)) return CFCFilter.Unfiltered;
switch (s.ToLower())
{
case "cfc 10":
//added because "CFC " is stripped off in some exports... (FTSS.TSV)
case "10":
return CFCFilter.Class10;
case "cfc 60":
case "60":
return CFCFilter.Class60;
case "cfc 180":
case "180":
return CFCFilter.Class180;
case "cfc 600":
case "600":
return CFCFilter.Class600;
case "cfc 1000":
case "1000":
return CFCFilter.Class1000;
case "unfiltered":
return CFCFilter.Unfiltered;
case "none":
return CFCFilter.None;
default:
return CFCFilter.Unfiltered;
}
}
//FB 13120 convert filter class to cfc filter string
/// <summary>
/// converts back to a string from IFilterClass [so that the ITestChannel can be updated]
/// </summary>
/// <param name="filter"></param>
/// <returns></returns>
public static string FilterClassToString(IFilterClass filter)
{
if (filter == null)
return "Unfiltered";
switch (filter.FClass)
{
case FilterClassType.CFC10: return "CFC 10";
case FilterClassType.CFC60: return "CFC 60";
case FilterClassType.CFC180: return "CFC 180";
case FilterClassType.CFC600: return "CFC 600";
case FilterClassType.CFC1000: return "CFC 1000";
case FilterClassType.AdHoc: return filter.Frequency.ToString();
case FilterClassType.Unfiltered: return "Unfiltered";
case FilterClassType.None: return "None";
default:
return "Unfiltered";
}
}
//FB 13120 convert filter class to cfc string
/// <summary>
/// converts back to a string from IFilterClass [so that the ITestChannel can be updated]
/// </summary>
/// <param name="filter"></param>
/// <returns></returns>
public static string FilterClassToCFC(IFilterClass filter, bool bUseZeroForUnfiltered = false)
{
switch (filter.FClass)
{
case FilterClassType.Unfiltered:
return bUseZeroForUnfiltered ? "0" : "P";
case FilterClassType.None:
return "P";
case FilterClassType.CFC10:
return "Q";
case FilterClassType.CFC60:
return "D";
case FilterClassType.CFC180:
return "C";
case FilterClassType.CFC600:
return "B";
case FilterClassType.CFC1000:
return "A";
case FilterClassType.AdHoc:
return "S";
}
return "S";
}
public static string CFCFilterToCFC(CFCFilter filter, bool bUseZeroForUnfiltered = false)
{
switch (filter)
{
case CFCFilter.Unfiltered:
return bUseZeroForUnfiltered ? "0" : "P";
case CFCFilter.None:
return "P";
case CFCFilter.Class10:
return "Q";
case CFCFilter.Class60:
return "D";
case CFCFilter.Class180:
return "C";
case CFCFilter.Class600:
return "B";
case CFCFilter.Class1000:
return "A";
}
return "S";
}
}
}

View File

@@ -0,0 +1,17 @@
using DTS.Common.Base;
using Prism.Events;
// ReSharper disable CheckNamespace
namespace DTS.Common.Events
{
/// <summary>
/// The number of selected Tests changed event.
/// </summary>
public class GraphChannelsReadCompletedNotification : PubSubEvent<GraphChannelsReadCompletedNotificationArgs> { }
public class GraphChannelsReadCompletedNotificationArgs
{
public bool IsReadCompleted { get; set; }
public IBaseViewModel GraphVM { get; set; }
}
}