aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs6
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs44
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml54
4 files changed, 84 insertions, 22 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml
index 963b9eb8b..f07e7f476 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="720" Width="1280" WindowStartupLocation="CenterOwner" WindowState="Maximized">
+ Title="Tango" Height="720" Width="1280" WindowStartupLocation="CenterOwner" WindowState="Maximized" Foreground="#494949">
<Grid>
<sharedControls:MultiTransitionControl AlwaysFade="True" TransitionType="Zoom" x:Name="TransitionControl" x:FieldModifier="public">
<sharedControls:MultiTransitionControl.Controls>
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 336681801..de8649c13 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs
@@ -38,6 +38,7 @@ namespace Tango.MachineStudio.UI.StudioApplication
_connectedMachine = value;
RaisePropertyChangedAuto();
RaisePropertyChanged(nameof(IsMachineConnected));
+ RaisePropertyChanged(nameof(IsMachineConnectedViaTCP));
if (_connectedMachine != null)
{
@@ -47,6 +48,11 @@ namespace Tango.MachineStudio.UI.StudioApplication
}
}
+ public bool IsMachineConnectedViaTCP
+ {
+ get { return IsMachineConnected && ConnectedMachine.Type != ExternalBridgeClientType.USB; }
+ }
+
private void ConnectedMachine_StateChanged(object sender, Transport.TransportComponentState e)
{
if (e == Transport.TransportComponentState.Disconnected || e == Transport.TransportComponentState.Failed)
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 061420037..f2beb7113 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
@@ -139,26 +139,48 @@ namespace Tango.MachineStudio.UI.ViewModels
private void ConnectToMachine()
{
- _notificationProvider.ShowModalDialog<MachineConnectionViewVM>((x) =>
+ _notificationProvider.ShowModalDialog<MachineConnectionViewVM>(async (x) =>
{
if (x.SelectedMachine != null)
{
- _notificationProvider.ShowModalDialog<MachineLoginViewVM>(async (login) =>
+ if (x.SelectedMachine.Type != Integration.Services.ExternalBridgeClientType.USB)
{
- using (NotificationProvider.PushTaskItem("Connecting to machine " + x.SelectedMachine.SerialNumber + "..."))
+ _notificationProvider.ShowModalDialog<MachineLoginViewVM>(async (login) =>
{
- try
+ using (NotificationProvider.PushTaskItem("Connecting to machine " + x.SelectedMachine.SerialNumber + "..."))
{
- await x.SelectedMachine.Connect();
- var authenticated = await x.SelectedMachine.Authenticate(login.Password);
- if (!authenticated)
+ try
{
- _notificationProvider.ShowError("It seems like you are not authorized to access the selected machine.");
+ await x.SelectedMachine.Connect();
+
+ var authenticated = await x.SelectedMachine.Authenticate(login.Password);
+ if (!authenticated)
+ {
+ _notificationProvider.ShowError("It seems like you are not authorized to access the selected machine.");
+ }
+ else
+ {
+ ApplicationManager.ConnectedMachine = x.SelectedMachine;
+ }
}
- else
+ catch (Exception ex)
{
- ApplicationManager.ConnectedMachine = x.SelectedMachine;
+ LogManager.Log(ex);
+ _notificationProvider.ShowError(ex.Message);
}
+
+ InvalidateRelayCommands();
+ }
+ });
+ }
+ else
+ {
+ using (NotificationProvider.PushTaskItem("Connecting to machine " + x.SelectedMachine.Device + "..."))
+ {
+ try
+ {
+ await x.SelectedMachine.Connect();
+ ApplicationManager.ConnectedMachine = x.SelectedMachine;
}
catch (Exception ex)
{
@@ -168,7 +190,7 @@ namespace Tango.MachineStudio.UI.ViewModels
InvalidateRelayCommands();
}
- });
+ }
InvalidateRelayCommands();
}
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 32108c652..8f03202a1 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml
@@ -54,20 +54,54 @@
<ListBox ItemsSource="{Binding Scanner.AvailableMachines}" SelectedItem="{Binding SelectedMachine}" Margin="0 0 0 7" BorderThickness="1" BorderBrush="Gainsboro">
<ListBox.ItemTemplate>
<DataTemplate>
- <StackPanel Orientation="Horizontal">
- <Image Source="/Images/machine-trans.png" Width="38" Height="38" RenderOptions.BitmapScalingMode="Fant"></Image>
- <StackPanel Margin="10 0 0 0">
- <TextBlock FontSize="11">
+ <Grid>
+ <StackPanel Orientation="Horizontal">
+ <StackPanel.Style>
+ <Style TargetType="StackPanel">
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Type}" Value="USB">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </StackPanel.Style>
+ <Image Source="/Images/machine-trans.png" Width="38" Height="38" RenderOptions.BitmapScalingMode="Fant"></Image>
+ <StackPanel Margin="10 0 0 0">
+ <TextBlock FontSize="11">
<Run FontWeight="Bold">S/N:</Run> <Run Text="{Binding SerialNumber,Mode=OneWay}"></Run>
- </TextBlock>
- <TextBlock FontSize="11">
+ </TextBlock>
+ <TextBlock FontSize="11">
<Run FontWeight="Bold">IP Address:</Run> <Run Text="{Binding IPAddress,Mode=OneWay}"></Run>
- </TextBlock>
- <TextBlock FontSize="11">
+ </TextBlock>
+ <TextBlock FontSize="11">
<Run FontWeight="Bold">Organization:</Run> <Run Text="{Binding Organization,Mode=OneWay}"></Run>
- </TextBlock>
+ </TextBlock>
+ </StackPanel>
</StackPanel>
- </StackPanel>
+
+ <StackPanel Orientation="Horizontal">
+ <StackPanel.Style>
+ <Style TargetType="StackPanel">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Type}" Value="USB">
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </StackPanel.Style>
+ <Image Source="/Images/machine-trans.png" Width="38" Height="38" RenderOptions.BitmapScalingMode="Fant"></Image>
+ <StackPanel Margin="10 0 0 0">
+ <TextBlock FontSize="11">
+ <Run FontWeight="Bold">Port:</Run> <Run Text="{Binding ComPort,Mode=OneWay}"></Run>
+ </TextBlock>
+ <TextBlock FontSize="11">
+ <Run FontWeight="Bold">Device:</Run> <Run Text="{Binding Device,Mode=OneWay}"></Run>
+ </TextBlock>
+ </StackPanel>
+ </StackPanel>
+ </Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>