diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-12-13 10:48:35 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-12-13 10:48:35 -0500 |
| commit | d00178d8f0002638d47174c0bd73ebcf1ac5f6fd (patch) | |
| tree | 43c0cf805efb5524cc7faa9f795a9edd52768014 /MediaBrowser.ServerApplication/Splash/SplashWindow.xaml.cs | |
| parent | 065a8ea21e956e148cb1637c669895bbb1b1af5b (diff) | |
support progress bar while splash window is up
Diffstat (limited to 'MediaBrowser.ServerApplication/Splash/SplashWindow.xaml.cs')
| -rw-r--r-- | MediaBrowser.ServerApplication/Splash/SplashWindow.xaml.cs | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/MediaBrowser.ServerApplication/Splash/SplashWindow.xaml.cs b/MediaBrowser.ServerApplication/Splash/SplashWindow.xaml.cs index db2f1dbc4..29eb4bf45 100644 --- a/MediaBrowser.ServerApplication/Splash/SplashWindow.xaml.cs +++ b/MediaBrowser.ServerApplication/Splash/SplashWindow.xaml.cs @@ -1,16 +1,6 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.ComponentModel; using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Shapes; namespace MediaBrowser.ServerApplication.Splash { @@ -19,10 +9,33 @@ namespace MediaBrowser.ServerApplication.Splash /// </summary> public partial class SplashWindow : Window { - public SplashWindow(Version version) + private readonly Progress<double> _progress; + + public SplashWindow(Version version, Progress<double> progress) { InitializeComponent(); lblStatus.Text = string.Format("Loading Media Browser Server\nVersion {0}...", version); + + _progress = progress; + + progress.ProgressChanged += progress_ProgressChanged; + } + + void progress_ProgressChanged(object sender, double e) + { + Dispatcher.InvokeAsync(() => + { + var width = e * 6.62; + + RectProgress.Width = width; + }); + } + + protected override void OnClosing(CancelEventArgs e) + { + _progress.ProgressChanged += progress_ProgressChanged; + + base.OnClosing(e); } } } |
