diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI')
4 files changed, 18 insertions, 25 deletions
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<IEventLogger>(); - 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/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<IStudioModule>(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<MachinesEvent> e) { - if (DiagnosticsFrameProvider.MachineEventsStateProvider.Events.Count == 0) + if (ApplicationManager.ConnectedMachine.MachineEventsStateProvider.Events.Count == 0) { IsMachineErrorsOpened = false; } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml index a85e0a850..b7a4cc93f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml @@ -227,11 +227,11 @@ </StackPanel> </Button> - <ToggleButton Visibility="{Binding DiagnosticsFrameProvider.MachineEventsStateProvider.HasEvents,Converter={StaticResource BooleanToVisibilityConverter},FallbackValue=Collapsed,TargetNullValue=Collapsed,Mode=OneWay}" IsChecked="{Binding IsMachineErrorsOpened}" Style="{StaticResource emptyToggleButton}" Margin="0 0 10 0" Cursor="Hand"> + <ToggleButton Visibility="{Binding ApplicationManager.ConnectedMachine.MachineEventsStateProvider.HasEvents,Converter={StaticResource BooleanToVisibilityConverter},FallbackValue=Collapsed,TargetNullValue=Collapsed,Mode=OneWay}" IsChecked="{Binding IsMachineErrorsOpened}" Style="{StaticResource emptyToggleButton}" Margin="0 0 10 0" Cursor="Hand"> <ToggleButton.ToolTip> <TextBlock> <Run>Press to view</Run> - <Run Text="{Binding DiagnosticsFrameProvider.MachineEventsStateProvider.Events.Count,Mode=OneWay}"></Run> + <Run Text="{Binding ApplicationManager.ConnectedMachine.MachineEventsStateProvider.Events.Count,Mode=OneWay}"></Run> <Run>hardware messages</Run> </TextBlock> </ToggleButton.ToolTip> @@ -240,7 +240,7 @@ <Style TargetType="Grid"> <Setter Property="Opacity" Value="1"></Setter> <Style.Triggers> - <DataTrigger Binding="{Binding DiagnosticsFrameProvider.MachineEventsStateProvider.HasEvents}" Value="True"> + <DataTrigger Binding="{Binding ApplicationManager.ConnectedMachine.MachineEventsStateProvider.HasEvents}" Value="True"> <DataTrigger.EnterActions> <BeginStoryboard> <Storyboard> @@ -433,7 +433,7 @@ <DropShadowEffect ShadowDepth="0" BlurRadius="10" /> </Border.Effect> - <ItemsControl ItemsSource="{Binding DiagnosticsFrameProvider.MachineEventsStateProvider.Events}"> + <ItemsControl ItemsSource="{Binding ApplicationManager.ConnectedMachine.MachineEventsStateProvider.Events}"> <ItemsControl.ItemTemplate> <DataTemplate DataType="{x:Type entities:MachinesEvent}"> <Border BorderThickness="0 0 0 1" BorderBrush="#E1E1E1" Padding="5"> |
