|
@@ -1,5 +1,7 @@
|
|
using InABox.Wpf;
|
|
using InABox.Wpf;
|
|
using System;
|
|
using System;
|
|
|
|
+using System.ComponentModel;
|
|
|
|
+using System.Runtime.CompilerServices;
|
|
using System.Windows;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media;
|
|
@@ -10,7 +12,7 @@ namespace InABox.WPF
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Interaction logic for ProgressForm.xaml
|
|
/// Interaction logic for ProgressForm.xaml
|
|
/// </summary>
|
|
/// </summary>
|
|
- public partial class ProgressForm : ThemableWindow
|
|
|
|
|
|
+ public partial class ProgressForm : ThemableWindow, INotifyPropertyChanged
|
|
{
|
|
{
|
|
private ImageSource? _image = null;
|
|
private ImageSource? _image = null;
|
|
|
|
|
|
@@ -25,6 +27,17 @@ namespace InABox.WPF
|
|
|
|
|
|
public Visibility CancelButtonVisibility => HasCancelButton ? Visibility.Visible : Visibility.Collapsed;
|
|
public Visibility CancelButtonVisibility => HasCancelButton ? Visibility.Visible : Visibility.Collapsed;
|
|
|
|
|
|
|
|
+ private string _message;
|
|
|
|
+ public string Message
|
|
|
|
+ {
|
|
|
|
+ get => _message;
|
|
|
|
+ set
|
|
|
|
+ {
|
|
|
|
+ _message = value;
|
|
|
|
+ Progress.Content = _message;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
private ProgressForm(string cancelText, bool hasCancelButton)
|
|
private ProgressForm(string cancelText, bool hasCancelButton)
|
|
{
|
|
{
|
|
CancelText = cancelText;
|
|
CancelText = cancelText;
|
|
@@ -52,9 +65,9 @@ namespace InABox.WPF
|
|
public void UpdateWindow(string message)
|
|
public void UpdateWindow(string message)
|
|
{
|
|
{
|
|
if (Progress.Dispatcher.CheckAccess())
|
|
if (Progress.Dispatcher.CheckAccess())
|
|
- Progress.Content = message;
|
|
|
|
|
|
+ Message = message;
|
|
else
|
|
else
|
|
- Progress.Dispatcher.Invoke(() => { Progress.Content = message; });
|
|
|
|
|
|
+ Progress.Dispatcher.Invoke(() => { Message = message; });
|
|
}
|
|
}
|
|
|
|
|
|
public void CloseWindow()
|
|
public void CloseWindow()
|
|
@@ -67,7 +80,7 @@ namespace InABox.WPF
|
|
|
|
|
|
public string GetMessage()
|
|
public string GetMessage()
|
|
{
|
|
{
|
|
- return Progress.Content as string;
|
|
|
|
|
|
+ return Message;
|
|
}
|
|
}
|
|
|
|
|
|
private void Window_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
|
private void Window_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
|
@@ -82,5 +95,11 @@ namespace InABox.WPF
|
|
{
|
|
{
|
|
OnCancelled?.Invoke();
|
|
OnCancelled?.Invoke();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public event PropertyChangedEventHandler? PropertyChanged;
|
|
|
|
+ protected void OnPropertyChanged([CallerMemberName] string propertyName = "")
|
|
|
|
+ {
|
|
|
|
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|