aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules
diff options
context:
space:
mode:
authorAvi Levkovich <avi@twine-s.com>2020-08-25 10:08:01 +0300
committerAvi Levkovich <avi@twine-s.com>2020-08-25 10:08:01 +0300
commit338edba081dba2a2aefb634811be1cc84ec93d64 (patch)
tree0021538796c254a8eab8527e8461a2e831e68c1c /Software/Visual_Studio/PPC/Modules
parent49ddda1cc22d6cbb72f499b37e5db32c95252dfa (diff)
downloadTango-338edba081dba2a2aefb634811be1cc84ec93d64.tar.gz
Tango-338edba081dba2a2aefb634811be1cc84ec93d64.zip
merge
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/remote_connections.pngbin0 -> 4186 bytes
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Tango.PPC.Technician.csproj11
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModelLocator.cs12
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/LoggingViewVM.cs8
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/RemoteConnectionsViewVM.cs64
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/CatalogView.xaml12
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/MainView.xaml1
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/RemoteConnectionsView.xaml88
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/RemoteConnectionsView.xaml.cs28
9 files changed, 224 insertions, 0 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/remote_connections.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/remote_connections.png
new file mode 100644
index 000000000..d9d4a1d45
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/remote_connections.png
Binary files differ
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Tango.PPC.Technician.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Tango.PPC.Technician.csproj
index e8eec7b2f..7f36b7b17 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Tango.PPC.Technician.csproj
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Tango.PPC.Technician.csproj
@@ -106,11 +106,15 @@
<Compile Include="ViewModels\LoggingViewVM.cs" />
<Compile Include="ViewModels\MainViewVM.cs" />
<Compile Include="ViewModels\PackagesViewVM.cs" />
+ <Compile Include="ViewModels\RemoteConnectionsViewVM.cs" />
<Compile Include="ViewModels\UpdatesViewVM.cs" />
<Compile Include="ViewModels\SystemViewVM.cs" />
<Compile Include="Views\CatalogView.xaml.cs">
<DependentUpon>CatalogView.xaml</DependentUpon>
</Compile>
+ <Compile Include="Views\RemoteConnectionsView.xaml.cs">
+ <DependentUpon>RemoteConnectionsView.xaml</DependentUpon>
+ </Compile>
<Compile Include="Views\UpdatesView.xaml.cs">
<DependentUpon>UpdatesView.xaml</DependentUpon>
</Compile>
@@ -219,6 +223,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Views\RemoteConnectionsView.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Views\UpdatesView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -272,5 +280,8 @@
<ItemGroup>
<Resource Include="Images\browser.png" />
</ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\remote_connections.png" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModelLocator.cs
index d50df6a01..9a8b63c91 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModelLocator.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModelLocator.cs
@@ -22,6 +22,7 @@ namespace Tango.PPC.Technician
TangoIOC.Default.Register<SystemViewVM>();
TangoIOC.Default.Register<PackagesViewVM>();
TangoIOC.Default.Register<UpdatesViewVM>();
+ TangoIOC.Default.Register<RemoteConnectionsViewVM>();
}
/// <summary>
@@ -100,5 +101,16 @@ namespace Tango.PPC.Technician
return TangoIOC.Default.GetInstance<UpdatesViewVM>();
}
}
+
+ /// <summary>
+ /// Gets the remote connections view vm.
+ /// </summary>
+ public static RemoteConnectionsViewVM RemoteConnectionsViewVM
+ {
+ get
+ {
+ return TangoIOC.Default.GetInstance<RemoteConnectionsViewVM>();
+ }
+ }
}
}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/LoggingViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/LoggingViewVM.cs
index a0110b18a..2aee7f561 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/LoggingViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/LoggingViewVM.cs
@@ -12,6 +12,7 @@ using Tango.Integration.Logging;
using Tango.Integration.Operation;
using Tango.Logging;
using Tango.PPC.Common;
+using Tango.PPC.Common.Helpers;
using Tango.PPC.Technician.Dialogs;
namespace Tango.PPC.Technician.ViewModels
@@ -86,6 +87,13 @@ namespace Tango.PPC.Technician.ViewModels
paused_logs = new List<LogItemBase>();
paused_embedded_logs = new List<LogItemBase>();
+ var appStartLogs = LogsHelper.GetLogSafe().EmptyAndDispose();
+
+ foreach (var log in appStartLogs)
+ {
+ ApplicationLogs.Insert(0, log);
+ }
+
LogManager.NewLog += LogManager_NewLog;
MachineOperator.EmbeddedLogManager.NewLog += EmbeddedLogManager_NewLog;
ClearCommand = new RelayCommand(ClearLogs);
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/RemoteConnectionsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/RemoteConnectionsViewVM.cs
new file mode 100644
index 000000000..2d8857329
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/RemoteConnectionsViewVM.cs
@@ -0,0 +1,64 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core.Commands;
+using Tango.Integration.ExternalBridge;
+using Tango.PPC.Common;
+
+namespace Tango.PPC.Technician.ViewModels
+{
+ public class RemoteConnectionsViewVM : PPCViewModel
+ {
+ public RelayCommand DisconnectCommand { get; set; }
+
+ private ExternalBridgeReceiver _selectedReceiver;
+ public ExternalBridgeReceiver SelectedReceiver
+ {
+ get { return _selectedReceiver; }
+ set
+ {
+ if (value != null)
+ {
+ _selectedReceiver = value;
+ InvalidateRelayCommands();
+ }
+ }
+ }
+
+ public RemoteConnectionsViewVM()
+ {
+ DisconnectCommand = new RelayCommand(DisconnectReceiver, () => SelectedReceiver != null);
+ }
+
+ private async void DisconnectReceiver()
+ {
+ if (SelectedReceiver != null)
+ {
+ try
+ {
+ await Task.Factory.StartNew(() =>
+ {
+ SelectedReceiver.Disconnect().Wait();
+ });
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error disconnecting the specified receiver.");
+ }
+ finally
+ {
+ _selectedReceiver = null;
+ RaisePropertyChanged(nameof(SelectedReceiver));
+ InvalidateRelayCommands();
+ }
+ }
+ }
+
+ public override void OnApplicationStarted()
+ {
+
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/CatalogView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/CatalogView.xaml
index 8f4bc9f0b..f954e461f 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/CatalogView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/CatalogView.xaml
@@ -105,6 +105,18 @@
</StackPanel>
</touch:TouchButton>
+ <touch:TouchButton Command="{Binding NavigationCommand}" CommandParameter="RemoteConnectionsView" Style="{StaticResource ButtonMenu}">
+ <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
+ <Image Source="../Images/remote_connections.png" Width="80" Height="80" />
+ <StackPanel Margin="10 0 0 0">
+ <TextBlock FontSize="{StaticResource TangoButtonFontSize}">Remote Connections</TextBlock>
+ <TextBlock Foreground="{StaticResource TangoGrayTextBrush}" TextWrapping="Wrap" Width="580">
+ View the current status of remote connections to this machine.
+ </TextBlock>
+ </StackPanel>
+ </StackPanel>
+ </touch:TouchButton>
+
<touch:TouchButton Command="{Binding BrowserCommand}" Style="{StaticResource ButtonMenu}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<Image Source="../Images/browser.png" RenderOptions.BitmapScalingMode="Fant" Width="80" Height="80" />
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/MainView.xaml
index d669de187..d4235341c 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/MainView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/MainView.xaml
@@ -19,6 +19,7 @@
<local:SystemView/>
<local:PackagesView/>
<local:UpdatesView/>
+ <local:RemoteConnectionsView/>
</controls:NavigationControl>
</Grid>
</UserControl>
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/RemoteConnectionsView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/RemoteConnectionsView.xaml
new file mode 100644
index 000000000..af93a56e5
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/RemoteConnectionsView.xaml
@@ -0,0 +1,88 @@
+<UserControl x:Class="Tango.PPC.Technician.Views.RemoteConnectionsView"
+ 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:vm="clr-namespace:Tango.PPC.Technician.ViewModels"
+ xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch"
+ xmlns:global="clr-namespace:Tango.PPC.Technician"
+ xmlns:local="clr-namespace:Tango.PPC.Technician.Views"
+ mc:Ignorable="d"
+ d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:RemoteConnectionsViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.RemoteConnectionsViewVM}">
+ <Grid Background="{StaticResource TangoMidBackgroundBrush}">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto"/>
+ <RowDefinition Height="1*"/>
+ </Grid.RowDefinitions>
+
+ <Border Padding="20" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoDividerBrush}">
+ <Border.Effect>
+ <DropShadowEffect Color="Silver" ShadowDepth="0" BlurRadius="20" Opacity="1" />
+ </Border.Effect>
+ <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold">Remote Connections</TextBlock>
+ </Border>
+
+ <Grid Grid.Row="1">
+ <Grid Margin="20">
+ <DockPanel>
+ <touch:TouchButton Command="{Binding DisconnectCommand}" DockPanel.Dock="Bottom" HorizontalAlignment="Right" Style="{StaticResource TangoHollowButton}" Height="60" Width="250" Margin="0 20 0 0">DISCONNECT</touch:TouchButton>
+ <touch:TouchSimpleDataGrid IsSynchronizedWithCurrentItem="True" SelectedItem="{Binding SelectedReceiver,Mode=TwoWay}" Background="{StaticResource TangoPrimaryBackgroundBrush}" AutoGenerateColumns="False" SelectionMode="Single" SelectionUnit="FullRow" BorderThickness="1" BorderBrush="{StaticResource TangoDarkForegroundBrush}" HeadersVisibility="Column" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False" CanUserSortColumns="False" IsReadOnly="True" ItemsSource="{Binding ExternalBridgeService.ActiveReceivers}" VerticalGridLinesBrush="{x:Null}" HorizontalGridLinesBrush="{StaticResource TangoGrayBrush}" RowHeight="50" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled">
+ <DataGrid.Resources>
+ <Style BasedOn="{StaticResource {x:Type DataGridColumnHeader}}" TargetType="{x:Type DataGridColumnHeader}">
+ <Setter Property="Background" Value="{StaticResource TangoDarkForegroundBrush}" />
+ <Setter Property="Foreground" Value="{StaticResource TangoLightForegroundBrush}" />
+ <Setter Property="Padding" Value="5"></Setter>
+ </Style>
+ </DataGrid.Resources>
+ <DataGrid.RowStyle>
+ <Style TargetType="DataGridRow" BasedOn="{StaticResource {x:Type DataGridRow}}">
+ <Style.Triggers>
+ <Trigger Property="IsSelected" Value="True">
+ <Setter Property="Background" Value="Transparent"></Setter>
+ <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}" />
+ </Trigger>
+ <Trigger Property="IsFocused" Value="True">
+ <Setter Property="Background" Value="Transparent"></Setter>
+ <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}" />
+ </Trigger>
+ </Style.Triggers>
+ </Style>
+ </DataGrid.RowStyle>
+ <DataGrid.CellStyle>
+ <Style TargetType="{x:Type DataGridCell}">
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type DataGridCell}">
+ <Grid Background="{TemplateBinding Background}">
+ <ContentPresenter VerticalAlignment="Center" />
+ </Grid>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ <Style.Triggers>
+ <Trigger Property="IsSelected" Value="True">
+ <Setter Property="Background" Value="Transparent"></Setter>
+ <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}" />
+ </Trigger>
+ </Style.Triggers>
+ </Style>
+ </DataGrid.CellStyle>
+ <DataGrid.Columns>
+ <DataGridTemplateColumn Header="" Width="50">
+ <DataGridTemplateColumn.CellTemplate>
+ <DataTemplate>
+ <touch:TouchIcon Width="16" Icon="Bridge" />
+ </DataTemplate>
+ </DataGridTemplateColumn.CellTemplate>
+ </DataGridTemplateColumn>
+ <DataGridTextColumn Header="App ID" Width="130" Binding="{Binding LoginInfo.AppID}" />
+ <DataGridTextColumn Header="User" Width="180" Binding="{Binding LoginInfo.UserName}" />
+ <DataGridTextColumn Header="Host Name" Width="180" Binding="{Binding LoginInfo.HostName}" />
+ <DataGridTextColumn Header="Safety Level Permissions" Width="1*" Binding="{Binding LoginInfo.RequireSafetyLevelOperations,Converter={StaticResource BooleanToYesNoConverter}}" />
+ </DataGrid.Columns>
+ </touch:TouchSimpleDataGrid>
+ </DockPanel>
+ </Grid>
+ </Grid>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/RemoteConnectionsView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/RemoteConnectionsView.xaml.cs
new file mode 100644
index 000000000..5d8e32444
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/RemoteConnectionsView.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.Technician.Views
+{
+ /// <summary>
+ /// Interaction logic for RemoteConnectionsView.xaml
+ /// </summary>
+ public partial class RemoteConnectionsView : UserControl
+ {
+ public RemoteConnectionsView()
+ {
+ InitializeComponent();
+ }
+ }
+}