| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 | using InABox.Wpf;using System;using System.Windows;using System.Windows.Controls;using System.Windows.Media;using System.Windows.Media.Animation;namespace InABox.WPF{    /// <summary>    ///     Interaction logic for ProgressForm.xaml    /// </summary>    public partial class ProgressForm : ThemableWindow    {        private ImageSource? _image = null;        private DoubleAnimation _fader = new DoubleAnimation(1d, 0.1d, new Duration(TimeSpan.FromSeconds(2))) { AutoReverse = true };        public ProgressForm()        {            InitializeComponent();            Topmost = true;            Loaded += (sender, args) =>            {                _fader.Completed += (o, e) => Splash.BeginAnimation(Image.OpacityProperty, _fader);                Splash.BeginAnimation(Image.OpacityProperty, _fader);            };        }                public ImageSource? DisplayImage        {            get => Splash.Source;            set => Splash.Source = value;        }                public void UpdateWindow(string message)        {            if (Progress.Dispatcher.CheckAccess())                Progress.Content = message;            else                Progress.Dispatcher.Invoke(() => { Progress.Content = message; });        }        public void CloseWindow()        {            if (Progress.Dispatcher.CheckAccess())                Close();            else                Progress.Dispatcher.Invoke(() => { Close(); });        }        public string GetMessage()        {            return Progress.Content as string;        }        private void Window_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)        {            if(e.ChangedButton == System.Windows.Input.MouseButton.Left)            {                DragMove();            }        }    }}
 |