/// <summary>Asynchronously creates and initialises a <see cref="UpdateWindow"/>.</summary> public static async Task CreateAsync(Window Window) { if (Instance != null) { Instance.Show(); } else { Window.Dispatcher.Invoke(() => { UpdateWindow UC = new UpdateWindow { ParentWindow = Window }; UC.Init(); }); await Task.Delay(300).ConfigureAwait(false); } }
/// <summary>Initialises a new instance of the <see cref="UpdateWindow"/> class.</summary> public UpdateWindow() { InitializeComponent(); Instance = this; }
// ReSharper disable once AsyncConverter.AsyncAwaitMayBeElidedHighlighting /// <summary>Asynchronously handles the <c>Loaded</c> event of this (<see cref="MahApps.Metro.Controls.MetroWindow"/>) control. /// <para/>Calls <see cref="UpdateWindow"/>.<see cref="UpdateWindow.CreateAsync(Window)"/> to ensure the application checks for any available updates, and notifies the user if one is available.</summary> /// <param name="Sender">The source of the event.</param> /// <param name="E">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> async void MetroWindow_Loaded(object Sender, RoutedEventArgs E) => await UpdateWindow.CreateAsync(this).ConfigureAwait(false);