markus / MarkusAutoUpdate / src / NetSparkle.UI.Avalonia / CheckingForUpdatesWindow.xaml.cs @ 63946dd5
이력 | 보기 | 이력해설 | 다운로드 (1.54 KB)
1 | d8f5045e | taeseongkim | using Avalonia; |
---|---|---|---|
2 | using Avalonia.Controls; |
||
3 | using Avalonia.Interactivity; |
||
4 | using Avalonia.Markup.Xaml; |
||
5 | using Avalonia.Media.Imaging; |
||
6 | using NetSparkleUpdater.Interfaces; |
||
7 | using System; |
||
8 | |||
9 | namespace NetSparkleUpdater.UI.Avalonia |
||
10 | { |
||
11 | public class CheckingForUpdatesWindow : Window, ICheckingForUpdates |
||
12 | { |
||
13 | public event EventHandler UpdatesUIClosing; |
||
14 | |||
15 | public CheckingForUpdatesWindow() |
||
16 | { |
||
17 | this.InitializeComponent(); |
||
18 | #if DEBUG |
||
19 | this.AttachDevTools(); |
||
20 | #endif |
||
21 | Closing += CheckingForUpdatesWindow_Closing; |
||
22 | } |
||
23 | |||
24 | public CheckingForUpdatesWindow(IBitmap iconBitmap) |
||
25 | { |
||
26 | this.InitializeComponent(); |
||
27 | #if DEBUG |
||
28 | this.AttachDevTools(); |
||
29 | #endif |
||
30 | Closing += CheckingForUpdatesWindow_Closing; |
||
31 | var imageControl = this.FindControl<Image>("AppIcon"); |
||
32 | if (imageControl != null) |
||
33 | { |
||
34 | imageControl.Source = iconBitmap; |
||
35 | } |
||
36 | } |
||
37 | |||
38 | private void CheckingForUpdatesWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) |
||
39 | { |
||
40 | Closing -= CheckingForUpdatesWindow_Closing; |
||
41 | UpdatesUIClosing?.Invoke(sender, new EventArgs()); |
||
42 | } |
||
43 | |||
44 | void ICheckingForUpdates.Close() |
||
45 | { |
||
46 | Close(); |
||
47 | } |
||
48 | |||
49 | void ICheckingForUpdates.Show() |
||
50 | { |
||
51 | Show(); |
||
52 | } |
||
53 | |||
54 | public void Cancel() |
||
55 | { |
||
56 | Close(); |
||
57 | } |
||
58 | |||
59 | private void InitializeComponent() |
||
60 | { |
||
61 | AvaloniaXamlLoader.Load(this); |
||
62 | } |
||
63 | } |
||
64 | } |