aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.ServerApplication/Splash
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-12-13 10:48:35 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-12-13 10:48:35 -0500
commitd00178d8f0002638d47174c0bd73ebcf1ac5f6fd (patch)
tree43c0cf805efb5524cc7faa9f795a9edd52768014 /MediaBrowser.ServerApplication/Splash
parent065a8ea21e956e148cb1637c669895bbb1b1af5b (diff)
support progress bar while splash window is up
Diffstat (limited to 'MediaBrowser.ServerApplication/Splash')
-rw-r--r--MediaBrowser.ServerApplication/Splash/SplashWindow.xaml13
-rw-r--r--MediaBrowser.ServerApplication/Splash/SplashWindow.xaml.cs37
2 files changed, 34 insertions, 16 deletions
diff --git a/MediaBrowser.ServerApplication/Splash/SplashWindow.xaml b/MediaBrowser.ServerApplication/Splash/SplashWindow.xaml
index 315c88cd2..b35eadd06 100644
--- a/MediaBrowser.ServerApplication/Splash/SplashWindow.xaml
+++ b/MediaBrowser.ServerApplication/Splash/SplashWindow.xaml
@@ -2,13 +2,18 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="386.939" Width="664.49" WindowStartupLocation="CenterScreen" Title="Media Browser Server" ShowInTaskbar="True" WindowStyle="None" BorderThickness="1" BorderBrush="#cccccc" AllowsTransparency="True">
- <Border BorderBrush="DarkGray" BorderThickness="2" Margin="0,0,0,0">
- <Grid Margin="-2,0,0,0">
- <Image x:Name="imgLogo" HorizontalAlignment="Center" Height="146" Margin="0,10,44,0" VerticalAlignment="Top" Width="616" Source="/Resources/Images/mb3logo800.png" Opacity="0.5"/>
+
+ <Border BorderBrush="DarkGray" BorderThickness="1">
+ <Grid>
+
+ <Image HorizontalAlignment="Center" Height="146" Margin="0,10,44,0" VerticalAlignment="Top" Width="616" Source="/Resources/Images/mb3logo800.png" Opacity="0.5"/>
+
<Grid HorizontalAlignment="Left" Height="153" Margin="0,173,0,0" VerticalAlignment="Top" Width="662" Background="Gray">
+
<TextBlock x:Name="lblStatus" HorizontalAlignment="Left" Margin="12,14,0,18" Width="637" FontSize="36" Foreground="#FFE6D7D7" Text="Loading Media Browser Server..." TextWrapping="WrapWithOverflow"/>
+
<Rectangle Fill="#FF49494B" HorizontalAlignment="Left" Height="13" Stroke="Black" VerticalAlignment="Bottom" Width="662"/>
- <Rectangle x:Name="rectProgress" Fill="#FF0A0ABF" HorizontalAlignment="Left" Height="13" Stroke="Black" VerticalAlignment="Bottom" Width="0"/>
+ <Rectangle x:Name="RectProgress" Fill="#52B54B" HorizontalAlignment="Left" Height="13" Stroke="Black" VerticalAlignment="Bottom" Width="0"/>
</Grid>
</Grid>
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);
}
}
}