diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-02-07 15:39:12 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-02-07 15:39:12 +0200 |
| commit | bd3cb640be12621ac37253e8a8c627ae40692e4d (patch) | |
| tree | cddc36bc95b966f48e1b7387fed1955504d3975b /Software | |
| parent | 7a1f9f14cc50001366be0efefc25fd5af403d02e (diff) | |
| download | Tango-bd3cb640be12621ac37253e8a8c627ae40692e4d.tar.gz Tango-bd3cb640be12621ac37253e8a8c627ae40692e4d.zip | |
Some fixes and improvements for PPC & Machine Studio.
Diffstat (limited to 'Software')
27 files changed, 127 insertions, 113 deletions
diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf Binary files differindex a7f85f8d5..14734b3f9 100644 --- a/Software/DB/PPC/Tango.mdf +++ b/Software/DB/PPC/Tango.mdf diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf Binary files differindex bbb8a827c..2b185ac48 100644 --- a/Software/DB/PPC/Tango_log.ldf +++ b/Software/DB/PPC/Tango_log.ldf diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf Binary files differindex d50c31b9a..7c71ba79c 100644 --- a/Software/DB/Tango.mdf +++ b/Software/DB/Tango.mdf diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf Binary files differindex 8f9843089..c71484957 100644 --- a/Software/DB/Tango_log.ldf +++ b/Software/DB/Tango_log.ldf diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk Binary files differindex c16a9a2cc..5edf8db16 100644 --- a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk +++ b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/ViewModels/MainViewVM.cs index 4db48c636..3df46ba6f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/ViewModels/MainViewVM.cs @@ -327,13 +327,11 @@ namespace Tango.MachineStudio.Storage.ViewModels handler.Canceled += (_, __) => { fs.Dispose(); - File.Delete(path); }; handler.Failed += (_, __) => { fs.Dispose(); - File.Delete(path); }; FileHandlers.Insert(0, new StorageFileHandlerModel(handler, path, StorageFileHandlerType.Upload)); diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Tango.PPC.Events.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Tango.PPC.Events.csproj index f38fe9162..fa7583e85 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Tango.PPC.Events.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Tango.PPC.Events.csproj @@ -129,6 +129,10 @@ <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> <Name>Tango.Core</Name> </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Integration\Tango.Integration.csproj"> + <Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project> + <Name>Tango.Integration</Name> + </ProjectReference> <ProjectReference Include="..\..\..\Tango.Logging\Tango.Logging.csproj"> <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> <Name>Tango.Logging</Name> @@ -145,6 +149,10 @@ <Project>{fd86424c-6e84-491b-8df9-3d0f5c236a2a}</Project> <Name>Tango.Touch</Name> </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Transport\Tango.Transport.csproj"> + <Project>{74e700b0-1156-4126-be40-ee450d3c3026}</Project> + <Name>Tango.Transport</Name> + </ProjectReference> <ProjectReference Include="..\..\Tango.PPC.Common\Tango.PPC.Common.csproj"> <Project>{0be74eee-22cb-4dba-b896-793b9e1a3ac0}</Project> <Name>Tango.PPC.Common</Name> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs index ed35a9b2d..9ee24ad38 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs @@ -12,6 +12,7 @@ using Tango.PPC.Common.Notifications; using Tango.PPC.Common.Notifications.NotificationItems; using Tango.PPC.Events.Enumerations; using System.Data.Entity; +using Tango.Integration.Operation; namespace Tango.PPC.Events.ViewModels { @@ -98,6 +99,26 @@ namespace Tango.PPC.Events.ViewModels var last_week = DateTime.UtcNow.AddDays(-7); HistoryEvents = (await db.MachinesEvents.Where(x => x.MachineGuid == MachineProvider.Machine.Guid && x.DateTime > last_week).Include(x => x.EventType).Where(x => (EventTypeNotificationTimes)x.EventType.EventNotificationTime != EventTypeNotificationTimes.None).ToListAsync()).OrderByDescending(x => x.DateTime).ToObservableCollection(); } + + MachineProvider.MachineOperator.StatusChanged += MachineOperator_StatusChanged; + } + + private void MachineOperator_StatusChanged(object sender, MachineStatuses status) + { + if (status == MachineStatuses.Disconnected) + { + foreach (var notification in _notifications.ToList()) + { + NotificationProvider.PopNotification(notification.Value); + } + + _notifications.Clear(); + + InvokeUI(() => + { + CurrentEvents.Clear(); + }); + } } private void EventLogger_EventReceived(object sender, MachinesEvent ev) diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs index 2a0392dd6..95912e1ea 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs @@ -33,11 +33,6 @@ namespace Tango.PPC.Common.Connection private bool _isInitialized; private Thread _connection_thread; - /// <summary> - /// Occurs when current <see cref="IMachineOperator" /> has changed. - /// </summary> - public event EventHandler<MachineOperatorChangedEventArgs> MachineOperatorChanged; - private Machine _machine; /// <summary> /// Gets the database machine entity associated with the current machine. @@ -67,24 +62,12 @@ namespace Tango.PPC.Common.Connection } private set { - var oldOperator = _machineOperator; _machineOperator = value; - OnMachineOperatorChanged(oldOperator, _machineOperator); RaisePropertyChangedAuto(); } } /// <summary> - /// Called when the machine operator has been changed - /// </summary> - /// <param name="oldOperator">The old operator.</param> - /// <param name="newOperator">The new operator.</param> - protected virtual void OnMachineOperatorChanged(IMachineOperator oldOperator, IMachineOperator newOperator) - { - MachineOperatorChanged?.Invoke(this, new MachineOperatorChangedEventArgs(oldOperator, newOperator)); - } - - /// <summary> /// Initializes a new instance of the <see cref="DefaultMachineProvider"/> class. /// </summary> public DefaultMachineProvider() @@ -128,7 +111,6 @@ namespace Tango.PPC.Common.Connection MachineOperator.Adapter = response.Adapter; MachineOperator.JobHandlingMode = JobHandlerModes.SettingUp; LogManager.Log("Connecting machine operator..."); - MachineOperatorChanged?.Invoke(this, new MachineOperatorChangedEventArgs(MachineOperator, MachineOperator)); await MachineOperator.Connect(); @@ -142,7 +124,6 @@ namespace Tango.PPC.Common.Connection UsbTransportAdapter adapter = new UsbTransportAdapter(settings.EmbeddedComPort, UsbSerialBaudRates.BR_115200); MachineOperator.Adapter = adapter; MachineOperator.JobHandlingMode = JobHandlerModes.SettingUp; - MachineOperatorChanged?.Invoke(this, new MachineOperatorChangedEventArgs(MachineOperator, MachineOperator)); await MachineOperator.Connect(); await Task.Delay(1000); @@ -165,7 +146,6 @@ namespace Tango.PPC.Common.Connection MachineOperator.Adapter = adapter; MachineOperator.JobHandlingMode = JobHandlerModes.SettingUp; LogManager.Log("Connecting machine operator..."); - MachineOperatorChanged?.Invoke(this, new MachineOperatorChangedEventArgs(MachineOperator, MachineOperator)); await MachineOperator.Connect(); await Task.Delay(1000); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/IMachineProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/IMachineProvider.cs index df4a448f7..43a6c290e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/IMachineProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/IMachineProvider.cs @@ -15,11 +15,6 @@ namespace Tango.PPC.Common.Connection public interface IMachineProvider { /// <summary> - /// Occurs when current <see cref="IMachineOperator"/> has changed. - /// </summary> - event EventHandler<MachineOperatorChangedEventArgs> MachineOperatorChanged; - - /// <summary> /// Gets the database machine entity associated with the current machine. /// </summary> Machine Machine { get; } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs index 6ef19c765..d99047f8f 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs @@ -45,21 +45,7 @@ namespace Tango.PPC.Common.Diagnostics public DefaultDiagnosticsFrameProvider(IMachineProvider machineProvider) { _machineProvider = machineProvider; - machineProvider.MachineOperatorChanged += MachineProvider_MachineOperatorChanged; - } - - - /// <summary> - /// Handles the Machine Provider Machine Operator Changed event. - /// </summary> - /// <param name="sender">The source of the event.</param> - /// <param name="e">The event arguments.</param> - private void MachineProvider_MachineOperatorChanged(object sender, MachineOperatorChangedEventArgs e) - { - if (e.MachineOperator != null) - { - e.MachineOperator.DiagnosticsDataAvailable += MachineOperator_DiagnosticsDataAvailable; - } + machineProvider.MachineOperator.DiagnosticsDataAvailable += MachineOperator_DiagnosticsDataAvailable; } /// <summary> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs index 8e1f7c722..d540e3fd3 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs @@ -73,7 +73,12 @@ namespace Tango.PPC.Common.EventLogging _logThread.IsBackground = true; _logThread.Start(); - _machineProvider.MachineOperatorChanged += _machineProvider_MachineOperatorChanged; + _machineProvider.MachineOperator.MachineEventsStateProvider.NewEvents += MachineEventsStateProvider_NewEvents; + _machineProvider.MachineOperator.MachineEventsStateProvider.EventsResolved += MachineEventsStateProvider_EventsResolved; + + _machineProvider.MachineOperator.RequestSent += Machine_RequestSent; + _machineProvider.MachineOperator.RequestFailed += Machine_RequestFailed; + _machineProvider.MachineOperator.ResponseReceived += Machine_ResponseReceived; } #endregion @@ -108,30 +113,6 @@ namespace Tango.PPC.Common.EventLogging #region Event Handlers - private void _machineProvider_MachineOperatorChanged(object sender, MachineOperatorChangedEventArgs e) - { - var machine = e.MachineOperator; - - if (machine != null) - { - if (machine.MachineEventsStateProvider != null) - { - machine.MachineEventsStateProvider.NewEvents -= MachineEventsStateProvider_NewEvents; - machine.MachineEventsStateProvider.NewEvents += MachineEventsStateProvider_NewEvents; - machine.MachineEventsStateProvider.EventsResolved -= MachineEventsStateProvider_EventsResolved; - machine.MachineEventsStateProvider.EventsResolved += MachineEventsStateProvider_EventsResolved; - } - - machine.RequestSent -= Machine_RequestSent; - machine.RequestFailed -= Machine_RequestFailed; - machine.ResponseReceived -= Machine_ResponseReceived; - - machine.RequestSent += Machine_RequestSent; - machine.RequestFailed += Machine_RequestFailed; - machine.ResponseReceived += Machine_ResponseReceived; - } - } - /// <summary> /// Handles the RequestSent event of the connected machine. /// </summary> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/DefaultOperationSystemManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/DefaultOperationSystemManager.cs index 23722319c..a073c1c5e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/DefaultOperationSystemManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/DefaultOperationSystemManager.cs @@ -82,7 +82,7 @@ namespace Tango.PPC.Common.OS CmdCommand command = new CmdCommand("cscript", $"C:\\Windows\\System32\\slmgr.vbs -ipk {activationKey}"); await command.Run(); - await Task.Delay(5000); + await Task.Delay(10000); if (!await IsActivated()) { diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs index f5c6f43b9..ee1b39ca6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs @@ -142,6 +142,13 @@ namespace Tango.PPC.UI.ViewModels set { _deploymentSlot = value; RaisePropertyChangedAuto(); } } + private MachineSetupView _currentView; + public MachineSetupView CurrentView + { + get { return _currentView; } + set { _currentView = value; RaisePropertyChangedAuto(); } + } + #endregion #region Commands @@ -284,6 +291,7 @@ namespace Tango.PPC.UI.ViewModels /// <param name="view">The view.</param> private Task NavigateTo(MachineSetupView view) { + CurrentView = view; return View.NavigateTo(view); } @@ -312,11 +320,13 @@ namespace Tango.PPC.UI.ViewModels } } - private void ConnectivityProvider_ConnectionStateChanged(object sender, Common.Connectivity.ConnectionStateEventArgs e) + private async void ConnectivityProvider_ConnectionStateChanged(object sender, Common.Connectivity.ConnectionStateEventArgs e) { if (e.IsConnected) { ConnectivityProvider.ConnectionStateChanged -= ConnectivityProvider_ConnectionStateChanged; + await NavigateTo(MachineSetupView.WiFiTestView); + await Task.Delay(5000); EnsureWiFi(); } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs index a553f3a18..07d034964 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs @@ -213,13 +213,20 @@ namespace Tango.PPC.UI.ViewModels private void CompleteUpdate() { - String updater_exe = Path.Combine(_update_result.UpdatePackagePath, "Tango.PPC.Updater.exe"); - - LogManager.Log("Completing machine setup..."); - LogManager.Log($"Executing '{updater_exe}' with arguments '{PathHelper.GetStartupPath()}'..."); - Process.Start(updater_exe, PathHelper.GetStartupPath()); - LogManager.Log("Terminating application process!"); - Environment.Exit(0); + if (!IsDbUpdate) + { + String updater_exe = Path.Combine(_update_result.UpdatePackagePath, "Tango.PPC.Updater.exe"); + LogManager.Log("Completing machine setup..."); + LogManager.Log($"Executing '{updater_exe}' with arguments '{PathHelper.GetStartupPath()}'..."); + Process.Start(updater_exe, PathHelper.GetStartupPath()); + LogManager.Log("Terminating application process!"); + Environment.Exit(0); + } + else + { + LogManager.Log("Restarting Application..."); + ApplicationManager.Restart(); + } } #endregion diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml index 0b3e0b1ee..bf3a85543 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml @@ -151,7 +151,7 @@ </Grid> <!--External Header Content Here--> - <commonControls:AsyncAdornerControl> + <!--<commonControls:AsyncAdornerControl> <commonControls:AsyncAdornerControl.Style> <Style TargetType="commonControls:AsyncAdornerControl"> <Setter Property="Visibility" Value="Hidden"></Setter> @@ -169,7 +169,7 @@ <StackPanel VerticalAlignment="Center"> <touch:TouchGifAnimation Source="/Images/preloader_rectangles.gif" EnableAnimation="{Binding NotificationProvider.IsInGlobalBusyState}" /> </StackPanel> - </commonControls:AsyncAdornerControl> + </commonControls:AsyncAdornerControl>--> </Grid> </DockPanel> </Border> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingView.xaml index 895619807..57793a9b3 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingView.xaml @@ -13,7 +13,7 @@ d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:LoadingViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.LoadingView}"> <Grid> <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> - <Image gif:ImageBehavior.EnableAnimation="{Binding IsLoading}" gif:ImageBehavior.AnimatedSource="/Images/Twine_Loading_GIF.gif" Margin="100 100 100 0" RenderTransformOrigin="0.5,0.5" RenderOptions.BitmapScalingMode="Fant" Height="382"> + <!--<Image gif:ImageBehavior.EnableAnimation="{Binding IsLoading}" gif:ImageBehavior.AnimatedSource="/Images/Twine_Loading_GIF.gif" Margin="100 100 100 0" RenderTransformOrigin="0.5,0.5" RenderOptions.BitmapScalingMode="Fant" Height="382"> <Image.Style> <Style TargetType="Image"> <Setter Property="RenderTransform"> @@ -45,8 +45,10 @@ </Style.Triggers> </Style> </Image.Style> - </Image> + </Image>--> + <touch:TouchBusyIndicator Width="250" Margin="0 100 0 0" Height="250" IsIndeterminate="{Binding IsLoading}" /> + <TextBlock Margin="0 40 0 0" HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}" Foreground="{StaticResource TangoGrayTextBrush}"> <Run>v</Run><Run Text="{Binding ApplicationManager.Version,Mode=OneWay}"></Run> </TextBlock> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml index 13f163ef5..30b99dbbf 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml @@ -65,7 +65,7 @@ <TextBlock DockPanel.Dock="Top" Margin="20 0" FontSize="{StaticResource TangoTitleFontSize}" HorizontalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center"> Checking internet connection, please wait... </TextBlock> - <touch:TouchBusyIndicator Width="250" Margin="0 100 0 0" Height="250" IsIndeterminate="True" /> + <touch:TouchBusyIndicator Width="250" Margin="0 100 0 0" Height="250" IsIndeterminate="{Binding CurrentView,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter='WiFiTestView'}" /> </StackPanel> </Grid> 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 9df92bbcc..6d1bde59d 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml @@ -91,19 +91,5 @@ <local:MachineUpdateView></local:MachineUpdateView> </controls:NavigationControl> </touch:TouchPanel> - - <!--<Grid Background="#28000000" Visibility="{Binding NotificationProvider.IsInGlobalBusyState,Converter={StaticResource BooleanToVisibilityConverter}}"/> - - <commonControls:AsyncAdornerControl HorizontalAlignment="Center" VerticalAlignment="Center" Width="600" Height="200" Visibility="Visible"> - <Grid> - <Border Background="White" CornerRadius="10"> - <Border.Effect> - <DropShadowEffect ShadowDepth="0" BlurRadius="10" /> - </Border.Effect> - - <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center">Please wait...</TextBlock> - </Border> - </Grid> - </commonControls:AsyncAdornerControl>--> </Grid> </UserControl> diff --git a/Software/Visual_Studio/Tango.Integration/Operation/DefaultMachineEventsStateProvider.cs b/Software/Visual_Studio/Tango.Integration/Operation/DefaultMachineEventsStateProvider.cs index 96f865cc3..8c376ea3e 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/DefaultMachineEventsStateProvider.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/DefaultMachineEventsStateProvider.cs @@ -136,5 +136,15 @@ namespace Tango.Integration.Operation { EventsChanged?.Invoke(this, events); } + + /// <summary> + /// Resets the current events tracking. + /// </summary> + public void Reset() + { + _events = new ReadOnlyCollection<MachinesEvent>(new List<MachinesEvent>()); + RaisePropertyChanged(nameof(Events)); + OnEventsChanged(new List<MachinesEvent>()); + } } } diff --git a/Software/Visual_Studio/Tango.Integration/Operation/IMachineEventsStateProvider.cs b/Software/Visual_Studio/Tango.Integration/Operation/IMachineEventsStateProvider.cs index 0fc086fe3..2cf00904f 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/IMachineEventsStateProvider.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/IMachineEventsStateProvider.cs @@ -49,5 +49,10 @@ namespace Tango.Integration.Operation /// </summary> /// <param name="events">The events.</param> void ApplyEvents(IEnumerable<Event> events); + + /// <summary> + /// Resets the current events tracking. + /// </summary> + void Reset(); } } diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 0edc04845..d0e03f873 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -189,12 +189,15 @@ namespace Tango.Integration.Operation get { return _status; } protected set { - _status = value; - RaisePropertyChangedAuto(); - OnMachineStatusChanged(value); - RaisePropertyChanged(nameof(IsPrinting)); - RaisePropertyChanged(nameof(CanPrint)); - LogManager.Log("Machine operator status changed: " + _status); + if (_status != value) + { + _status = value; + RaisePropertyChangedAuto(); + OnMachineStatusChanged(value); + RaisePropertyChanged(nameof(IsPrinting)); + RaisePropertyChanged(nameof(CanPrint)); + LogManager.Log("Machine operator status changed: " + _status); + } } } @@ -690,11 +693,11 @@ namespace Tango.Integration.Operation { LogRequestFailed(request, ex); } + } - if (MachineEventsStateProvider != null) - { - MachineEventsStateProvider.ApplyEvents(new List<Event>()); - } + if (MachineEventsStateProvider != null) + { + MachineEventsStateProvider.Reset(); } await base.Disconnect(); @@ -724,6 +727,10 @@ namespace Tango.Integration.Operation DeviceInformation = response.Message.DeviceInformation; + _diagnosticsSent = false; + _eventsSent = false; + _debugSent = false; + OnEnableDiagnosticsChanged(EnableDiagnostics); OnEnableEmbeddedDebuggingChanged(EnableEmbeddedDebugging); OnEnableEventsNotification(EnableEventsNotification); @@ -1305,6 +1312,10 @@ namespace Tango.Integration.Operation LogRequestSent(request); bool responseLogged = false; + Status = MachineStatuses.Printing; + RunningJob = originalJob; + PrintingStarted?.Invoke(this, new PrintingEventArgs(handler, originalJob)); + SendContinuousRequest<JobRequest, JobResponse>(request, null, TimeSpan.FromSeconds(2)).Subscribe((response) => { handler.RaiseStatusReceived(response.Message.Status); @@ -1312,9 +1323,6 @@ namespace Tango.Integration.Operation if (!responseLogged) { responseLogged = true; - Status = MachineStatuses.Printing; - RunningJob = originalJob; - PrintingStarted?.Invoke(this, new PrintingEventArgs(handler, originalJob)); LogResponseReceived(response.Message); } }, (ex) => diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.cs index 45e154ba2..0f7468011 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.cs @@ -273,7 +273,7 @@ namespace Tango.Touch.Controls { if (ItemExpandedPropertyPath != null) { - foreach (var item in Notifications) + foreach (var item in Notifications.Cast<Object>().ToList()) { item.SetPropertyValueByPath(ItemExpandedPropertyPath, expanded); } diff --git a/Software/Visual_Studio/Tango.Touch/Converters/TouchIconKindToGeometryConverter.cs b/Software/Visual_Studio/Tango.Touch/Converters/TouchIconKindToGeometryConverter.cs index 54358d59b..3174156c0 100644 --- a/Software/Visual_Studio/Tango.Touch/Converters/TouchIconKindToGeometryConverter.cs +++ b/Software/Visual_Studio/Tango.Touch/Converters/TouchIconKindToGeometryConverter.cs @@ -14,7 +14,15 @@ namespace Tango.Touch.Converters public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { TouchIconKind kind = (TouchIconKind)value; - return TouchIcon.Icons[kind]; + + if (TouchIcon.Icons != null) + { + return TouchIcon.Icons[kind]; + } + else + { + return TouchIconKind.AccessPoint; + } } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj b/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj index 9bd7f0b71..15e455168 100644 --- a/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj +++ b/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj @@ -385,7 +385,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Transport/Adapters/UsbTransportAdapter.cs b/Software/Visual_Studio/Tango.Transport/Adapters/UsbTransportAdapter.cs index d846fdc17..f00347c8d 100644 --- a/Software/Visual_Studio/Tango.Transport/Adapters/UsbTransportAdapter.cs +++ b/Software/Visual_Studio/Tango.Transport/Adapters/UsbTransportAdapter.cs @@ -148,6 +148,7 @@ namespace Tango.Transport.Adapters _serialPort.DiscardOutBuffer(); _serialPort.DiscardInBuffer(); _serialPort.Close(); + _serialPort.Dispose(); State = TransportComponentState.Disconnected; LogManager.Log("USB adapter disconnected."); diff --git a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs index bef6f2dcf..03188b71f 100644 --- a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs +++ b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs @@ -81,8 +81,11 @@ namespace Tango.Transport get { return _state; } protected set { - _state = value; - OnStateChanged(_state); + if (_state != value) + { + _state = value; + OnStateChanged(_state); + } } } @@ -1064,6 +1067,11 @@ namespace Tango.Transport return; } } + catch (ThreadAbortException) + { + LogManager.Log("KeepAlive thread has been aborted."); + return; + } catch (Exception ex) { if (State != TransportComponentState.Connected) return; |
