From a009e4db12c49028bd7414bdbfd645dc6b7f52cd Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Mon, 7 Oct 2019 10:10:10 +0300 Subject: Refactoring code - added comments --- .../Models/HardwareCollection.cs | 2 +- .../Models/HardwareComponent.cs | 6 +- .../Models/HardwareParameter.cs | 90 ++++++++++++++-------- .../Models/IHasDifference.cs | 13 ++++ .../Tango.MachineStudio.MachineDesigner.csproj | 3 +- .../ViewModels/HardwareConfigurationViewVM.cs | 2 +- .../Views/HardwareConfigurationView.xaml | 6 +- 7 files changed, 84 insertions(+), 38 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/IHasDifference.cs (limited to 'Software/Visual_Studio/MachineStudio') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareCollection.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareCollection.cs index 765bc9dfd..7c774e65f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareCollection.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareCollection.cs @@ -7,7 +7,7 @@ using Tango.Core; namespace Tango.MachineStudio.MachineDesigner.Models { - public class HardwareCollection : ExtendedObject + public class HardwareCollection : ExtendedObject, IHasDifference { public String CollectionName { get; set; } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareComponent.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareComponent.cs index d03428ce5..c0610dd5f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareComponent.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareComponent.cs @@ -7,7 +7,7 @@ using Tango.Core; namespace Tango.MachineStudio.MachineDesigner.Models { - public class HardwareComponent : ExtendedObject + public class HardwareComponent : ExtendedObject, IHasDifference { public String ComponentName { get; set; } public String Description { get; set; } @@ -16,12 +16,14 @@ namespace Tango.MachineStudio.MachineDesigner.Models { get { - return Properties.Any(item => item.IsDifferent); + return Properties.Any(item => item.HasDifferences); } } + public HardwareComponent() { Properties = new SynchronizedObservableCollection(); } + } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareParameter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareParameter.cs index 33dbcad71..9e30874e9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareParameter.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareParameter.cs @@ -8,16 +8,23 @@ using Tango.Core.Commands; namespace Tango.MachineStudio.MachineDesigner.Models { - public class HardwareParameter : ExtendedObject + /// + /// The HardwareParameter class. + /// Contains default/editable/actual value and data type of each hardware parameter reflected in . + /// + /// + /// This class provides data state changes. + /// + public class HardwareParameter : ExtendedObject, IHasDifference { - public event EventHandler Selected; - + #region properties public HardwareComponent Component { get; set; } - public RelayCommand DeleteCommand { get; set; } - public String PropertyName { get; set; } + /// + /// The default value contains data from database + /// private Object _defaultValue; public Object DefaultValue { @@ -27,12 +34,18 @@ namespace Tango.MachineStudio.MachineDesigner.Models _defaultValue = value; } } - + /// + /// The type of hardware parameter is used for display correct ui element. + /// Can be boolean, int32, or Double + /// public Type Type { get { return DefaultValue.GetType(); } } - // updated after editing + + /// + /// The value contains modified data, saved in database or immediately after editing in this session + /// private Object _actualValue = null; public Object ActualValue { @@ -41,12 +54,15 @@ namespace Tango.MachineStudio.MachineDesigner.Models { _actualValue = value; RaisePropertyChangedAuto(); - RaisePropertyChanged(nameof(IsDifferent)); + RaisePropertyChanged(nameof(HasDifferences)); RaisePropertyChanged(nameof(IsValuesMatched)); } } - // displayed during editing + /// + /// The editable value contains value displayed in edit box in UI. + /// Initialization the value occurs by clicking in UI and the value will be equal actual value if it exists or default value. + /// private Object _editableValue = null; public Object EditableValue { @@ -75,8 +91,34 @@ namespace Tango.MachineStudio.MachineDesigner.Models } } } + /// + /// Used in UI to display modified value + /// + public bool HasDifferences + { + get + { + return (ActualValue != null); + } + } + /// + /// Used to display warning explanation icon in case actual value equals default value + /// + public bool IsValuesMatched + { + get + { + return ActualValue != null && ActualValue.ToString() == DefaultValue.ToString(); + } + } + #endregion properties - + #region events + /// + /// Occurs when start select mode. + /// Used to set in all others Parameter IsSelected to false except this. + /// + public event EventHandler Selected; private void OnIsSelectedChanged() { if (IsSelected) @@ -91,32 +133,20 @@ namespace Tango.MachineStudio.MachineDesigner.Models } } } - - public bool IsDifferent - { - get - { - return (ActualValue != null); - } - } - - public bool IsValuesMatched + #endregion + #region constructors + public HardwareParameter() { - get - { - return ActualValue != null && ActualValue.ToString() == DefaultValue.ToString(); - } + DeleteCommand = new RelayCommand(DeleteValue); } - + #endregion + #region commands + public RelayCommand DeleteCommand { get; set; } public void DeleteValue() { ActualValue = null; EditableValue = null; } - - public HardwareParameter() - { - DeleteCommand = new RelayCommand(DeleteValue); - } + #endregion } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/IHasDifference.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/IHasDifference.cs new file mode 100644 index 000000000..bd4851867 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/IHasDifference.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.MachineDesigner.Models +{ + interface IHasDifference + { + bool HasDifferences { get;} + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj index 855b0d196..0e6cca479 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj @@ -81,6 +81,7 @@ + @@ -303,7 +304,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/HardwareConfigurationViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/HardwareConfigurationViewVM.cs index 415a8ab72..f7ae88f68 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/HardwareConfigurationViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/HardwareConfigurationViewVM.cs @@ -316,7 +316,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels { HardwareConfiguration hwConfig = new HardwareConfiguration(); - foreach (var parameter in Collections.SelectMany(x => x.Components).SelectMany(x => x.Properties).Where(x => x.IsDifferent)) + foreach (var parameter in Collections.SelectMany(x => x.Components).SelectMany(x => x.Properties).Where(x => x.HasDifferences)) { hwConfig.Parameters.Add(new HardwareConfiguration.HardwareConfigurationParameter() { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/HardwareConfigurationView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/HardwareConfigurationView.xaml index ca9ea99b4..f63fbf28c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/HardwareConfigurationView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/HardwareConfigurationView.xaml @@ -80,7 +80,7 @@ : - + @@ -188,7 +188,7 @@ - @@ -198,7 +198,7 @@ - + -- cgit v1.3.1 From 0c664ab02889ac34b568ccd9a1d4aff5985f9d7a Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Mon, 7 Oct 2019 11:05:59 +0300 Subject: Refactoring - added app.xaml files to view in designer VS --- .../MachineStudio/Modules/MachineStudio.Dispensers/App.xaml | 12 ++++++++++++ .../Tango.MachineStudio.Dispensers.csproj | 4 ++++ .../Modules/Tango.MachineStudio.Catalogs/App.xaml | 12 ++++++++++++ .../Tango.MachineStudio.Catalogs.csproj | 4 ++++ .../Modules/Tango.MachineStudio.ColorCapture/App.xaml | 13 +++++++++++++ .../Tango.MachineStudio.ColorCapture.csproj | 4 ++++ .../Modules/Tango.MachineStudio.ColorLab/App.xaml | 12 ++++++++++++ .../Tango.MachineStudio.ColorLab.csproj | 6 +++++- .../MachineStudio/Modules/Tango.MachineStudio.DB/App.xaml | 12 ++++++++++++ .../Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj | 6 +++++- .../Modules/Tango.MachineStudio.DataCapture/App.xaml | 12 ++++++++++++ .../Tango.MachineStudio.DataCapture.csproj | 6 +++++- .../Modules/Tango.MachineStudio.HardwareDesigner/App.xaml | 12 ++++++++++++ .../Tango.MachineStudio.HardwareDesigner.csproj | 6 +++++- .../Modules/Tango.MachineStudio.Logging/App.xaml | 12 ++++++++++++ .../Tango.MachineStudio.Logging.csproj | 6 +++++- .../Modules/Tango.MachineStudio.MachineDesigner/App.xaml | 12 ++++++++++++ .../Tango.MachineStudio.MachineDesigner.csproj | 4 ++++ .../MachineStudio/Modules/Tango.MachineStudio.RML/App.xaml | 12 ++++++++++++ .../Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj | 4 ++++ .../Modules/Tango.MachineStudio.Statistics/App.xaml | 12 ++++++++++++ .../Tango.MachineStudio.Statistics.csproj | 4 ++++ .../Modules/Tango.MachineStudio.Storage/App.xaml | 12 ++++++++++++ .../Tango.MachineStudio.Storage.csproj | 4 ++++ .../Modules/Tango.MachineStudio.Stubs/App.xaml | 12 ++++++++++++ .../Tango.MachineStudio.Stubs.csproj | 6 +++++- .../Modules/Tango.MachineStudio.Technician/App.xaml | 12 ++++++++++++ .../Tango.MachineStudio.Technician.csproj | 6 +++++- .../Modules/Tango.MachineStudio.UsersAndRoles/App.xaml | 12 ++++++++++++ .../Tango.MachineStudio.UsersAndRoles.csproj | 6 +++++- 30 files changed, 249 insertions(+), 8 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/App.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/App.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/App.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/App.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/App.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/App.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/App.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/App.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/App.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/App.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/App.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/App.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/App.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/App.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/App.xaml (limited to 'Software/Visual_Studio/MachineStudio') diff --git a/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/App.xaml b/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/App.xaml new file mode 100644 index 000000000..224e686a3 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/App.xaml @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/Tango.MachineStudio.Dispensers.csproj b/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/Tango.MachineStudio.Dispensers.csproj index 414de1e17..a2b863f9f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/Tango.MachineStudio.Dispensers.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/Tango.MachineStudio.Dispensers.csproj @@ -148,6 +148,10 @@ + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/App.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/App.xaml new file mode 100644 index 000000000..6eb88cf5f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/App.xaml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Tango.MachineStudio.Catalogs.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Tango.MachineStudio.Catalogs.csproj index 5473c28bc..613b3a95a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Tango.MachineStudio.Catalogs.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Tango.MachineStudio.Catalogs.csproj @@ -88,6 +88,10 @@ GlobalVersionInfo.cs + + Designer + MSBuild:Compile + MSBuild:Compile Designer diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/App.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/App.xaml new file mode 100644 index 000000000..1aed4c1f5 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/App.xaml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Tango.MachineStudio.ColorCapture.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Tango.MachineStudio.ColorCapture.csproj index dab747e8d..8f37a9c2d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Tango.MachineStudio.ColorCapture.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Tango.MachineStudio.ColorCapture.csproj @@ -102,6 +102,10 @@ + + Designer + MSBuild:Compile + MSBuild:Compile Designer diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/App.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/App.xaml new file mode 100644 index 000000000..9af77d7c9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/App.xaml @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj index ef01ae5f9..3590fb9e8 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj @@ -171,6 +171,10 @@ + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -197,7 +201,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/App.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/App.xaml new file mode 100644 index 000000000..477f21727 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/App.xaml @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj index 2b1ce73bb..a6b278fe1 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj @@ -346,6 +346,10 @@ MainDBView.xaml + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -719,7 +723,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/App.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/App.xaml new file mode 100644 index 000000000..9d4319bb9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/App.xaml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj index 0e1fa8b8a..ce4729c2a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj @@ -86,6 +86,10 @@ RecordingBarView.xaml + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -195,7 +199,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/App.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/App.xaml new file mode 100644 index 000000000..616bf229b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/App.xaml @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Tango.MachineStudio.HardwareDesigner.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Tango.MachineStudio.HardwareDesigner.csproj index 0e7663abc..b40dd2088 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Tango.MachineStudio.HardwareDesigner.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Tango.MachineStudio.HardwareDesigner.csproj @@ -84,6 +84,10 @@ MainView.xaml + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -193,7 +197,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/App.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/App.xaml new file mode 100644 index 000000000..70c42855b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/App.xaml @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging.csproj index c5af1bf96..4ef8888f1 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging.csproj @@ -194,6 +194,10 @@ + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -250,7 +254,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/App.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/App.xaml new file mode 100644 index 000000000..c8329636d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/App.xaml @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj index 0e6cca479..d80060831 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj @@ -125,6 +125,10 @@ SpoolsView.xaml + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/App.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/App.xaml new file mode 100644 index 000000000..787e83d72 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/App.xaml @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj index 6741a1dff..2ff9ab0a3 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj @@ -191,6 +191,10 @@ + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/App.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/App.xaml new file mode 100644 index 000000000..f34703f07 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/App.xaml @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Tango.MachineStudio.Statistics.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Tango.MachineStudio.Statistics.csproj index 0bf3681db..243663c5a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Tango.MachineStudio.Statistics.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Tango.MachineStudio.Statistics.csproj @@ -86,6 +86,10 @@ GlobalVersionInfo.cs + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/App.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/App.xaml new file mode 100644 index 000000000..255016d18 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/App.xaml @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/Tango.MachineStudio.Storage.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/Tango.MachineStudio.Storage.csproj index 15958f019..cd110ca6d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/Tango.MachineStudio.Storage.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/Tango.MachineStudio.Storage.csproj @@ -142,6 +142,10 @@ + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/App.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/App.xaml new file mode 100644 index 000000000..ef08a4d98 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/App.xaml @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Tango.MachineStudio.Stubs.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Tango.MachineStudio.Stubs.csproj index 3c3efdca7..91268f3a3 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Tango.MachineStudio.Stubs.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Tango.MachineStudio.Stubs.csproj @@ -87,6 +87,10 @@ + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -173,7 +177,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/App.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/App.xaml new file mode 100644 index 000000000..cfd8febd4 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/App.xaml @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj index ff45bcbf9..809eb2496 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj @@ -298,6 +298,10 @@ MachineTechView.xaml + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -724,7 +728,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/App.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/App.xaml new file mode 100644 index 000000000..016775aab --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/App.xaml @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Tango.MachineStudio.UsersAndRoles.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Tango.MachineStudio.UsersAndRoles.csproj index 3b14fd13c..82376b751 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Tango.MachineStudio.UsersAndRoles.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Tango.MachineStudio.UsersAndRoles.csproj @@ -162,6 +162,10 @@ + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -210,7 +214,7 @@ - + \ No newline at end of file -- cgit v1.3.1 From 20b54cfc2b40bb69d1d6558c7fac6cc412c98da0 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 7 Oct 2019 14:42:44 +0300 Subject: Implemented RML import/export. Fixed issue with MS in 1920x1080. Added IP Address & Up Time to PPC. Added ExternalBridge Icon IsInSession Indication. Fixed issue with ExternalBridgeService disconnection. --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 53673984 -> 53673984 bytes Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../PPC Installer-cache/cacheIndex.txt | Bin 52 -> 52 bytes .../Advanced Installer Projects/PPC Installer.aip | 6 +- .../ViewModels/MainViewVM.cs | 2 +- .../ViewModels/MainViewVM.cs | 91 +++++++++++++++++++++ .../Tango.MachineStudio.RML/Views/RmlsView.xaml | 76 ++++++++++------- .../Tango.MachineStudio.UI/MainWindow.xaml | 4 +- .../Tango.MachineStudio.UI/MainWindow.xaml.cs | 7 +- .../ViewModels/SystemViewVM.cs | 43 ++++++++++ .../Tango.PPC.Technician/Views/SystemView.xaml | 41 +++++++--- .../Application/IPPCApplicationManager.cs | 5 ++ .../PPCApplication/DefaultPPCApplicationManager.cs | 7 ++ .../PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs | 2 +- .../PPC/Tango.PPC.UI/Views/MainView.xaml | 13 ++- Software/Visual_Studio/Tango.BL/Entities/Rml.cs | 45 ++++++++++ .../Tango.Transport/TransporterBase.cs | 2 +- 19 files changed, 293 insertions(+), 51 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index e689d3860..44cb41149 100644 Binary files a/Software/DB/PPC/Tango.mdf and b/Software/DB/PPC/Tango.mdf differ diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf index dbc33c2eb..a08ddfca9 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 6b4ec2038..1e370f3c3 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 9aea78ecc..be04f47f6 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt index a603ff06b..6d87e9201 100644 Binary files a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt and b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt differ diff --git a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip index 61e14fbe8..5daca3dcb 100644 --- a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip +++ b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip @@ -18,10 +18,10 @@ - + - + @@ -400,7 +400,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 27d43bd20..4ab3bb1bb 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -2565,7 +2565,7 @@ namespace Tango.MachineStudio.Developer.ViewModels private async void ImportJobFile() { OpenFileDialog dlg = new OpenFileDialog(); - dlg.Title = "Import Job File"; + dlg.Title = "Import Job Files"; dlg.Filter = "Twine Job Files|*.job"; dlg.Multiselect = true; if (dlg.ShowDialog().Value) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs index a76799881..ee21b9ac3 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs @@ -181,6 +181,10 @@ namespace Tango.MachineStudio.RML.ViewModels public RelayCommand CloneRmlCommand { get; set; } + public RelayCommand ExportRMLFileCommand { get; set; } + + public RelayCommand ImportRMLFileCommand { get; set; } + public MainViewVM(INotificationProvider notificationProvider) { _notification = notificationProvider; @@ -199,6 +203,9 @@ namespace Tango.MachineStudio.RML.ViewModels ImportForwardDataCommand = new RelayCommand(ImportCCTData, () => ActiveRML != null && IsFree); ExportForwardDataCommand = new RelayCommand(ExportCCTData, () => ActiveRML != null && SelectedCCT != null && IsFree); + + ExportRMLFileCommand = new RelayCommand(ExportRmlFile, () => SelectedRML != null && IsFree); + ImportRMLFileCommand = new RelayCommand(ImportRmlFile, () => IsFree); } public override void OnApplicationReady() @@ -769,5 +776,89 @@ namespace Tango.MachineStudio.RML.ViewModels } #endregion + + #region RML Import / Export + + private async void ImportRmlFile() + { + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Title = "Import Thread Files"; + dlg.Filter = "Twine Thread Files|*.rml"; + dlg.Multiselect = true; + + if (dlg.ShowDialog().Value) + { + using (_notification.PushTaskItem($"Importing thread files...")) + { + try + { + IsFree = false; + + LogManager.Log($"Importing thread files..."); + + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + foreach (var file in dlg.FileNames) + { + var json = File.ReadAllText(file); + var rmlFile = await Rml.FromRmlFile(db, json); + + db.Rmls.Add(rmlFile); + } + + await db.SaveChangesAsync(); + } + + IsFree = true; + + _notification.ShowInfo($"Threads imported successfully."); + + LoadRmls(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error importing thread file."); + _notification.ShowError($"An error occurred while trying to import the selected thread file.\n{ex.FlattenMessage()}"); + } + finally + { + IsFree = true; + } + } + } + } + + private async void ExportRmlFile() + { + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Title = "Export Thread File"; + dlg.Filter = "Twine Thread Files|*.rml"; + dlg.DefaultExt = ".rml"; + dlg.FileName = SelectedRML.Name; + + if (dlg.ShowDialog().Value) + { + using (_notification.PushTaskItem($"Exporting Thread '{SelectedRML.Name}'...")) + { + try + { + LogManager.Log($"Exporting Thread file {SelectedRML.Name}"); + + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + var rmlJsonFile = await SelectedRML.ToRmlFile(db); + File.WriteAllText(dlg.FileName, rmlJsonFile); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error exporting Thread file."); + _notification.ShowError($"An error occurred while trying to export thread '{SelectedRML.Name}'.\n{ex.FlattenMessage()}"); + } + } + } + } + + #endregion } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml index fdfc00ba6..288f00a3d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml @@ -19,38 +19,58 @@ - + - - + + - - - - - - - + + + + + + + @@ -63,11 +83,11 @@ - + - + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml index eecbcf8ad..a76749b05 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml @@ -15,8 +15,8 @@ - - + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs index d0eec65e2..915deb484 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs @@ -105,19 +105,24 @@ namespace Tango.MachineStudio.UI switch (ratio) { case 16d / 9d: - grid.Height = 1000; + grid.Height = 1145; + grid.Width = 2000; break; case 16d / 10d: grid.Height = 1145; + grid.Width = 1920; break; case 4d / 3d: grid.Height = 1280; + grid.Width = 1920; break; case 1366d / 768d: grid.Height = 1100; + grid.Width = 1920; break; default: grid.Height = 1145; + grid.Width = 1920; break; } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs index e01003c0b..444c1d09e 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Management; +using System.Net; +using System.Net.Sockets; using System.Text; using System.Threading.Tasks; using System.Timers; @@ -40,6 +42,20 @@ namespace Tango.PPC.Technician.ViewModels set { _temperature = value; RaisePropertyChangedAuto(); } } + private TimeSpan _upTime; + public TimeSpan UpTime + { + get { return _upTime; } + set { _upTime = value; RaisePropertyChangedAuto(); } + } + + private String _ipAddress; + public String IPAddress + { + get { return _ipAddress; } + set { _ipAddress = value; RaisePropertyChangedAuto(); } + } + public RelayCommand ResetDeviceCommand { get; set; } public RelayCommand RestartCommand { get; set; } @@ -132,6 +148,12 @@ namespace Tango.PPC.Technician.ViewModels _statsTimer.Start(); } + public override void OnApplicationReady() + { + base.OnApplicationReady(); + IPAddress = GetIpv4Address(); + } + private void _statsTimer_Elapsed(object sender, ElapsedEventArgs e) { if (IsVisible) @@ -139,6 +161,7 @@ namespace Tango.PPC.Technician.ViewModels CPU = GetAppCPU(); RAM = GetAppRam(); //Temperature = GetTemperature(); + UpTime = DateTime.Now - ApplicationManager.StartUpDate; } } @@ -201,5 +224,25 @@ namespace Tango.PPC.Technician.ViewModels return 0; } } + + public String GetIpv4Address() + { + try + { + var host = Dns.GetHostEntry(Dns.GetHostName()); + foreach (var ip in host.AddressList) + { + if (ip.AddressFamily == AddressFamily.InterNetwork) + { + return ip.ToString(); + } + } + return "N/A"; + } + catch (Exception ex) + { + return "N/A"; + } + } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml index f6e6370c1..f2bfcdf7d 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml @@ -49,19 +49,34 @@ - - - - - - - Restart Device - Shutdown Device - Factory Reset - Exit To Shell - + + + + + UP TIME: + + + + + IP ADDRESS: + + + + + + + + + + + Restart Device + Shutdown Device + Factory Reset + Exit To Shell + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs index 5f58be48b..7c67ac1a3 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs @@ -95,6 +95,11 @@ namespace Tango.PPC.Common.Application /// String BuildDate { get; } + /// + /// Gets the application startup date. + /// + DateTime StartUpDate { get; } + /// /// Gets or sets a value indicating whether the screen is currently locked. /// diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs index 6a9e42ce5..c7351aa4a 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs @@ -120,6 +120,11 @@ namespace Tango.PPC.UI.PPCApplication } } + /// + /// Gets the application startup date. + /// + public DateTime StartUpDate { get; private set; } + private bool _isScreenLocked; /// /// Gets or sets a value indicating whether the screen is currently locked. @@ -171,6 +176,8 @@ namespace Tango.PPC.UI.PPCApplication bool initialized = false; bool isAfterSetup = false; + StartUpDate = DateTime.Now; + await Task.Factory.StartNew(() => { try diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs index db8540db7..a572fe23e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs @@ -8,4 +8,4 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango PPC Application")] -[assembly: AssemblyVersion("1.0.47.0")] +[assembly: AssemblyVersion("1.0.48.0")] diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml index 5accd8ff3..0ee8058c0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml @@ -63,7 +63,18 @@ - + + + + + diff --git a/Software/Visual_Studio/Tango.BL/Entities/Rml.cs b/Software/Visual_Studio/Tango.BL/Entities/Rml.cs index 63c0a9dbe..b9224a6d6 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Rml.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Rml.cs @@ -5,6 +5,8 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Media; +using Tango.BL.Builders; +using Tango.BL.Serialization; namespace Tango.BL.Entities { @@ -57,5 +59,48 @@ namespace Tango.BL.Entities { return ProcessParametersTablesGroups.FirstOrDefault(x => x.Active); } + + public Task ToRmlFile(ObservablesContext context) + { + return Task.Factory.StartNew(() => + { + var rml = new RmlBuilder(context).Set(Guid).WithActiveParametersGroup().WithCCT().WithLiquidFactors().Build(); + + String result = rml.ToJson(new EntitySerializationStrategy() + .Include(() => rml.Cct) + .Include(() => rml.LiquidTypesRmls) + .Include(() => rml.ProcessParametersTablesGroups) + .Include(typeof(ProcessParametersTablesGroup).GetProperty(nameof(ProcessParametersTablesGroup.ProcessParametersTables))), + EntitySerializationFlags.IgnoreCollections | EntitySerializationFlags.IgnoreReferenceTypes | EntitySerializationFlags.Indented); + + return result; + }); + } + + public static Task FromRmlFile(ObservablesContext context, String json) + { + return Task.Factory.StartNew(() => + { + Rml rml = Rml.FromJson(json,new EntitySerializationStrategy(),EntitySerializationFlags.Indented); + + if (context.Rmls.Any(x => x.Guid == rml.Guid || x.Name == rml.Name)) + { + throw new InvalidOperationException($"Thread {rml.Name} already exist."); + } + + if (rml.Cct != null) + { + if (context.Ccts.Any(x => x.Guid == rml.Cct.Guid)) + { + rml.Cct = null; + } + } + + rml.LastUpdated = DateTime.UtcNow; + rml.Code = context.Rmls.Max(x => x.Code) + 1; + + return rml; + }); + } } } diff --git a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs index 443f5f7cb..2824ed26a 100644 --- a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs +++ b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs @@ -1191,7 +1191,7 @@ namespace Tango.Transport } catch (Exception ex) when (ex is TimeoutException || ex is AggregateException) { - if (State != TransportComponentState.Connected || aborted || Adapter.State == TransportComponentState.Failed) return; + if (State != TransportComponentState.Connected || aborted || (Adapter.State == TransportComponentState.Failed && FailsWithAdapter)) return; if (UseKeepAlive) { -- cgit v1.3.1 From 45d005de26630b6c39867ba3a03f252628f4b090 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 7 Oct 2019 15:33:06 +0300 Subject: Machine Studio v4.0.29 PPC 1.0.48 --- .../Machine Studio Installer.aip | 100 +++++++++++++++++++-- .../Properties/AssemblyInfo.cs | 2 +- 2 files changed, 94 insertions(+), 8 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio') diff --git a/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip b/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip index 0ada18302..a1d7a5e2b 100644 --- a/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip +++ b/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip @@ -15,10 +15,10 @@ - + - + @@ -73,9 +73,17 @@ + + + + + + + + @@ -105,6 +113,7 @@ + @@ -119,7 +128,9 @@ + + @@ -128,6 +139,7 @@ + @@ -135,8 +147,11 @@ + + + @@ -148,13 +163,18 @@ + + + + + @@ -181,6 +201,7 @@ + @@ -197,15 +218,23 @@ + + + + + + + + @@ -213,19 +242,25 @@ + + + + + + @@ -288,12 +323,16 @@ + + + + @@ -331,14 +370,14 @@ - + - + @@ -375,9 +414,18 @@ + + + + + + + + + @@ -404,11 +452,13 @@ + + @@ -426,7 +476,9 @@ + + @@ -435,6 +487,7 @@ + @@ -443,8 +496,11 @@ + + + @@ -456,13 +512,18 @@ + + + + + @@ -490,6 +551,7 @@ + @@ -506,15 +568,23 @@ + + + + + + + + @@ -522,19 +592,25 @@ + + + + + + @@ -554,7 +630,7 @@ - + @@ -690,6 +766,8 @@ + + @@ -697,6 +775,12 @@ + + + + + + @@ -738,6 +822,9 @@ + + + @@ -756,7 +843,7 @@ - + @@ -832,7 +919,6 @@ - diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs index 1fb4da669..91792e0f3 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ using System.Runtime.InteropServices; [assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyTitle("Tango - Machine Studio")] -[assembly: AssemblyVersion("4.0.28.0")] +[assembly: AssemblyVersion("4.0.29.0")] [assembly: ComVisible(false)] \ No newline at end of file -- cgit v1.3.1 From 583d3716e37a9be80c8bb248215f343ed4fcd2d1 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 7 Oct 2019 15:51:21 +0300 Subject: Redundant. --- .../Models/HardwareCollection.cs | 19 +++++++++++ .../Models/HardwareParameter.cs | 39 +++++++++++++++------- .../Models/IHasDifference.cs | 3 ++ 3 files changed, 49 insertions(+), 12 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareCollection.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareCollection.cs index 7c774e65f..79c7fc946 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareCollection.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareCollection.cs @@ -7,11 +7,26 @@ using Tango.Core; namespace Tango.MachineStudio.MachineDesigner.Models { + /// + /// Represents a hardware version collection. + /// + /// + /// public class HardwareCollection : ExtendedObject, IHasDifference { + /// + /// Gets or sets the name of the collection. + /// public String CollectionName { get; set; } + /// + /// Gets or sets the components. + /// public SynchronizedObservableCollection Components { get; set; } + + /// + /// Gets a value indicating whether this instance has differences. + /// public bool HasDifferences { get @@ -19,6 +34,10 @@ namespace Tango.MachineStudio.MachineDesigner.Models return Components.Any(item => item.HasDifferences); } } + + /// + /// Initializes a new instance of the class. + /// public HardwareCollection() { Components = new SynchronizedObservableCollection(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareParameter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareParameter.cs index 9e30874e9..5bddfb02e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareParameter.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareParameter.cs @@ -12,20 +12,19 @@ namespace Tango.MachineStudio.MachineDesigner.Models /// The HardwareParameter class. /// Contains default/editable/actual value and data type of each hardware parameter reflected in . /// - /// - /// This class provides data state changes. - /// public class HardwareParameter : ExtendedObject, IHasDifference { - #region properties + #region Properties + public HardwareComponent Component { get; set; } public String PropertyName { get; set; } + + private Object _defaultValue; /// /// The default value contains data from database /// - private Object _defaultValue; public Object DefaultValue { get { return _defaultValue; } @@ -34,6 +33,7 @@ namespace Tango.MachineStudio.MachineDesigner.Models _defaultValue = value; } } + /// /// The type of hardware parameter is used for display correct ui element. /// Can be boolean, int32, or Double @@ -43,10 +43,11 @@ namespace Tango.MachineStudio.MachineDesigner.Models get { return DefaultValue.GetType(); } } + + private Object _actualValue = null; /// - /// The value contains modified data, saved in database or immediately after editing in this session + /// The value contains modified data, saved in database or immediately after editing in this session. /// - private Object _actualValue = null; public Object ActualValue { get { return _actualValue; } @@ -59,11 +60,12 @@ namespace Tango.MachineStudio.MachineDesigner.Models } } + + private Object _editableValue = null; /// - /// The editable value contains value displayed in edit box in UI. + /// The editable value contains value displayed in edit box in UI. /// Initialization the value occurs by clicking in UI and the value will be equal actual value if it exists or default value. /// - private Object _editableValue = null; public Object EditableValue { get { return _editableValue; } @@ -91,6 +93,7 @@ namespace Tango.MachineStudio.MachineDesigner.Models } } } + /// /// Used in UI to display modified value /// @@ -101,6 +104,7 @@ namespace Tango.MachineStudio.MachineDesigner.Models return (ActualValue != null); } } + /// /// Used to display warning explanation icon in case actual value equals default value /// @@ -111,14 +115,17 @@ namespace Tango.MachineStudio.MachineDesigner.Models return ActualValue != null && ActualValue.ToString() == DefaultValue.ToString(); } } - #endregion properties + + #endregion #region events + /// /// Occurs when start select mode. /// Used to set in all others Parameter IsSelected to false except this. /// public event EventHandler Selected; + private void OnIsSelectedChanged() { if (IsSelected) @@ -133,20 +140,28 @@ namespace Tango.MachineStudio.MachineDesigner.Models } } } + #endregion - #region constructors + + #region Constructors + public HardwareParameter() { DeleteCommand = new RelayCommand(DeleteValue); } + #endregion - #region commands + + #region Commands + public RelayCommand DeleteCommand { get; set; } + public void DeleteValue() { ActualValue = null; EditableValue = null; } + #endregion } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/IHasDifference.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/IHasDifference.cs index bd4851867..759f69ce4 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/IHasDifference.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/IHasDifference.cs @@ -8,6 +8,9 @@ namespace Tango.MachineStudio.MachineDesigner.Models { interface IHasDifference { + /// + /// Gets a value indicating whether this instance has differences. + /// bool HasDifferences { get;} } } -- cgit v1.3.1