-
Notifications
You must be signed in to change notification settings - Fork 4
/
MainWindow.xaml
258 lines (229 loc) · 11.5 KB
/
MainWindow.xaml
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
<Controls:MetroWindow
x:Class="NDI_Telestrator.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:NDI="clr-namespace:NewTek.NDI.WPF;assembly=NDILibDotNet2"
xmlns:XAMLConverters="clr-namespace:NDI_Telestrator.XAMLConverters"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:whiteboard="clr-namespace:NDI_Telestrator"
x:Name="this"
Title="Telestrator"
Width="1280"
Height="800"
Background="#777"
BorderBrush="DarkSlateGray"
BorderThickness="1"
FontFamily="Montserrat"
KeyDown="MainWindow_KeyDown"
WindowStartupLocation="CenterScreen">
<Controls:MetroWindow.Resources />
<Controls:MetroWindow.Flyouts>
<Controls:FlyoutsControl>
<whiteboard:OptionsDialogue x:Name="optionsDialogue" IsOpen="False" />
</Controls:FlyoutsControl>
</Controls:MetroWindow.Flyouts>
<Grid Margin="0,0,0,-6" HorizontalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border
Grid.Row="1"
Margin="5"
VerticalAlignment="Center"
BorderBrush="Black"
BorderThickness="1">
<Grid Background="{DynamicResource MahApps.Brushes.Tile.Small}">
<!--<Grid Background="White">-->
<Grid Panel.ZIndex="1000">
<NDI:NdiSendContainer
x:Name="ndi"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
NdiFrameRateNumerator="30000"
NdiHeight="1080"
NdiName="Telestrator"
NdiWidth="1920">
<whiteboard:WhiteboardCanvas
x:Name="theWhiteboard"
Width="1920"
Height="1080"
ClipToBounds="True"
Cursor="Pen" />
</NDI:NdiSendContainer>
</Grid>
<whiteboard:BackgroundView x:Name="theBackground" ReceiverName="Telestrator" />
</Grid>
</Border>
<StackPanel
Grid.Row="2"
Margin="5"
HorizontalAlignment="Center"
Orientation="Horizontal">
<StackPanel.Resources>
<Style x:Key="ToolbarButtonStyle" TargetType="{x:Type Control}">
<Style.Setters>
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Margin" Value="0,0,0,3" />
</Style.Setters>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<!--<Setter Property="Background" Value="{DynamicResource MahApps.Brushes.Gray8}" />-->
<Setter Property="Background" Value="Transparent" />
</Trigger>
</Style.Triggers>
</Style>
<XAMLConverters:ColorToSolidColorBrushNoTransparent x:Key="ColorToSolidColorBrushNoTransparent" />
</StackPanel.Resources>
<Border BorderBrush="Transparent" BorderThickness="0,0,0,3">
<Button
Width="30"
Height="32"
VerticalAlignment="Bottom"
materialDesign:RippleAssist.IsCentered="True"
Click="Btn_Screenshot_Click"
ClipToBounds="True"
Style="{StaticResource MaterialDesignToolForegroundButton}">
<materialDesign:PackIcon Kind="Camera" />
</Button>
</Border>
<Border BorderBrush="Transparent" BorderThickness="0,0,0,3">
<Button
Width="30"
Height="32"
VerticalAlignment="Bottom"
materialDesign:RippleAssist.IsCentered="True"
Click="Btn_Delete_Click"
ClipToBounds="True"
IsEnabled="{Binding hasStrokes, ElementName=theWhiteboard}"
Style="{StaticResource MaterialDesignToolForegroundButton}">
<materialDesign:PackIcon Kind="Delete" />
</Button>
</Border>
<Border BorderBrush="Transparent" BorderThickness="0,0,0,3">
<Button
Width="30"
Height="32"
VerticalAlignment="Bottom"
materialDesign:RippleAssist.IsCentered="True"
Click="Btn_Undo_Click"
ClipToBounds="True"
IsEnabled="{Binding hasUndoContent, ElementName=theWhiteboard}"
Style="{StaticResource MaterialDesignToolForegroundButton}">
<materialDesign:PackIcon Kind="Undo" />
</Button>
</Border>
<Border BorderBrush="Transparent" BorderThickness="0,0,0,3">
<Button
Width="30"
Height="32"
VerticalAlignment="Bottom"
materialDesign:RippleAssist.IsCentered="True"
Click="Btn_Redo_Click"
ClipToBounds="True"
IsEnabled="{Binding hasRedoContent, ElementName=theWhiteboard}"
Style="{StaticResource MaterialDesignToolForegroundButton}">
<materialDesign:PackIcon Kind="Redo" />
</Button>
</Border>
<Controls:ColorPicker
Controls:TextBoxHelper.ButtonWidth="0"
BorderThickness="0"
DefaultColor="Transparent"
SelectedColorChanged="onClrPickBackground"
Style="{StaticResource ToolbarButtonStyle}">
<Controls:ColorPicker.SelectedColorTemplate>
<DataTemplate>
<materialDesign:PackIcon Foreground="{Binding Converter={StaticResource ColorToSolidColorBrushNoTransparent}}" Kind="Image" />
</DataTemplate>
</Controls:ColorPicker.SelectedColorTemplate>
</Controls:ColorPicker>
<!-- https://github.com/MahApps/MahApps.Metro/blob/077161c41be0e74f81a0ad150a12495bd8b2237d/src/MahApps.Metro/Themes/ColorPicker/ColorPicker.xaml#L96 -->
<Controls:ColorPicker
Controls:TextBoxHelper.ButtonWidth="0"
BorderThickness="0"
DefaultColor="Black"
SelectedColorChanged="onClrPickPen"
Style="{StaticResource ToolbarButtonStyle}">
<Controls:ColorPicker.SelectedColorTemplate>
<DataTemplate>
<materialDesign:PackIcon Foreground="{Binding Converter={StaticResource ColorToSolidColorBrushNoTransparent}}" Kind="Pencil" />
</DataTemplate>
</Controls:ColorPicker.SelectedColorTemplate>
</Controls:ColorPicker>
<Controls:DropDownButton
HorizontalAlignment="Center"
HorizontalContentAlignment="Center"
ArrowVisibility="Collapsed"
BorderThickness="0"
DataContext="{Binding handleSelectThickness, ElementName=this}"
Style="{StaticResource ToolbarButtonStyle}">
<Controls:DropDownButton.Icon>
<materialDesign:PackIcon Kind="Circle" />
</Controls:DropDownButton.Icon>
<Controls:DropDownButton.ItemContainerStyle>
<Style BasedOn="{StaticResource {x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
<Setter Property="Command" Value="{Binding DataContext}" />
<Setter Property="Width" Value="90" />
<Setter Property="CommandParameter" Value="{Binding Tag}" />
</Style>
</Controls:DropDownButton.ItemContainerStyle>
<Controls:DropDownButton.Resources>
<!-- materialDesign:PackIcon -->
<Style x:Key="IconStyle" TargetType="{x:Type materialDesign:PackIcon}">
<Setter Property="Width" Value="30" />
<Setter Property="Height" Value="32" />
<Setter Property="VerticalAlignment" Value="Bottom" />
<Setter Property="ClipToBounds" Value="True" />
<Setter Property="Foreground" Value="Black" />
<Setter Property="Kind" Value="Circle" />
<Setter Property="RenderTransformOrigin" Value="0.5,0.5" />
</Style>
</Controls:DropDownButton.Resources>
<Controls:DropDownButton.Items>
<materialDesign:PackIcon Style="{StaticResource IconStyle}" Tag="1.0">
<materialDesign:PackIcon.RenderTransform>
<ScaleTransform ScaleX="0.2" ScaleY="0.2" />
</materialDesign:PackIcon.RenderTransform>
</materialDesign:PackIcon>
<materialDesign:PackIcon Style="{StaticResource IconStyle}" Tag="2.0">
<materialDesign:PackIcon.RenderTransform>
<ScaleTransform ScaleX="0.4" ScaleY="0.4" />
</materialDesign:PackIcon.RenderTransform>
</materialDesign:PackIcon>
<materialDesign:PackIcon Style="{StaticResource IconStyle}" Tag="3.0">
<materialDesign:PackIcon.RenderTransform>
<ScaleTransform ScaleX="0.6" ScaleY="0.6" />
</materialDesign:PackIcon.RenderTransform>
</materialDesign:PackIcon>
<materialDesign:PackIcon Style="{StaticResource IconStyle}" Tag="4.0">
<materialDesign:PackIcon.RenderTransform>
<ScaleTransform ScaleX="0.8" ScaleY="0.8" />
</materialDesign:PackIcon.RenderTransform>
</materialDesign:PackIcon>
<materialDesign:PackIcon Style="{StaticResource IconStyle}" Tag="5.0" />
</Controls:DropDownButton.Items>
</Controls:DropDownButton>
<Border BorderBrush="Transparent" BorderThickness="0,0,0,3">
<Button
Width="30"
Height="32"
VerticalAlignment="Bottom"
materialDesign:RippleAssist.IsCentered="True"
Click="Btn_Options_Click"
ClipToBounds="True"
Foreground="Black"
Style="{StaticResource MaterialDesignToolForegroundButton}">
<materialDesign:PackIcon Kind="Settings" />
</Button>
</Border>
</StackPanel>
</Grid>
</Controls:MetroWindow>