-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathAddProgramWindow.xaml.cs
More file actions
41 lines (32 loc) · 891 Bytes
/
AddProgramWindow.xaml.cs
File metadata and controls
41 lines (32 loc) · 891 Bytes
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
using System;
using System.Windows;
namespace WpfApp1
{
public partial class AddProgramWindow : Window
{
public string EnteredExeName { get; private set; }
public AddProgramWindow()
{
InitializeComponent();
}
private void OkButton_Click(object sender, RoutedEventArgs e)
{
var text = ExeNameTextBox.Text?.Trim();
if (string.IsNullOrWhiteSpace(text))
{
DialogResult = false;
return;
}
if (!text.EndsWith(".exe", StringComparison.OrdinalIgnoreCase))
{
text += ".exe";
}
EnteredExeName = text;
DialogResult = true;
}
private void CancelButton_Click(object sender, RoutedEventArgs e)
{
DialogResult = false;
}
}
}