From d38bf750367c6d6cdda3a6a3efbdf3552aa85358 Mon Sep 17 00:00:00 2001 From: Roy Date: Sun, 13 Nov 2022 03:46:12 +0200 Subject: FSE Stats Module. Extended job run structure. CSV export. --- .../Tango.SharedUI/Components/SelectedObject.cs | 25 +++++++++--- .../Components/SelectedObjectCollection.cs | 45 +++++++++++++++++++++- 2 files changed, 64 insertions(+), 6 deletions(-) (limited to 'Software/Visual_Studio/Tango.SharedUI') diff --git a/Software/Visual_Studio/Tango.SharedUI/Components/SelectedObject.cs b/Software/Visual_Studio/Tango.SharedUI/Components/SelectedObject.cs index 322f43a4c..9e9c8094a 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Components/SelectedObject.cs +++ b/Software/Visual_Studio/Tango.SharedUI/Components/SelectedObject.cs @@ -25,20 +25,35 @@ namespace Tango.SharedUI.Components set { _isEnabled = value; RaisePropertyChangedAuto(); } } + private Object _data; + public Object Data + { + get { return _data; } + set { _data = value; RaisePropertyChangedAuto(); } + } + public SelectedObject() { IsEnabled = true; } + + public SelectedObject(Object data) : this() + { + Data = data; + } + + public SelectedObject(Object data, bool selected) : this(data) + { + IsSelected = selected; + } } public class SelectedObject : SelectedObject { - private T _data; - - public T Data + new public T Data { - get { return _data; } - set { _data = value; RaisePropertyChangedAuto(); } + get { return (T)base.Data; } + set { base.Data = (T)value; RaisePropertyChangedAuto(); } } public SelectedObject() : base() diff --git a/Software/Visual_Studio/Tango.SharedUI/Components/SelectedObjectCollection.cs b/Software/Visual_Studio/Tango.SharedUI/Components/SelectedObjectCollection.cs index 8aa087ed3..a174dc070 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Components/SelectedObjectCollection.cs +++ b/Software/Visual_Studio/Tango.SharedUI/Components/SelectedObjectCollection.cs @@ -1,14 +1,32 @@ using System; +using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; +using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.SharedUI.Components; + +public static class ISelectedObjectCollectionExt +{ + public static IList GetItems(this ISelectedObjectCollection source) + { + return source.Cast().ToList(); + } +} namespace Tango.SharedUI.Components { - public class SelectedObjectCollection : ObservableCollection> + public interface ISelectedObjectCollection : IEnumerable, INotifyCollectionChanged + { + event EventHandler SelectionChanged; + ObservableCollection Source { get; set; } + ObservableCollection SynchedSource { get; set; } + } + + public class SelectedObjectCollection : ObservableCollection>, ISelectedObjectCollection { private Func _compareFunc; @@ -16,6 +34,11 @@ namespace Tango.SharedUI.Components public ObservableCollection Source { get; set; } public ObservableCollection SynchedSource { get; set; } + ObservableCollection ISelectedObjectCollection.Source { get; set; } + ObservableCollection ISelectedObjectCollection.SynchedSource { get; set; } + + public bool IsReadOnly { get; } + public SelectedObjectCollection(ObservableCollection source, ObservableCollection synchedSource, Func compareFunc) { _compareFunc = compareFunc; @@ -77,5 +100,25 @@ namespace Tango.SharedUI.Components SelectionChanged?.Invoke(this, new EventArgs()); } + + public void Add(SelectedObject item) + { + base.Add((SelectedObject)item); + } + + public bool Contains(SelectedObject item) + { + return base.Contains((SelectedObject)item); + } + + public void CopyTo(SelectedObject[] array, int arrayIndex) + { + base.CopyTo(array.Cast>().ToArray(), arrayIndex); + } + + public bool Remove(SelectedObject item) + { + return base.Remove((SelectedObject)item); + } } } -- cgit v1.3.1