aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml
blob: 319fa3596a5fd46b63997c38d85b676667b53c6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<UserControl x:Class="Tango.MachineStudio.UI.Views.ConnectedMachineView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             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.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"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views"
             mc:Ignorable="d" 
              d:DesignHeight="300" d:DesignWidth="300" Width="600" Height="440" Background="White" DataContext="{Binding ConnectedMachineViewVM, Source={StaticResource Locator}}">

    <UserControl.Resources>
        <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"></converters:BooleanToVisibilityConverter>
        <converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter"></converters:BooleanToVisibilityInverseConverter>
        <converters:BooleanInverseConverter x:Key="BooleanInverseConverter"></converters:BooleanInverseConverter>
        <converters:ByteArrayToFileSizeConverter x:Key="ByteArrayToFileSizeConverter" />
    </UserControl.Resources>

    <Grid>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="80"/>
                <RowDefinition Height="1*"/>
            </Grid.RowDefinitions>

            <Grid>
                <StackPanel Orientation="Horizontal" Margin="10">
                    <ContentControl Content="{Binding ApplicationManager.ConnectedMachine}">
                        <ContentControl.Resources>
                            <DataTemplate DataType="{x:Type integration:ExternalBridgeTcpClient}">
                                <Image Source="/Images/external-bridge-tcp.png" Width="48" Height="48" RenderOptions.BitmapScalingMode="Fant"></Image>
                            </DataTemplate>

                            <DataTemplate DataType="{x:Type integration:ExternalBridgeUsbClient}">
                                <Image Source="/Images/external-bridge-usb.png" Width="48" Height="48" RenderOptions.BitmapScalingMode="Fant"></Image>
                            </DataTemplate>
                        </ContentControl.Resources>
                    </ContentControl>

                    <TextBlock Text="Machine Connection" VerticalAlignment="Center" Margin="10 0 0 0" FontSize="20"></TextBlock>
                </StackPanel>
            </Grid>

            <Grid Grid.Row="1" Margin="10 0 10 10">

                <Grid.RowDefinitions>
                    <RowDefinition Height="1*"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                </Grid.RowDefinitions>

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="1*"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <Grid d:DataContext="{d:DesignInstance Type=integ:MachineOperator, IsDesignTimeCreatable=False}">
                    <ContentControl Content="{Binding ApplicationManager.ConnectedMachine}">
                        <ContentControl.Resources>
                            <DataTemplate DataType="{x:Type integration:ExternalBridgeTcpClient}">
                                <controls:TableGrid RowHeight="22">
                                    <TextBlock FontWeight="SemiBold" Text="Serial Number:" />
                                    <TextBlock Text="{Binding SerialNumber}" />
                                    <TextBlock FontWeight="SemiBold" Text="Name:" />
                                    <TextBlock Text="{Binding Machine.Name}" />
                                    <TextBlock FontWeight="SemiBold" Text="Organization:" />
                                    <TextBlock Text="{Binding Machine.Organization.Name}" />
                                    <TextBlock FontWeight="SemiBold" Text="Embedded Software Version:" />
                                    <TextBlock Text="{Binding DeviceInformation.Version}" />
                                    <TextBlock FontWeight="SemiBold" Text="IP Address:" />
                                    <TextBlock Text="{Binding IPAddress}" />
                                    <TextBlock FontWeight="SemiBold" Text="Total Bytes Sent:" />
                                    <TextBlock Text="{Binding Adapter.TotalBytesSent,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}" />
                                    <TextBlock FontWeight="SemiBold" Text="Total Bytes Received:" />
                                    <TextBlock Text="{Binding Adapter.TotalBytesReceived,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}" />
                                    <TextBlock FontWeight="SemiBold" Text="Transfer Rate:" />
                                    <TextBlock>
                                        <Run Text="{Binding Adapter.TransferRate,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}"></Run>
                                        <Run Text="/ sec"></Run>
                                    </TextBlock>
                                    <TextBlock FontWeight="SemiBold" Text="Diagnostics Frame Rate:" />
                                    <TextBlock>
                                        <Run Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.DiagnosticsFrameProvider.FrameRate,Mode=OneWay,IsAsync=True}"></Run>
                                        <Run Text="/ sec"></Run>
                                    </TextBlock>
                                    <TextBlock FontWeight="SemiBold" Text="Enable Diagnostics:" />
                                    <ToggleButton IsChecked="{Binding EnableDiagnostics}" HorizontalAlignment="Left"></ToggleButton>
                                    <TextBlock FontWeight="SemiBold" Text="Enable Embedded Debug Logs:" />
                                    <ToggleButton IsChecked="{Binding EnableEmbeddedDebugging}" HorizontalAlignment="Left"></ToggleButton>
                                    <TextBlock FontWeight="SemiBold" Text="Enable Events:" />
                                    <ToggleButton IsChecked="{Binding EnableEventsNotification}" HorizontalAlignment="Left"></ToggleButton>
                                </controls:TableGrid>
                            </DataTemplate>

                            <DataTemplate DataType="{x:Type integration:ExternalBridgeUsbClient}">
                                <controls:TableGrid RowHeight="22">
                                    <TextBlock FontWeight="SemiBold" Text="Serial Number:" />
                                    <TextBlock Text="{Binding SerialNumber}" />
                                    <TextBlock FontWeight="SemiBold" Text="Name:" />
                                    <TextBlock Text="{Binding Machine.Name}" />
                                    <TextBlock FontWeight="SemiBold" Text="Organization:" />
                                    <TextBlock Text="{Binding Machine.Organization.Name}" />
                                    <TextBlock FontWeight="SemiBold" Text="Embedded Software Version:" />
                                    <TextBlock Text="{Binding DeviceInformation.Version}" />
                                    <TextBlock FontWeight="SemiBold" Text="COM Port:" />
                                    <TextBlock Text="{Binding ComPort}" />
                                    <TextBlock FontWeight="SemiBold" Text="Device:" />
                                    <TextBlock Text="{Binding Device}" />
                                    <TextBlock FontWeight="SemiBold" Text="Total Bytes Sent:" />
                                    <TextBlock Text="{Binding Adapter.TotalBytesSent,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}" />
                                    <TextBlock FontWeight="SemiBold" Text="Total Bytes Received:" />
                                    <TextBlock Text="{Binding Adapter.TotalBytesReceived,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}" />
                                    <TextBlock FontWeight="SemiBold" Text="Transfer Rate:" />
                                    <TextBlock>
                                        <Run Text="{Binding Adapter.TransferRate,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}"></Run>
                                        <Run Text="/ sec"></Run>
                                    </TextBlock>
                                    <TextBlock FontWeight="SemiBold" Text="Diagnostics Frame Rate:" />
                                    <TextBlock>
                                        <Run Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.DiagnosticsFrameProvider.FrameRate,Mode=OneWay,IsAsync=True}"></Run>
                                        <Run Text="/ sec"></Run>
                                    </TextBlock>
                                    <TextBlock FontWeight="SemiBold" Text="Enable Diagnostics:" />
                                    <ToggleButton IsChecked="{Binding EnableDiagnostics}" HorizontalAlignment="Left"></ToggleButton>
                                    <TextBlock FontWeight="SemiBold" Text="Enable Embedded Debug Logs:" />
                                    <ToggleButton IsChecked="{Binding EnableEmbeddedDebugging}" HorizontalAlignment="Left"></ToggleButton>
                                    <TextBlock FontWeight="SemiBold" Text="Enable Events:" />
                                    <ToggleButton IsChecked="{Binding EnableEventsNotification}" HorizontalAlignment="Left"></ToggleButton>
                                </controls:TableGrid>
                            </DataTemplate>
                        </ContentControl.Resources>
                    </ContentControl>
                </Grid>

                <Grid Grid.Row="1" Grid.ColumnSpan="2">
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Height="40" VerticalAlignment="Bottom">

                    </StackPanel>
                </Grid>

                <Grid Grid.Row="1" Grid.ColumnSpan="2">
                    <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
                        <Button DockPanel.Dock="Bottom" Height="40" Width="170" Command="{Binding UploadHardwareConfigurationCommand}" ToolTip="Upload the current hardware configuration stored for this machine">UPLOAD HW CONFIG</Button>
                        <Button DockPanel.Dock="Bottom" Height="40" Width="140" Command="{Binding DisconnectCommand}" Margin="10 0 0 0">DISCONNECT</Button>
                    </StackPanel>
                </Grid>

                <Grid Grid.Column="1">
                    <DockPanel>
                        <StackPanel>
                            <Button FontSize="11" Height="40" Width="140" Command="{Binding ResetCommand}" Background="Transparent" BorderBrush="#202020" Foreground="#202020" Margin="0 2" ToolTip="Reset the embedded device">RESET</Button>
                            <Button FontSize="11" Height="40" Width="140" Command="{Binding TurnOffHeatersCommand}" Background="Transparent" BorderBrush="#202020" Foreground="#202020" Margin="0 2" ToolTip="Resets the current process parameters in the embedded device">
                                <TextBlock TextWrapping="Wrap" TextAlignment="Center">
                                TURN OFF HEATERS
                                </TextBlock>
                            </Button>
                        </StackPanel>
                    </DockPanel>
                </Grid>
            </Grid>
        </Grid>
    </Grid>
</UserControl>