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,23 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace DTS.Common.Converters
{
public class IsLessThanConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var left = value != null && decimal.TryParse(value.ToString(), out _) ? decimal.Parse(value.ToString(), culture.NumberFormat) : 0;
var right = parameter != null && decimal.TryParse(parameter.ToString(), out _) ? decimal.Parse(parameter.ToString(), culture.NumberFormat) : 0;
return left < right;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return DependencyProperty.UnsetValue;
}
}
}

View File

@@ -0,0 +1,23 @@
using System.ComponentModel;
using DTS.Common.Base.Classes;
using DTS.Common.Converters;
namespace DTS.Common.Enums
{
/// <summary>
/// these are the different input modes for the data
/// </summary>
[TypeConverter(typeof(EnumDescriptionTypeConverter))]
public enum DigitalInputModes
{
NONE = 1 << 0, //DI's input mode not set
[DescriptionResource("DigitalInputMode_TLH")]
TLH = 1 << 1, //Transition Low to High
[DescriptionResource("DigitalInputMode_THL")]
THL = 1 << 2, //Transition High to Low
[DescriptionResource("DigitalInputMode_CCNO")]
CCNO = 1 << 3, //set to contact closure normally open
[DescriptionResource("DigitalInputMode_CCNC")]
CCNC = 1 << 4 //set to contact closure normally closed
}
}

View File

@@ -0,0 +1,32 @@
using System;
using System.Linq;
using System.Windows;
using System.Windows.Data;
namespace DTS.Common.Converters
{
public class BooleanAndToVisibilityMultiConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
var useFalseAsVisible = parameter != null && parameter.ToString().ToUpper().Contains("FALSE");
var hideNotCollapse = parameter != null && parameter.ToString().ToUpper().Contains("HIDE");
bool value = !values.All(val => val is bool) ? false : values.All(val => (bool)val);
if (useFalseAsVisible)
{
if (!value)
return Visibility.Visible;
return hideNotCollapse ? Visibility.Hidden : Visibility.Collapsed;
}
if (!value)
return hideNotCollapse ? Visibility.Hidden : Visibility.Collapsed;
return Visibility.Visible;
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,7 @@
namespace DTS.Common.RibbonControl
{
public class ButtonData : ControlData
{
}
}

View File

@@ -0,0 +1,68 @@
using System;
using System.Threading.Tasks;
using DTS.Common.Base;
using Microsoft.Practices.Prism.Regions;
// ReSharper disable InconsistentNaming
// ReSharper disable CheckNamespace
namespace DTS.Common
{
public interface IDTSRegionManager : IRegionManager
{
/// <summary>
/// Adds View to the Main Region.
/// </summary>
/// <param name="viewDefinition">The View definition.</param>
/// <param name="parameter">The parameter which uses to initialize the View.</param>
void AddView(ViewDefinition viewDefinition, object parameter);
/// <summary>
/// Adds View to the Main Region.
/// </summary>
/// <param name="viewDefinition">The View definition.</param>
/// <param name="parameter">The parameter which uses to initialize the View.</param>
/// <param name="allowMultipleInstances">A value indicating whether to allow to create the multiple views.</param>
void AddView(ViewDefinition viewDefinition, object parameter, bool allowMultipleInstances);
/// <summary>
/// Adds View to the Main Region asynchronously.
/// </summary>
/// <param name="viewDefinition">The View definition.</param>
/// <param name="parameter">The parameter which uses to initialize the service.</param>
Task AddViewAsync(ViewDefinition viewDefinition, object parameter);
/// <summary>
/// Adds View to the Main Region asynchronously.
/// </summary>
/// <param name="viewDefinition">The View definition.</param>
/// <param name="parameter">The parameter which uses to initialize the View.</param>
/// <param name="allowMultipleInstances">A value indicating whether to allow to create the multiple views.</param>
Task AddViewAsync(ViewDefinition viewDefinition, object parameter, bool allowMultipleInstances);
/// <summary>
/// Removes View from the Main Region.
/// </summary>
/// <param name="viewModel">The View-model.</param>
void RemoveView(IBaseViewModel viewModel);
/// <summary>
/// Removes View from the specified region by name
/// </summary>
/// <param name="regionName"></param>
void RemoveViewByRegionName(string regionName);
/// <summary>
/// Reloads data for the specified View.
/// </summary>
/// <param name="interfaceForView">Type of the View's interface.</param>
/// <param name="parameter">The parameter which uses to initialize the View.</param>
void RefreshView(Type interfaceForView, object parameter);
/// <summary>
/// Reloads data for the specified View asynchronously.
/// </summary>
/// <param name="interfaceForView">Type of the View's interface.</param>
/// <param name="parameter">The parameter which uses to initialize the View.</param>
Task RefreshViewAsync(Type interfaceForView, object parameter);
}
}

View File

@@ -0,0 +1,15 @@
using System;
namespace DTS.Common.Interface.DASFactory.Diagnostics.HardwareList
{
public interface ISLICE6TreeNode
{
int DASId { get; set; }
string SerialNumber { get; set; }
int Port { get; set; }
string PortString { get; }
int Number { get; set; }
int PositionOnChain { get; set; }
string PositionOnChainString { get; }
}
}

View File

@@ -0,0 +1,207 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
using DTS.Common.Base;
using DTS.Common.Events;
using DTS.Common.Utilities.Logging;
using Microsoft.Practices.Prism.Events;
using Microsoft.Practices.ServiceLocation;
namespace DTS.Common.Controls
{
/// <inheritdoc cref="IBasePropertyChanged" />
/// <summary>
/// Interaction logic for GridViewColumnHeaderSelectable.xaml
/// </summary>
public partial class GridViewColumnHeaderSelectable : UserControl, IBasePropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public bool SetProperty<T>(ref T storage, T value, string propertyName = null)
{
if (Equals(storage, value)) return false;
storage = value;
OnPropertyChanged(propertyName);
return true;
}
public void OnPropertyChanged(string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public GridViewColumnHeaderSelectable()
{
InitializeComponent();
var eventAggregator = ServiceLocator.Current.GetInstance<IEventAggregator>();
eventAggregator.GetEvent<ListViewStatusEvent>().Subscribe(OnListviewStatusEvent, ThreadOption.UIThread);
}
public override string ToString()
{
return HeaderTitle;
}
private void OnListviewStatusEvent(ListViewStatusArg arg)
{
if (arg.Status != ListViewStatusArg.ListViewStatus.Unloaded)
{
return;
}
if (arg.Id == ListviewId)
{
}
}
public string ListviewId
{
get => (string) GetValue(ListviewIdProperty);
set => SetValue(ListviewIdProperty, value);
}
public static readonly DependencyProperty ListviewIdProperty =
DependencyProperty.Register(
"ListviewId",
typeof(string),
typeof(GridViewColumnHeaderSelectable), new PropertyMetadata(""));
public string HeaderTitle
{
get => (string) GetValue(HeaderTitleProperty);
set => SetValue(HeaderTitleProperty, value);
}
// Using a DependencyProperty enables animation, styling, binding, etc.
public static readonly DependencyProperty HeaderTitleProperty =
DependencyProperty.Register(
"HeaderTitle", // The name of the DependencyProperty
typeof(string), // The type of the DependencyProperty
typeof(GridViewColumnHeaderSelectable), // The type of the owner of the DependencyProperty
new PropertyMetadata( // OnHeaderTitleChanged will be called when HeaderTitle changes
"Awesome", // The default value of the DependencyProperty
OnHeaderTitleChanged
)
);
private static void OnHeaderTitleChanged(
DependencyObject d,
DependencyPropertyChangedEventArgs e
)
{
if (d is GridViewColumnHeaderSelectable instance)
{
instance.HeaderTitle = (string) e.NewValue;
}
}
private bool _toggleButtonIsChecked = false;
/// <summary>
/// holds whether the toggle button is checked or not and controls whether the popup is open or not
/// </summary>
public bool ToggleButtonIsChecked
{
get => _toggleButtonIsChecked;
set
{
if (value == _toggleButtonIsChecked) return;
_toggleButtonIsChecked = value;
OnPropertyChanged("ToggleButtonIsChecked");
OnPropertyChanged("ToggleIconGeometry");
RaiseOpenChangedEvent(value);
}
}
public static readonly DependencyProperty HeaderIsCheckedProperty =
DependencyProperty.Register(
"ToggleButtonIsChecked",
typeof(bool),
typeof(GridViewColumnHeaderSelectable),
new PropertyMetadata(
false,
OnHeaderIsOpenChanged
)
);
private static void OnHeaderIsOpenChanged(
DependencyObject d,
DependencyPropertyChangedEventArgs e)
{
if (!(d is GridViewColumnHeaderSelectable instance)) return;
instance.ToggleButtonIsChecked = (bool)e.NewValue;
var isOpen = instance.ToggleButtonIsChecked;
instance.RaiseOpenChangedEvent(isOpen);
}
// Create a custom routed event by first registering a RoutedEventID
// This event uses the bubbling routing strategy
public static readonly RoutedEvent OpenChangedEvent = EventManager.RegisterRoutedEvent(
"OpenChanged", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(GridViewColumnHeaderSelectable));
// Provide CLR accessors for the event
public event RoutedEventHandler OpenChanged
{
add => AddHandler(OpenChangedEvent, value);
remove => RemoveHandler(OpenChangedEvent, value);
}
// This method raises the Tap event
private void RaiseOpenChangedEvent(bool isOpen)
{
var newEventArgs = new RoutedEventArgs(OpenChangedEvent, isOpen);
RaiseEvent(newEventArgs);
}
public static readonly RoutedEvent ClickEvent = EventManager.RegisterRoutedEvent(
"ClickHandler", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(GridViewColumnHeaderSelectable));
public event RoutedEventHandler ClickHandler
{
add => AddHandler(ClickEvent, value);
remove => RemoveHandler(ClickEvent, value);
}
private void RaiseClickEvent(object tag)
{
var newEventArgs = new RoutedEventArgs(ClickEvent, tag);
RaiseEvent(newEventArgs);
}
private void PreviewLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
RaiseClickEvent(Tag);
}
private void SelectAllButton_OnClick(object sender, RoutedEventArgs e)
{
RaiseSelectAllEvent(true);
}
private void ClearAllButton_OnClick(object sender, RoutedEventArgs e)
{
RaiseSelectAllEvent(false);
}
// Create a custom routed event by first registering a RoutedEventID
// This event uses the bubbling routing strategy
public static readonly RoutedEvent SelectAllEvent = EventManager.RegisterRoutedEvent(
"SelectAll", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(GridViewColumnHeaderSelectable));
// Provide CLR accessors for the event
public event RoutedEventHandler SelectAll
{
add => AddHandler(SelectAllEvent, value);
remove => RemoveHandler(SelectAllEvent, value);
}
// This method raises the Tap event
private void RaiseSelectAllEvent(bool selectAll)
{
var newEventArgs = new RoutedEventArgs(SelectAllEvent, selectAll);
RaiseEvent(newEventArgs);
OnPropertyChanged("ToggleIconGeometry");
}
}
}