using System; using System.Collections.Generic; using System.ComponentModel; using DTS.Common.Base; using DTS.Common.Enums.Sensors; using DTS.Common.Interface; using DTS.Common.Interface.TestDefinition; using Prism.Commands; // ReSharper disable CheckNamespace // ReSharper disable RedundantDefaultMemberInitializer namespace DTS.Common.Classes.Viewer.TestMetadata { public class TestSummary : ITestSummary { /// /// the _ROI Period x folder name if present /// 18411 Data will not export [CSV Unfiltered] /// public const string ROI_SUFFIX = @"_ROI Period"; public string Id { get; set; } public string SetupName { get; set; } public string Description { get; set; } public int ChannelCount { get; set; } public DateTime FileDate { get; set; } public DateTime TimeStamp { get; set; } public string DataType { get; set; } private bool _isSelected = false; public bool IsSelected { get => _isSelected; set { if (value != IsSelected) { _isSelected = value; SelectionChanged(); OnPropertyChanged("IsSelected"); } } } public List Graphs { get; set; } public List Channels { get; set; } public List CalculatedChannels { get; set; } public IBaseViewModel Parent { get; set; } public CalibrationBehaviors CalibrationBehavior { get; set; } = CalibrationBehaviors.NonLinearIfAvailable; public ITestMetadata TestMetadata { get; set; } #region Commands private DelegateCommand _isSelectedCommand; public DelegateCommand IsSelectedCommand { get => _isSelectedCommand ?? (_isSelectedCommand = new DelegateCommand(SelectionChanged)); set => _isSelectedCommand = value; } public void SelectionChanged() { var parent = (ITestSummaryListViewModel)Parent; if (parent == null) return; var list = parent.SelectedTestSummaryList; if (IsSelected) { if (!list.Contains(this)) list.Add(this); } else { if (list.Contains(this)) list.Remove(this); } parent.PublishSelectedTestSummaryList(); } #endregion Commands /// ///Occurs when a property value changes. /// public event PropertyChangedEventHandler PropertyChanged; public void OnPropertyChanged(string propertyName) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } }