support progress bar while splash window is up

This commit is contained in:
Luke Pulverenti
2013-12-13 10:48:35 -05:00
parent 065a8ea21e
commit d00178d8f0
7 changed files with 126 additions and 72 deletions

View File

@@ -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);
}
}
}