-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCategoryPrompt.xaml.cs
50 lines (44 loc) · 980 Bytes
/
CategoryPrompt.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
using System.Windows;
using System.Windows.Input;
namespace App_Launcher
{
/// <summary>
/// Interaction logic for CategoryPrompt.xaml
/// </summary>
public partial class CategoryPrompt : Window
{
public CategoryPrompt()
{
InitializeComponent();
}
public bool ConfirmClicked { get; private set; } = false;
public string GetCategoryName()
{
return CategoryName.Text;
}
public bool PromptSucceeded()
{
return !string.IsNullOrEmpty(CategoryName.Text);
}
public void SetDefault(string Title)
{
CategoryName.Text = Title;
}
private void ConfirmCategory(object sender, MouseButtonEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
{
if (string.IsNullOrEmpty(CategoryName.Text))
{
MessageBox.Show("New category requires a name to be added.", "Category Name Required",
MessageBoxButton.OK, MessageBoxImage.Error);
}
else
{
ConfirmClicked = true;
Close();
}
}
}
}
}