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,76 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.ServiceProcess;
using DTS.Common;
using DTS.Common.Base;
namespace DTS.Viewer.GraphList.Model
{
public class GraphObject : IBaseClass
{
public GraphObject()
{
LoadGraphs();
}
#region Properties
private int _recId;
public int RecordId { get => _recId; set { _recId = value; OnPropertyChanged("RecordId"); } }
private int _id;
public int Id { get => _id; set { _id = value; Property.Id = _id; OnPropertyChanged("Id"); } }
private string _name = string.Empty;
public string Name { get => _name; set { _name = value; Property.Name = value; OnPropertyChanged("Name"); } }
private string _description = string.Empty;
public string Description { get { return _description; } set { _description = value; Property.Description = _description; OnPropertyChanged("Description"); } }
private CFCFilter _filter = CFCFilter.Unfiltered;
public CFCFilter Filter { get { return _filter; } set { _filter = value; Property.Filter = _filter.ToString(); OnPropertyChanged("Filter"); } }
private string _dataFlag = string.Empty;
public string DataFlag { get { return _dataFlag; } set { _dataFlag = value; Property.DataFlag = _dataFlag; OnPropertyChanged("DataFlag"); } }
private double _shiftT0;
public double ShiftT0 { get { return _shiftT0; } set { _shiftT0 = value; Property.ShiftT0 = _shiftT0; OnPropertyChanged("ShiftT0"); } }
private double _euMultiplier;
public double EuMultiplier { get { return _euMultiplier; } set { _euMultiplier = value; Property.EuMultiplier = _euMultiplier; OnPropertyChanged("EuMultiplier"); } }
private double _euOffset;
public double EuOffset { get { return _euOffset; } set { _euOffset = value; Property.EuOffset = _euOffset; OnPropertyChanged("EuOffset"); } }
private List<double> _data = new List<double>();
public List<double> Data { get { return _data; } set { _data = value; OnPropertyChanged("Data"); } }
private bool _isVisable;
public bool Visable { get { return _isVisable; } set { _isVisable = value; OnPropertyChanged("Visable"); } }
private GraphPropertyObject _property = new GraphPropertyObject();
public GraphPropertyObject Property { get { return _property; } set { _property = value; OnPropertyChanged("Property"); } }
///<summary>
///Occurs when a property value changes.
///</summary>
public event PropertyChangedEventHandler PropertyChanged;
public void OnPropertyChanged(string propertyName)
{
var eventHandler = PropertyChanged;
if (eventHandler != null)
{
eventHandler(this, new PropertyChangedEventArgs(propertyName));
}
}
#endregion Properties
private void LoadGraphs()
{
//var svControllerc = new ServiceController("CPUService");
//svControllerc.ExecuteCommand(128);
}
}
}

View File

@@ -0,0 +1,60 @@
using System.ComponentModel;
using DTS.Common;
using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;
namespace DTS.Viewer.GraphList.Model
{
//http://brianlagunas.com/extended-wpf-toolkitthe-updated-propertygrid/
//https://wpftoolkit.codeplex.com/wikipage?title=PropertyGrid&referringTitle=Home
public class GraphPropertyObject
{
public GraphPropertyObject() { }
#region Display Properties
[Category("Information")]
[DisplayName("Id")]
[ReadOnly(true)]
[Description("This property is read only.")]
public int Id { get; set; }
[Category("Information")]
[DisplayName("Name")]
[ReadOnly(true)]
[Description("This property is read only.")]
public string Name { get; set; }
[Category("Information")]
[DisplayName("Description")]
[ReadOnly(true)]
[Description("This property uses a TextBox as the default editor.")]
public string Description { get; set; }
[Category("Parameters")]
[DisplayName("Filter")]
[Description("This property uses a TextBox as the default editor.")]
[ItemsSource(typeof(CFCFilterItemSource))]
public string Filter { get; set; }
[Category("Parameters")]
[DisplayName("Data Flag")]
[Description("This property uses a TextBox as the default editor.")]
public string DataFlag { get; set; }
[Category("Parameters")]
[DisplayName("Shift T0 (ms)")]
[Description("This property uses a TextBox as the default editor.")]
public double ShiftT0 { get; set; }
[Category("Parameters")]
[DisplayName("EU Multiplier")]
[Description("This property uses a TextBox as the default editor.")]
public double EuMultiplier { get; set; }
[Category("Parameters")]
[DisplayName("EU Offset")]
[Description("This property uses a TextBox as the default editor.")]
public double EuOffset { get; set; }
#endregion
}
}

View File

@@ -0,0 +1,142 @@
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Windows.Media;
using DTS.Common.Base;
using DTS.Common.Interface;
// ReSharper disable RedundantDefaultMemberInitializer
// ReSharper disable UnassignedGetOnlyAutoProperty
// ReSharper disable CheckNamespace
namespace DTS.Viewer.GraphList
{
/// <summary>
/// Main class to bind to treeview
/// </summary>
public class TreeViewChannels : IBaseModel
{
private string _name = string.Empty;
public string Name { get => _name; set { _name = value; OnPropertyChanged("Name"); } }
private ObservableCollection<TestGroup> _groups = new ObservableCollection<TestGroup>();
public ObservableCollection<TestGroup> Groups { get => _groups; set { _groups = value; _groupsCount = _groups.Count; OnPropertyChanged("Groups"); } }
private int _groupsCount = 0;
public int GroupsCount { get => _groupsCount; set { _groupsCount = value; OnPropertyChanged("GroupsCount"); } }
private string _path = string.Empty;
public string Path { get => _path; set { _path = value; OnPropertyChanged("Path"); } }
public bool IsSaved { get; }
private bool _isExpanded = true;
public bool IsExpanded { get => _isExpanded; set { _isExpanded = value; OnPropertyChanged("IsExpanded"); } }
private bool _isSelected = false;
public bool IsSelected { get => _isSelected; set { _isSelected = value; OnPropertyChanged("IsSelected"); } }
#region PropertyChanged
public event PropertyChangedEventHandler PropertyChanged;
public void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
#endregion PropertyChanged
}
/// <summary>
/// Child class for TreeViewChannels
/// </summary>
public class TestGroup : INotifyPropertyChanged
{
private string _path = string.Empty;
public string Path { get => _path; set { _path = value; OnPropertyChanged("Path"); } }
private string _dtsFile = string.Empty;
public string DTSFile { get => _dtsFile; set { _dtsFile = value; OnPropertyChanged("DTSFile"); } }
private IBaseViewModel _parent;
/// <summary>
/// Parent ViewModel
/// </summary>
public IBaseViewModel Parent { get => _parent; set { _parent = value; OnPropertyChanged("Parent"); } }
private bool _isLocked = false;
/// <summary>
/// Locked Graph - call parent function to lock graph's channels
/// </summary>
public bool IsLocked
{
get => _isLocked;
set
{
_isLocked = value;
((IGraphMainViewModel)Parent).AddLockedGroupChannels(TestName, Name, Channels.ToList(), _isLocked);
OnPropertyChanged("IsLocked");
}
}
private bool _isGraph = false;
public bool IsGraph { get => _isGraph; set { _isGraph = value; OnPropertyChanged("IsGraph"); } }
private bool _isExpanded = true;
public bool IsExpanded { get => _isExpanded; set { _isExpanded = value; OnPropertyChanged("IsExpanded"); } }
private bool _canLock = true;
public bool CanLock
{
get => _canLock;
set
{
_canLock = value;
OnPropertyChanged("CanLock");
}
}
private bool _isSelected = false;
/// <summary>
/// Selected Graph - call parent function to select graph's channels
/// </summary>
public bool IsSelected
{
get => _isSelected;
set
{
if (!CanLock && value)
{
return; //ignore, don't select
}
if (Name.StartsWith("Test Channels") || Name.StartsWith("Calculated Channels")) return;
var prevValue = _isSelected;
_isSelected = value;
if (IsSelected && IsSelected != prevValue) ((IGraphMainViewModel)Parent).AddSelectedGroupChannels(Name, Channels.ToList());
OnPropertyChanged("IsSelected");
}
}
private string _testName = string.Empty;
public string TestName { get => _testName; set { _testName = value; OnPropertyChanged("TestName"); } }
private string _name = string.Empty;
public string Name { get => _name; set { _name = value; OnPropertyChanged("Name"); } }
private string _displayName = string.Empty;
public string DisplayName { get => _displayName; set { _displayName = value; OnPropertyChanged("DisplayName"); } }
private ObservableCollection<ITestChannel> _channels = new ObservableCollection<ITestChannel>();
public ObservableCollection<ITestChannel> Channels { get => _channels; set { _channels = value; _channelCount = _channels.Count; OnPropertyChanged("Channels"); } }
private int _channelCount = 0;
public int ChannelCount { get => _channelCount; set { _channelCount = value; OnPropertyChanged("ChannelCount"); } }
#region PropertyChanged
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); }
#endregion PropertyChanged
}
}

View File

@@ -0,0 +1,322 @@
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows;
using DTS.Common.Base;
using DTS.Common.Interface;
using System.Windows.Media;
using System.Collections.Generic;
using System;
// ReSharper disable RedundantDefaultMemberInitializer
// ReSharper disable UnassignedGetOnlyAutoProperty
// ReSharper disable CheckNamespace
namespace DTS.Viewer.GraphList
{
/// <summary>
/// Main class to bind to treeview
/// </summary>
public class TreeViewIds : IBaseModel
{
private IBaseViewModel _parent;
/// <summary>
/// Parent ViewModel
/// </summary>
public IBaseViewModel Parent { get => _parent; set { _parent = value; OnPropertyChanged("Parent"); } }
private string _name = string.Empty;
public string Name { get => _name; set { _name = value; OnPropertyChanged("Name"); } }
private int _treeIndex = 0;
public int TreeIndex { get => _treeIndex; set { _treeIndex = value; OnPropertyChanged("TreeIndex"); } }
private int _eventCount = 0;
public int EventCount { get => _eventCount; set { _eventCount = value; OnPropertyChanged("EventCount"); } }
private ObservableCollection<ITestEvent> _events = new ObservableCollection<ITestEvent>();
public ObservableCollection<ITestEvent> Events { get => _events; set { _events = value; _eventCount = _events.Count; OnPropertyChanged("Events"); } }
private string _path = string.Empty;
public string Path { get => _path; set { _path = value; OnPropertyChanged("Path"); } }
public bool IsSaved { get; }
private bool _isExpanded = true;
public bool IsExpanded { get => _isExpanded; set { _isExpanded = value; OnPropertyChanged("IsExpanded"); } }
private bool _isSelected = false;
public bool IsSelected
{
get => _isSelected;
set
{
if ((IExportGraphMainViewModel)Parent == null) return;
if (((IExportGraphMainViewModel)Parent).SettingChildNodesToTrue && !value)
{
return;
}
if (!IsShiftPressed)
{
((IExportGraphMainViewModel)Parent).SetLastIndexChecked(TreeIndex);
}
_isSelected = value;
((IExportGraphMainViewModel)Parent).SettingChildNodesToTrue = value;
((IExportGraphMainViewModel)Parent).SettingOrResettingChildNodes = true;
OnPropertyChanged("IsSelected");
SetChildNodes(value);
((IExportGraphMainViewModel)Parent).SettingChildNodesToTrue = false;
((IExportGraphMainViewModel)Parent).SettingOrResettingChildNodes = false;
}
}
public void SetChildNodes(bool isSelected)
{
foreach (var node in Events)
{
node.IsSelected = isSelected;
}
}
#region PropertyChanged
public event PropertyChangedEventHandler PropertyChanged;
public void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
#endregion PropertyChanged
public static readonly DependencyProperty IsItemSelectedProperty =
DependencyProperty.RegisterAttached("IsItemSelected", typeof(bool), typeof(TreeViewIds));
public static void SetIsItemSelected(UIElement element, bool value)
{
element.SetValue(IsItemSelectedProperty, value);
}
private static bool IsShiftPressed
{
get { return Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift); }
}
private static List<TreeViewItem> GetTreeViewItems(ItemsControl parentItem, bool includeCollapsedItems, List<TreeViewItem> itemList = null)
{
if (itemList == null)
itemList = new List<TreeViewItem>();
for (var index = 0; index < parentItem.Items.Count; index++)
{
var tvItem = parentItem.ItemContainerGenerator.ContainerFromIndex(index) as TreeViewItem;
if (tvItem == null) continue;
itemList.Add(tvItem);
if (includeCollapsedItems || tvItem.IsExpanded)
GetTreeViewItems(tvItem, includeCollapsedItems, itemList);
}
return itemList;
}
}
/// <summary>
/// Child class for TreeViewIds
/// </summary>
public class TestEvent : ITestEvent
{
private string _path = string.Empty;
public string Path { get => _path; set { _path = value; OnPropertyChanged("Path"); } }
private IBaseViewModel _parent;
/// <summary>
/// Parent ViewModel
/// </summary>
public IBaseViewModel Parent { get => _parent; set { _parent = value; OnPropertyChanged("Parent"); } }
private bool _isLocked = false;
/// <summary>
/// Locked Graph - call parent function to lock Id's events
/// </summary>
public bool IsLocked
{
get => _isLocked;
set
{
_isLocked = value;
var parent = Parent;
if (parent.GetType().GetInterfaces().Contains(typeof(IExportGraphMainViewModel))) { ((IExportGraphMainViewModel)parent).AddLockedEvents(TestName, Name, Events.ToList(), _isLocked); }
OnPropertyChanged("IsLocked");
}
}
private bool _isGraph = false;
public bool IsGraph { get => _isGraph; set { _isGraph = value; OnPropertyChanged("IsGraph"); } }
private bool _isExpanded = true;
public bool IsExpanded { get => _isExpanded; set { _isExpanded = value; OnPropertyChanged("IsExpanded"); } }
private bool _canLock = true;
public bool CanLock
{
get => _canLock;
set
{
_canLock = value;
OnPropertyChanged("CanLock");
}
}
private static bool IsShiftPressed
{
get
{
return Keyboard.IsKeyDown(Key.LeftShift) ||
Keyboard.IsKeyDown(Key.RightShift);
}
}
private static bool IsCtrlPressed
{
get
{
return Keyboard.IsKeyDown(Key.LeftCtrl) ||
Keyboard.IsKeyDown(Key.RightCtrl);
}
}
private bool _isSelected = false;
/// <summary>
/// Selected Event - call parent function to select Id's event
/// </summary>
public bool IsSelected
{
get => _isSelected;
set => SetIsSelected(value);
}
private void SetIsSelectedShiftPressed(bool value)
{
if (IsShiftPressed &&
!((IExportGraphMainViewModel)Parent).ResettingAllItems &&
!((IExportGraphMainViewModel)Parent).SettingItemsBetween)
{
((IExportGraphMainViewModel)Parent).ResettingAllItems = true;
((IExportGraphMainViewModel)Parent).ResetAllItems();
((IExportGraphMainViewModel)Parent).ResettingAllItems = false;
}
if (IsShiftPressed &&
!((IExportGraphMainViewModel)Parent).SettingItemsBetween)
{
((IExportGraphMainViewModel)Parent).SettingItemsBetween = true;
((IExportGraphMainViewModel)Parent).SetItemsBetween(((IExportGraphMainViewModel)Parent).LastIndexChecked, TreeIndex);
((IExportGraphMainViewModel)Parent).SettingItemsBetween = false;
}
}
private bool ShouldExitSetIsSelected(bool value)
{
if (((IExportGraphMainViewModel)Parent).SettingChildNodesToTrue && !value)
{
return true;
}
if (((IExportGraphMainViewModel)Parent).SettingPeerNodeToTrue && !value)
{
return true;
}
if (((IExportGraphMainViewModel)Parent).ResettingAllItems && value)
{
return true;
}
return false;
}
private void SetIsSelectedShiftNotPressed(bool value)
{
if (!IsShiftPressed &&
!IsCtrlPressed &&
!((IExportGraphMainViewModel)Parent).ResettingAllItems &&
!((IExportGraphMainViewModel)Parent).SettingOrResettingChildNodes)
{
((IExportGraphMainViewModel)Parent).SettingPeerNodeToTrue = false;
((IExportGraphMainViewModel)Parent).ResettingAllItems = true;
((IExportGraphMainViewModel)Parent).ResetAllItems();
((IExportGraphMainViewModel)Parent).ResettingAllItems = false;
}
}
private void SetIsSelected(bool value)
{
if (ShouldExitSetIsSelected(value)) { return; }
((IExportGraphMainViewModel)Parent).SettingPeerNodeToTrue = value;
if (IsShiftPressed) { SetIsSelectedShiftPressed(value); }
if (!IsShiftPressed && !((IExportGraphMainViewModel)Parent).SettingOrResettingChildNodes)
{
((IExportGraphMainViewModel)Parent).SetLastIndexChecked(TreeIndex);
}
if (!IsShiftPressed) { SetIsSelectedShiftNotPressed(value); }
if (!IsShiftPressed ||
(IsShiftPressed && ((IExportGraphMainViewModel)Parent).SettingItemsBetween) ||
(IsShiftPressed && ((IExportGraphMainViewModel)Parent).ResettingAllItems))
{
var prevValue = _isSelected;
_isSelected = value;
var myself = new List<ITestEvent>
{
this
};
if (IsSelected != prevValue)
{
if (IsSelected)
{
((IExportGraphMainViewModel)Parent).AddToSelectedEvents(Name, myself);
}
else
{
((IExportGraphMainViewModel)Parent).RemoveFromSelectedEvents(Name, myself);
}
}
OnPropertyChanged("IsSelected");
}
((IExportGraphMainViewModel)Parent).SettingPeerNodeToTrue = false;
}
private string _testName = string.Empty;
public string TestName { get => _testName; set { _testName = value; OnPropertyChanged("TestName"); } }
private string _name = string.Empty;
public string Name { get => _name; set { _name = value; OnPropertyChanged("Name"); } }
private string _testSetupName = string.Empty;
public string TestSetupName { get => _testSetupName; set { _testSetupName = value; OnPropertyChanged("TestSetupName"); } }
private string _testItem = string.Empty;
public string TestItem { get => _testItem; set { _testItem = value; OnPropertyChanged("TestItem"); } }
private string _dtsFile = string.Empty;
public string DTSFile { get => _dtsFile; set { _dtsFile = value; OnPropertyChanged("DTSFile"); } }
private string _dataType = string.Empty;
public string DataType { get => _dataType; set { _dataType = value; OnPropertyChanged("DataType"); } }
private int _eventCount = 0;
private ObservableCollection<ITestEvent> _events = new ObservableCollection<ITestEvent>();
public ObservableCollection<ITestEvent> Events { get => _events; set { _events = value; _eventCount = _events.Count; OnPropertyChanged("Events"); } }
private string _testId = string.Empty;
public string TestId { get => _testId; set { _testId = value; OnPropertyChanged("TestId"); } }
private int _treeIndex = 0;
public int TreeIndex { get => _treeIndex; set { _treeIndex = value; OnPropertyChanged("TreeIndex"); } }
#region PropertyChanged
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); }
#endregion PropertyChanged
}
}