Skip to content

Commit dea814c

Browse files
committed
Added in options for defaults vmix shortcuts and size an color of the burush
1 parent 7c173ec commit dea814c

File tree

8 files changed

+39
-153
lines changed

8 files changed

+39
-153
lines changed

App.config

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
3-
<startup>
4-
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
5-
</startup>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
5+
</startup>
6+
<appSettings>
7+
<add key="Play-Pause" value="http://10.244.0.5/?shortcut=02cfc5c9-95e8-4e9e-92be-cd9401b7ddcd"/>
8+
<!--The url to play a replay-->
9+
<add key="Reverse" value="http://10.244.0.5/?shortcut=35af7592-d27b-47c8-aa51-0153f1b01e42"/>
10+
<!--The url to Reverse a replay-->
11+
<add key="Default_Pen_Color" value="yellow"/>
12+
<!-- Sets the default color of the brush. For a list of Color you can use see: https://learn.microsoft.com/en-us/dotnet/api/system.windows.media.colors?view=windowsdesktop-8.0-->
13+
<add key="Default_Pen_Size" value="9"/>
14+
<!--Sets the default size of the brush-->
15+
</appSettings>
616
</configuration>

BackgroundView.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
using NewTek.NDI;
2-
2+
using System.Windows.Media;
33
namespace NDI_Telestrator
44
{
55
public class BackgroundView : NewTek.NDI.WPF.ReceiveView
66
{
77
private Finder NDIFinder = new Finder(true);
88

99
public System.Collections.ObjectModel.ObservableCollection<Source> Sources => NDIFinder.Sources;
10-
1110

1211
public void setSource(Source source)
1312
{

InkControls.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ public static void Btn_Screenshot_Click(object sender, RoutedEventArgs e)
206206
public static void createNewLayer()
207207
{
208208
whiteboard.addNewLayer();
209+
209210
}
210211

211212
public static void setActiveLayer(int index)

MainWindow.xaml

Lines changed: 2 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
99
xmlns:whiteboard="clr-namespace:NDI_Telestrator"
1010
x:Name="this"
11-
Title="Warrior Media Telestrator"
11+
Title="NDI Telestrator"
1212
Width="1280"
1313
Height="800"
1414
Background="Purple"
@@ -90,151 +90,17 @@
9090
<XAMLConverters:ColorToSolidColorBrushNoTransparent x:Key="ColorToSolidColorBrushNoTransparent" />
9191
</StackPanel.Resources>
9292

93-
<Border BorderBrush="Transparent" BorderThickness="0,0,0,3">
94-
<Button
95-
Width="30"
96-
Height="32"
97-
VerticalAlignment="Bottom"
98-
materialDesign:RippleAssist.IsCentered="True"
99-
Click="Btn_Screenshot_Click"
100-
ClipToBounds="True"
101-
Style="{StaticResource MaterialDesignToolForegroundButton}">
102-
<materialDesign:PackIcon Kind="Camera" />
103-
</Button>
104-
</Border>
105-
106-
<Border BorderBrush="Transparent" BorderThickness="0,0,0,3">
107-
<Button
108-
Width="30"
109-
Height="32"
110-
VerticalAlignment="Bottom"
111-
materialDesign:RippleAssist.IsCentered="True"
112-
Click="Btn_Delete_Click"
113-
ClipToBounds="True"
114-
IsEnabled="{Binding hasStrokes, ElementName=theWhiteboard}"
115-
Style="{StaticResource MaterialDesignToolForegroundButton}">
116-
<materialDesign:PackIcon Kind="Delete" />
117-
</Button>
118-
</Border>
119-
120-
<Border BorderBrush="Transparent" BorderThickness="0,0,0,3">
121-
<Button
122-
Width="30"
123-
Height="32"
124-
VerticalAlignment="Bottom"
125-
materialDesign:RippleAssist.IsCentered="True"
126-
Click="Btn_Undo_Click"
127-
ClipToBounds="True"
128-
IsEnabled="{Binding hasUndoContent, ElementName=theWhiteboard}"
129-
Style="{StaticResource MaterialDesignToolForegroundButton}">
130-
<materialDesign:PackIcon Kind="Undo" />
131-
</Button>
132-
</Border>
133-
134-
<Border BorderBrush="Transparent" BorderThickness="0,0,0,3">
135-
<Button
136-
Width="30"
137-
Height="32"
138-
VerticalAlignment="Bottom"
139-
materialDesign:RippleAssist.IsCentered="True"
140-
Click="Btn_Redo_Click"
141-
ClipToBounds="True"
142-
IsEnabled="{Binding hasRedoContent, ElementName=theWhiteboard}"
143-
Style="{StaticResource MaterialDesignToolForegroundButton}">
144-
<materialDesign:PackIcon Kind="Redo" />
145-
</Button>
146-
</Border>
147-
148-
<Controls:ColorPicker
149-
Controls:TextBoxHelper.ButtonWidth="0"
150-
BorderThickness="0"
151-
DefaultColor="Transparent"
152-
SelectedColorChanged="onClrPickBackground"
153-
Style="{StaticResource ToolbarButtonStyle}">
154-
155-
<Controls:ColorPicker.SelectedColorTemplate>
156-
<DataTemplate>
157-
<materialDesign:PackIcon Foreground="{Binding Converter={StaticResource ColorToSolidColorBrushNoTransparent}}" Kind="Image" />
158-
</DataTemplate>
159-
</Controls:ColorPicker.SelectedColorTemplate>
160-
</Controls:ColorPicker>
161-
162-
<!-- https://github.com/MahApps/MahApps.Metro/blob/077161c41be0e74f81a0ad150a12495bd8b2237d/src/MahApps.Metro/Themes/ColorPicker/ColorPicker.xaml#L96 -->
163-
<Controls:ColorPicker
164-
Controls:TextBoxHelper.ButtonWidth="0"
165-
BorderThickness="0"
166-
DefaultColor="Black"
167-
SelectedColorChanged="onClrPickPen"
168-
Style="{StaticResource ToolbarButtonStyle}">
16993

170-
<Controls:ColorPicker.SelectedColorTemplate>
171-
<DataTemplate>
172-
<materialDesign:PackIcon Foreground="{Binding Converter={StaticResource ColorToSolidColorBrushNoTransparent}}" Kind="Pencil" />
173-
</DataTemplate>
174-
</Controls:ColorPicker.SelectedColorTemplate>
175-
</Controls:ColorPicker>
17694

177-
<Controls:DropDownButton
178-
HorizontalAlignment="Center"
179-
HorizontalContentAlignment="Center"
180-
ArrowVisibility="Collapsed"
181-
BorderThickness="0"
182-
DataContext="{Binding handleSelectThickness, ElementName=this}"
183-
Style="{StaticResource ToolbarButtonStyle}">
184-
<Controls:DropDownButton.Icon>
185-
<materialDesign:PackIcon Kind="Circle" />
186-
</Controls:DropDownButton.Icon>
187-
<Controls:DropDownButton.ItemContainerStyle>
188-
<Style BasedOn="{StaticResource {x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
189-
<Setter Property="Command" Value="{Binding DataContext}" />
190-
<Setter Property="Width" Value="90" />
191-
<Setter Property="CommandParameter" Value="{Binding Tag}" />
192-
</Style>
193-
</Controls:DropDownButton.ItemContainerStyle>
194-
<Controls:DropDownButton.Resources>
19595

196-
<!-- materialDesign:PackIcon -->
197-
<Style x:Key="IconStyle" TargetType="{x:Type materialDesign:PackIcon}">
198-
<Setter Property="Width" Value="30" />
199-
<Setter Property="Height" Value="32" />
200-
<Setter Property="VerticalAlignment" Value="Bottom" />
201-
<Setter Property="ClipToBounds" Value="True" />
202-
<Setter Property="Foreground" Value="Black" />
203-
<Setter Property="Kind" Value="Circle" />
204-
<Setter Property="RenderTransformOrigin" Value="0.5,0.5" />
205-
</Style>
206-
</Controls:DropDownButton.Resources>
207-
<Controls:DropDownButton.Items>
20896

209-
<materialDesign:PackIcon Style="{StaticResource IconStyle}" Tag="1.0">
210-
<materialDesign:PackIcon.RenderTransform>
211-
<ScaleTransform ScaleX="0.2" ScaleY="0.2" />
212-
</materialDesign:PackIcon.RenderTransform>
213-
</materialDesign:PackIcon>
21497

215-
<materialDesign:PackIcon Style="{StaticResource IconStyle}" Tag="2.0">
216-
<materialDesign:PackIcon.RenderTransform>
217-
<ScaleTransform ScaleX="0.4" ScaleY="0.4" />
218-
</materialDesign:PackIcon.RenderTransform>
219-
</materialDesign:PackIcon>
22098

22199

222-
<materialDesign:PackIcon Style="{StaticResource IconStyle}" Tag="3.0">
223-
<materialDesign:PackIcon.RenderTransform>
224-
<ScaleTransform ScaleX="0.6" ScaleY="0.6" />
225-
</materialDesign:PackIcon.RenderTransform>
226-
</materialDesign:PackIcon>
227100

228-
<materialDesign:PackIcon Style="{StaticResource IconStyle}" Tag="4.0">
229-
<materialDesign:PackIcon.RenderTransform>
230-
<ScaleTransform ScaleX="0.8" ScaleY="0.8" />
231-
</materialDesign:PackIcon.RenderTransform>
232-
</materialDesign:PackIcon>
233101

234-
<materialDesign:PackIcon Style="{StaticResource IconStyle}" Tag="5.0" />
235102

236-
</Controls:DropDownButton.Items>
237-
</Controls:DropDownButton>
103+
238104

239105
<Border BorderBrush="Transparent" BorderThickness="0,0,0,3">
240106
<Button

MainWindow.xaml.cs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using System.Net.Http;
1111
using System.Threading.Tasks;
1212
using ControlzEx.Standard;
13+
using System.Configuration;
1314

1415
namespace NDI_Telestrator
1516
{
@@ -22,9 +23,17 @@ private void requestNDI(object caller, object args)
2223
{
2324
ndi.requestFrameUpdate();
2425
}
25-
26+
public static Color FromName(String name)
27+
{
28+
var color_props = typeof(Colors).GetProperties();
29+
foreach (var c in color_props)
30+
if (name.Equals(c.Name, StringComparison.OrdinalIgnoreCase))
31+
return (Color)c.GetValue(new Color(), null);
32+
return Colors.Transparent;
33+
}
2634
static async Task GetVmix(String url)
2735
{
36+
2837
var client = new HttpClient();
2938

3039
var result = await client.GetAsync(url);
@@ -37,7 +46,8 @@ public MainWindow()
3746
optionsDialogue.whiteboard = theWhiteboard;
3847
optionsDialogue.background = theBackground;
3948

40-
49+
theWhiteboard.SetPenColour(FromName(ConfigurationManager.AppSettings["Default_Pen_Color"]));
50+
theWhiteboard.SetPenThickness(double.Parse(ConfigurationManager.AppSettings["Default_Pen_Size"]));
4151

4252

4353
// Send background updates every 250ms
@@ -73,7 +83,7 @@ public MainWindow()
7383

7484
private void MainWindow_KeyDown(object sender, KeyEventArgs e)
7585
{
76-
86+
7787
switch (e.Key)
7888
{
7989

@@ -145,15 +155,15 @@ private void MainWindow_KeyDown(object sender, KeyEventArgs e)
145155

146156

147157
case Key.D1:
148-
GetVmix("http://10.244.0.5/?shortcut=02cfc5c9-95e8-4e9e-92be-cd9401b7ddcd");
149-
Console.WriteLine("Play");
158+
String play = ConfigurationManager.AppSettings["Play-Pause"];
159+
GetVmix(play);
160+
Console.WriteLine("Play-Pause");
150161
theWhiteboard.Clear();
151162
break;
152-
case Key.D2:
153163

154-
GetVmix("http://10.244.0.5/?shortcut=35af7592-d27b-47c8-aa51-0153f1b01e42");
164+
case Key.D2:
165+
GetVmix(ConfigurationManager.AppSettings["Reverse"]);
155166
Console.WriteLine("Reverse");
156-
157167
break;
158168
}
159169
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<ProjectGuid>{84ED7244-5644-4150-9349-A87E457763B1}</ProjectGuid>
88
<OutputType>WinExe</OutputType>
99
<RootNamespace>Warrior_Media_Telestrator</RootNamespace>
10-
<AssemblyName>Warrior Media Telestrator</AssemblyName>
10+
<AssemblyName>NDI-Telestrator</AssemblyName>
1111
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
1212
<FileAlignment>512</FileAlignment>
1313
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.5.33530.505
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Warrior Media Telestrator", "Warrior Media Telestrator.csproj", "{84ED7244-5644-4150-9349-A87E457763B1}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NDI-Telestrator", "NDI-Telestrator.csproj", "{84ED7244-5644-4150-9349-A87E457763B1}"
77
EndProject
88
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NDILibDotNet2", "lib\NDILibDotNet2\NDILibDotNet2.csproj", "{7195BFA6-8095-4618-96F6-8577DB13FB43}"
99
EndProject

Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
// General Information about an assembly is controlled through the following
88
// set of attributes. Change these attribute values to modify the information
99
// associated with an assembly.
10-
[assembly: AssemblyTitle("Warrior Media Telestrator")]
10+
[assembly: AssemblyTitle("NDI-Telestrator")]
1111
[assembly: AssemblyDescription("")]
1212
[assembly: AssemblyConfiguration("")]
1313
[assembly: AssemblyCompany("")]
14-
[assembly: AssemblyProduct("Warrior Media Telestrator")]
14+
[assembly: AssemblyProduct("NDI-Telestrator")]
1515
[assembly: AssemblyCopyright("Copyright © 2023 Tj Doescher tj@dashfam.com")]
1616
[assembly: AssemblyTrademark("")]
1717
[assembly: AssemblyCulture("")]

0 commit comments

Comments
 (0)