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

@ -124,19 +124,10 @@ namespace MediaBrowser.ServerApplication
_mainWindow = win;
}
private void HideMainWindow()
{
if (_mainWindow != null)
{
_mainWindow.Hide();
_mainWindow = null;
}
}
private SplashWindow _splashWindow;
private SplashForm _splashWindow;
private void ShowSplashWindow(Progress<double> progress)
{
var win = new SplashWindow(_appHost.ApplicationVersion, progress);
var win = new SplashForm(_appHost.ApplicationVersion, progress);
win.Show();
_splashWindow = win;

View File

@ -196,8 +196,11 @@
<Compile Include="Networking\NativeMethods.cs" />
<Compile Include="Networking\NetworkManager.cs" />
<Compile Include="Networking\NetworkShares.cs" />
<Compile Include="Splash\SplashWindow.xaml.cs">
<DependentUpon>SplashWindow.xaml</DependentUpon>
<Compile Include="Splash\SplashForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Splash\SplashForm.Designer.cs">
<DependentUpon>SplashForm.cs</DependentUpon>
</Compile>
<Page Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
@ -220,10 +223,6 @@
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="Splash\SplashWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
@ -249,6 +248,9 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Splash\SplashForm.resx">
<DependentUpon>SplashForm.cs</DependentUpon>
</EmbeddedResource>
<None Include="app.manifest" />
<None Include="FFMpeg\ARIALUNI.7z" />
<None Include="FFMpeg\ffmpeg-20130904-git-f974289-win32-static.7z" />
@ -302,42 +304,6 @@
<ItemGroup>
<Resource Include="Resources\Images\icon.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Images\folder.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Images\movie.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Images\series.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Images\season.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Images\episode.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Images\audio.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Images\artist.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Images\persons.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Images\album.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Images\boxset.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Images\trailer.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Images\folder.jpg" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.5">
<Visible>False</Visible>

View File

@ -1,17 +1,17 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.17626
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace MediaBrowser.ServerApplication.Properties
{
namespace MediaBrowser.ServerApplication.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
@ -22,50 +22,52 @@ namespace MediaBrowser.ServerApplication.Properties
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MediaBrowser.ServerApplication.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set
{
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap mb3logo800 {
get {
object obj = ResourceManager.GetObject("mb3logo800", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@ -60,6 +60,7 @@
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
@ -68,9 +69,10 @@
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
@ -85,9 +87,10 @@
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
@ -109,9 +112,13 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="mb3logo800" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Images\mb3logo800.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

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