aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-10-23 15:41:42 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-10-23 15:41:42 +0300
commiteed57807589a6de896c27e988e2d0e8d1358faa4 (patch)
tree516a6737ec212bd5b1d50497eac78df01811cb35 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI
parent68f524e2b0cf3f3628e5ec21aaf311abe5ec242a (diff)
downloadTango-eed57807589a6de896c27e988e2d0e8d1358faa4.tar.gz
Tango-eed57807589a6de896c27e988e2d0e8d1358faa4.zip
Added storage api proto files.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs33
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs62
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml32
4 files changed, 89 insertions, 40 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs
index d4690c6b5..908a9fd38 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs
@@ -4,5 +4,5 @@ using System.Runtime.InteropServices;
[assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)]
[assembly: AssemblyTitle("Tango - Machine Studio")]
-[assembly: AssemblyVersion("3.5.52.18238")]
+[assembly: AssemblyVersion("3.5.53.18238")]
[assembly: ComVisible(false)] \ No newline at end of file
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs
index 51b7168ed..7737911e0 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs
@@ -52,6 +52,8 @@ namespace Tango.MachineStudio.UI.ViewModels
/// <param name="scanner">The scanner.</param>
public MachineConnectionViewVM(ExternalBridgeScanner scanner)
{
+ EnableDiagnostics = true;
+ UploadHardwareConfiguration = true;
Scanner = scanner;
ConnectCommand = new RelayCommand(Connect, (x) => SelectedMachine != null);
}
@@ -97,5 +99,36 @@ namespace Tango.MachineStudio.UI.ViewModels
Scanner.AvailableMachines.Add(_emulator);
Scanner.Start();
}
+
+ private bool _enableDiagnostics;
+ /// <summary>
+ /// Gets or sets a value indicating whether to enable diagnostics after connection.
+ /// </summary>
+ public bool EnableDiagnostics
+ {
+ get { return _enableDiagnostics; }
+ set { _enableDiagnostics = value; RaisePropertyChangedAuto(); }
+ }
+
+ private bool _uploadHardwareConfiguration;
+ /// <summary>
+ /// Gets or sets a value indicating whether to upload hardware configuration after connection.
+ /// </summary>
+ public bool UploadHardwareConfiguration
+ {
+ get { return _uploadHardwareConfiguration; }
+ set { _uploadHardwareConfiguration = value; RaisePropertyChangedAuto(); }
+ }
+
+ private bool _enableKeepAlive;
+ /// <summary>
+ /// Gets or sets a value indicating whether to use the keep alive mechanism.
+ /// </summary>
+ public bool EnableKeepAlive
+ {
+ get { return _enableKeepAlive; }
+ set { _enableKeepAlive = value; RaisePropertyChangedAuto(); }
+ }
+
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
index 49a8ca807..9b625a6ee 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
@@ -445,6 +445,11 @@ namespace Tango.MachineStudio.UI.ViewModels
}
}
+ x.SelectedMachine.EnableDiagnostics = x.EnableDiagnostics;
+ x.SelectedMachine.EnableEmbeddedDebugging = x.EnableDiagnostics;
+ x.SelectedMachine.EnableEventsNotification = x.EnableDiagnostics;
+ x.SelectedMachine.UseKeepAlive = x.EnableKeepAlive;
+
if (x.SelectedMachine.RequiresAuthentication)
{
_notificationProvider.ShowModalDialog<MachineLoginViewVM>(async (login) =>
@@ -453,11 +458,6 @@ namespace Tango.MachineStudio.UI.ViewModels
{
try
{
- if (x.SelectedMachine.EnableDiagnostics)
- {
- x.SelectedMachine.EnableEmbeddedDebugging = true;
- }
-
await x.SelectedMachine.As<IExternalBridgeSecureClient>().Connect(new PMR.Integration.ExternalBridgeLoginRequest()
{
AppID = "Machine Studio",
@@ -479,6 +479,11 @@ namespace Tango.MachineStudio.UI.ViewModels
PostMessage(new MachineConnectionChangedMessage() { Machine = x.SelectedMachine });
_eventLogger.Log(String.Format("Successfully connected to machine {0} via TCP", x.SelectedMachine.SerialNumber));
+ if (x.UploadHardwareConfiguration)
+ {
+ UploadHardwareConfiguration();
+ }
+
}
catch (ResponseErrorException ex)
{
@@ -507,11 +512,6 @@ namespace Tango.MachineStudio.UI.ViewModels
{
try
{
- if (x.SelectedMachine.EnableDiagnostics)
- {
- x.SelectedMachine.EnableEmbeddedDebugging = true;
- }
-
await x.SelectedMachine.Connect();
x.SelectedMachine.SerialNumber = vm.SelectedMachine.SerialNumber;
ApplicationManager.SetConnectedMachine(x.SelectedMachine);
@@ -520,6 +520,11 @@ namespace Tango.MachineStudio.UI.ViewModels
_eventLogger.Log(String.Format("Successfully connected to machine {0} via USB", x.SelectedMachine.SerialNumber));
_settings.LastVirtualMachineSerialNumber = vm.SelectedMachine.SerialNumber;
_settings.Save();
+
+ if (x.UploadHardwareConfiguration)
+ {
+ UploadHardwareConfiguration();
+ }
}
catch (Exception ex)
{
@@ -560,22 +565,7 @@ namespace Tango.MachineStudio.UI.ViewModels
{
using (NotificationProvider.PushTaskItem("Uploading hardware configuration..."))
{
- try
- {
- using (ObservablesContext db = ObservablesContext.CreateDefault())
- {
- var config = db.Adapter.GetConfiguration(s => s.Guid == ApplicationManager.Machine.ConfigurationGuid);
- var hw = db.Adapter.GetHardwareVersionByMachine(ApplicationManager.Machine.Guid);
-
- await ApplicationManager.ConnectedMachine.UploadHardwareConfiguration(hw, config);
- }
- NotificationProvider.ShowInfo("Hardware configuration uploaded successfully.");
- }
- catch (Exception ex)
- {
- LogManager.Log(ex, "Error uploading hardware configuration.");
- NotificationProvider.ShowError("Error uploading hardware configuration." + Environment.NewLine + ex.Message);
- }
+ UploadHardwareConfiguration();
}
}
}
@@ -623,6 +613,26 @@ namespace Tango.MachineStudio.UI.ViewModels
InvalidateRelayCommands();
}
+ private async void UploadHardwareConfiguration()
+ {
+ try
+ {
+ using (ObservablesContext db = ObservablesContext.CreateDefault())
+ {
+ var config = db.Adapter.GetConfiguration(s => s.Guid == ApplicationManager.Machine.ConfigurationGuid);
+ var hw = db.Adapter.GetHardwareVersionByMachine(ApplicationManager.Machine.Guid);
+
+ await ApplicationManager.ConnectedMachine.UploadHardwareConfiguration(hw, config);
+ }
+ NotificationProvider.ShowInfo("Hardware configuration uploaded successfully.");
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error uploading hardware configuration.");
+ NotificationProvider.ShowError("Error uploading hardware configuration." + Environment.NewLine + ex.Message);
+ }
+ }
+
/// <summary>
/// Navigates to the home screen.
/// </summary>
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 180a2a8e0..9794404b9 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml
@@ -10,7 +10,7 @@
xmlns:emulations="clr-namespace:Tango.Emulations.ExternalBridge;assembly=Tango.Emulations"
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 MachineConnectionViewVM, Source={StaticResource Locator}}">
+ d:DesignHeight="300" d:DesignWidth="300" Width="630" Height="400" Background="White" DataContext="{Binding MachineConnectionViewVM, Source={StaticResource Locator}}">
<UserControl.Resources>
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"></converters:BooleanToVisibilityConverter>
@@ -57,10 +57,6 @@
<ListBox.Resources>
<DataTemplate DataType="{x:Type integration:ExternalBridgeTcpClient}">
<DockPanel>
- <StackPanel Orientation="Vertical" VerticalAlignment="Center" DockPanel.Dock="Right" ToolTip="Allow incoming diagnostics data">
- <ToggleButton IsChecked="{Binding EnableDiagnostics}" VerticalAlignment="Center"></ToggleButton>
- <TextBlock VerticalAlignment="Center" FontSize="10">Diagnostics/Debugging</TextBlock>
- </StackPanel>
<StackPanel Orientation="Horizontal">
<Image Source="/Images/external-bridge-tcp.png" Width="38" Height="38" RenderOptions.BitmapScalingMode="Fant"></Image>
<StackPanel Margin="10 0 0 0">
@@ -79,10 +75,6 @@
</DataTemplate>
<DataTemplate DataType="{x:Type integration:ExternalBridgeUsbClient}">
<DockPanel>
- <StackPanel Orientation="Vertical" VerticalAlignment="Center" DockPanel.Dock="Right" ToolTip="Allow incoming diagnostics data">
- <ToggleButton IsChecked="{Binding EnableDiagnostics}" VerticalAlignment="Center"></ToggleButton>
- <TextBlock VerticalAlignment="Center" FontSize="10">Diagnostics</TextBlock>
- </StackPanel>
<StackPanel Orientation="Horizontal">
<Image Source="/Images/external-bridge-usb.png" Width="38" Height="38" RenderOptions.BitmapScalingMode="Fant"></Image>
<StackPanel Margin="10 0 0 0">
@@ -98,10 +90,6 @@
</DataTemplate>
<DataTemplate DataType="{x:Type emulations:EmulatorExternalBridge}">
<DockPanel>
- <StackPanel Orientation="Vertical" VerticalAlignment="Center" DockPanel.Dock="Right" ToolTip="Allow incoming diagnostics data">
- <ToggleButton IsChecked="{Binding EnableDiagnostics}" VerticalAlignment="Center"></ToggleButton>
- <TextBlock VerticalAlignment="Center" FontSize="10">Diagnostics</TextBlock>
- </StackPanel>
<StackPanel Orientation="Horizontal">
<Image Source="/Images/external-bridge-emulator.png" Width="38" Height="38" RenderOptions.BitmapScalingMode="Fant"></Image>
<StackPanel Margin="10 0 0 0">
@@ -123,6 +111,24 @@
</Grid>
<Grid Grid.Row="1">
+
+ <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
+ <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
+ <ToggleButton IsChecked="{Binding EnableDiagnostics}" VerticalAlignment="Center" ToolTip="Allow incoming diagnostics data, debug logs and hardware events"></ToggleButton>
+ <TextBlock VerticalAlignment="Center" FontSize="10" Margin="5 0 0 0">Diagnostics, Debug &amp; Events</TextBlock>
+ </StackPanel>
+
+ <StackPanel Margin="20 0 0 0" Orientation="Horizontal" VerticalAlignment="Center">
+ <ToggleButton IsChecked="{Binding UploadHardwareConfiguration}" VerticalAlignment="Center" ToolTip="Upload hardware configuration after connection is successful"></ToggleButton>
+ <TextBlock VerticalAlignment="Center" FontSize="10" Margin="5 0 0 0">Upload HW Configuration</TextBlock>
+ </StackPanel>
+
+ <StackPanel Margin="20 0 0 0" Orientation="Horizontal" VerticalAlignment="Center">
+ <ToggleButton IsChecked="{Binding EnableKeepAlive}" VerticalAlignment="Center" ToolTip="Upload hardware configuration after connection is successful"></ToggleButton>
+ <TextBlock VerticalAlignment="Center" FontSize="10" Margin="5 0 0 0">Keep Alive</TextBlock>
+ </StackPanel>
+ </StackPanel>
+
<Button HorizontalAlignment="Right" Width="140" Command="{Binding ConnectCommand}">CONNECT</Button>
</Grid>
</Grid>