-
Notifications
You must be signed in to change notification settings - Fork 4
/
OptionsDialogue.xaml.cs
161 lines (123 loc) · 3.93 KB
/
OptionsDialogue.xaml.cs
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
using System;
using System.ComponentModel;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
namespace NDI_Telestrator
{
/// <summary>
/// Interaction logic for OptionsDialogue.xaml
/// </summary>
public partial class OptionsDialogue : MahApps.Metro.Controls.Flyout, INotifyPropertyChanged
{
private BackgroundView _background;
public BackgroundView background
{
get
{
return _background;
}
set
{
_background = value;
OnPropertyChanged();
}
}
private WhiteboardCanvas _whiteboard;
public WhiteboardCanvas whiteboard
{
get
{
return _whiteboard;
}
set
{
_whiteboard = value;
OnPropertyChanged();
}
}
protected void OnPropertyChanged([System.Runtime.CompilerServices.CallerMemberName] string name = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
public event PropertyChangedEventHandler PropertyChanged;
public OptionsDialogue()
{
InitializeComponent();
// Fix dropdown disappearing when the main button is pressed (instead of the arrow)
// https://github.com/featherbear/NDI-Telestrator/issues/3
Loaded += (_sender, _evt) =>
{
helpers.MahApps_SplitBox_Helper.setupMainClickDropdown(NDISourcesDropdown);
helpers.MahApps_SplitBox_Helper.setupMainClickDropdown(ScreenshotFormatDropdown);
};
}
private void NDISources_Selected(object sender, SelectionChangedEventArgs e)
{
background.setSource((NewTek.NDI.Source)e.AddedItems[0]);
}
#region Screenshot Options
public int bindScreenshotFormatTypeIndex
{
get
{
return (int)Options.screenshotFormatType;
}
set
{
Options.screenshotFormatType = (Enums.ScreenshotFormatTypes)value;
}
}
#endregion
private void onBtnLoad(object sender, RoutedEventArgs e)
{
InkControls.onBtnLoadClick(sender, e);
}
private void onBtnSave(object sender, RoutedEventArgs e)
{
InkControls.onBtnSaveClick(sender, e);
}
private void onTglQuickSave(object sender, EventArgs e)
{
Options.quickSaveEnabled = !Options.quickSaveEnabled;
}
private void onBtnCreateLayer(object sender, RoutedEventArgs e)
{
InkControls.createNewLayer();
Console.WriteLine("There are now " + InkControls.whiteboard.Children.Count + " canvases");
}
private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
// TODO: Persist visible selection
ListBox obj = (ListBox)sender;
if (obj.SelectedIndex == -1) return;
selectedIndex = obj.SelectedIndex;
InkControls.setActiveLayer(obj.Items.Count - selectedIndex - 1);
}
private int _selectedIndex = 0;
public int selectedIndex
{
get
{
return _selectedIndex;
}
set
{
_selectedIndex = value;
OnPropertyChanged();
}
}
private void onBtnAddSingle(object sender, RoutedEventArgs e)
{
InkControls.requestAddDrawing(false);
}
private void onBtnAddMultiple(object sender, RoutedEventArgs e)
{
InkControls.requestAddDrawing(true);
}
}
}