aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/Views/MonitoringView.xaml
blob: 0af56909673a654c8ee6c50fc7ae1b0ed95711c7 (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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<UserControl x:Class="Tango.FSE.PPCConsole.Views.MonitoringView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:graphs="clr-namespace:Tango.FSE.Common.Graphs;assembly=Tango.FSE.Common"
             xmlns:global="clr-namespace:Tango.FSE.PPCConsole"
             xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
             xmlns:vm="clr-namespace:Tango.FSE.PPCConsole.ViewModels"
             xmlns:controls="clr-namespace:Tango.FSE.Common.Controls;assembly=Tango.FSE.Common"
             xmlns:local="clr-namespace:Tango.FSE.PPCConsole.Views"
             mc:Ignorable="d" 
             d:DesignHeight="720" d:DesignWidth="1280" d:DataContext="{d:DesignInstance Type=vm:MonitoringViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MonitoringViewVM}">

    <UserControl.Resources>

        <Style x:Key="DynamicResolutionGraph" TargetType="graphs:RealTimeGraph" BasedOn="{StaticResource {x:Type graphs:RealTimeGraph}}">
            <Setter Property="VerticalTicks" Value="11"></Setter>
            <Style.Triggers>
                <DataTrigger Binding="{Binding ResolutionService.IsLowResolution}" Value="True">
                    <Setter Property="VerticalTicks" Value="5"></Setter>
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="ItemsPanel_Legends" TargetType="ItemsControl">
            <Setter Property="Margin" Value="40"></Setter>
            <Setter Property="HorizontalAlignment" Value="Right"></Setter>
            <Setter Property="VerticalAlignment" Value="Top"></Setter>
            <Setter Property="ItemsPanel">
                <Setter.Value>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal"></StackPanel>
                    </ItemsPanelTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="ItemTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal" Margin="0 0 20 0">
                            <Ellipse Width="10" Height="10" Fill="{Binding Fill}" />
                            <TextBlock Opacity="0.5" FontWeight="SemiBold" Margin="5 0 0 0" FontSize="{StaticResource FSE_SmallFontSize}" Text="{Binding Name}"></TextBlock>
                        </StackPanel>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>

    <Grid IsEnabled="{Binding IsFree}">
        <Grid Margin="20 20 20 0" IsEnabled="{Binding MachineProvider.IsPPCAvailable}">
            <Grid.RowDefinitions>
                <RowDefinition Height="1*"/>
                <RowDefinition Height="1*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="1*"/>
                <ColumnDefinition Width="1*"/>
            </Grid.ColumnDefinitions>

            <Grid Margin="0 0 20 0">
                <graphs:RealTimeGraph Style="{StaticResource DynamicResolutionGraph}" Controller="{Binding CPUController}" StringFormat="0\%"/>

                <ItemsControl Style="{StaticResource ItemsPanel_Legends}" ItemsSource="{Binding CPUController.DataSeriesCollection}"/>

                <Viewbox IsHitTestVisible="False" Margin="90 50 90 90" Stretch="Uniform">
                    <Grid Width="200" Height="200">
                        <Ellipse Stroke="#38FFFFFF" StrokeThickness="20" />

                        <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
                            <TextBlock Opacity="0.8" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="SemiBold" FontSize="25" Text="{Binding CPUController.DataSeriesCollection[0].CurrentValue,StringFormat='\{0\}%'}"></TextBlock>
                            <Rectangle Width="120" Margin="0 5" VerticalAlignment="Center" Stroke="{StaticResource FSE_PrimaryForegroundBrush}" StrokeThickness="1" />
                            <TextBlock Opacity="0.8" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="SemiBold" FontSize="25" Text="{Binding CPUController.DataSeriesCollection[1].CurrentValue,StringFormat='\{0\}%'}"></TextBlock>
                        </StackPanel>
                    </Grid>
                </Viewbox>

                <TextBlock Foreground="{StaticResource FSE_PrimaryAccentBrush}" Margin="100 30" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="{StaticResource FSE_LargeFontSize}" FontWeight="SemiBold">CPU</TextBlock>
            </Grid>

            <Grid Margin="20 0 0 0" Grid.Column="1">
                <graphs:RealTimeGraph Style="{StaticResource DynamicResolutionGraph}" Controller="{Binding RAMController}" StringFormat="0 \MB" />

                <ItemsControl Style="{StaticResource ItemsPanel_Legends}" ItemsSource="{Binding RAMController.DataSeriesCollection}"/>

                <Viewbox IsHitTestVisible="False" Margin="90 50 90 90" Stretch="Uniform">
                    <Grid Width="200" Height="200">
                        <Ellipse Stroke="#38FFFFFF" StrokeThickness="20" />

                        <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
                            <TextBlock Opacity="0.8" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="SemiBold" FontSize="25" Text="{Binding RAMController.DataSeriesCollection[0].CurrentValue,StringFormat='\{0\} MB'}"></TextBlock>
                            <Rectangle Width="120" Margin="0 5" VerticalAlignment="Center" Stroke="{StaticResource FSE_PrimaryForegroundBrush}" StrokeThickness="1" />
                            <TextBlock Opacity="0.8" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="SemiBold" FontSize="25" Text="{Binding RAMController.DataSeriesCollection[1].CurrentValue,StringFormat='\{0\} MB'}"></TextBlock>
                        </StackPanel>
                    </Grid>
                </Viewbox>

                <TextBlock Foreground="{StaticResource FSE_PrimaryAccentBrush}" Margin="100 30" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="{StaticResource FSE_LargeFontSize}" FontWeight="SemiBold">RAM</TextBlock>
            </Grid>

            <Grid Grid.Row="1" Grid.ColumnSpan="2" Margin="0 40 0 0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="2.5*"/>
                    <ColumnDefinition Width="8*"/>
                </Grid.ColumnDefinitions>

                <Grid>
                    <DockPanel>

                        <TextBlock DockPanel.Dock="Top" Foreground="{StaticResource FSE_GrayBrush}" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="{StaticResource FSE_LargeFontSize}" FontWeight="SemiBold">AVAILABLE DISK SPACE</TextBlock>

                        <Button ToolTip="Perform automatic disk space optimization" Command="{Binding PerformDiskSpaceOptimizationCommand}" IsEnabled="{Binding MachineProvider.IsConnected}" DockPanel.Dock="Right" FontSize="{StaticResource FSE_SmallFontSize}" Background="Transparent" VerticalAlignment="Top" Margin="0 12 10 0" Style="{StaticResource FSE_Button_Orange}">
                            <StackPanel Orientation="Horizontal">
                                <material:PackIcon Kind="Recycle" Margin="0 -2 0 0" />
                                <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Visibility="{Binding ResolutionService.IsHighResolution,Converter={StaticResource BooleanToVisibilityConverter}}">FREE SPACE</TextBlock>
                            </StackPanel>
                        </Button>

                        <lvc:PieChart Opacity="0.7" Margin="-20 0 0 0"  DisableAnimations="True" LegendLocation="Bottom" Hoverable="False" DataTooltip="{x:Null}" HorizontalAlignment="Left" Width="250">
                            <lvc:PieChart.Series>
                                <lvc:PieSeries Foreground="{StaticResource FSE_PrimaryForegroundBrush}" Stroke="{StaticResource FSE_PrimaryBackgroundBrush}" Fill="#F47FD121" FontSize="16" Title="Free" Values="{Binding AvailableDiskSpace,Converter={StaticResource DoubleToChartValuesConverter}}" DataLabels="True" 
                               LabelPoint="{Binding DiskSpacePointLabel}"/>
                                <lvc:PieSeries Foreground="{StaticResource FSE_PrimaryForegroundBrush}" Stroke="{StaticResource FSE_PrimaryBackgroundBrush}" Fill="#FF4F4F" FontSize="16" Title="Used" Values="{Binding UsedDiskSpace,Converter={StaticResource DoubleToChartValuesConverter}}" DataLabels="True"
                               LabelPoint="{Binding DiskSpacePointLabel}"/>
                            </lvc:PieChart.Series>
                        </lvc:PieChart>
                    </DockPanel>
                </Grid>

                <Grid Grid.Column="1">
                    <DockPanel>
                        <TextBlock DockPanel.Dock="Top" Foreground="{StaticResource FSE_GrayBrush}" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="{StaticResource FSE_LargeFontSize}" FontWeight="SemiBold">SYSTEM INFORMATION</TextBlock>

                        <controls:FSEPanel Margin="0 10 0 0" Padding="20" >
                            <Grid>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="270"/>
                                        <ColumnDefinition Width="1*"/>
                                    </Grid.ColumnDefinitions>

                                    <ListBox ItemsSource="{Binding SystemInfo.System}" SelectedItem="{Binding SelectedSystemObjectCollection}">
                                        <ListBox.ItemsPanel>
                                            <ItemsPanelTemplate>
                                                <WrapPanel/>
                                            </ItemsPanelTemplate>
                                        </ListBox.ItemsPanel>
                                        <ListBox.ItemTemplate>
                                            <DataTemplate>
                                                <TextBlock Width="115" Text="{Binding Name}"></TextBlock>
                                            </DataTemplate>
                                        </ListBox.ItemTemplate>
                                    </ListBox>

                                    <ScrollViewer Margin="40 0 0 0" Grid.Column="1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
                                        <ItemsControl ItemsSource="{Binding SelectedSystemObjectCollection.Objects}">
                                            <ItemsControl.ItemsPanel>
                                                <ItemsPanelTemplate>
                                                    <WrapPanel Orientation="Horizontal" IsItemsHost="True"></WrapPanel>
                                                </ItemsPanelTemplate>
                                            </ItemsControl.ItemsPanel>
                                            <ItemsControl.ItemTemplate>
                                                <DataTemplate>
                                                    <DockPanel Margin="10 0 10 10" Width="400">
                                                        <TextBlock TextTrimming="CharacterEllipsis" DockPanel.Dock="Top" Text="{Binding Name}" Foreground="{StaticResource FSE_GrayBrush}"></TextBlock>
                                                        <Border TextElement.FontSize="{StaticResource FSE_SmallFontSize}" Margin="0 5 0 0" Padding="3" BorderThickness="0" BorderBrush="{StaticResource FSE_BorderBrush}" CornerRadius="5">
                                                            <ItemsControl Opacity="0.7" ItemsSource="{Binding Properties}">
                                                                <ItemsControl.ItemsPanel>
                                                                    <ItemsPanelTemplate>
                                                                        <WrapPanel Orientation="Vertical" />
                                                                    </ItemsPanelTemplate>
                                                                </ItemsControl.ItemsPanel>
                                                                <ItemsControl.ItemTemplate>
                                                                    <DataTemplate>
                                                                        <DockPanel>
                                                                            <DockPanel.ToolTip>
                                                                                <TextBlock>
                                                                                    <Run FontWeight="SemiBold" Text="{Binding Name}"></Run><Run>:</Run>
                                                                                    <Run Text="{Binding Value}"></Run>
                                                                                </TextBlock>
                                                                            </DockPanel.ToolTip>
                                                                            <TextBlock TextTrimming="CharacterEllipsis" Width="170" FontWeight="SemiBold" HorizontalAlignment="Left">
                                                                                <Run Text="{Binding Name}"></Run><Run>:</Run>
                                                                            </TextBlock>
                                                                            <TextBlock TextTrimming="CharacterEllipsis" Margin="20 0 0 0" HorizontalAlignment="Left" Text="{Binding Value}"></TextBlock>
                                                                        </DockPanel>
                                                                    </DataTemplate>
                                                                </ItemsControl.ItemTemplate>
                                                            </ItemsControl>
                                                        </Border>
                                                    </DockPanel>
                                                </DataTemplate>
                                            </ItemsControl.ItemTemplate>
                                        </ItemsControl>
                                    </ScrollViewer>
                                </Grid>

                                <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="{Binding FetchingSystemInfo,Converter={StaticResource BooleanToVisibilityConverter}}">
                                    <ProgressBar HorizontalAlignment="Center" Style="{StaticResource FSE_CircularProgressBar}" IsIndeterminate="{Binding FetchingSystemInfo}" Width="80" Height="80" />
                                    <TextBlock HorizontalAlignment="Center" Margin="0 10 0 0" Text="Fetching System Information..."></TextBlock>
                                </StackPanel>
                            </Grid>
                        </controls:FSEPanel>
                    </DockPanel>
                </Grid>
            </Grid>
        </Grid>
    </Grid>
</UserControl>