-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
426 lines (359 loc) · 24.1 KB
/
MainWindow.xaml
File metadata and controls
426 lines (359 loc) · 24.1 KB
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
<ribbon:RibbonWindow x:Class="CSharpCodeAnalyst.MainWindow"
xmlns:ribbon="clr-namespace:System.Windows.Controls.Ribbon;assembly=System.Windows.Controls.Ribbon"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:analyst="clr-namespace:CSharpCodeAnalyst"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:resources="clr-namespace:CSharpCodeAnalyst.Resources"
xmlns:dynamicDataGrid1="clr-namespace:CSharpCodeAnalyst.Shared.DynamicDataGrid"
xmlns:tree="clr-namespace:CSharpCodeAnalyst.Features.Tree"
xmlns:advancedSearch="clr-namespace:CSharpCodeAnalyst.Features.AdvancedSearch"
xmlns:info="clr-namespace:CSharpCodeAnalyst.Features.Info"
xmlns:graph="clr-namespace:CSharpCodeAnalyst.Features.Graph"
x:Name="RootWindow"
Icon="/Resources/lamp.ico"
Closing="RootWindow_Closing"
Title="{Binding Title}" Height="520" Width="1200"
MinWidth="720" MinHeight="400"
d:DataContext="{d:DesignInstance analyst:MainViewModel}"
KeyDown="OnKeyDown">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Styles/ButtonStyles.xaml" />
<ResourceDictionary Source="Styles/DataGridStyles.xaml" />
<ResourceDictionary Source="Styles/ImageStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
</ResourceDictionary>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Ribbon>
<Ribbon.ApplicationMenu>
<RibbonApplicationMenu KeyTip="F">
<RibbonApplicationMenuItem Header="{x:Static resources:Strings.Settings_Header}"
Command="{Binding OpenSettingsDialogCommand}"
ToolTip="{x:Static resources:Strings.Settings_Header_Tooltip}"
ImageSource="/Resources/slider.png" KeyTip="S" />
<RibbonApplicationMenuItem Header="{x:Static resources:Strings.Exit_Header}" Click="Exit_Click"
KeyTip="X" />
</RibbonApplicationMenu>
</Ribbon.ApplicationMenu>
<RibbonTab Header="{x:Static resources:Strings.Home_Header}" KeyTip="H">
<RibbonGroup Header="{x:Static resources:Strings.File_Header}"
LargeImageSource="/Resources/save_project.png">
<RibbonSplitButton Label="{x:Static resources:Strings.Import_Label}"
LargeImageSource="/Resources/import_solution.png"
Command="{Binding LoadSolutionCommand}"
KeyTip="IM">
<RibbonMenuItem Header="{x:Static resources:Strings.ImportSolution_Label}"
ImageSource="/Resources/import_solution.png"
Command="{Binding LoadSolutionCommand}" />
<RibbonMenuItem Header="{x:Static resources:Strings.ImportJdeps_Label}"
ImageSource="/Resources/import_solution.png"
Command="{Binding ImportJdepsCommand}" />
<RibbonMenuItem Header="{x:Static resources:Strings.ImportPlainText_Label}"
ImageSource="/Resources/import_solution.png"
Command="{Binding ImportPlainTextCommand}" />
</RibbonSplitButton>
<RibbonButton Label="{x:Static resources:Strings.ProjectFilter_Label}"
LargeImageSource="/Resources/filter_32.png"
Command="{Binding OpenFilterDialogCommand}" KeyTip="FI">
<RibbonButton.ToolTip>
<ToolTip Content="{x:Static resources:Strings.ProjectFilter_Tooltip}" />
</RibbonButton.ToolTip>
</RibbonButton>
<RibbonSplitButton Label="{x:Static resources:Strings.LoadProject_Label}"
LargeImageSource="/Resources/load_project.png"
Command="{Binding LoadProjectCommand}"
ItemsSource="{Binding RecentFiles}"
KeyTip="LO">
<RibbonSplitButton.ItemContainerStyle>
<Style TargetType="RibbonMenuItem">
<Setter Property="ImageSource" Value="{Binding ImageSource}" />
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock Text="{Binding Path}" TextOptions.TextFormattingMode="Display" />
</DataTemplate>
</Setter.Value>
</Setter>
<Setter Property="Command" Value="{Binding Command}" />
<Setter Property="CommandParameter" Value="{Binding Path}" />
</Style>
</RibbonSplitButton.ItemContainerStyle>
</RibbonSplitButton>
<RibbonButton Label="{x:Static resources:Strings.SaveProject_Label}"
LargeImageSource="/Resources/save_project.png"
Command="{Binding SaveProjectCommand}" KeyTip="SA" />
</RibbonGroup>
<RibbonGroup Header="Tools" LargeImageSource="/Resources/cycle_32.png">
<RibbonButton Label="{x:Static resources:Strings.Find_Cycles_Label}"
LargeImageSource="/Resources/cycle_32.png"
Command="{Binding FindCyclesCommand}" KeyTip="CY" />
<RibbonButton Label="{x:Static resources:Strings.AiAdvise_Label}"
LargeImageSource="/Resources/advisor.png"
Command="{Binding AiAdviseCommand}" KeyTip="AI">
<RibbonButton.ToolTip>
<ToolTip Content="{x:Static resources:Strings.AiAdvise_Tooltip}" />
</RibbonButton.ToolTip>
</RibbonButton>
<RibbonSplitButton Label="{x:Static resources:Strings.Analyzers_Label}"
LargeImageSource="/Resources/analysis_32.png"
ItemsSource="{Binding Analyzers}" KeyTip="AN">
<!-- Integrate analyzers -->
<RibbonSplitButton.ItemContainerStyle>
<Style TargetType="RibbonMenuItem">
<Setter Property="Header" Value="{Binding Name}" />
<Setter Property="ToolTip" Value="{Binding Description}" />
<Setter Property="ImageSource" Value="/Resources/analysis_32.png" />
<Setter Property="Command"
Value="{Binding DataContext.ExecuteAnalyzerCommand, RelativeSource={RelativeSource AncestorType=Window}}" />
<Setter Property="CommandParameter" Value="{Binding Id}" />
</Style>
</RibbonSplitButton.ItemContainerStyle>
</RibbonSplitButton>
</RibbonGroup>
<RibbonGroup Header="{x:Static resources:Strings.CodeExplorer_Header}"
LargeImageSource="/Resources/four-arrows_32.png">
<RibbonButton Label="{x:Static resources:Strings.Clear_Label}"
LargeImageSource="/Resources/trash-can_32.png"
Command="{Binding GraphClearCommand}" KeyTip="CL">
<RibbonButton.ToolTip>
<ToolTip Content="{x:Static resources:Strings.Clear_Tooltip}" />
</RibbonButton.ToolTip>
</RibbonButton>
<RibbonButton Label="{x:Static resources:Strings.HideFilter_Label}"
LargeImageSource="/Resources/filter_32.png"
Command="{Binding GraphViewModel.OpenGraphHideDialogCommand}" KeyTip="HI">
<RibbonButton.ToolTip>
<ToolTip Content="{x:Static resources:Strings.HideFilter_Tooltip}" />
</RibbonButton.ToolTip>
</RibbonButton>
<RibbonButton Label="{x:Static resources:Strings.Layout_Label}"
LargeImageSource="/Resources/four-arrows_32.png"
Command="{Binding GraphLayoutCommand}" KeyTip="LA">
<RibbonButton.ToolTip>
<ToolTip Content="{x:Static resources:Strings.Layout_Tooltip}" />
</RibbonButton.ToolTip>
</RibbonButton>
<RibbonSplitButton Label="Export"
LargeImageSource="/Resources/document-xml_32.png"
Command="{Binding ExportToDgmlCommand}" KeyTip="EX">
<RibbonMenuItem Header="{x:Static resources:Strings.ExportDgml_Label}"
ImageSource="/Resources/document-xml_32.png"
ToolTip="{x:Static resources:Strings.ExportDgml_Tooltip}"
Command="{Binding ExportToDgmlCommand}" />
<RibbonMenuItem Header="{x:Static resources:Strings.SavePng_Label}"
ImageSource="/Resources/png-file_32.png"
ToolTip="{x:Static resources:Strings.SavePng_Tooltip}"
Command="{Binding ExportToPngCommand}"
CommandParameter="{Binding ElementName=ExplorationControl}" />
<RibbonMenuItem Header="{x:Static resources:Strings.ExportSvg_Label}"
ImageSource="/Resources/svg-file_32.png"
ToolTip="{x:Static resources:Strings.ExportSvg_Tooltip}"
Command="{Binding ExportToSvgCommand}" />
<RibbonMenuItem Header="{x:Static resources:Strings.ExportDsi_Label}"
ImageSource="/Resources/spreadsheet_32.png"
ToolTip="{x:Static resources:Strings.ExportDsi_Tooltip}"
Command="{Binding ExportToDsiCommand}" />
<RibbonMenuItem Header="{x:Static resources:Strings.ExportPlainText_Label}"
ImageSource="/Resources/png-file_32.png"
ToolTip="{x:Static resources:Strings.ExportPlainText_Tooltip}"
Command="{Binding ExportPlainTextCommand}" />
<RibbonSeparator />
<RibbonMenuItem Header="{x:Static resources:Strings.ExportPlantUml_Label}"
ImageSource="/Resources/document-xml_32.png"
ToolTip="{x:Static resources:Strings.ExportPlantUml_Tooltip}"
Command="{Binding ExportToPlantUmlCommand}" />
<RibbonMenuItem Header="{x:Static resources:Strings.Copy_BitmapClipboard_Label}"
ImageSource="/Resources/png-file_32.png"
ToolTip="{x:Static resources:Strings.Copy_BitmapClipboard_Tooltip}"
Command="{Binding CopyBitmapToClipboardCommand}"
CommandParameter="{Binding ElementName=ExplorationControl}" />
</RibbonSplitButton>
<RibbonButton Label="{x:Static resources:Strings.Undo_Label}"
LargeImageSource="/Resources/undo_32.png"
Command="{Binding GraphViewModel.UndoCommand}" KeyTip="UN">
<RibbonButton.ToolTip>
<ToolTip Content="{x:Static resources:Strings.Undo_Tooltip}" />
</RibbonButton.ToolTip>
</RibbonButton>
<RibbonButton Label="{x:Static resources:Strings.Gallery_Label}"
LargeImageSource="/Resources/document_graph_32.png"
Command="{Binding ShowGalleryCommand}" KeyTip="GA">
<RibbonButton.ToolTip>
<ToolTip Content="{x:Static resources:Strings.Gallery_Tooltip}" />
</RibbonButton.ToolTip>
</RibbonButton>
</RibbonGroup>
<!-- Rendering -->
<RibbonGroup Header="{x:Static resources:Strings.Settings_Rendering}"
LargeImageSource="Resources/rendering.png">
<Grid Margin="0, 0, 0, 0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="Auto" /> <!-- Label -->
<ColumnDefinition Width="Auto" /> <!-- Drop Down -->
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<RibbonToggleButton HorizontalAlignment="Left"
Grid.Row="0" Grid.Column="0"
Label="{x:Static resources:Strings.Flow_Label}"
SmallImageSource="/Resources/guidepost_small.png"
IsChecked="{Binding GraphViewModel.ShowDataFlow, Mode=TwoWay}" KeyTip="SH">
<RibbonToggleButton.ToolTip>
<ToolTip Content="{x:Static resources:Strings.Flow_Tooltip}" />
</RibbonToggleButton.ToolTip>
</RibbonToggleButton>
<RibbonToggleButton Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left"
Label="{x:Static resources:Strings.FlatGraph_Label}"
SmallImageSource="/Resources/left-right_small.png"
IsChecked="{Binding GraphViewModel.ShowFlatGraph, Mode=TwoWay}" KeyTip="FL">
<RibbonToggleButton.ToolTip>
<ToolTip Content="{x:Static resources:Strings.FlatGraph_Tooltip}" />
</RibbonToggleButton.ToolTip>
</RibbonToggleButton>
<TextBlock VerticalAlignment="Center"
Grid.Row="0" Grid.Column="2"
Text="{x:Static resources:Strings.Rendering_Label}" />
<ComboBox VerticalAlignment="Center" Height="22" Margin="5,2,2,2" Padding="4,0,4,0"
VerticalContentAlignment="Center"
Grid.Row="0" Grid.Column="3"
ItemsSource="{Binding GraphViewModel.RenderOptions}"
SelectedItem="{Binding GraphViewModel.SelectedRenderOption}" />
<TextBlock VerticalAlignment="Center"
Grid.Row="1" Grid.Column="2"
Text="{x:Static resources:Strings.Highlighting_Label}" />
<ComboBox VerticalAlignment="Center"
Height="22" Margin="5,2,2,2" Padding="4,0,4,0"
VerticalContentAlignment="Center"
Grid.Row="1" Grid.Column="3"
ItemsSource="{Binding GraphViewModel.HighlightOptions}"
SelectedItem="{Binding GraphViewModel.SelectedHighlightOption}" />
</Grid>
</RibbonGroup>
<!-- Help Ribbon Group -->
<RibbonGroup Header="{x:Static resources:Strings.Help_Header}"
LargeImageSource="/Resources/help_32.png">
<RibbonButton Label="{x:Static resources:Strings.Legend_Label}"
LargeImageSource="/Resources/legend_32.png"
Command="{Binding ShowLegendCommand}" KeyTip="LE">
<RibbonButton.ToolTip>
<ToolTip Content="{x:Static resources:Strings.Legend_Tooltip}" />
</RibbonButton.ToolTip>
</RibbonButton>
</RibbonGroup>
<!-- Helpers Ribbon Group -->
<RibbonGroup Header="Helpers"
LargeImageSource="/Resources/snapshot_32.png">
<RibbonButton Label="{x:Static resources:Strings.Snapshot}"
LargeImageSource="/Resources/snapshot_32.png"
Command="{Binding SnapshotCommand}" KeyTip="SN">
<RibbonButton.ToolTip>
<ToolTip Content="{x:Static resources:Strings.Snapshot_Tooltip}" />
</RibbonButton.ToolTip>
</RibbonButton>
<RibbonButton Label="{x:Static resources:Strings.Restore}"
LargeImageSource="/Resources/restore_32.png"
Command="{Binding RestoreCommand}" KeyTip="RE">
<RibbonButton.ToolTip>
<ToolTip Content="{x:Static resources:Strings.Restore_Tooltip}" />
</RibbonButton.ToolTip>
</RibbonButton>
</RibbonGroup>
</RibbonTab>
</Ribbon>
<Grid Grid.Row="1" x:Name="SplitterGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="SplitterColumn" Width="Auto" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- Navigation area -->
<Expander Grid.Column="0" ExpandDirection="Right" IsExpanded="{Binding IsLeftPanelExpanded}"
x:Name="LeftExpander"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Collapsed="LeftExpander_Collapsed">
<Expander.Header>
<TextBlock Text="{x:Static resources:Strings.CodeStructure_Header}" FontWeight="Bold">
<TextBlock.LayoutTransform>
<RotateTransform Angle="90" />
</TextBlock.LayoutTransform>
</TextBlock>
</Expander.Header>
<Expander.Style>
<Style TargetType="Expander">
<Setter Property="MinWidth" Value="{x:Static analyst:MainWindow.TreeMinWidthCollapsed}" />
<Style.Triggers>
<Trigger Property="IsExpanded" Value="True">
<Setter Property="MinWidth" Value="{x:Static analyst:MainWindow.TreeMinWidthExpanded}" />
</Trigger>
</Style.Triggers>
</Style>
</Expander.Style>
<TabControl x:Name="CodeStructureTab"
SelectedIndex="{Binding SelectedLeftTabIndex}"
Visibility="{Binding IsLeftPanelExpanded, Converter={StaticResource BooleanToVisibilityConverter}}"
Margin="0">
<!-- Tree View Tab -->
<TabItem Header="Tree View">
<tree:TreeControl x:Name="TreeControl" DataContext="{Binding TreeViewModel}" />
</TabItem>
<!-- Search Tab -->
<TabItem Header="Advanced Search">
<advancedSearch:AdvancedSearchControl DataContext="{Binding SearchViewModel}" />
</TabItem>
<!-- Info Panel -->
<TabItem Header="{x:Static resources:Strings.InfoPanel_TabHeader}">
<info:InfoPanel DataContext="{Binding InfoPanelViewModel}" />
</TabItem>
</TabControl>
</Expander>
<!-- If the expander is collapse we don't show the splitter-->
<GridSplitter Grid.Column="1"
Width="5"
HorizontalAlignment="Center"
VerticalAlignment="Stretch"
ShowsPreview="False"
DragDelta="GridSplitter_DragDelta"
Visibility="{Binding IsExpanded, ElementName=LeftExpander, Converter={StaticResource BooleanToVisibilityConverter}}" />
<!-- Without ClipToBounds we can draw the nodes over the tree and ribbon.-->
<TabControl Grid.Column="2" SelectedIndex="{Binding SelectedRightTabIndex}" x:Name="WorkingArea">
<TabItem Header="{x:Static resources:Strings.CodeExplorer_TabHeader}">
<graph:CodeExplorerControl x:Name="ExplorationControl" />
</TabItem>
<TabItem Header="{x:Static resources:Strings.Tab_Cycles}">
<dynamicDataGrid1:DynamicDataGrid TableData="{Binding Cycles}" />
</TabItem>
<TabItem Header="{x:Static resources:Strings.Tab_Analyzer}">
<dynamicDataGrid1:DynamicDataGrid TableData="{Binding AnalyzerResult}" />
</TabItem>
<TabItem Header="{x:Static resources:Strings.Metrics_TabHeader}">
<dynamicDataGrid1:DynamicDataGrid SelfDescribingData="{Binding Metrics}" />
</TabItem>
</TabControl>
</Grid>
<!-- Loading Overlay -->
<Grid Grid.Row="0" Grid.RowSpan="2"
Background="#80000000"
Visibility="{Binding IsLoading, Converter={StaticResource BooleanToVisibilityConverter}}">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="{Binding LoadMessage}" Foreground="White" FontSize="16" Margin="0,0,0,10" />
<ProgressBar IsIndeterminate="True" Width="200" Height="20" />
</StackPanel>
</Grid>
</Grid>
</ribbon:RibbonWindow>