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 ! --- .../ViewModels/MainViewVM.cs | 25 +++++++++------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs index 81719287b..c9f4b3441 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -238,8 +238,6 @@ namespace Tango.MachineStudio.UI.ViewModels ApplicationManager = applicationManager; DiagnosticsFrameProvider = frameProvider; - DiagnosticsFrameProvider.MachineEventsStateProviderChanged += FrameProvider_MachineEventsStateProviderChanged; - StartModuleCommand = new RelayCommand(StartModule); HomeCommand = new RelayCommand(Home); @@ -253,26 +251,23 @@ namespace Tango.MachineStudio.UI.ViewModels _updateCheckThread = new Thread(UpdateCheckThreadMethod); _updateCheckThread.IsBackground = true; _updateCheckThread.Start(); - } - private void FrameProvider_MachineEventsStateProviderChanged(object sender, Integration.Operation.IMachineEventsStateProvider provider) - { - - if (DiagnosticsFrameProvider.MachineEventsStateProvider.Events.Count == 0) + ApplicationManager.ConnectedMachineChanged += (sender, machine) => { - IsMachineErrorsOpened = false; - } - - provider.NewEvents -= MachineEventsStateProvider_NewEvents; - provider.NewEvents += MachineEventsStateProvider_NewEvents; + if (machine != null) + { + machine.MachineEventsStateProvider.NewEvents -= MachineEventsStateProvider_NewEvents; + machine.MachineEventsStateProvider.NewEvents += MachineEventsStateProvider_NewEvents; - provider.EventsResolved -= MachineEventsStateProvider_EventsResolved; - provider.EventsResolved += MachineEventsStateProvider_EventsResolved; + machine.MachineEventsStateProvider.EventsResolved -= MachineEventsStateProvider_EventsResolved; + machine.MachineEventsStateProvider.EventsResolved += MachineEventsStateProvider_EventsResolved; + } + }; } private void MachineEventsStateProvider_EventsResolved(object sender, IEnumerable e) { - if (DiagnosticsFrameProvider.MachineEventsStateProvider.Events.Count == 0) + if (ApplicationManager.ConnectedMachine.MachineEventsStateProvider.Events.Count == 0) { IsMachineErrorsOpened = false; } -- 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.UI/ViewModels') 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