From a898decf18c4c0ed56d020dc09df55df1ca0263a Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 9 Apr 2018 18:30:58 +0300 Subject: Lots of changes :/ --- .../ViewModels/MainViewVM.cs | 40 +++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (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 c9f4b3441..3cb728395 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -20,10 +20,12 @@ using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Authentication; using Tango.MachineStudio.Common.Diagnostics; using Tango.MachineStudio.Common.EventLogging; +using Tango.MachineStudio.Common.Html; using Tango.MachineStudio.Common.Messages; using Tango.MachineStudio.Common.Modules; using Tango.MachineStudio.Common.Navigation; using Tango.MachineStudio.Common.Notifications; +using Tango.MachineStudio.Common.Speech; using Tango.MachineStudio.Common.StudioApplication; using Tango.MachineStudio.Common.Update; using Tango.MachineStudio.UI.StudioApplication; @@ -49,6 +51,7 @@ namespace Tango.MachineStudio.UI.ViewModels private bool _isDisconnecting; private Thread _updateCheckThread; private IEventLogger _eventLogger; + private IHtmlPresenter _htmlPresenter; /// /// Gets or sets the current loaded module. @@ -129,6 +132,16 @@ namespace Tango.MachineStudio.UI.ViewModels /// public RelayCommand UpdateCenterCommand { get; set; } + /// + /// Gets or sets the toggle speech command. + /// + public RelayCommand ToggleSpeechCommand { get; set; } + + /// + /// Gets or sets the display HTML command. + /// + public RelayCommand ResolveMachineEventCommand { get; set; } + private IAuthenticationProvider _authenticationProvider; /// /// Gets or sets the authentication provider. @@ -169,6 +182,11 @@ namespace Tango.MachineStudio.UI.ViewModels set { _applicationManager = value; RaisePropertyChangedAuto(); } } + /// + /// Gets or sets the speech provider. + /// + public ISpeechProvider SpeechProvider { get; set; } + private bool _isUpdateAvailable; /// /// Gets or sets a value indicating whether a new version update is available. @@ -228,7 +246,9 @@ namespace Tango.MachineStudio.UI.ViewModels IStudioApplicationManager applicationManager, INavigationManager navigationManager, IEventLogger eventLogger, - IDiagnosticsFrameProvider frameProvider) : base(view) + IDiagnosticsFrameProvider frameProvider, + ISpeechProvider speechProvider, + IHtmlPresenter htmlPresenter) : base(view) { _eventLogger = eventLogger; _navigation = navigationManager; @@ -237,6 +257,8 @@ namespace Tango.MachineStudio.UI.ViewModels NotificationProvider = notificationProvider; ApplicationManager = applicationManager; DiagnosticsFrameProvider = frameProvider; + SpeechProvider = speechProvider; + _htmlPresenter = htmlPresenter; StartModuleCommand = new RelayCommand(StartModule); @@ -263,6 +285,10 @@ namespace Tango.MachineStudio.UI.ViewModels machine.MachineEventsStateProvider.EventsResolved += MachineEventsStateProvider_EventsResolved; } }; + + ToggleSpeechCommand = new RelayCommand(() => { SpeechProvider.Mute = !SpeechProvider.Mute; }); + + ResolveMachineEventCommand = new RelayCommand(ResolveMachineEvent); } private void MachineEventsStateProvider_EventsResolved(object sender, IEnumerable e) @@ -542,5 +568,17 @@ namespace Tango.MachineStudio.UI.ViewModels { _applicationManager.ShutDown(); } + + /// + /// Displays the HTML. + /// + /// The HTML page. + private void ResolveMachineEvent(MachinesEvent machineEvent) + { + if (_htmlPresenter.DisplayHtml(machineEvent.EventType.HtmlPage)) + { + //Send resolved to embedded ! + } + } } } -- cgit v1.3.1