mirror of
https://github.com/Nathanwoodburn/FireWallet.git
synced 2024-11-23 23:58:14 +11:00
splash: Added splash screen fade in out
This commit is contained in:
parent
742cd9bafd
commit
9f0f7214e2
BIN
FireWallet/FW.ico
Normal file
BIN
FireWallet/FW.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
@ -6,7 +6,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<ApplicationIcon>favicon.ico</ApplicationIcon>
|
||||
<ApplicationIcon>FW.ico</ApplicationIcon>
|
||||
<Title>FireWallet</Title>
|
||||
<PackageProjectUrl>https://l.woodburn.au</PackageProjectUrl>
|
||||
<PackageIcon>HSDBatcher.png</PackageIcon>
|
||||
@ -16,7 +16,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="favicon.ico" />
|
||||
<Content Include="FW.ico" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -142,13 +142,21 @@ namespace FireWallet
|
||||
}
|
||||
}
|
||||
Application.DoEvents();
|
||||
|
||||
while (!ss.IsClosed)
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
Application.DoEvents();
|
||||
}
|
||||
}
|
||||
AddLog("Loaded");
|
||||
|
||||
|
||||
// Pull form to front
|
||||
Opacity = 1;
|
||||
|
||||
this.WindowState = FormWindowState.Minimized;
|
||||
this.Show();
|
||||
this.Opacity = 1;
|
||||
this.WindowState = FormWindowState.Normal;
|
||||
textBoxaccountpassword.Focus();
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
10
FireWallet/Properties/Resources.Designer.cs
generated
10
FireWallet/Properties/Resources.Designer.cs
generated
@ -59,5 +59,15 @@ namespace FireWallet.Properties {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap FWSplash {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("FWSplash", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -117,4 +117,8 @@
|
||||
<resheader name="writer">
|
||||
<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="FWSplash" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\FWSplash.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
BIN
FireWallet/Resources/FWSplash.png
Normal file
BIN
FireWallet/Resources/FWSplash.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 50 KiB |
50
FireWallet/SplashScreen.Designer.cs
generated
50
FireWallet/SplashScreen.Designer.cs
generated
@ -28,11 +28,18 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SplashScreen));
|
||||
label1 = new Label();
|
||||
pictureBox1 = new PictureBox();
|
||||
label2 = new Label();
|
||||
panelNew = new Panel();
|
||||
pictureBoxNew = new PictureBox();
|
||||
timerIn = new System.Windows.Forms.Timer(components);
|
||||
timerOut = new System.Windows.Forms.Timer(components);
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
|
||||
panelNew.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxNew).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
@ -67,12 +74,45 @@
|
||||
label2.Text = "Nathan.Woodburn/";
|
||||
label2.Click += label2_Click;
|
||||
//
|
||||
// panelNew
|
||||
//
|
||||
panelNew.Controls.Add(pictureBoxNew);
|
||||
panelNew.Dock = DockStyle.Fill;
|
||||
panelNew.Location = new Point(0, 0);
|
||||
panelNew.Name = "panelNew";
|
||||
panelNew.Size = new Size(450, 450);
|
||||
panelNew.TabIndex = 3;
|
||||
//
|
||||
// pictureBoxNew
|
||||
//
|
||||
pictureBoxNew.BackColor = Color.Black;
|
||||
pictureBoxNew.Dock = DockStyle.Fill;
|
||||
pictureBoxNew.Image = Properties.Resources.FWSplash;
|
||||
pictureBoxNew.InitialImage = null;
|
||||
pictureBoxNew.Location = new Point(0, 0);
|
||||
pictureBoxNew.Name = "pictureBoxNew";
|
||||
pictureBoxNew.Size = new Size(450, 450);
|
||||
pictureBoxNew.SizeMode = PictureBoxSizeMode.Zoom;
|
||||
pictureBoxNew.TabIndex = 0;
|
||||
pictureBoxNew.TabStop = false;
|
||||
pictureBoxNew.Visible = false;
|
||||
//
|
||||
// timerIn
|
||||
//
|
||||
timerIn.Enabled = true;
|
||||
timerIn.Tick += timerIn_Tick;
|
||||
//
|
||||
// timerOut
|
||||
//
|
||||
timerOut.Tick += timerOut_Tick;
|
||||
//
|
||||
// SplashScreen
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackColor = Color.Black;
|
||||
ClientSize = new Size(444, 435);
|
||||
ClientSize = new Size(450, 450);
|
||||
Controls.Add(panelNew);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(pictureBox1);
|
||||
Controls.Add(label1);
|
||||
@ -83,8 +123,12 @@
|
||||
ShowInTaskbar = false;
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "FireWallet";
|
||||
TopMost = true;
|
||||
FormClosing += SplashScreen_FormClosing;
|
||||
Load += SplashScreen_Load;
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
|
||||
panelNew.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxNew).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
@ -93,5 +137,9 @@
|
||||
private Label label1;
|
||||
private PictureBox pictureBox1;
|
||||
private Label label2;
|
||||
private Panel panelNew;
|
||||
private PictureBox pictureBoxNew;
|
||||
private System.Windows.Forms.Timer timerIn;
|
||||
private System.Windows.Forms.Timer timerOut;
|
||||
}
|
||||
}
|
@ -1,13 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing.Imaging;
|
||||
//using Microsoft.DirectX.AudioVideoPlayback;
|
||||
|
||||
|
||||
namespace FireWallet
|
||||
{
|
||||
@ -17,6 +11,7 @@ namespace FireWallet
|
||||
{
|
||||
InitializeComponent();
|
||||
close = false;
|
||||
IsClosed = false;
|
||||
}
|
||||
bool close;
|
||||
private void SplashScreen_FormClosing(object sender, FormClosingEventArgs e)
|
||||
@ -26,10 +21,14 @@ namespace FireWallet
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
public bool IsClosed { get; set; }
|
||||
public void CloseSplash()
|
||||
{
|
||||
close = true;
|
||||
this.Close();
|
||||
|
||||
// Fade out
|
||||
timerIn.Stop();
|
||||
timerOut.Start();
|
||||
}
|
||||
|
||||
private void label2_Click(object sender, EventArgs e)
|
||||
@ -41,5 +40,73 @@ namespace FireWallet
|
||||
};
|
||||
Process.Start(psi);
|
||||
}
|
||||
Bitmap splash = new Bitmap(Properties.Resources.FWSplash);
|
||||
private void SplashScreen_Load(object sender, EventArgs e)
|
||||
{
|
||||
pictureBoxNew.Visible = true;
|
||||
this.TransparencyKey = Color.FromArgb(0, 0, 0);
|
||||
pictureBoxNew.Invalidate();
|
||||
}
|
||||
public Image SetImageOpacity(Image image, float opacity)
|
||||
{
|
||||
try
|
||||
{
|
||||
//create a Bitmap the size of the image provided
|
||||
Bitmap bmp = new Bitmap(image.Width, image.Height);
|
||||
|
||||
//create a graphics object from the image
|
||||
using (Graphics gfx = Graphics.FromImage(bmp))
|
||||
{
|
||||
|
||||
//create a color matrix object
|
||||
ColorMatrix matrix = new ColorMatrix();
|
||||
|
||||
//set the opacity
|
||||
matrix.Matrix33 = opacity;
|
||||
|
||||
//create image attributes
|
||||
ImageAttributes attributes = new ImageAttributes();
|
||||
|
||||
//set the color(opacity) of the image
|
||||
attributes.SetColorMatrix(matrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
|
||||
|
||||
//now draw the image
|
||||
gfx.DrawImage(image, new Rectangle(0, 0, bmp.Width, bmp.Height), 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, attributes);
|
||||
}
|
||||
return bmp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
float opacity = 0.0f;
|
||||
|
||||
private void timerIn_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (opacity >= 1)
|
||||
{
|
||||
timerIn.Stop();
|
||||
return;
|
||||
}
|
||||
opacity += 0.05f;
|
||||
pictureBoxNew.Image = SetImageOpacity(splash, opacity);
|
||||
pictureBoxNew.Invalidate();
|
||||
}
|
||||
|
||||
private void timerOut_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (opacity <= 0)
|
||||
{
|
||||
timerOut.Stop();
|
||||
IsClosed = true;
|
||||
this.Close();
|
||||
return;
|
||||
}
|
||||
opacity -= 0.05f;
|
||||
pictureBoxNew.Image = SetImageOpacity(splash, opacity);
|
||||
pictureBoxNew.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -898,6 +898,12 @@
|
||||
AAAAAAAAAAAAAADQwWbM+D8RAPjBClJL0gAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="timerIn.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="timerOut.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>104, 17</value>
|
||||
</metadata>
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAABAAEAAAAAAAEAIAB2pAAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAOEAAADAAgGAAAAfG+p9QAAIABJ
|
||||
|
Loading…
Reference in New Issue
Block a user