From ba650e5a15528a673d3427ca218a7ea639709f8f Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 14 Oct 2018 10:38:04 +0300 Subject: Machine Studio v3.5.46 --- .../MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs index 4524e0622..0e9c8cc08 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ using System.Runtime.InteropServices; [assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyTitle("Tango - Machine Studio")] -[assembly: AssemblyVersion("3.5.45.18238")] +[assembly: AssemblyVersion("3.5.46.18238")] [assembly: ComVisible(false)] \ No newline at end of file -- cgit v1.3.1 From c1686b546c6ecad789b7e5c6f67cb6b885363911 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 14 Oct 2018 12:29:29 +0300 Subject: Enabled KeepAlive and for machine studio and implemented a connection lost dialog. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 15400960 -> 15400960 bytes .../Build/Shortcuts/Machine Studio.lnk | Bin 1532 -> 1516 bytes .../DefaultStudioApplicationManager.cs | 23 +++++++- .../Tango.MachineStudio.UI.csproj | 10 +++- .../ViewModels/ConnectionLostViewVM.cs | 14 +++++ .../Views/ConnectedMachineView.xaml | 4 +- .../Views/ConnectionLostView.xaml | 58 +++++++++++++++++++++ .../Views/ConnectionLostView.xaml.cs | 28 ++++++++++ .../Visual_Studio/Tango.Transport/ITransporter.cs | 5 ++ .../Tango.Transport/KeepAliveException.cs | 24 +++++++++ .../Tango.Transport/Tango.Transport.csproj | 3 +- .../Tango.Transport/TransporterBase.cs | 32 ++++++------ 13 files changed, 180 insertions(+), 21 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectionLostViewVM.cs create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectionLostView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectionLostView.xaml.cs create mode 100644 Software/Visual_Studio/Tango.Transport/KeepAliveException.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index b8dad7bed..48507a1fc 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 caed17045..03be8a1e0 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk index ccdef426b..41c6efe80 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk and b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk differ diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs index 8eff9ea4e..e6c687b92 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -22,6 +22,9 @@ using Tango.Core.DI; using Tango.BL.Entities; using Tango.BL; using Tango.MachineStudio.UI.ViewModels; +using Tango.MachineStudio.Common.Notifications; +using Tango.MachineStudio.UI.Views; +using Tango.Integration.Operation; namespace Tango.MachineStudio.UI.StudioApplication { @@ -34,16 +37,18 @@ namespace Tango.MachineStudio.UI.StudioApplication { private INavigationManager _navigationManager; private IStudioModuleLoader _moduleLoader; + private INotificationProvider _notification; private List _openedWindows; /// /// Initializes a new instance of the class. /// /// The navigation manager. - public DefaultStudioApplicationManager(INavigationManager navigationManager, IStudioModuleLoader moduleLoader) + public DefaultStudioApplicationManager(INavigationManager navigationManager, IStudioModuleLoader moduleLoader, INotificationProvider notification) { _moduleLoader = moduleLoader; _navigationManager = navigationManager; + _notification = notification; _openedWindows = new List(); Application.Current.MainWindow.ContentRendered += (_, __) => @@ -109,8 +114,22 @@ namespace Tango.MachineStudio.UI.StudioApplication if (e == Transport.TransportComponentState.Disconnected || e == Transport.TransportComponentState.Failed) { ConnectedMachine = null; - } + if (e == Transport.TransportComponentState.Failed) + { + String failed_reason = (sender as IMachineOperator).FailedStateException.Message; + + ConnectionLostViewVM vm = new ConnectionLostViewVM() + { + Exception = failed_reason + }; + + InvokeUI(() => + { + _notification.ShowModalDialog(vm, (x) => { }, () => { }); + }); + } + } } /// diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj index 003a7f194..39f748ceb 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj @@ -171,6 +171,7 @@ + @@ -189,6 +190,9 @@ ConnectedMachineView.xaml + + ConnectionLostView.xaml + LoadingView.xaml @@ -269,6 +273,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -583,7 +591,7 @@ copy /Y "$(SolutionDir)Referenced Assemblies\Microsoft.WITDataStore32.dll" "$(Ta - + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectionLostViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectionLostViewVM.cs new file mode 100644 index 000000000..f1f4f69c0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectionLostViewVM.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.SharedUI; + +namespace Tango.MachineStudio.UI.ViewModels +{ + public class ConnectionLostViewVM : DialogViewVM + { + public String Exception { get; set; } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml index 4e3de9e60..b1502f374 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml @@ -12,7 +12,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300" Width="600" Height="440" Background="White" DataContext="{Binding ConnectedMachineViewVM, Source={StaticResource Locator}}"> + d:DesignHeight="300" d:DesignWidth="300" Width="600" Height="480" Background="White" DataContext="{Binding ConnectedMachineViewVM, Source={StaticResource Locator}}"> @@ -138,6 +138,8 @@ + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectionLostView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectionLostView.xaml new file mode 100644 index 000000000..bac704fe0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectionLostView.xaml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The machine connection has entered an invalid or inactive state and will be regarded as. + + disconnected. + + + Reason: + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectionLostView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectionLostView.xaml.cs new file mode 100644 index 000000000..50f0429a4 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectionLostView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.UI.Views +{ + /// + /// Interaction logic for ConnectionLostView.xaml + /// + public partial class ConnectionLostView : UserControl + { + public ConnectionLostView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/Tango.Transport/ITransporter.cs b/Software/Visual_Studio/Tango.Transport/ITransporter.cs index b7e016d56..61e4c7376 100644 --- a/Software/Visual_Studio/Tango.Transport/ITransporter.cs +++ b/Software/Visual_Studio/Tango.Transport/ITransporter.cs @@ -29,6 +29,11 @@ namespace Tango.Transport /// ITransportEncoder Encoder { get; set; } + /// + /// Gets the last failed state exception/reason. + /// + Exception FailedStateException { get; } + /// /// Sends a request. /// diff --git a/Software/Visual_Studio/Tango.Transport/KeepAliveException.cs b/Software/Visual_Studio/Tango.Transport/KeepAliveException.cs new file mode 100644 index 000000000..35ba716ff --- /dev/null +++ b/Software/Visual_Studio/Tango.Transport/KeepAliveException.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Transport +{ + /// + /// Represents a 'Keep Alive' timeout exception. + /// + /// + public class KeepAliveException : TimeoutException + { + /// + /// Initializes a new instance of the class. + /// + /// The message that describes the error. + public KeepAliveException(String message) : base(message) + { + + } + } +} diff --git a/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj b/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj index 52284f80b..ead68f9cc 100644 --- a/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj +++ b/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj @@ -87,6 +87,7 @@ + @@ -130,7 +131,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs index 94dbd54f7..798445cf3 100644 --- a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs +++ b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs @@ -100,14 +100,15 @@ namespace Tango.Transport set { _useKeepAlive = value; + RaisePropertyChangedAuto(); - if (UseKeepAlive) + if (_useKeepAlive) { - LogManager.Log("KeepAlive is now working..."); + LogManager.Log("KeepAlive is activated..."); } else { - LogManager.Log("KeepAlive is now shutdown."); + LogManager.Log("KeepAlive is deactivated."); } } } @@ -141,6 +142,12 @@ namespace Tango.Transport /// If multiple messages of the same type are found and buffer exceeds the maximum they will be trimmed. /// public int MaxMessageBufferCount { get; set; } + + /// + /// Gets the last failed state exception/reason. + /// + public Exception FailedStateException { get; private set; } + #endregion #region Virtual Methods @@ -215,6 +222,7 @@ namespace Tango.Transport protected virtual void OnFailed(Exception ex) { Disconnect().Wait(); + FailedStateException = ex; State = TransportComponentState.Failed; LogManager.Log(ex, "Transporter failed."); } @@ -764,12 +772,9 @@ namespace Tango.Transport _pushThread.IsBackground = true; _pushThread.Start(); - if (UseKeepAlive) - { - _keepAliveThread = new Thread(KeepAliveThreadMethod); - _keepAliveThread.IsBackground = true; - _keepAliveThread.Start(); - } + _keepAliveThread = new Thread(KeepAliveThreadMethod); + _keepAliveThread.IsBackground = true; + _keepAliveThread.Start(); } /// @@ -1041,16 +1046,15 @@ namespace Tango.Transport var task = SendRequest(new KeepAliveRequest(), TimeSpan.FromSeconds(5)); task.Wait(); var response = task.Result; - } } - catch (TimeoutException) + catch (Exception ex) when (ex is TimeoutException || ex is AggregateException) { if (State != TransportComponentState.Connected) return; if (UseKeepAlive) { - OnFailed(new TimeoutException("The transporter has not received a KeepAlive response within the given time.")); + OnFailed(new KeepAliveException("The transporter has not received a KeepAlive response within the given time.")); return; } } @@ -1064,10 +1068,6 @@ namespace Tango.Transport return; } } - - if (State != TransportComponentState.Connected) return; - - if (State != TransportComponentState.Connected) return; } } -- cgit v1.3.1 From 27ef734e78b8b11f06cf4f01e68a8f9c9efb75d1 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 14 Oct 2018 12:49:20 +0300 Subject: Machine Studio v3.5.47 --- .../Visual_Studio/Build/Shortcuts/Machine Studio.lnk | Bin 1516 -> 1532 bytes .../Tango.MachineStudio.UI/Properties/AssemblyInfo.cs | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk index 41c6efe80..3cdd0db6d 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk and b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk differ diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs index 0e9c8cc08..631804544 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ using System.Runtime.InteropServices; [assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyTitle("Tango - Machine Studio")] -[assembly: AssemblyVersion("3.5.46.18238")] +[assembly: AssemblyVersion("3.5.47.18238")] [assembly: ComVisible(false)] \ No newline at end of file -- cgit v1.3.1