-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDialogWindow.xaml.cs
More file actions
97 lines (86 loc) · 2.65 KB
/
DialogWindow.xaml.cs
File metadata and controls
97 lines (86 loc) · 2.65 KB
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
using iNKORE.UI.WPF.Modern.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace beforewindeploy
{
/// <summary>
/// Interaction logic for DialogWindow.xaml
/// </summary>
public partial class DialogWindow : Window
{
private bool canClose = false;
public enum DialogMessageBoxResult
{
TryAgain,
OfflineInstall,
Skip
}
public DialogMessageBoxResult Result { get; private set; }
public DialogWindow(string message, string title, bool? isOffline)
{
InitializeComponent();
this.BringIntoView();
this.Title = title;
messageContent.Text = message;
if (isOffline == true)
{
offlineInstallButton.IsEnabled = false;
}
}
private void tryAgainButton_Click(object sender, RoutedEventArgs e)
{
Result = DialogMessageBoxResult.TryAgain;
canClose = true;
this.Close();
}
private void offlineInstallButton_Click(object sender, RoutedEventArgs e)
{
Result = DialogMessageBoxResult.OfflineInstall;
canClose = true;
this.Close();
}
private void skipButton_Click(object sender, RoutedEventArgs e)
{
Result = DialogMessageBoxResult.Skip;
canClose = true;
this.Close();
}
private void messageContent_SizeChanged(object sender, SizeChangedEventArgs e)
{
if (messageContent.ActualHeight > 24)
{
messageContent.Margin = new Thickness(88, 25, 0, 0);
double heightChange = e.NewSize.Height - e.PreviousSize.Height;
this.Height += heightChange - 40;
this.MaxHeight += heightChange - 40;
this.MinHeight += heightChange - 40;
}
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if (!canClose)
{
e.Cancel = true;
}
}
private void Window_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
tryAgainButton_Click(sender, e);
}
}
}
}