From 17a77c30765fe8a0d3ca57a9ec60fb43b82432d2 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 8 Apr 2018 16:55:37 +0300 Subject: Implemented timeline events ! --- .../Diagnostics/DefaultDiagnosticsFrameProvider.cs | 41 ---------------------- .../Diagnostics/IDiagnosticsFrameProvider.cs | 10 ------ .../EventLogging/DefaultEventLogger.cs | 1 + 3 files changed, 1 insertion(+), 51 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs index 8f1076bb8..63612d420 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs @@ -34,25 +34,6 @@ namespace Tango.MachineStudio.Common.Diagnostics set { _disable = value; - - if (!_disable) - { - if (_application.ConnectedMachine != null) - { - MachineEventsStateProvider = _application.ConnectedMachine.MachineEventsStateProvider; - } - else - { - MachineEventsStateProvider = new DefaultMachineEventsStateProvider(); - } - } - else - { - if (_application.ConnectedMachine != null) - { - MachineEventsStateProvider = new DefaultMachineEventsStateProvider(); - } - } } } @@ -61,21 +42,6 @@ namespace Tango.MachineStudio.Common.Diagnostics /// public event EventHandler FrameReceived; - private IMachineEventsStateProvider _machineEventsStateProvider; - /// - /// Gets or sets the machine events state provider used to get notifications about current machine events and errors. - /// - public IMachineEventsStateProvider MachineEventsStateProvider - { - get { return _machineEventsStateProvider; } - set - { - _machineEventsStateProvider = value; - RaisePropertyChangedAuto(); - MachineEventsStateProviderChanged?.Invoke(this, _machineEventsStateProvider); - } - } - /// /// Initializes a new instance of the class. /// @@ -83,7 +49,6 @@ namespace Tango.MachineStudio.Common.Diagnostics public DefaultDiagnosticsFrameProvider(IStudioApplicationManager applicationManager) { _application = applicationManager; - MachineEventsStateProvider = new DefaultMachineEventsStateProvider(); applicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; } @@ -97,11 +62,6 @@ namespace Tango.MachineStudio.Common.Diagnostics if (machine != null) { machine.DiagnosticsDataAvailable += DefaultDiagnosticsFrameProvider_DiagnosticsDataAvailable; - - if (!Disable) - { - MachineEventsStateProvider = machine.MachineEventsStateProvider; - } } } @@ -127,7 +87,6 @@ namespace Tango.MachineStudio.Common.Diagnostics if (Disable) { OnFrameReceived(frame); - MachineEventsStateProvider.ApplyEvents(frame.Events); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/IDiagnosticsFrameProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/IDiagnosticsFrameProvider.cs index ab4780a1f..3294b341d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/IDiagnosticsFrameProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/IDiagnosticsFrameProvider.cs @@ -18,16 +18,6 @@ namespace Tango.MachineStudio.Common.Diagnostics /// event EventHandler FrameReceived; - /// - /// Occurs when the machine events state provider has changed. - /// - event EventHandler MachineEventsStateProviderChanged; - - /// - /// Gets or sets the machine events state provider used to get notifications about current machine events and errors. - /// - IMachineEventsStateProvider MachineEventsStateProvider { get; } - /// /// Disables the frame delivery from the current connected machine and enables the manual push frame method. /// diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs index d3fb0897f..91aa049e9 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs @@ -220,6 +220,7 @@ namespace Tango.MachineStudio.Common.EventLogging machineEvent.DateTime = DateTime.UtcNow; machineEvent.Description = message; machineEvent.EventType = _eventTypesGuids[eventType]; + machineEvent.EventTypeGuid = machineEvent.EventType.Guid; Log(machineEvent); } -- cgit v1.3.1 From a0e25846735104f09a18647220db59804977e73a Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 8 Apr 2018 17:48:58 +0300 Subject: Fixed issue with "Application Started" event. Fixed issue with segment indexing after emb import. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 1572864 -> 1572864 bytes .../ViewModels/MainViewVM.cs | 2 +- .../EventLogging/DefaultEventLogger.cs | 29 +++++++++++------- .../Tango.MachineStudio.UI/App.xaml.cs | 6 ---- .../ViewModels/LoadingViewVM.cs | 4 +++ .../Tango.BL/EntitiesExtensions/Machine.cs | 2 +- .../Tango.BL/EntitiesExtensions/MediaColor.cs | 33 +++++++++++++++++++++ .../Tango.BL/ExtensionMethods/MediaColor.cs | 33 --------------------- Software/Visual_Studio/Tango.BL/Tango.BL.csproj | 2 +- 10 files changed, 58 insertions(+), 53 deletions(-) create mode 100644 Software/Visual_Studio/Tango.BL/EntitiesExtensions/MediaColor.cs delete mode 100644 Software/Visual_Studio/Tango.BL/ExtensionMethods/MediaColor.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index e570d5638..dff82fd11 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 1589c0595..b6a391fd4 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ 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 63994f592..7891f96b7 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 @@ -1752,7 +1752,7 @@ namespace Tango.MachineStudio.Developer.ViewModels segment.Length = totalLength; segment.Name = "Embroidery Segment"; - segment.SegmentIndex = vm.Paths.IndexOf(path) + 2; + segment.SegmentIndex = vm.Paths.IndexOf(path); if (path.Brush is SolidColorBrush) { diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs index 91aa049e9..f3ae1002b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs @@ -78,21 +78,28 @@ namespace Tango.MachineStudio.Common.EventLogging { if (!_isInitialized) { - _db = ObservablesContext.CreateDefault(); - _db.Configuration.LazyLoadingEnabled = false; + try + { + _db = ObservablesContext.CreateDefault(); + _db.Configuration.LazyLoadingEnabled = false; - _db.ActionTypes.ToList(); - _db.EventTypesActions.ToList(); - _db.EventTypesCategories.ToList(); - _db.EventTypesGroups.ToList(); - _db.EventTypes.ToList(); + _db.ActionTypes.ToList(); + _db.EventTypesActions.ToList(); + _db.EventTypesCategories.ToList(); + _db.EventTypesGroups.ToList(); + _db.EventTypes.ToList(); - foreach (var type in _db.EventTypes) + foreach (var type in _db.EventTypes) + { + _eventTypesGuids.Add((EventTypes)type.Code, type); + } + + _isInitialized = true; + } + catch { - _eventTypesGuids.Add((EventTypes)type.Code, type); + _isInitialized = false; } - - _isInitialized = true; } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs index 8b3233ab1..76c7b3e58 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs @@ -50,12 +50,6 @@ namespace Tango.MachineStudio.UI exceptionTrapper = new WpfGlobalExceptionTrapper(); exceptionTrapper.Initialize(this); exceptionTrapper.ApplicationCrashed += ExceptionTrapper_ApplicationCrashed; - - var eventLogger = ServiceLocator.Current.GetInstance(); - if (eventLogger != null) - { - eventLogger.Log(EventTypes.ApplicationStarted, "Application Started!"); - } } #region Global Exception Trapping diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs index 5776cadc2..512341f7e 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs @@ -14,6 +14,7 @@ using Tango.MachineStudio.Common.StudioApplication; using Tango.SharedUI; using Tango.BL; using Tango.MachineStudio.Common.EventLogging; +using Tango.BL.Enumerations; namespace Tango.MachineStudio.UI.ViewModels { @@ -66,6 +67,9 @@ namespace Tango.MachineStudio.UI.ViewModels try { ObservablesEntitiesAdapter.Instance.Initialize(); + + _eventLogger.Log(EventTypes.ApplicationStarted, "Application Started!"); + InvokeUI(() => { _studioModuleLoader.LoadModules(); diff --git a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Machine.cs b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Machine.cs index e00715795..ff32ba02f 100644 --- a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Machine.cs +++ b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Machine.cs @@ -31,7 +31,7 @@ namespace Tango.BL.Entities foreach (var segment in job.Segments) { - segment.SegmentIndex = job.Segments.IndexOf(segment); + //segment.SegmentIndex = job.Segments.IndexOf(segment); foreach (var stop in segment.BrushStops) { diff --git a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/MediaColor.cs b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/MediaColor.cs new file mode 100644 index 000000000..e4a312775 --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/MediaColor.cs @@ -0,0 +1,33 @@ +using ColorMine.ColorSpaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; + +namespace Tango.BL.Entities +{ + public partial class MediaColor + { + private Color _color; + + public Color Color + { + get { return _color; } + set { _color = value; RaisePropertyChangedAuto(); } + } + + protected override void RaisePropertyChanged(string propName) + { + base.RaisePropertyChanged(propName); + + if (propName == nameof(L) || propName == nameof(A) || propName == nameof(B)) + { + Lab lab = new Lab(L, A, B); + var rgb = lab.To(); + Color = Color.FromRgb((byte)rgb.R, (byte)rgb.G, (byte)rgb.B); + } + } + } +} diff --git a/Software/Visual_Studio/Tango.BL/ExtensionMethods/MediaColor.cs b/Software/Visual_Studio/Tango.BL/ExtensionMethods/MediaColor.cs deleted file mode 100644 index e4a312775..000000000 --- a/Software/Visual_Studio/Tango.BL/ExtensionMethods/MediaColor.cs +++ /dev/null @@ -1,33 +0,0 @@ -using ColorMine.ColorSpaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Media; - -namespace Tango.BL.Entities -{ - public partial class MediaColor - { - private Color _color; - - public Color Color - { - get { return _color; } - set { _color = value; RaisePropertyChangedAuto(); } - } - - protected override void RaisePropertyChanged(string propName) - { - base.RaisePropertyChanged(propName); - - if (propName == nameof(L) || propName == nameof(A) || propName == nameof(B)) - { - Lab lab = new Lab(L, A, B); - var rgb = lab.To(); - Color = Color.FromRgb((byte)rgb.R, (byte)rgb.G, (byte)rgb.B); - } - } - } -} diff --git a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj index d56324d8f..04c1b0a6b 100644 --- a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj +++ b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj @@ -97,7 +97,7 @@ - + -- cgit v1.3.1