-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNewSpeaker_Window.xaml.cs
76 lines (65 loc) · 2.41 KB
/
NewSpeaker_Window.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
using System.Collections.Generic;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Markup;
using SOTR_Fixer.Classes;
namespace SOTR_Fixer
{
/// <summary>
/// Interaction logic for NewSpeaker_Window.xaml
/// </summary>
public partial class NewSpeaker_Window : Window
{
public string shortcut { get; set; }
public string firstName { get; set; }
public string lastName { get; set; }
public NewSpeaker_Window()
{
InitializeComponent();
Shortcut_TB.Focus();
}
#region close New Speaker window
private void NewSpeaker_Cancel_Btn_Click(object sender, RoutedEventArgs e)
{
Close();
}
#endregion
#region add new speaker with gathered data
private void NewSpeaker_Add_Btn_Click(object sender, RoutedEventArgs e)
{
shortcut = Shortcut_TB.Text;
firstName = FirstName_TB.Text;
lastName = LastName_TB.Text;
DialogResult = true;
}
#endregion
#region using 't' and more than one letter not allowed in shortcuts
private void Shortcut_TB_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
if (e.Text == "t" || e.Text == "T")
{
e.Handled = true; // prevent the "t" from being entered
//ToolTip.Visibility = Visibility.Visible; // show the ToolTip
MessageBox.Show("You cannot use 't' here as it is reserved for the time indicator.", "Shortcut Rule", MessageBoxButton.OK, MessageBoxImage.Warning);
}
if (Shortcut_TB.Text.Length >= 1)
{
e.Handled = true;
MessageBox.Show("You may not use more than one letter as a shortcut.", "Shortcut Rule", MessageBoxButton.OK, MessageBoxImage.Warning);
}
}
#endregion
#region using 'space' not allowed in shortcuts
private void Shortcut_TB_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Space)
{
e.Handled = true;
MessageBox.Show("You cannot use 'space' here. Only letters are permitted.", "Shortcut Rule", MessageBoxButton.OK, MessageBoxImage.Warning);
}
}
#endregion
}
}