-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUpdateNotificationWindow.xaml.cs
More file actions
56 lines (50 loc) · 1.74 KB
/
UpdateNotificationWindow.xaml.cs
File metadata and controls
56 lines (50 loc) · 1.74 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
using System.Windows;
namespace OverlayScope
{
/// <summary>
/// ダイアログの結果(どのボタンが押されたか)を示すためのenum。
/// </summary>
public enum UpdateActionResult
{
None,
GoToGitHub,
GoToWebsite
}
/// <summary>
/// 更新通知を表示するためのカスタムダイアログウィンドウ。
/// </summary>
public partial class UpdateNotificationWindow : Window
{
/// <summary>
/// ユーザーが選択した結果を格納します。
/// </summary>
public UpdateActionResult Result { get; private set; } = UpdateActionResult.None;
/// <summary>
/// コンストラクタ。バージョンとリリースノートをUIに表示します。
/// </summary>
public UpdateNotificationWindow(string version, string releaseNotes)
{
InitializeComponent();
VersionText.Text = version;
ReleaseNotesText.Text = releaseNotes;
}
private void GitHubButton_Click(object sender, RoutedEventArgs e)
{
Result = UpdateActionResult.GoToGitHub;
this.DialogResult = true; // ShowDialog()がtrueを返すように設定
this.Close();
}
private void WebsiteButton_Click(object sender, RoutedEventArgs e)
{
Result = UpdateActionResult.GoToWebsite;
this.DialogResult = true;
this.Close();
}
private void LaterButton_Click(object sender, RoutedEventArgs e)
{
Result = UpdateActionResult.None;
this.DialogResult = false; // ShowDialog()がfalseを返すように設定
this.Close();
}
}
}