convert splash window to win forms

This commit is contained in:
Luke Pulverenti
2014-02-15 13:08:25 -05:00
parent 60213b2d3c
commit bf1c36ba61
21 changed files with 2746 additions and 146 deletions

View File

@@ -0,0 +1,178 @@
namespace MediaBrowser.ServerApplication.Splash
{
partial class SplashForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SplashForm));
this.panelMainContainer = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.panelProgress = new System.Windows.Forms.Panel();
this.panel4 = new System.Windows.Forms.Panel();
this.lblVersion = new System.Windows.Forms.Label();
this.lblStatus = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.panelMainContainer.SuspendLayout();
this.panel2.SuspendLayout();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// panelMainContainer
//
this.panelMainContainer.BackColor = System.Drawing.Color.Gray;
this.panelMainContainer.Controls.Add(this.panel3);
this.panelMainContainer.Controls.Add(this.panel2);
this.panelMainContainer.Controls.Add(this.panel1);
this.panelMainContainer.Dock = System.Windows.Forms.DockStyle.Fill;
this.panelMainContainer.Location = new System.Drawing.Point(0, 0);
this.panelMainContainer.Name = "panelMainContainer";
this.panelMainContainer.Padding = new System.Windows.Forms.Padding(1);
this.panelMainContainer.Size = new System.Drawing.Size(648, 347);
this.panelMainContainer.TabIndex = 0;
//
// panel3
//
this.panel3.BackColor = System.Drawing.Color.White;
this.panel3.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel3.Location = new System.Drawing.Point(1, 277);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(646, 69);
this.panel3.TabIndex = 2;
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.Gray;
this.panel2.Controls.Add(this.panelProgress);
this.panel2.Controls.Add(this.panel4);
this.panel2.Controls.Add(this.lblVersion);
this.panel2.Controls.Add(this.lblStatus);
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.Location = new System.Drawing.Point(1, 141);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(646, 205);
this.panel2.TabIndex = 1;
//
// panelProgress
//
this.panelProgress.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(82)))), ((int)(((byte)(181)))), ((int)(((byte)(75)))));
this.panelProgress.Location = new System.Drawing.Point(0, 125);
this.panelProgress.Name = "panelProgress";
this.panelProgress.Size = new System.Drawing.Size(0, 13);
this.panelProgress.TabIndex = 3;
//
// panel4
//
this.panel4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(73)))), ((int)(((byte)(73)))), ((int)(((byte)(73)))));
this.panel4.Location = new System.Drawing.Point(0, 125);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(648, 13);
this.panel4.TabIndex = 2;
//
// lblVersion
//
this.lblVersion.AutoSize = true;
this.lblVersion.Font = new System.Drawing.Font("Segoe UI", 32F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblVersion.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(215)))), ((int)(((byte)(215)))));
this.lblVersion.Location = new System.Drawing.Point(3, 59);
this.lblVersion.MaximumSize = new System.Drawing.Size(0, 100);
this.lblVersion.Name = "lblVersion";
this.lblVersion.Size = new System.Drawing.Size(270, 59);
this.lblVersion.TabIndex = 1;
this.lblVersion.Text = "Version 1234";
//
// lblStatus
//
this.lblStatus.AutoSize = true;
this.lblStatus.Font = new System.Drawing.Font("Segoe UI", 32F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblStatus.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(215)))), ((int)(((byte)(215)))));
this.lblStatus.Location = new System.Drawing.Point(3, 0);
this.lblStatus.MaximumSize = new System.Drawing.Size(0, 100);
this.lblStatus.Name = "lblStatus";
this.lblStatus.Size = new System.Drawing.Size(599, 59);
this.lblStatus.TabIndex = 0;
this.lblStatus.Text = "Loading Media Browser Server";
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.White;
this.panel1.Controls.Add(this.pictureBox1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(1, 1);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(646, 140);
this.panel1.TabIndex = 0;
//
// pictureBox1
//
this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBox1.Image = global::MediaBrowser.ServerApplication.Properties.Resources.mb3logo800;
this.pictureBox1.Location = new System.Drawing.Point(0, 0);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(646, 140);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// SplashForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(648, 347);
this.ControlBox = false;
this.Controls.Add(this.panelMainContainer);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "SplashForm";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Media Browser";
this.panelMainContainer.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel panelMainContainer;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Label lblStatus;
private System.Windows.Forms.Label lblVersion;
private System.Windows.Forms.Panel panel4;
private System.Windows.Forms.Panel panelProgress;
private System.Windows.Forms.PictureBox pictureBox1;
}
}

View File

@@ -0,0 +1,45 @@
using System;
using System.ComponentModel;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MediaBrowser.ServerApplication.Splash
{
public partial class SplashForm : Form
{
private readonly TaskScheduler _uiThread;
private readonly Progress<double> _progress;
public SplashForm(Version version, Progress<double> progress)
{
InitializeComponent();
lblVersion.Text = string.Format("Version {0}...", version);
_progress = progress;
progress.ProgressChanged += progress_ProgressChanged;
_uiThread = TaskScheduler.FromCurrentSynchronizationContext();
}
async void progress_ProgressChanged(object sender, double e)
{
await Task.Factory.StartNew(() =>
{
var width = e * 6.48;
panelProgress.Width = Convert.ToInt32(width);
}, CancellationToken.None, TaskCreationOptions.None, _uiThread);
}
protected override void OnClosing(CancelEventArgs e)
{
_progress.ProgressChanged += progress_ProgressChanged;
base.OnClosing(e);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,21 +0,0 @@
<Window x:Class="MediaBrowser.ServerApplication.Splash.SplashWindow"
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="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="#52B54B" HorizontalAlignment="Left" Height="13" Stroke="Black" VerticalAlignment="Bottom" Width="0"/>
</Grid>
</Grid>
</Border>
</Window>

View File

@@ -1,41 +0,0 @@
using System;
using System.ComponentModel;
using System.Windows;
namespace MediaBrowser.ServerApplication.Splash
{
/// <summary>
/// Interaction logic for SplashWindow.xaml
/// </summary>
public partial class SplashWindow : Window
{
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);
}
}
}