From 1e3777f0813b2ac26ae0b52e89c171955a949563 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 29 Jul 2018 09:54:44 +0300 Subject: Moved external bridge classes to ExternalBridge namespace. --- .../Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml | 2 +- .../Tango.MachineStudio.UI/Views/MachineConnectionView.xaml | 2 +- .../MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml | 2 +- .../MachineStudio/Tango.MachineStudio.UI/Views/ResolvedIssuesView.xaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views') 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 39c42392d..bb8b65f6a 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml @@ -4,7 +4,7 @@ xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:integration="clr-namespace:Tango.Integration.Services;assembly=Tango.Integration" + xmlns:integration="clr-namespace:Tango.Integration.ExternalBridge;assembly=Tango.Integration" xmlns:integ="clr-namespace:Tango.Integration.Operation;assembly=Tango.Integration" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml index 6f0a74805..3a8baf7e5 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml @@ -5,7 +5,7 @@ xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:integration="clr-namespace:Tango.Integration.Services;assembly=Tango.Integration" + xmlns:integration="clr-namespace:Tango.Integration.ExternalBridge;assembly=Tango.Integration" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" mc:Ignorable="d" diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml index 37cd0b793..2a6228eda 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml @@ -6,7 +6,7 @@ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:autoComplete="clr-namespace:Tango.AutoComplete.Editors;assembly=Tango.AutoComplete" - xmlns:integration="clr-namespace:Tango.Integration.Services;assembly=Tango.Integration" + xmlns:integration="clr-namespace:Tango.Integration.ExternalBridge;assembly=Tango.Integration" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:vm="clr-namespace:Tango.MachineStudio.UI.ViewModels" xmlns:tfs="clr-namespace:Tango.TFS;assembly=Tango.TFS" diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ResolvedIssuesView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ResolvedIssuesView.xaml index 4fb457f87..3b5affbbf 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ResolvedIssuesView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ResolvedIssuesView.xaml @@ -6,7 +6,7 @@ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:autoComplete="clr-namespace:Tango.AutoComplete.Editors;assembly=Tango.AutoComplete" - xmlns:integration="clr-namespace:Tango.Integration.Services;assembly=Tango.Integration" + xmlns:integration="clr-namespace:Tango.Integration.ExternalBridge;assembly=Tango.Integration" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:vm="clr-namespace:Tango.MachineStudio.UI.ViewModels" xmlns:tfs="clr-namespace:Tango.TFS;assembly=Tango.TFS" -- cgit v1.3.1 From d62b12aab4f521ff287da135b6e66e92629a50dd Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 29 Jul 2018 10:56:41 +0300 Subject: Added data source in about dialog in machine studio. Added last monitor in machine studio settings. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 1835008 -> 1835008 bytes .../MachineStudioSettings.cs | 8 + .../Tango.MachineStudio.UI/MainWindow.xaml | 2 +- .../Tango.MachineStudio.UI/MainWindow.xaml.cs | 20 ++- .../DefaultStudioApplicationManager.cs | 114 ++++++++------- .../ViewModels/AboutViewVM.cs | 5 + .../Tango.MachineStudio.UI/Views/AboutView.xaml | 4 +- .../PPC/Modules/Tango.PPC.MachineSettings/App.xaml | 11 ++ .../Images/ppc-module.png | Bin 0 -> 1748 bytes .../MachineSettingsModule.cs | 84 +++++++++++ .../Properties/AssemblyInfo.cs | 20 +++ .../Properties/Resources.Designer.cs | 71 +++++++++ .../Properties/Resources.resx | 117 +++++++++++++++ .../Properties/Settings.Designer.cs | 30 ++++ .../Properties/Settings.settings | 7 + .../Tango.PPC.MachineSettings.csproj | 161 +++++++++++++++++++++ .../Tango.PPC.MachineSettings/ViewModelLocator.cs | 32 ++++ .../ViewModels/MainViewVM.cs | 24 +++ .../Tango.PPC.MachineSettings/Views/MainView.xaml | 14 ++ .../Views/MainView.xaml.cs | 28 ++++ .../Modules/Tango.PPC.MachineSettings/app.config | 61 ++++++++ .../Tango.PPC.MachineSettings/packages.config | 7 + Software/Visual_Studio/Tango.sln | 55 ++++++- 24 files changed, 817 insertions(+), 58 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/App.xaml create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Images/ppc-module.png create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/MachineSettingsModule.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/AssemblyInfo.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Resources.Designer.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Resources.resx create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Settings.Designer.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Settings.settings create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModelLocator.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/app.config create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/packages.config (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index c88505833..163460bb9 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 665a0d93e..44c77937d 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs index b12d9a580..d63e07594 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows; using Tango.Logging; using Tango.Settings; @@ -40,13 +41,20 @@ namespace Tango.MachineStudio.Common /// public List LoggingCategories { get; set; } + /// + /// Gets or sets the last bounds. + /// + public Rect LastBounds { get; set; } + /// /// Initializes a new instance of the class. /// public MachineStudioSettings() { + LastBounds = new Rect(); LoggingCategories = new List(); UpdateServiceAddress = "http://twine01/MachineStudioUpdateService/MachineStudioUpdateService.svc"; + } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml index 1dfe4c18f..b8a6cd1c0 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml @@ -8,7 +8,7 @@ xmlns:views="clr-namespace:Tango.MachineStudio.UI.Views" xmlns:sharedControls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" mc:Ignorable="d" - Title="Tango" Height="800" Width="1280" WindowStartupLocation="CenterOwner" WindowState="Maximized" Foreground="#494949" BorderThickness="1" BorderBrush="{StaticResource AccentColorBrush}"> + Title="Tango" Height="800" Width="1280" Foreground="#494949" BorderThickness="1" BorderBrush="{StaticResource AccentColorBrush}"> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs index 9901d3b80..f0f93a867 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs @@ -18,7 +18,9 @@ using System.Windows.Shapes; using Tango.Core.DI; using Tango.Core.Helpers; using Tango.Logging; +using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.StudioApplication; +using Tango.Settings; namespace Tango.MachineStudio.UI { @@ -37,10 +39,20 @@ namespace Tango.MachineStudio.UI try { InitializeComponent(); + + WindowStartupLocation = WindowStartupLocation.Manual; + + var r = SettingsManager.Default.GetOrCreate().LastBounds; + + if (r.Width > 0 && r.Height > 0) + { + Left = r.Left; + } + Instance = this; ThreadsHelper.SetDisptacher(Dispatcher); - this.Closing += MainWindow_Closing; + Closing += MainWindow_Closing; } catch (Exception ex) { @@ -49,6 +61,12 @@ namespace Tango.MachineStudio.UI this.Loaded += MainWindow_Loaded; this.SizeChanged += MainWindow_SizeChanged; + ContentRendered += MainWindow_ContentRendered; + } + + private void MainWindow_ContentRendered(object sender, EventArgs e) + { + WindowState = WindowState.Maximized; } private void MainWindow_SizeChanged(object sender, SizeChangedEventArgs e) 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 d6a832c8a..c7ac60ace 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -148,76 +148,92 @@ namespace Tango.MachineStudio.UI.StudioApplication IsShuttingDown = true; - await Task.Factory.StartNew(async () => + try { + Rect r = new Rect( + MainWindow.Instance.Left, + MainWindow.Instance.Top, + MainWindow.Instance.Width, + MainWindow.Instance.Height); + + await Task.Factory.StartNew(async () => + { //Do Shutdown Procedures... foreach (var vm in TangoIOC.Default.GetAllInstancesByBase()) - { - try { - var result = await vm.OnShutdownRequest(); - if (!result) + try + { + var result = await vm.OnShutdownRequest(); + if (!result) + { + IsShuttingDown = false; + return; + } + } + catch (Exception ex) { - IsShuttingDown = false; - return; + LogManager.Log(ex, "Error on shutdown request with " + vm.GetType().Name); } } - catch (Exception ex) + + foreach (var vm in TangoIOC.Default.GetAllInstancesByBase()) { - LogManager.Log(ex, "Error on shutdown request with " + vm.GetType().Name); + vm.OnShuttingDown(); } - } - foreach (var vm in TangoIOC.Default.GetAllInstancesByBase()) - { - vm.OnShuttingDown(); - } + SettingsManager.Default.GetOrCreate().LastBounds = r; - try - { - SettingsManager.Default.Save(); - } - catch (Exception ex) - { - LogManager.Log(ex, "Error saving settings."); - } + try + { + SettingsManager.Default.Save(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error saving settings."); + } - _navigationManager.NavigateTo(NavigationView.ShutdownView); + _navigationManager.NavigateTo(NavigationView.ShutdownView); - Thread.Sleep(1500); + Thread.Sleep(1500); - foreach (var window in _openedWindows) - { - ThreadsHelper.InvokeUI(() => + foreach (var window in _openedWindows) { - window.Close(); - }); - } + ThreadsHelper.InvokeUI(() => + { + window.Close(); + }); + } - try - { - if (ConnectedMachine != null) + try { - ConnectedMachine.Disconnect().Wait(); + if (ConnectedMachine != null) + { + ConnectedMachine.Disconnect().Wait(); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error disconnecting from machine."); } - } - catch (Exception ex) - { - LogManager.Log(ex, "Error disconnecting from machine."); - } - var eventLogger = TangoIOC.Default.GetInstance(); - if (eventLogger != null) - { - eventLogger.Log(EventTypes.ApplicationTerminated, "Application Terminated!"); - eventLogger.FlushAll(); - } + var eventLogger = TangoIOC.Default.GetInstance(); + if (eventLogger != null) + { + eventLogger.Log(EventTypes.ApplicationTerminated, "Application Terminated!"); + eventLogger.FlushAll(); + } - Thread.Sleep(1500); + Thread.Sleep(1500); - Environment.Exit(0); + Environment.Exit(0); - }); + }); + } + catch (Exception ex) + { + IsShuttingDown = false; + LogManager.Log(ex,"An error occurred while shutting down machine studio."); + } } /// @@ -264,7 +280,7 @@ namespace Tango.MachineStudio.UI.StudioApplication { get { - return typeof(ExtendedObject).Assembly.GetName().Version.ToString(3); + return typeof(ExtendedObject).Assembly.GetName().Version.ToString(3); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/AboutViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/AboutViewVM.cs index 5fe3b06b8..0b8a205f7 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/AboutViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/AboutViewVM.cs @@ -3,7 +3,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.Core; using Tango.MachineStudio.Common.StudioApplication; +using Tango.Settings; using Tango.SharedUI; namespace Tango.MachineStudio.UI.ViewModels @@ -12,9 +14,12 @@ namespace Tango.MachineStudio.UI.ViewModels { public IStudioApplicationManager ApplicationManager { get; set; } + public CoreSettings Settings { get; set; } + public AboutViewVM(IStudioApplicationManager applicationManager) { ApplicationManager = applicationManager; + Settings = SettingsManager.Default.GetOrCreate(); } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml index 2ac0df9de..0f8bceac7 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml @@ -36,13 +36,15 @@ - + Machine Studio: v Core Libraries: v Build Date: + Data Source: + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/App.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/App.xaml new file mode 100644 index 000000000..e3b2c28f8 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/App.xaml @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Images/ppc-module.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Images/ppc-module.png new file mode 100644 index 000000000..6f27f49be Binary files /dev/null and b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Images/ppc-module.png differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/MachineSettingsModule.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/MachineSettingsModule.cs new file mode 100644 index 000000000..0d6f7c75f --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/MachineSettingsModule.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media.Imaging; +using Tango.BL.Enumerations; +using Tango.PPC.Common; +using Tango.PPC.MachineSettings.Views; +using Tango.SharedUI.Helpers; + +namespace Tango.PPC.MachineSettings +{ + /// + /// Represents a PPC . + /// + /// + [PPCModule(2)] + public class MachineSettingsModule : PPCModuleBase + { + /// + /// Gets the module name. + /// + public override string Name + { + get + { + return "Settings"; + } + } + + /// + /// Gets the module description. + /// + public override string Description + { + get + { + return "Local Machine Settings"; + } + } + + /// + /// Gets the module cover image. + /// + public override BitmapSource Image + { + get + { + return ResourceHelper.GetImageFromResources("Images/ppc-module.png"); + } + } + + /// + /// Gets the module entry point view type. + /// + public override Type MainViewType + { + get + { + return typeof(MainView); + } + } + + /// + /// Gets the permission required to see and load this module. + /// + public override Permissions Permission + { + get + { + return Permissions.RunMachineStudio; + } + } + + /// + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// + public override void Dispose() + { + //Dispose module here... + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..52774bee8 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tango Module")] +[assembly: AssemblyVersion("2.0.1.1407")] + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Resources.Designer.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Resources.Designer.cs new file mode 100644 index 000000000..05abad8e0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.PPC.MachineSettings.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.PPC.MachineSettings.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Resources.resx b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Settings.Designer.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Settings.Designer.cs new file mode 100644 index 000000000..b16d01807 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.PPC.MachineSettings.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Settings.settings b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj new file mode 100644 index 000000000..d0fccad96 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj @@ -0,0 +1,161 @@ + + + + + Debug + AnyCPU + {91B70E9B-66A7-4873-AE10-400E71CF404F} + library + Tango.PPC.MachineSettings + Tango.PPC.MachineSettings + v4.6 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + true + full + false + ..\..\..\Build\Debug\PPC\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\..\Build\Release\PPC\ + TRACE + prompt + 4 + + + + ..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll + True + + + ..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll + + + ..\..\..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll + + + ..\..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll + + + + + + ..\..\..\packages\Expression.Blend.Sdk.1.0.2\lib\net45\System.Windows.Interactivity.dll + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + + + GlobalVersionInfo.cs + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + MainView.xaml + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + {f441feee-322a-4943-b566-110e12fd3b72} + Tango.BL + + + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} + Tango.Core + + + {b112d89a-a106-41ae-a0c1-4abc84c477f5} + Tango.DragAndDrop + + + {bc932dbd-7cdb-488c-99e4-f02cf441f55e} + Tango.Logging + + + {e4927038-348d-4295-aaf4-861c58cb3943} + Tango.PMR + + + {d8f1ad85-526a-4f50-b6dc-d437af63d8d8} + Tango.Settings + + + {8491d07b-c1f6-4b62-a412-41b9fd2d6538} + Tango.SharedUI + + + {fd86424c-6e84-491b-8df9-3d0f5c236a2a} + Tango.Touch + + + {74e700b0-1156-4126-be40-ee450d3c3026} + Tango.Transport + + + {0be74eee-22cb-4dba-b896-793b9e1a3ac0} + Tango.PPC.Common + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModelLocator.cs new file mode 100644 index 000000000..5d3e101cd --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModelLocator.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.DI; +using Tango.PPC.MachineSettings.ViewModels; + +namespace Tango.PPC.MachineSettings +{ + public static class ViewModelLocator + { + /// + /// Initializes a new instance of the ViewModelLocator class. + /// + static ViewModelLocator() + { + TangoIOC.Default.Register(); + } + + /// + /// Gets the main view VM. + /// + public static MainViewVM MainViewVM + { + get + { + return TangoIOC.Default.GetInstance(); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs new file mode 100644 index 000000000..877374a40 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common; + +namespace Tango.PPC.MachineSettings.ViewModels +{ + /// + /// Represents the main view VM and entry point for . + /// + /// + public class MainViewVM : PPCViewModel + { + /// + /// Called when the application has been started + /// + public override void OnApplicationStarted() + { + //Start initializing here rather then in the constructor. + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml new file mode 100644 index 000000000..ff27b26f3 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml @@ -0,0 +1,14 @@ + + + + + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml.cs new file mode 100644 index 000000000..4a9e38e05 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.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.PPC.MachineSettings.Views +{ + /// + /// Interaction logic for MainView.xaml + /// + public partial class MainView : UserControl + { + public MainView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/app.config b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/app.config new file mode 100644 index 000000000..77b7003e2 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/app.config @@ -0,0 +1,61 @@ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/packages.config b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/packages.config new file mode 100644 index 000000000..80367fdd2 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/packages.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.sln b/Software/Visual_Studio/Tango.sln index 9fed570ea..ed2b5f28e 100644 --- a/Software/Visual_Studio/Tango.sln +++ b/Software/Visual_Studio/Tango.sln @@ -208,6 +208,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.CatalogGenerator", "U EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.AnimatedGif", "Tango.AnimatedGif\Tango.AnimatedGif.csproj", "{D129789C-3096-4D0B-8DD7-FE24A4DF4B21}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.PPC.MachineSettings", "PPC\Modules\Tango.PPC.MachineSettings\Tango.PPC.MachineSettings.csproj", "{91B70E9B-66A7-4873-AE10-400E71CF404F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution AppVeyor|Any CPU = AppVeyor|Any CPU @@ -3607,6 +3609,46 @@ Global {D129789C-3096-4D0B-8DD7-FE24A4DF4B21}.Release|x64.Build.0 = Release|Any CPU {D129789C-3096-4D0B-8DD7-FE24A4DF4B21}.Release|x86.ActiveCfg = Release|Any CPU {D129789C-3096-4D0B-8DD7-FE24A4DF4B21}.Release|x86.Build.0 = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.AppVeyor|Any CPU.ActiveCfg = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.AppVeyor|Any CPU.Build.0 = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.AppVeyor|ARM.ActiveCfg = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.AppVeyor|ARM.Build.0 = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.AppVeyor|ARM64.ActiveCfg = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.AppVeyor|ARM64.Build.0 = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.AppVeyor|x64.ActiveCfg = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.AppVeyor|x64.Build.0 = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.AppVeyor|x86.ActiveCfg = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.AppVeyor|x86.Build.0 = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Debug|ARM.ActiveCfg = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Debug|ARM.Build.0 = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Debug|ARM64.Build.0 = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Debug|x64.ActiveCfg = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Debug|x64.Build.0 = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Debug|x86.ActiveCfg = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Debug|x86.Build.0 = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.DefaultBuild|Any CPU.ActiveCfg = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.DefaultBuild|Any CPU.Build.0 = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.DefaultBuild|ARM.ActiveCfg = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.DefaultBuild|ARM.Build.0 = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.DefaultBuild|ARM64.ActiveCfg = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.DefaultBuild|ARM64.Build.0 = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.DefaultBuild|x64.ActiveCfg = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.DefaultBuild|x64.Build.0 = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.DefaultBuild|x86.ActiveCfg = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.DefaultBuild|x86.Build.0 = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Release|Any CPU.Build.0 = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Release|ARM.ActiveCfg = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Release|ARM.Build.0 = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Release|ARM64.ActiveCfg = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Release|ARM64.Build.0 = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Release|x64.ActiveCfg = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Release|x64.Build.0 = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Release|x86.ActiveCfg = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -3670,14 +3712,15 @@ Global {729455D4-C384-4497-AF5D-0A598F86DAC6} = {0048447D-1D94-4E60-9DAD-7349C777CB4E} {0440A135-0DF0-4232-AB3C-98B9283123B3} = {5F6BBAA8-EAD0-4B18-97E5-55B4F56DD760} {808E47B6-BAA7-4D23-83CB-40C53DC4B38A} = {5F6BBAA8-EAD0-4B18-97E5-55B4F56DD760} + {91B70E9B-66A7-4873-AE10-400E71CF404F} = {0048447D-1D94-4E60-9DAD-7349C777CB4E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {7986F7F4-A86A-4994-B1B6-0988D7F057B6} - BuildVersion_BuildVersioningStyle = None.None.Increment.DeltaBaseYearDayOfYear - BuildVersion_UpdateAssemblyVersion = True - BuildVersion_UpdateFileVersion = False - BuildVersion_StartDate = 2000/1/1 - BuildVersion_AssemblyInfoFilename = Properties\AssemblyInfo.cs BuildVersion_UseGlobalSettings = False + BuildVersion_AssemblyInfoFilename = Properties\AssemblyInfo.cs + BuildVersion_StartDate = 2000/1/1 + BuildVersion_UpdateFileVersion = False + BuildVersion_UpdateAssemblyVersion = True + BuildVersion_BuildVersioningStyle = None.None.Increment.DeltaBaseYearDayOfYear + SolutionGuid = {7986F7F4-A86A-4994-B1B6-0988D7F057B6} EndGlobalSection EndGlobal -- cgit v1.3.1 From 86919dc24020229cbd1d8c59f29a4a36895f5b7a Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 29 Jul 2018 13:03:22 +0300 Subject: Implemented diagnostics frame rate monitor on IDiagnosticsFrameProvider. Added diagnostics frame rate to connected machine dialog. Implemented dynamic graphs max points using frame rate on tech board!. Implemented speed control on DIagnosticsFilePlayer & Data Capture module. Implemented graphs duration control on tech board. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 1835008 -> 1835008 bytes .../Tango.MachineStudio.DataCapture.csproj | 6 +- .../Views/MainView.xaml | 201 +++++++++++---------- .../Views/TimelineView.xaml.cs | 6 +- .../Helpers/GraphsHelper.cs | 2 +- .../TechnicianModuleSettings.cs | 4 +- .../ViewModels/MachineTechViewVM.cs | 98 +++++++++- .../Views/MachineTechView.xaml | 17 ++ .../Diagnostics/DefaultDiagnosticsFrameProvider.cs | 47 ++++- .../Diagnostics/IDiagnosticsFrameProvider.cs | 5 + .../ViewModels/ConnectedMachineViewVM.cs | 13 +- .../Views/ConnectedMachineView.xaml | 16 +- .../Diagnostics/DiagnosticsFilePlayer.cs | 27 ++- 14 files changed, 325 insertions(+), 117 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 163460bb9..4c31e0729 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 44c77937d..104f4ed58 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.DataCapture/Tango.MachineStudio.DataCapture.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj index 24241bd14..7c7c8c272 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj @@ -154,6 +154,10 @@ {9652f972-2bd1-4283-99cb-fc6240434c17} Tango.Video + + {cf7c0ff4-9440-42cf-83b8-c060772792d4} + Tango.Visuals + {cb0b0aa2-bb24-4bca-a720-45e397684e12} Tango.MachineStudio.Common @@ -184,7 +188,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml index 37f92dea7..1ef3c1769 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml @@ -6,6 +6,7 @@ xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:visuals="clr-namespace:Tango.Visuals;assembly=Tango.Visuals" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:vm="clr-namespace:Tango.MachineStudio.DataCapture.ViewModels" xmlns:logging="clr-namespace:Tango.MachineStudio.Logging.Views;assembly=Tango.MachineStudio.Logging" @@ -182,110 +183,118 @@ - - - - - - - - - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Speed + + x + + - - + + Total Frames: - - + + File Size: - - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -316,7 +325,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml.cs index 8004ef154..92d176671 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml.cs @@ -44,7 +44,11 @@ namespace Tango.MachineStudio.Logging.Views private void ItemsControl_SizeChanged(object sender, SizeChangedEventArgs e) { TimelineEventGroup group = (sender as FrameworkElement).DataContext as TimelineEventGroup; - group.Height = e.NewSize.Height; + + if (group != null) + { + group.Height = e.NewSize.Height; + } } private void scrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsHelper.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsHelper.cs index 0cd14f917..fa80f90dd 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsHelper.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsHelper.cs @@ -23,7 +23,7 @@ namespace Tango.MachineStudio.Technician.Helpers try { var settings = SettingsManager.Default.GetOrCreate(); - double seconds = settings.GraphsViewDurationSeconds; + double seconds = settings.GraphsDuration; double pullRate = settings.DiagnosticsResponseIntervalMilli; return (int)(((pullRate * pointsPerFrame * 10 * seconds) * (10 / pullRate)) * 0.65); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModuleSettings.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModuleSettings.cs index 12acaf3ee..65ff8d537 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModuleSettings.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModuleSettings.cs @@ -12,7 +12,7 @@ namespace Tango.MachineStudio.Technician /// /// Gets or sets the graphs view duration in seconds. /// - public int GraphsViewDurationSeconds { get; set; } + public int GraphsDuration { get; set; } /// /// Gets or sets the diagnostics response interval in milliseconds. @@ -29,7 +29,7 @@ namespace Tango.MachineStudio.Technician /// public TechnicianModuleSettings() { - GraphsViewDurationSeconds = 10; + GraphsDuration = 10; DiagnosticsResponseIntervalMilli = 30; } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs index d403223ec..3dff65fbc 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs @@ -43,6 +43,7 @@ namespace Tango.MachineStudio.Technician.ViewModels public class MachineTechViewVM : StudioViewModel { private List _diagnoticsMonitorsDataProperties; + private IDiagnosticsFrameProvider _diagnosticsFrameProvider; private Dictionary _singleControllers; private Dictionary _multiControllers; private static object _elementsLock = new object(); @@ -149,6 +150,28 @@ namespace Tango.MachineStudio.Technician.ViewModels set { _currentDiagnosticsResponseSize = value; RaisePropertyChanged(nameof(CurrentDiagnosticsResponseSize)); } } + private int _graphsDurationSeconds; + /// + /// Gets or sets the graphs duration seconds. + /// + public int GraphsDurationSeconds + { + get { return _graphsDurationSeconds; } + set { _graphsDurationSeconds = value; RaisePropertyChangedAuto(); } + } + + private int _tempGraphsDurationSeconds; + /// + /// Gets or sets the temporary graphs duration seconds. + /// + public int TempGraphsDurationSeconds + { + get { return _tempGraphsDurationSeconds; } + set { _tempGraphsDurationSeconds = value; RaisePropertyChangedAuto(); } + } + + + #endregion #region Commands @@ -183,6 +206,8 @@ namespace Tango.MachineStudio.Technician.ViewModels ///
public RelayCommand ResetHardwareConfigurationCommand { get; set; } + public RelayCommand UpdateGraphsDurationCommand { get; set; } + #endregion #region Constructors @@ -192,10 +217,13 @@ namespace Tango.MachineStudio.Technician.ViewModels /// /// The application manager. /// The notification provider. - public MachineTechViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider _diagnosticsFrameProvider, IEventLogger eventLogger) + public MachineTechViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider diagnosticsFrameProvider, IEventLogger eventLogger) { _settings = SettingsManager.Default.GetOrCreate(); + GraphsDurationSeconds = _settings.GraphsDuration; + TempGraphsDurationSeconds = GraphsDurationSeconds; + _notification = notificationProvider; _eventLogger = eventLogger; _singleControllers = new Dictionary(); @@ -217,14 +245,28 @@ namespace Tango.MachineStudio.Technician.ViewModels if (File.Exists(_lastTechProjectFile)) { - OpenProjectFile(_lastTechProjectFile); + try + { + OpenProjectFile(_lastTechProjectFile); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error loading last project file."); + } } + _diagnosticsFrameProvider = diagnosticsFrameProvider; _diagnosticsFrameProvider.FrameReceived += DiagnosticsFrameProvider_FrameReceived; UploadHardwareConfigurationCommand = new RelayCommand(UploadHardwareConfiguration); SyncHardwareConfigurationCommand = new RelayCommand(SyncHardwareConfiguration); ResetHardwareConfigurationCommand = new RelayCommand(() => ResetHardwareConfiguration()); + UpdateGraphsDurationCommand = new RelayCommand(() => + { + GraphsDurationSeconds = TempGraphsDurationSeconds; + _settings.GraphsDuration = GraphsDurationSeconds; + ClearAllGraphs(); + }); } #endregion @@ -320,7 +362,16 @@ namespace Tango.MachineStudio.Technician.ViewModels if (_singleControllers.TryGetValue(graphItem, out controller)) { - controller.PushData(GetDataArray(graphItem.TechMonitor, prop.GetValue(data.Monitors))); + var points = GetDataArray(graphItem.TechMonitor, prop.GetValue(data.Monitors)); + + int maxPoints = (int)(_diagnosticsFrameProvider.FrameRate * GraphsDurationSeconds * points.Count); + + InvokeUI(() => + { + graphItem.Editor.InnerGraph.InnerGraph.MaxPoints = maxPoints; + }); + + controller.PushData(points); } } } @@ -336,7 +387,19 @@ namespace Tango.MachineStudio.Technician.ViewModels if (_multiControllers.TryGetValue(graphItem, out controller)) { - controller.PushData(GetDataMatrix(graphItem.TechMonitor, prop.GetValue(data.Monitors))); + var points = GetDataMatrix(graphItem.TechMonitor, prop.GetValue(data.Monitors)); + + if (points.Count > 0) + { + int maxPoints = (int)(_diagnosticsFrameProvider.FrameRate * GraphsDurationSeconds * points[0].Count); + + InvokeUI(() => + { + graphItem.Editor.InnerGraph.InnerGraph.MaxPoints = maxPoints; + }); + } + + controller.PushData(points); } } } @@ -1179,7 +1242,7 @@ namespace Tango.MachineStudio.Technician.ViewModels catch (Exception ex) { String msg = "Error uploading process parameters:" + Environment.NewLine + parameters.ToJsonString(); - _eventLogger.Log(ex,msg); + _eventLogger.Log(ex, msg); LogManager.Log(ex, msg); _notification.ShowError("Could not upload process parameters." + Environment.NewLine + ex.Message); } @@ -1199,7 +1262,7 @@ namespace Tango.MachineStudio.Technician.ViewModels /// private void InitJobRunnerItem(JobRunnerItem item) { - item.StartJob += () => + item.StartJob += () => { try { @@ -1209,12 +1272,12 @@ namespace Tango.MachineStudio.Technician.ViewModels item.JobHandler = handler; - handler.StatusChanged += (x, status) => + handler.StatusChanged += (x, status) => { item.RunningJobStatus = status; }; - handler.Stopped += (x,e) => + handler.Stopped += (x, e) => { item.IsJobStarted = false; }; @@ -1226,7 +1289,7 @@ namespace Tango.MachineStudio.Technician.ViewModels } }; - item.StopJob += () => + item.StopJob += () => { if (item.JobHandler != null) { @@ -1597,5 +1660,22 @@ namespace Tango.MachineStudio.Technician.ViewModels } #endregion + + #region Graphs + + public void ClearAllGraphs() + { + foreach (var controller in _singleControllers) + { + controller.Value.Clear(); + } + + foreach (var controller in _multiControllers) + { + controller.Value.Clear(); + } + } + + #endregion } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml index 29ba98cd3..c11dbc525 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml @@ -4,6 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:vm="clr-namespace:Tango.MachineStudio.Technician.ViewModels" xmlns:global="clr-namespace:Tango.MachineStudio.Technician" + xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:fa="http://schemas.fontawesome.io/icons/" xmlns:editors="clr-namespace:Tango.Editors;assembly=Tango.Editors" @@ -176,6 +177,22 @@ + + + + GRAPHS DURATION: + + sec + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs index 957648536..477332ad9 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs @@ -8,6 +8,7 @@ using Tango.Integration.Operation; using Tango.Integration.ExternalBridge; using Tango.MachineStudio.Common.StudioApplication; using Tango.PMR.Diagnostics; +using System.Diagnostics; namespace Tango.MachineStudio.Common.Diagnostics { @@ -18,6 +19,10 @@ namespace Tango.MachineStudio.Common.Diagnostics public class DefaultDiagnosticsFrameProvider : ExtendedObject, IDiagnosticsFrameProvider { private IStudioApplicationManager _application; + private Stopwatch _watch; + private List _rates; + private DateTime _last_measure; + private const int _min_rate_change = 4; private bool _disable; /// @@ -32,10 +37,27 @@ namespace Tango.MachineStudio.Common.Diagnostics } } + private double _frameRate; + /// + /// Gets the current diagnostics frame rate. + /// + public double FrameRate + { + get + { + return _frameRate; + } + private set + { + _frameRate = value; + RaisePropertyChangedAuto(); + } + } + /// /// Occurs when a new data frame is available. /// - public event EventHandler FrameReceived; + public event EventHandler FrameReceived; /// /// Initializes a new instance of the class. @@ -43,6 +65,8 @@ namespace Tango.MachineStudio.Common.Diagnostics /// The application manager. public DefaultDiagnosticsFrameProvider(IStudioApplicationManager applicationManager) { + _rates = new List(); + _watch = new Stopwatch(); _application = applicationManager; applicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; } @@ -56,6 +80,9 @@ namespace Tango.MachineStudio.Common.Diagnostics { if (machine != null) { + _last_measure = DateTime.Now; + _rates = new List(); + _watch = new Stopwatch(); machine.DiagnosticsDataAvailable += DefaultDiagnosticsFrameProvider_DiagnosticsDataAvailable; } } @@ -91,6 +118,24 @@ namespace Tango.MachineStudio.Common.Diagnostics /// The frame. protected virtual void OnFrameReceived(StartDiagnosticsResponse frame) { + if (DateTime.Now > _last_measure.AddSeconds(1) && _rates.Count > 0) + { + _last_measure = DateTime.Now; + + var rate = Math.Round(1000d / _rates.Average(), 2); + + if (rate > FrameRate + _min_rate_change || rate < FrameRate - _min_rate_change) + { + FrameRate = rate; + } + + _rates.Clear(); + } + + _rates.Add(_watch.ElapsedMilliseconds); + + _watch.Restart(); + FrameReceived?.Invoke(this, frame); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/IDiagnosticsFrameProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/IDiagnosticsFrameProvider.cs index 3944fe8cb..eb1033c29 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/IDiagnosticsFrameProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/IDiagnosticsFrameProvider.cs @@ -18,6 +18,11 @@ namespace Tango.MachineStudio.Common.Diagnostics /// event EventHandler FrameReceived; + /// + /// Gets the current diagnostics frame rate. + /// + double FrameRate { get; } + /// /// Disables the frame delivery from the current connected machine and enables the manual push frame method. /// diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs index 8034ceb69..35a4b0e9d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs @@ -5,6 +5,7 @@ using System.Text; using System.Threading.Tasks; using Tango.BL.Entities; using Tango.Core.Commands; +using Tango.MachineStudio.Common.Diagnostics; using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.Common.StudioApplication; using Tango.SharedUI; @@ -30,18 +31,28 @@ namespace Tango.MachineStudio.UI.ViewModels public ConnectedMachineVMResult Result { get; set; } + private IDiagnosticsFrameProvider _diagnosticsFrameProvider; + public IDiagnosticsFrameProvider DiagnosticsFrameProvider + { + get { return _diagnosticsFrameProvider; } + set { _diagnosticsFrameProvider = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand DisconnectCommand { get; set; } public RelayCommand UploadHardwareConfigurationCommand { get; set; } public RelayCommand ResetCommand { get; set; } - public ConnectedMachineViewVM(IStudioApplicationManager application) + public ConnectedMachineViewVM(IStudioApplicationManager application, IDiagnosticsFrameProvider frameProvider) { ApplicationManager = application; DisconnectCommand = new RelayCommand(Disconnect); UploadHardwareConfigurationCommand = new RelayCommand(UploadHardwareConfiguration); ResetCommand = new RelayCommand(Reset); + + DiagnosticsFrameProvider = frameProvider; } private void Reset() 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 bb8b65f6a..aa2b014fe 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml @@ -11,7 +11,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="400" Background="White" DataContext="{Binding ConnectedMachineViewVM, Source={StaticResource Locator}}"> + d:DesignHeight="300" d:DesignWidth="300" Width="600" Height="420" Background="White" DataContext="{Binding ConnectedMachineViewVM, Source={StaticResource Locator}}"> @@ -73,7 +73,12 @@ - + + + + + + @@ -103,7 +108,12 @@ - + + + + + + diff --git a/Software/Visual_Studio/Tango.Integration/Diagnostics/DiagnosticsFilePlayer.cs b/Software/Visual_Studio/Tango.Integration/Diagnostics/DiagnosticsFilePlayer.cs index 7b3cf9859..80a19c296 100644 --- a/Software/Visual_Studio/Tango.Integration/Diagnostics/DiagnosticsFilePlayer.cs +++ b/Software/Visual_Studio/Tango.Integration/Diagnostics/DiagnosticsFilePlayer.cs @@ -124,6 +124,28 @@ namespace Tango.Integration.Diagnostics set { _machineEvents = value; RaisePropertyChangedAuto(); } } + private double _speed; + /// + /// Gets or sets the player speed (default 1.0). + /// + public double Speed + { + get { return _speed; } + set { _speed = value; RaisePropertyChangedAuto(); } + } + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + public DiagnosticsFilePlayer() + { + Speed = 1.0; + } + #endregion #region Public Methods @@ -321,11 +343,12 @@ namespace Tango.Integration.Diagnostics if (CurrentFrame > 0) { - Thread.Sleep(_timeCodeChannel.Frames[CurrentFrame].Milliseconds - _timeCodeChannel.Frames[CurrentFrame - 1].Milliseconds); + double sleep = _timeCodeChannel.Frames[CurrentFrame].Milliseconds - _timeCodeChannel.Frames[CurrentFrame - 1].Milliseconds; + Thread.Sleep((int)(sleep / Speed)); } else { - Thread.Sleep(10); + Thread.Sleep((int)(10d / Speed)); } } -- cgit v1.3.1 From 019bc4dca9a0655e5adf1e26d8e3f513563113db Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 30 Jul 2018 11:47:03 +0300 Subject: Improved and optimized transport layer transporter and adapter. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 1835008 -> 1835008 bytes .../ViewModels/LoadingViewVM.cs | 19 ++- .../Tango.MachineStudio.UI/Views/LoadingView.xaml | 2 +- .../PPC/Modules/Tango.PPC.Jobs/JobsModule.cs | 2 +- .../Tango.PPC.Jobs/Properties/AssemblyInfo.cs | 2 +- .../MachineSettingsModule.cs | 2 +- .../ViewModels/MainViewVM.cs | 8 ++ .../Tango.PPC.MachineSettings/Views/MainView.xaml | 28 ++++- .../Application/IPPCApplicationManager.cs | 5 + .../Connection/DefaultMachineProvider.cs | 3 - .../Connection/IMachineProvider.cs | 1 + .../ExternalBridge/IPPCExternalBridgeService.cs | 14 +++ .../ExternalBridge/PPCExternalBridgeService.cs | 27 +++++ .../Tango.PPC.Common/Navigation/NavigationView.cs | 1 + .../PPC/Tango.PPC.Common/PPCSettings.cs | 5 + .../Tango.PPC.Common/Properties/AssemblyInfo.cs | 2 +- .../PPC/Tango.PPC.Common/Tango.PPC.Common.csproj | 4 +- .../PPCApplication/DefaultPPCApplicationManager.cs | 3 + .../PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs | 2 +- .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 14 ++- .../PPC/Tango.PPC.UI/ViewModelLocator.cs | 12 ++ .../ViewModels/ExternalBridgeViewVM.cs | 25 ++++ .../PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs | 26 +++- .../PPC/Tango.PPC.UI/Views/ExternalBridgeView.xaml | 14 +++ .../Tango.PPC.UI/Views/ExternalBridgeView.xaml.cs | 28 +++++ .../Properties/AssemblyInfo.cs | 2 +- .../Tango.AnimatedGif/Properties/AssemblyInfo.cs | 2 +- .../Tango.BL/Enumerations/Permissions.cs | 12 ++ .../Visual_Studio/Tango.BL/Enumerations/Roles.cs | 8 +- .../Tango.BL/Properties/AssemblyInfo.cs | 2 +- .../Tango.Core/Properties/AssemblyInfo.cs | 2 +- .../Tango.DAL.Remote/Properties/AssemblyInfo.cs | 2 +- .../Tango.DragAndDrop/Properties/AssemblyInfo.cs | 2 +- .../Tango.Hive/Properties/AssemblyInfo.cs | 2 +- .../ExternalBridge/ExternalBridgeService.cs | 135 ++++++++++++++++++--- .../ExternalBridge/ExternalBridgeTcpClient.cs | 2 +- .../ExternalBridge/IExternalBridgeService.cs | 7 +- .../Tango.Integration/Properties/AssemblyInfo.cs | 2 +- .../Tango.Logging/Properties/AssemblyInfo.cs | 2 +- .../Tango.PMR/Properties/AssemblyInfo.cs | 2 +- .../Tango.Protobuf/Properties/AssemblyInfo.cs | 2 +- .../Tango.Scripting/Properties/AssemblyInfo.cs | 2 +- .../Tango.Serialization/Properties/AssemblyInfo.cs | 2 +- .../Tango.Settings/Properties/AssemblyInfo.cs | 2 +- .../Tango.SharedUI/Properties/AssemblyInfo.cs | 2 +- .../Tango.TFS/Properties/AssemblyInfo.cs | 2 +- .../Tango.Touch/Properties/AssemblyInfo.cs | 2 +- .../Adapters/TcpTransportAdapter.cs | 83 +++++-------- .../Adapters/UsbTransportAdapter.cs | 41 +++---- .../Tango.Transport/ITransportAdapter.cs | 5 - .../Tango.Transport/Properties/AssemblyInfo.cs | 2 +- .../Tango.Transport/Tango.Transport.csproj | 3 +- .../Tango.Transport/TransportAdapterBase.cs | 16 +-- .../Tango.Transport/TransportAdapterMode.cs | 23 ---- .../Tango.Transport/TransporterBase.cs | 52 +++++--- .../Tango.Protobuf.CLI/Properties/AssemblyInfo.cs | 2 +- 57 files changed, 476 insertions(+), 198 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/IPPCExternalBridgeService.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/PPCExternalBridgeService.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Views/ExternalBridgeView.xaml create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Views/ExternalBridgeView.xaml.cs delete mode 100644 Software/Visual_Studio/Tango.Transport/TransportAdapterMode.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 4c31e0729..fb9191f16 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 104f4ed58..a924d13e2 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ 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 26be2d16b..a7750b39c 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs @@ -19,6 +19,8 @@ using Tango.MachineStudio.UI.TFS; using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Update; using Tango.Core.DI; +using Tango.Settings; +using Tango.Core; namespace Tango.MachineStudio.UI.ViewModels { @@ -37,13 +39,19 @@ namespace Tango.MachineStudio.UI.ViewModels public IStudioApplicationManager ApplicationManager { get; set; } private bool _isLoading; - public bool IsLoading { get { return _isLoading; } set { _isLoading = value; RaisePropertyChangedAuto(); } } + private String _status; + public String Status + { + get { return _status; } + set { _status = value; RaisePropertyChangedAuto(); } + } + /// /// Initializes a new instance of the class. /// @@ -52,6 +60,7 @@ namespace Tango.MachineStudio.UI.ViewModels /// The notification provider. public LoadingViewVM(IStudioApplicationManager applicationManager, INavigationManager navigationManager, IStudioModuleLoader studioModuleLoader, INotificationProvider notificationProvider, IEventLogger eventLogger, TeamFoundationServiceExtendedClient teamFoundationClient) { + Status = "Loading, please wait..."; _tfs = teamFoundationClient; _eventLogger = eventLogger; ApplicationManager = applicationManager; @@ -79,6 +88,8 @@ namespace Tango.MachineStudio.UI.ViewModels { try { + Status = "Checking for critical updates..."; + LogManager.Log("Checking for forced update..."); var service = UpdateServiceHelper.GetUpdateServiceChannel(); var client = service.CreateChannel(); @@ -119,17 +130,23 @@ namespace Tango.MachineStudio.UI.ViewModels try { + Status = "Connecting to Team Foundation Services..."; _tfs.Initialize(); + Thread.Sleep(500); } catch (Exception ex) { LogManager.Log(ex, "Could not initialize Team Foundation Service client."); } + Status = "Loading, please wait..."; + ObservablesEntitiesAdapter.Instance.Initialize(); _eventLogger.Log(EventTypes.ApplicationStarted, "Application Started!"); + Status = "Starting application..."; + InvokeUI(() => { _studioModuleLoader.LoadModules(); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml index 91fc11a22..2a63ae00f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml @@ -16,7 +16,7 @@ Twine Solutions - Loading, please wait... + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/JobsModule.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/JobsModule.cs index ad0eb6f45..0a1dfb7e1 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/JobsModule.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/JobsModule.cs @@ -50,7 +50,7 @@ namespace Tango.PPC.Jobs { get { - return Permissions.RunTechnicianModule; + return Permissions.RunPPCJobsModule; } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Properties/AssemblyInfo.cs index 523281b9e..0e34bae6c 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Properties/AssemblyInfo.cs @@ -8,7 +8,7 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango Panel PC Jobs Module")] -[assembly: AssemblyVersion("2.0.4.1407")] +[assembly: AssemblyVersion("2.0.5.1355")] [assembly:ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/MachineSettingsModule.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/MachineSettingsModule.cs index 0d6f7c75f..a3087ab5a 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/MachineSettingsModule.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/MachineSettingsModule.cs @@ -69,7 +69,7 @@ namespace Tango.PPC.MachineSettings { get { - return Permissions.RunMachineStudio; + return Permissions.RunPPCSettingsModule; } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs index 877374a40..61ce69e4e 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs @@ -3,7 +3,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.Core.DI; using Tango.PPC.Common; +using Tango.PPC.Common.ExternalBridge; namespace Tango.PPC.MachineSettings.ViewModels { @@ -13,6 +15,12 @@ namespace Tango.PPC.MachineSettings.ViewModels /// public class MainViewVM : PPCViewModel { + /// + /// Gets or sets the external bridge service. + /// + [TangoInject] + public IPPCExternalBridgeService ExternalBridgeService { get; set; } + /// /// Called when the application has been started /// diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml index ff27b26f3..23d5a08a6 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml @@ -2,13 +2,35 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:vm="clr-namespace:Tango.PPC.MachineSettings.ViewModels" xmlns:global="clr-namespace:Tango.PPC.MachineSettings" xmlns:local="clr-namespace:Tango.PPC.MachineSettings.Views" mc:Ignorable="d" d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> - - + + + + + + + + + + + + Settings + + + + + + Enable External Bridge Service + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs index 50bceb3e1..16e31b5a3 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs @@ -20,6 +20,11 @@ namespace Tango.PPC.Common.Application /// event EventHandler ApplicationStarted; + /// + /// Occurs when the all components are ready. + /// + event EventHandler Ready; + /// /// Occurs when all PPC modules are ready and initialized. /// 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 8b0098eb8..d97265ed6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs @@ -81,9 +81,6 @@ namespace Tango.PPC.Common.Connection MachineOperator.Adapter = response.Adapter; MachineOperator.JobHandlingMode = JobHandlerModes.SettingUp; await MachineOperator.Connect(); - - ExternalBridgeService service = new ExternalBridgeService(MachineOperator, Machine); - service.Start(); } catch { } } 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 a041b1a2f..5b5f1e588 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/IMachineProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/IMachineProvider.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.BL.Entities; +using Tango.Integration.ExternalBridge; using Tango.Integration.Operation; namespace Tango.PPC.Common.Connection diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/IPPCExternalBridgeService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/IPPCExternalBridgeService.cs new file mode 100644 index 000000000..9154fa09c --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/IPPCExternalBridgeService.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Integration.ExternalBridge; + +namespace Tango.PPC.Common.ExternalBridge +{ + public interface IPPCExternalBridgeService : IExternalBridgeService + { + + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/PPCExternalBridgeService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/PPCExternalBridgeService.cs new file mode 100644 index 000000000..338015b8b --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/PPCExternalBridgeService.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.Integration.ExternalBridge; +using Tango.Integration.Operation; +using Tango.PPC.Common.Application; +using Tango.PPC.Common.Connection; +using Tango.Settings; + +namespace Tango.PPC.Common.ExternalBridge +{ + public class PPCExternalBridgeService : ExternalBridgeService, IPPCExternalBridgeService + { + public PPCExternalBridgeService(IPPCApplicationManager applicationManager, IMachineProvider machineProvider) + { + applicationManager.Ready += (_, __) => + { + MachineOperator = machineProvider.MachineOperator; + Machine = machineProvider.Machine; + Enabled = SettingsManager.Default.GetOrCreate().EnableExternalBridgeService; + }; + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs index f5744fd21..6f9efc4cc 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs @@ -14,6 +14,7 @@ namespace Tango.PPC.Common.Navigation LoadingView, LayoutView, LoginView, + ExternalBridgeView, HomeModule, ShutdownView, } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index 5ed4c35d9..d6effad38 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -19,6 +19,11 @@ namespace Tango.PPC.Common /// public String MachineSerialNumber { get; set; } + /// + /// Gets or sets a value indicating whether to enable external bridge service. + /// + public bool EnableExternalBridgeService { get; set; } + /// /// Gets or sets the logging categories. /// diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/AssemblyInfo.cs index f8ec20184..947ab83eb 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/AssemblyInfo.cs @@ -8,7 +8,7 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango Panel PC Common Library")] -[assembly: AssemblyVersion("2.0.7.1304")] +[assembly: AssemblyVersion("2.0.8.1355")] [assembly:ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj index 141e41872..63d28c545 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj @@ -103,6 +103,8 @@ + + @@ -254,7 +256,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs index 0fbef92a7..2f81475cd 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs @@ -149,6 +149,7 @@ namespace Tango.PPC.UI.PPCApplication ModulesInitialized?.Invoke(this, new EventArgs()); _machineProvider.Init(); + Ready?.Invoke(this, new EventArgs()); } /// @@ -163,5 +164,7 @@ namespace Tango.PPC.UI.PPCApplication vm.OnApplicationShuttingDown(); } } + + public event EventHandler Ready; } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs index 71dca288e..62a77b113 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs @@ -8,4 +8,4 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango Panel PC Application")] -[assembly: AssemblyVersion("2.0.4.1304")] +[assembly: AssemblyVersion("2.0.5.1355")] diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index 850896f0d..5b65495b0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -125,11 +125,15 @@ + + + ExternalBridgeView.xaml + LayoutView.xaml @@ -170,6 +174,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -274,6 +282,10 @@ {096f16c8-6d06-4b5f-9496-b9d2df2d94a3} Tango.PPC.Jobs + + {91b70e9b-66a7-4873-ae10-400e71cf404f} + Tango.PPC.MachineSettings + {0be74eee-22cb-4dba-b896-793b9e1a3ac0} Tango.PPC.Common @@ -392,7 +404,7 @@ copy /Y "$(SolutionDir)Referenced Assemblies\vcruntime140d.dll" "$(TargetDir)" - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs index a56b9bd4c..83be2ee65 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs @@ -8,6 +8,7 @@ using Tango.PPC.Common.Authentication; using Tango.PPC.Common.Connection; using Tango.PPC.Common.Diagnostics; using Tango.PPC.Common.EventLogging; +using Tango.PPC.Common.ExternalBridge; using Tango.PPC.Common.Modules; using Tango.PPC.Common.Navigation; using Tango.PPC.Common.Notifications; @@ -47,6 +48,7 @@ namespace Tango.PPC.UI TangoIOC.Default.Unregister(); TangoIOC.Default.Unregister(); TangoIOC.Default.Unregister(); + TangoIOC.Default.Unregister(); TangoIOC.Default.Register(new DefaultDispetcherProvider(Application.Current.Dispatcher)); TangoIOC.Default.Register(); @@ -58,12 +60,14 @@ namespace Tango.PPC.UI TangoIOC.Default.Register(); TangoIOC.Default.Register(); TangoIOC.Default.Register(); + TangoIOC.Default.Register(); //TangoIOC.Default.Register(new TeamFoundationServiceExtendedClient("https://twinetfs.visualstudio.com", String.Empty, "szzfokrceo4rhd4eqi5qpmxn3pa5iwl3q7tlqd36l2m7smz2ynoa")); TangoIOC.Default.Register(); TangoIOC.Default.Register(); TangoIOC.Default.Register(); TangoIOC.Default.Register(); + TangoIOC.Default.Register(); TangoIOC.Default.GetInstance().ApplicationStarted += (_, __) => @@ -111,5 +115,13 @@ namespace Tango.PPC.UI return TangoIOC.Default.GetInstance(); } } + + public static ExternalBridgeViewVM ExternalBridgeViewVM + { + get + { + return TangoIOC.Default.GetInstance(); + } + } } } \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs new file mode 100644 index 000000000..f0b6bbfdf --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.DI; +using Tango.PPC.Common; +using Tango.PPC.Common.ExternalBridge; + +namespace Tango.PPC.UI.ViewModels +{ + public class ExternalBridgeViewVM : PPCViewModel + { + /// + /// Gets or sets the external bridge service. + /// + [TangoInject] + public IPPCExternalBridgeService ExternalBridgeService { get; set; } + + public override void OnApplicationStarted() + { + //throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs index faac9ad16..cf85246f8 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs @@ -7,6 +7,7 @@ using Tango.Core.DI; using Tango.PPC.Common; using Tango.PPC.Common.Application; using Tango.PPC.Common.Authentication; +using Tango.PPC.Common.ExternalBridge; using Tango.PPC.Common.Modules; using Tango.PPC.Common.Navigation; using Tango.PPC.Common.Notifications; @@ -20,12 +21,29 @@ namespace Tango.PPC.UI.ViewModels /// public class MainViewVM : PPCViewModel { - /// - /// Called when the application has been started. - /// + [TangoInject] + public IPPCExternalBridgeService ExternalBridgeService { get; set; } + public override void OnApplicationStarted() { - + ExternalBridgeService.ClientConnected += ExternalBridgeService_ClientConnected; + ExternalBridgeService.ClientDisconnected += ExternalBridgeService_ClientDisconnected; + } + + private void ExternalBridgeService_ClientDisconnected(object sender, EventArgs e) + { + InvokeUI(() => + { + NavigationManager.NavigateTo(Common.Navigation.NavigationView.HomeModule); + }); + } + + private void ExternalBridgeService_ClientConnected(object sender, EventArgs e) + { + InvokeUI(() => + { + NavigationManager.NavigateTo(Common.Navigation.NavigationView.ExternalBridgeView, false); + }); } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/ExternalBridgeView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/ExternalBridgeView.xaml new file mode 100644 index 000000000..c2dad0a5e --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/ExternalBridgeView.xaml @@ -0,0 +1,14 @@ + + + This machine is currently being controlled + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/ExternalBridgeView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/ExternalBridgeView.xaml.cs new file mode 100644 index 000000000..f1cfe95de --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/ExternalBridgeView.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.PPC.UI.Views +{ + /// + /// Interaction logic for ExternalBridgeView.xaml + /// + public partial class ExternalBridgeView : UserControl + { + public ExternalBridgeView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/SideChains/ICSharpCode.AvalonEdit/Properties/AssemblyInfo.cs b/Software/Visual_Studio/SideChains/ICSharpCode.AvalonEdit/Properties/AssemblyInfo.cs index 9d9b7d061..9b7f2135e 100644 --- a/Software/Visual_Studio/SideChains/ICSharpCode.AvalonEdit/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/SideChains/ICSharpCode.AvalonEdit/Properties/AssemblyInfo.cs @@ -20,7 +20,7 @@ using System.Windows.Markup; [assembly: AssemblyCompany("ic#code")] [assembly: AssemblyProduct("SharpDevelop")] [assembly: AssemblyCopyright("2000-2013 AlphaSierraPapa for the SharpDevelop Team")] -[assembly: AssemblyVersion("1.0.12.1411")] +[assembly: AssemblyVersion("1.0.13.1355")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2243:AttributeStringLiteralsShouldParseCorrectly", diff --git a/Software/Visual_Studio/Tango.AnimatedGif/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.AnimatedGif/Properties/AssemblyInfo.cs index ae9836ae2..da470e4cf 100644 --- a/Software/Visual_Studio/Tango.AnimatedGif/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.AnimatedGif/Properties/AssemblyInfo.cs @@ -6,6 +6,6 @@ using System.Windows.Markup; [assembly: AssemblyTitle("Tango - GIF Animation Library")] [assembly: ComVisible(false)] -[assembly: AssemblyVersion("2.0.5.1407")] +[assembly: AssemblyVersion("2.0.6.1355")] [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/Permissions.cs b/Software/Visual_Studio/Tango.BL/Enumerations/Permissions.cs index 5b2bc90d0..0aff2a59d 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/Permissions.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/Permissions.cs @@ -91,5 +91,17 @@ namespace Tango.BL.Enumerations [Description("Allows openning the machine studio developer console")] RunDeveloperConsole = 11, + /// + /// (Allows the loading of the PPC jobs module) + /// + [Description("Allows the loading of the PPC jobs module")] + RunPPCJobsModule = 12, + + /// + /// (Allows loading the PPC settings module) + /// + [Description("Allows loading the PPC settings module")] + RunPPCSettingsModule = 13, + } } diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/Roles.cs b/Software/Visual_Studio/Tango.BL/Enumerations/Roles.cs index 886bd7c9b..39864eeb8 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/Roles.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/Roles.cs @@ -41,7 +41,7 @@ namespace Tango.BL.Enumerations /// (Twine Research and development) /// [Description("Twine Research and development")] - MachineDeveloper = 3, + Researcher = 3, /// /// (Publish new Machine Studio Versions) @@ -73,5 +73,11 @@ namespace Tango.BL.Enumerations [Description("Color adjustment & calibration algorithms developer ")] ColorScientist = 8, + /// + /// (Standard PPC User) + /// + [Description("Standard PPC User")] + PPCUser = 9, + } } diff --git a/Software/Visual_Studio/Tango.BL/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.BL/Properties/AssemblyInfo.cs index db222c791..1e121152e 100644 --- a/Software/Visual_Studio/Tango.BL/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.BL/Properties/AssemblyInfo.cs @@ -4,4 +4,4 @@ using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - Business logic components")] [assembly: ComVisible(false)] -[assembly: AssemblyVersion("2.0.16.1608")] \ No newline at end of file +[assembly: AssemblyVersion("2.0.17.1355")] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Core/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.Core/Properties/AssemblyInfo.cs index 186628b13..407229686 100644 --- a/Software/Visual_Studio/Tango.Core/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.Core/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - Core Components")] -[assembly: AssemblyVersion("2.0.16.1411")] +[assembly: AssemblyVersion("2.0.17.1355")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.DAL.Remote/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.DAL.Remote/Properties/AssemblyInfo.cs index 90c6d8ff1..5b7163f7d 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - Remote Data Access Layer")] -[assembly: AssemblyVersion("2.0.15.1411")] +[assembly: AssemblyVersion("2.0.16.1355")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.DragAndDrop/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.DragAndDrop/Properties/AssemblyInfo.cs index a490d0fb3..03bc5d817 100644 --- a/Software/Visual_Studio/Tango.DragAndDrop/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.DragAndDrop/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - Drag & Drop Components")] -[assembly: AssemblyVersion("2.0.13.1411")] +[assembly: AssemblyVersion("2.0.14.1355")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Hive/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.Hive/Properties/AssemblyInfo.cs index 17431f6d7..412aa9136 100644 --- a/Software/Visual_Studio/Tango.Hive/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.Hive/Properties/AssemblyInfo.cs @@ -5,7 +5,7 @@ using System.Runtime.InteropServices; using System.Windows; [assembly: AssemblyTitle("Tango - Hive UI Components")] -[assembly: AssemblyVersion("2.0.9.1407")] +[assembly: AssemblyVersion("2.0.10.1355")] [assembly:ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs index 8408d33af..ff8a72bc3 100644 --- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs @@ -14,6 +14,7 @@ using Tango.PMR.Integration; using Tango.Transport.Discovery; using Tango.Transport.Servers; using Tango.Transport.Adapters; +using Tango.PMR.Connection; namespace Tango.Integration.ExternalBridge { @@ -22,19 +23,51 @@ namespace Tango.Integration.ExternalBridge private UdpDiscoveryService _discoverySevice; private TcpServer _tcpServer; - public IMachineOperator MachineOperator { get; private set; } + private IMachineOperator _machineOperator; + public IMachineOperator MachineOperator + { + get { return _machineOperator; } + set { _machineOperator = value; OnMachineOperatorChanged(); } + } - public Machine Machine { get; private set; } + private Machine _machine; + + public Machine Machine + { + get { return _machine; } + set { _machine = value; OnMachineChanged(); } + } public bool IsStarted { get; private set; } - public ExternalBridgeService(IMachineOperator machineOperator, Machine machine) + private bool _enabled; + + public bool Enabled { - Machine = machine; - MachineOperator = machineOperator; + get { return _enabled; } + set + { + _enabled = value; - _tcpServer = new TcpServer(1984); - _tcpServer.ClientConnected += _tcpServer_ClientConnected; + if (_enabled) + { + Start(); + } + else + { + Stop(); + } + + RaisePropertyChangedAuto(); + } + } + + private void OnMachineChanged() + { + if (_discoverySevice != null && _discoverySevice.IsStarted) + { + _discoverySevice.Stop(); + } _discoverySevice = new UdpDiscoveryService(8888, new ExternalBridgeUdpDiscoveryPacket() { @@ -42,6 +75,18 @@ namespace Tango.Integration.ExternalBridge }); } + public ExternalBridgeService() + { + _tcpServer = new TcpServer(1984); + _tcpServer.ClientConnected += _tcpServer_ClientConnected; + } + + public ExternalBridgeService(IMachineOperator machineOperator, Machine machine) : this() + { + Machine = machine; + MachineOperator = machineOperator; + } + private async void _tcpServer_ClientConnected(object sender, ClientConnectedEventArgs e) { Adapter = new TcpTransportAdapter(e.Socket); @@ -56,10 +101,12 @@ namespace Tango.Integration.ExternalBridge _discoverySevice.Start(); IsStarted = true; + _enabled = true; + RaisePropertyChanged(nameof(Enabled)); } } - public void Stop() + public async void Stop() { if (IsStarted) { @@ -67,6 +114,33 @@ namespace Tango.Integration.ExternalBridge _discoverySevice.Stop(); IsStarted = false; + _enabled = false; + RaisePropertyChanged(nameof(Enabled)); + + try + { + await Disconnect(); + } + catch { } + + ClientDisconnected?.Invoke(this, new EventArgs()); + } + } + + private void OnMachineOperatorChanged() + { + if (MachineOperator != null) + { + MachineOperator.StateChanged -= MachineOperator_StateChanged; + MachineOperator.StateChanged += MachineOperator_StateChanged; + } + } + + private void MachineOperator_StateChanged(object sender, TransportComponentState e) + { + if (e != TransportComponentState.Connected) + { + Stop(); } } @@ -74,7 +148,16 @@ namespace Tango.Integration.ExternalBridge { base.OnRequestReceived(container); - if (container.Type == MessageType.ExternalClientLoginRequest) + if (!Enabled) return; + + if (container.Type == MessageType.ConnectRequest) + { + await SendResponse(new ConnectResponse() + { + DeviceInformation = MachineOperator.DeviceInformation, + }, container.Token); + } + else if (container.Type == MessageType.ExternalClientLoginRequest) { var request = MessageFactory.ParseTangoMessageFromContainer(container); @@ -85,14 +168,18 @@ namespace Tango.Integration.ExternalBridge { response.Authenticated = true; response.SerialNumber = Machine.SerialNumber; + ClientConnected?.Invoke(this, new EventArgs()); } await SendResponse(response, container.Token); } + else if (container.Type == MessageType.DisconnectRequest) + { + await SendResponse(new DisconnectResponse(), container.Token); + Stop(); + } else { - MachineOperator.RequestTimeout = TimeSpan.FromSeconds(60); - if (!container.Continuous) { var response = await MachineOperator.SendRequest(container); @@ -100,20 +187,28 @@ namespace Tango.Integration.ExternalBridge } else { - MachineOperator.SendContinuousRequest(container).Subscribe((response) => + MachineOperator.SendContinuousRequest(container).Subscribe((response) => { - - SendResponse(response); - - },(ex) => - { - if (ex is ResponseErrorException) + if (Enabled) { - SendResponse((ex as ResponseErrorException).Container); + SendResponse(response); } - }); + + }, (ex) => + { + if (Enabled) + { + if (ex is ResponseErrorException) + { + SendResponse((ex as ResponseErrorException).Container); + } + } + }); } } } + + public event EventHandler ClientConnected; + public event EventHandler ClientDisconnected; } } diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs index a81e64c02..c90fb2264 100644 --- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs @@ -85,7 +85,7 @@ namespace Tango.Integration.ExternalBridge { SerialNumber = serialNumber; IPAddress = ipAddress; - UseKeepAlive = true; + UseKeepAlive = false; EnableDiagnostics = true; } diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeService.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeService.cs index d8e106ac4..d69cefc09 100644 --- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeService.cs +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeService.cs @@ -12,10 +12,13 @@ namespace Tango.Integration.ExternalBridge { public interface IExternalBridgeService : ITransporter { - IMachineOperator MachineOperator { get; } - Machine Machine { get; } + event EventHandler ClientConnected; + event EventHandler ClientDisconnected; + IMachineOperator MachineOperator { get; set; } + Machine Machine { get; set; } bool IsStarted { get; } void Start(); void Stop(); + bool Enabled { get; set; } } } diff --git a/Software/Visual_Studio/Tango.Integration/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.Integration/Properties/AssemblyInfo.cs index fa528d630..8f425aaaf 100644 --- a/Software/Visual_Studio/Tango.Integration/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.Integration/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - Logging Library")] -[assembly: AssemblyVersion("2.0.14.1304")] +[assembly: AssemblyVersion("2.0.15.1355")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Logging/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.Logging/Properties/AssemblyInfo.cs index a34091bb5..de818c079 100644 --- a/Software/Visual_Studio/Tango.Logging/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.Logging/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - Logging Library")] -[assembly: AssemblyVersion("2.0.20.1304")] +[assembly: AssemblyVersion("2.0.21.1355")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.PMR/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.PMR/Properties/AssemblyInfo.cs index ddf3cb254..0db026c21 100644 --- a/Software/Visual_Studio/Tango.PMR/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.PMR/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - Protobuf Message Repository")] -[assembly: AssemblyVersion("2.0.18.1304")] +[assembly: AssemblyVersion("2.0.19.1355")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Protobuf/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.Protobuf/Properties/AssemblyInfo.cs index b34d8addd..2790afbf3 100644 --- a/Software/Visual_Studio/Tango.Protobuf/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.Protobuf/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - Protobuf Components")] -[assembly: AssemblyVersion("2.0.16.1608")] +[assembly: AssemblyVersion("2.0.17.1355")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Scripting/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.Scripting/Properties/AssemblyInfo.cs index d28d9ccf5..63541df84 100644 --- a/Software/Visual_Studio/Tango.Scripting/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.Scripting/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - Roslyn Scripting Components")] -[assembly: AssemblyVersion("2.0.13.1411")] +[assembly: AssemblyVersion("2.0.14.1355")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Serialization/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.Serialization/Properties/AssemblyInfo.cs index cc507873f..32ed84090 100644 --- a/Software/Visual_Studio/Tango.Serialization/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.Serialization/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - Serialization Components")] -[assembly: AssemblyVersion("2.0.15.1411")] +[assembly: AssemblyVersion("2.0.16.1355")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Settings/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.Settings/Properties/AssemblyInfo.cs index fe1eb27cc..0555f98d1 100644 --- a/Software/Visual_Studio/Tango.Settings/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.Settings/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - Global Settings")] -[assembly: AssemblyVersion("2.0.15.1411")] +[assembly: AssemblyVersion("2.0.16.1355")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.SharedUI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.SharedUI/Properties/AssemblyInfo.cs index 27ee43517..eeb037af0 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.SharedUI/Properties/AssemblyInfo.cs @@ -5,7 +5,7 @@ using System.Runtime.InteropServices; using System.Windows; [assembly: AssemblyTitle("Tango - Shared UI Components")] -[assembly: AssemblyVersion("2.0.13.1411")] +[assembly: AssemblyVersion("2.0.14.1355")] [assembly: ComVisible(false)] diff --git a/Software/Visual_Studio/Tango.TFS/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.TFS/Properties/AssemblyInfo.cs index 009d62401..d7c187140 100644 --- a/Software/Visual_Studio/Tango.TFS/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.TFS/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - VSTS API Library")] -[assembly: AssemblyVersion("2.0.6.1407")] +[assembly: AssemblyVersion("2.0.7.1355")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Touch/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.Touch/Properties/AssemblyInfo.cs index ff906391d..7bde38929 100644 --- a/Software/Visual_Studio/Tango.Touch/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.Touch/Properties/AssemblyInfo.cs @@ -5,7 +5,7 @@ using System.Runtime.InteropServices; using System.Windows; [assembly: AssemblyTitle("Tango - Touch Components")] -[assembly: AssemblyVersion("2.0.5.1407")] +[assembly: AssemblyVersion("2.0.6.1355")] [assembly: ComVisible(false)] [assembly:ThemeInfo( diff --git a/Software/Visual_Studio/Tango.Transport/Adapters/TcpTransportAdapter.cs b/Software/Visual_Studio/Tango.Transport/Adapters/TcpTransportAdapter.cs index 38ba29e5c..8069efcf3 100644 --- a/Software/Visual_Studio/Tango.Transport/Adapters/TcpTransportAdapter.cs +++ b/Software/Visual_Studio/Tango.Transport/Adapters/TcpTransportAdapter.cs @@ -23,6 +23,7 @@ namespace Tango.Transport.Adapters private TcpClient _socket; private Thread _pullThread; private bool _initializedFromConstructor; + private byte[] _size_buffer; #region Properties @@ -40,7 +41,6 @@ namespace Tango.Transport.Adapters /// public TcpTransportAdapter() { - AdapterMode = TransportAdapterMode.PREPEND_HEADER; Address = "127.0.0.1"; Port = 9999; } @@ -155,69 +155,46 @@ namespace Tango.Transport.Adapters private void PullThreadMethod() { - int counter = 0; - try { - while (State == TransportComponentState.Connected) + if (State == TransportComponentState.Connected) { - if (AdapterMode == TransportAdapterMode.NO_HEADER) - { - if (_socket.Available > 0) - { - byte[] data = new byte[_socket.Available]; - _socket.GetStream().Read(data, 0, data.Length); - OnDataAvailable(data); - } - } - else - { - if (_socket.Available > 4) - { - byte[] size = new byte[4]; - _socket.GetStream().Read(size, 0, size.Length); - int expectedSize = BitConverter.ToInt32(size, 0); + _size_buffer = new byte[4]; + _socket.GetStream().BeginRead(_size_buffer, 0, _size_buffer.Length, EndReading, _socket.GetStream()); + } + } + catch (Exception ex) + { + OnFailed(ex); + } + } - byte[] data = new byte[expectedSize]; - int read = 0; + private void EndReading(IAsyncResult ar) + { + try + { + if (State == TransportComponentState.Connected) + { + _socket.GetStream().EndRead(ar); - while (read < expectedSize) - { - read += _socket.GetStream().Read(data, read, Math.Min(_socket.Available, expectedSize - read)); + int expectedSize = BitConverter.ToInt32(_size_buffer, 0); - //Thread.Sleep(2); + byte[] data = new byte[expectedSize]; + int read = 0; - if (State != TransportComponentState.Connected) - { - break; - } - } + while (read < expectedSize) + { + read += _socket.GetStream().Read(data, read, Math.Min(_socket.Available, expectedSize - read)); - OnDataAvailable(data); + if (State != TransportComponentState.Connected) + { + break; } } - Thread.Sleep(10); - counter++; - - //if (counter >= 200) - //{ - // try - // { - // if (_socket.Client.Poll(1, SelectMode.SelectRead) && _socket.Client.Available == 0) - // { - // OnFailed(LogManager.Log(new TimeoutException("Client disconnected."))); - // return; - // } - // } - // catch (SocketException ex) - // { - // OnFailed(LogManager.Log(ex)); - // return; - // } - - // counter = 0; - //} + OnDataAvailable(data); + + PullThreadMethod(); } } catch (Exception ex) diff --git a/Software/Visual_Studio/Tango.Transport/Adapters/UsbTransportAdapter.cs b/Software/Visual_Studio/Tango.Transport/Adapters/UsbTransportAdapter.cs index 4bd6d2679..d914ac98a 100644 --- a/Software/Visual_Studio/Tango.Transport/Adapters/UsbTransportAdapter.cs +++ b/Software/Visual_Studio/Tango.Transport/Adapters/UsbTransportAdapter.cs @@ -29,7 +29,6 @@ namespace Tango.Transport.Adapters public UsbTransportAdapter() : base() { BaudRate = UsbSerialBaudRates.BR_9600; - AdapterMode = TransportAdapterMode.PREPEND_HEADER; Address = "COM1"; } @@ -159,38 +158,30 @@ namespace Tango.Transport.Adapters { if (e.EventType == SerialData.Eof) return; - if (AdapterMode == TransportAdapterMode.NO_HEADER) + if (_serialPort.BytesToRead > 4) { - byte[] data = new byte[_serialPort.BytesToRead]; - _serialPort.Read(data, 0, data.Length); - OnDataAvailable(data); - } - else - { - if (_serialPort.BytesToRead > 4) - { - byte[] size = new byte[4]; - _serialPort.Read(size, 0, size.Length); - int expectedSize = BitConverter.ToInt32(size, 0); + byte[] size = new byte[4]; + _serialPort.Read(size, 0, size.Length); + int expectedSize = BitConverter.ToInt32(size, 0); - byte[] data = new byte[expectedSize]; - int read = 0; + byte[] data = new byte[expectedSize]; + int read = 0; - while (read < expectedSize) - { - read += _serialPort.Read(data, read, Math.Min(_serialPort.BytesToRead, expectedSize - read)); + while (read < expectedSize) + { + read += _serialPort.Read(data, read, Math.Min(_serialPort.BytesToRead, expectedSize - read)); - //Thread.Sleep(2); + //Thread.Sleep(2); - if (State != TransportComponentState.Connected) - { - break; - } + if (State != TransportComponentState.Connected) + { + break; } - - OnDataAvailable(data); } + + OnDataAvailable(data); } + } catch (Exception ex) { diff --git a/Software/Visual_Studio/Tango.Transport/ITransportAdapter.cs b/Software/Visual_Studio/Tango.Transport/ITransportAdapter.cs index 8260f926d..5e6b528c2 100644 --- a/Software/Visual_Studio/Tango.Transport/ITransportAdapter.cs +++ b/Software/Visual_Studio/Tango.Transport/ITransportAdapter.cs @@ -44,10 +44,5 @@ namespace Tango.Transport /// Gets or sets the adapter address. /// String Address { get; set; } - - /// - /// Gets or sets the adapter reading/writing mode. - /// - TransportAdapterMode AdapterMode { get; set; } } } diff --git a/Software/Visual_Studio/Tango.Transport/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.Transport/Properties/AssemblyInfo.cs index fc6a0e393..317e3adad 100644 --- a/Software/Visual_Studio/Tango.Transport/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.Transport/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - Transport Components")] -[assembly: AssemblyVersion("2.0.14.1304")] +[assembly: AssemblyVersion("2.0.15.1355")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj b/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj index 18245d5cf..ebd34b210 100644 --- a/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj +++ b/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj @@ -94,7 +94,6 @@ - @@ -128,7 +127,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Transport/TransportAdapterBase.cs b/Software/Visual_Studio/Tango.Transport/TransportAdapterBase.cs index 981ab0882..8a5ebda55 100644 --- a/Software/Visual_Studio/Tango.Transport/TransportAdapterBase.cs +++ b/Software/Visual_Studio/Tango.Transport/TransportAdapterBase.cs @@ -90,11 +90,6 @@ namespace Tango.Transport } } - /// - /// Gets or sets the adapter reading/writing mode. - /// - public TransportAdapterMode AdapterMode { get; set; } - #endregion #region Virtual Methods @@ -166,14 +161,7 @@ namespace Tango.Transport { byte[] postData = data; - if (AdapterMode == TransportAdapterMode.NO_HEADER) - { - return postData; - } - else - { - postData = BitConverter.GetBytes(data.Length).Concat(data).ToArray(); - } + postData = BitConverter.GetBytes(data.Length).Concat(data).ToArray(); TotalBytesSent += postData.Length; _totalBytes += postData.Length; @@ -239,7 +227,7 @@ namespace Tango.Transport /// public override string ToString() { - return this.GetType().Name + " [" + AdapterMode + "]"; + return this.GetType().Name; } #endregion diff --git a/Software/Visual_Studio/Tango.Transport/TransportAdapterMode.cs b/Software/Visual_Studio/Tango.Transport/TransportAdapterMode.cs deleted file mode 100644 index e89eba38d..000000000 --- a/Software/Visual_Studio/Tango.Transport/TransportAdapterMode.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tango.Transport -{ - /// - /// Represents an read/write mode. - /// - public enum TransportAdapterMode - { - /// - /// Pure protobuf message with no message size. - /// - NO_HEADER, - /// - /// Prepends and truncates the message size before writing and reading. - /// - PREPEND_HEADER - } -} diff --git a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs index d2c33d504..0d975973b 100644 --- a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs +++ b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs @@ -34,6 +34,8 @@ namespace Tango.Transport private Thread _keepAliveThread; private ITransportAdapter _adapter; private Dictionary _pendingResponses; + private AutoResetEvent _pull_wait_handle; + private AutoResetEvent _push_wait_handle; #region Events @@ -180,7 +182,7 @@ namespace Tango.Transport /// The data. protected virtual void OnAdapterDataAvailable(object sender, byte[] data) { - _arrivedResponses.Enqueue(data); + EnqueueMessageIn(data); } /// @@ -221,6 +223,9 @@ namespace Tango.Transport /// public TransporterBase() { + _pull_wait_handle = new AutoResetEvent(false); + _push_wait_handle = new AutoResetEvent(false); + Encoder = new ProtoEncoder(); _pendingResponses = new Dictionary(); _sendingQueue = new ConcurrentQueue(); @@ -295,7 +300,7 @@ namespace Tango.Transport TaskCompletionSource source = new TaskCompletionSource(); TransportMessage message = new TransportMessage(container.Token, request, TransportMessageDirection.Request, () => container.ToByteArray(), source); - _sendingQueue.Enqueue(message); + EnqueueMessageOut(message); Task.Delay(timeout != null ? timeout.Value : RequestTimeout).ContinueWith((x) => { if (!source.Task.IsCompleted) @@ -361,7 +366,7 @@ namespace Tango.Transport TaskCompletionSource source = new TaskCompletionSource(); TransportMessage message = new TransportMessage(container.Token, container, TransportMessageDirection.Request, () => container.ToByteArray(), source); - _sendingQueue.Enqueue(message); + EnqueueMessageOut(message); Task.Delay(timeout != null ? timeout.Value : RequestTimeout).ContinueWith((x) => { if (!source.Task.IsCompleted) @@ -414,7 +419,7 @@ namespace Tango.Transport TaskCompletionSource source = new TaskCompletionSource(); TransportMessage message = new TransportMessage(token, container, TransportMessageDirection.Response, () => container.ToByteArray(), source); - _sendingQueue.Enqueue(message); + EnqueueMessageOut(message); return source.Task; } @@ -447,7 +452,7 @@ namespace Tango.Transport IsContinuous = true, ContinuesResponseSubject = subject, }; - _sendingQueue.Enqueue(message); + EnqueueMessageOut(message); Task.Delay(timeout != null ? timeout.Value : RequestTimeout).ContinueWith((x) => { @@ -480,7 +485,7 @@ namespace Tango.Transport TaskCompletionSource> source = new TaskCompletionSource>(); TransportMessage> message = new TransportMessage>(request.Container.Token, request, TransportMessageDirection.Request, () => Encoder.Encode(request), source); - _sendingQueue.Enqueue(message); + EnqueueMessageOut(message); Task.Delay(timeout != null ? timeout.Value : RequestTimeout).ContinueWith((x) => { if (!source.Task.IsCompleted) @@ -521,7 +526,7 @@ namespace Tango.Transport IsContinuous = true, ContinuesResponseSubject = subject, }; - _sendingQueue.Enqueue(message); + EnqueueMessageOut(message); Task.Delay(firstTimeout != null ? firstTimeout.Value : RequestTimeout).ContinueWith((x) => { @@ -585,7 +590,7 @@ namespace Tango.Transport IsContinuous = true, ContinuesResponseSubject = subject, }; - _sendingQueue.Enqueue(message); + EnqueueMessageOut(message); Task.Delay(timeout != null ? timeout.Value : RequestTimeout).ContinueWith((x) => { @@ -695,7 +700,7 @@ namespace Tango.Transport TaskCompletionSource source = new TaskCompletionSource(); TransportMessage message = new TransportMessage(token, response, TransportMessageDirection.Response, () => Encoder.Encode(response), source); - _sendingQueue.Enqueue(message); + EnqueueMessageOut(message); return source.Task; } @@ -745,6 +750,26 @@ namespace Tango.Transport return container.Timeout > 0 ? TimeSpan.FromMilliseconds(container.Timeout) : default(TimeSpan?); } + /// + /// Enqueues the message and releases the push wait handle. + /// + /// The message. + private void EnqueueMessageOut(TransportMessageBase message) + { + _sendingQueue.Enqueue(message); + _push_wait_handle.Set(); + } + + /// + /// Enqueues the message and releases the pull wait handle. + /// + /// The data. + private void EnqueueMessageIn(byte[] data) + { + _arrivedResponses.Enqueue(data); + _pull_wait_handle.Set(); + } + #endregion #region Push Thread @@ -758,7 +783,7 @@ namespace Tango.Transport { while (State == TransportComponentState.Connected) { - while (Adapter != null && _sendingQueue.Count > 0) + if (Adapter != null && _sendingQueue.Count > 0) { TransportMessageBase message; if (_sendingQueue.TryDequeue(out message)) @@ -797,8 +822,7 @@ namespace Tango.Transport } } - Thread.Sleep(10); - + _push_wait_handle.WaitOne(); } } catch (Exception ex) @@ -822,7 +846,7 @@ namespace Tango.Transport { byte[] data; - while (Adapter != null && _arrivedResponses.Count > 0) + if (Adapter != null && _arrivedResponses.Count > 0) { if (_arrivedResponses.TryDequeue(out data)) { @@ -951,7 +975,7 @@ namespace Tango.Transport } } - Thread.Sleep(10); + _pull_wait_handle.WaitOne(); } } catch (Exception ex) diff --git a/Software/Visual_Studio/Utilities/Tango.Protobuf.CLI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Utilities/Tango.Protobuf.CLI/Properties/AssemblyInfo.cs index 353778c4d..4cd5bafb7 100644 --- a/Software/Visual_Studio/Utilities/Tango.Protobuf.CLI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Utilities/Tango.Protobuf.CLI/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - Protobuf Compilation CLI")] -[assembly: AssemblyVersion("2.0.14.1411")] +[assembly: AssemblyVersion("2.0.15.1355")] [assembly: ComVisible(false)] \ No newline at end of file -- cgit v1.3.1