forked from NetSparkleUpdater/NetSparkle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCheckingForUpdatesWindow.axaml.cs
More file actions
64 lines (58 loc) · 1.92 KB
/
CheckingForUpdatesWindow.axaml.cs
File metadata and controls
64 lines (58 loc) · 1.92 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
using Avalonia;
using Avalonia.Controls;
using Avalonia.Media.Imaging;
using NetSparkleUpdater.Interfaces;
using System;
namespace NetSparkleUpdater.UI.Avalonia
{
/// <summary>
/// Interaction logic for CheckingForUpdatesWindow.xaml.
///
/// Window that shows while NetSparkle is checking for updates.
/// </summary>
public partial class CheckingForUpdatesWindow : Window, ICheckingForUpdates
{
/// <inheritdoc/>
public event EventHandler? UpdatesUIClosing;
/// <summary>
/// Create the window that tells the user that SparkleUpdater is checking
/// for updates
/// </summary>
public CheckingForUpdatesWindow()
{
this.InitializeComponent();
Closing += CheckingForUpdatesWindow_Closing;
}
/// <summary>
/// Create the window that tells the user that SparkleUpdater is checking
/// for updates with a given bitmap to use as an icon/graphic
/// </summary>
/// <param name="iconBitmap">The bitmap to use for the application logo/graphic</param>
public CheckingForUpdatesWindow(Bitmap? iconBitmap)
{
this.InitializeComponent();
#if DEBUG
Application.Current?.AttachDeveloperTools();
#endif
Closing += CheckingForUpdatesWindow_Closing;
var imageControl = this.FindControl<Image>("AppIcon");
if (imageControl != null)
{
imageControl.Source = iconBitmap;
}
}
private void CheckingForUpdatesWindow_Closing(object? sender, System.ComponentModel.CancelEventArgs e)
{
Closing -= CheckingForUpdatesWindow_Closing;
UpdatesUIClosing?.Invoke(sender, new EventArgs());
}
void ICheckingForUpdates.Close()
{
Close();
}
void ICheckingForUpdates.Show()
{
Show();
}
}
}