splash: begin work on new splash

This commit is contained in:
Nick Vella 2019-08-16 00:07:04 +10:00
parent 654465e576
commit e543266caa
10 changed files with 446 additions and 227 deletions

69
logotype.svg Normal file
View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="439"
height="248"
viewBox="0 0 116.15208 65.616669"
version="1.1"
id="svg4639"
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
sodipodi:docname="logotype.svg">
<defs
id="defs4633" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.98994949"
inkscape:cx="27.052336"
inkscape:cy="109.95002"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
units="px"
inkscape:window-width="1920"
inkscape:window-height="1027"
inkscape:window-x="-8"
inkscape:window-y="635"
inkscape:window-maximized="1" />
<metadata
id="metadata4636">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-231.38331)">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.40555573px;line-height:1.25;font-family:'Segoe UI';-inkscape-font-specification:'Segoe UI, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="-0.61529404"
y="293.91696"
id="text5198"><tspan
sodipodi:role="line"
id="tspan5196"
x="-0.61529404"
y="293.91696"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.40555573px;font-family:'Segoe UI';-inkscape-font-specification:'Segoe UI, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:-0.15875px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;stroke-width:0.26458332">Open Live Writer</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -0,0 +1,162 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace OpenLiveWriter.CoreServices {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Exceptions {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Exceptions() {
}
/// <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 (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenLiveWriter.CoreServices.Exceptions", typeof(Exceptions).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 {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to The specified path ({0}) is invalid.
/// </summary>
internal static string SiteStorageException_InvalidPath {
get {
return ResourceManager.GetString("SiteStorageException.InvalidPath", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The specified RootFile value (&quot;{0}&quot;) is invalid.
/// </summary>
internal static string SiteStorageException_InvalidRootFileName {
get {
return ResourceManager.GetString("SiteStorageException.InvalidRootFileName", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Error accessing manifest for site at {0}.
/// </summary>
internal static string SiteStorageException_ManifestAccessError {
get {
return ResourceManager.GetString("SiteStorageException.ManifestAccessError", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to A RootFile was not specified for the site.
/// </summary>
internal static string SiteStorageException_NoRootFileSpecified {
get {
return ResourceManager.GetString("SiteStorageException.NoRootFileSpecified", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Error accessing path {0}.
/// </summary>
internal static string SiteStorageException_PathAccessError {
get {
return ResourceManager.GetString("SiteStorageException.PathAccessError", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Could not locate the path {0}.
/// </summary>
internal static string SiteStorageException_PathNotFound {
get {
return ResourceManager.GetString("SiteStorageException.PathNotFound", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to A Stream that was written to was not closed prior to attempting to read from it (path = {0}).
/// </summary>
internal static string SiteStorageException_StreamNotClosed {
get {
return ResourceManager.GetString("SiteStorageException.StreamNotClosed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Error copying site from {0} to {1}.
/// </summary>
internal static string SiteStorageException_UnableToCopySite {
get {
return ResourceManager.GetString("SiteStorageException.UnableToCopySite", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Unable to create storage at {0}.
/// </summary>
internal static string SiteStorageException_UnableToCreateStorage {
get {
return ResourceManager.GetString("SiteStorageException.UnableToCreateStorage", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Error deleting site at {0}.
/// </summary>
internal static string SiteStorageException_UnableToDeleteSite {
get {
return ResourceManager.GetString("SiteStorageException.UnableToDeleteSite", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Error moving site from {0} to {1}.
/// </summary>
internal static string SiteStorageException_UnableToMoveSite {
get {
return ResourceManager.GetString("SiteStorageException.UnableToMoveSite", resourceCulture);
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -134,6 +134,11 @@
<Compile Include="DisposableCursor.cs" />
<Compile Include="DragDropHelper.cs" />
<Compile Include="EventCounter.cs" />
<Compile Include="Exceptions.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Exceptions.resx</DependentUpon>
</Compile>
<Compile Include="ExifMetadata.cs" />
<Compile Include="FileHelper.cs" />
<Compile Include="FileItem.cs" />
@ -325,6 +330,8 @@
</EmbeddedResource>
<EmbeddedResource Include="Exceptions.resx">
<SubType>Designer</SubType>
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Exceptions.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Images\ApplicationIcon.ico" />
<EmbeddedResource Include="Images\SplashScreen.png" />
@ -343,6 +350,10 @@
<ItemGroup>
<EmbeddedResource Include="Images\SplashScreenLogo.jpg" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Images\NetFoundationLogo.png" />
<EmbeddedResource Include="Images\SplashScreenLogo.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(RepoRoot)\writer.build.targets" />
<PropertyGroup>
@ -356,19 +367,14 @@
<MarketsSourceFiles Include="$(MarketsSourceDataFolder)\**\*.xml" />
</ItemGroup>
</Target>
<Target Name="GenerateMarketXml" DependsOnTargets="ResolveProjectReferences;GenerateMarketXmlDeps;GenerateMarketXmlCopyMaster;GenerateMarketXmlImpl" BeforeTargets="CoreCompile">
</Target>
<Target Name="GenerateMarketXmlImpl" Inputs="@(MarketsSourceFiles)" Outputs="$(MarketsXmlPath)">
<Exec Command="&quot;$(OutDir)MarketXmlGenerator.exe&quot; &quot;$(MarketsSourceDataFolder)&quot; &quot;$(MarketsXmlPath)&quot;" />
</Target>
<Target Name="GenerateMarketXmlCopyMaster" Inputs="$(MasterXmlPath)" Outputs="$(MasterXmlOutput)">
<MakeDir Directories="$(MSBuildProjectDirectory)\Marketization" Condition="!Exists('$(MSBuildProjectDirectory)\Marketization')" />
<Copy SourceFiles="$(MasterXmlPath)" DestinationFiles="$(MasterXmlOutput)" />
</Target>
<Target Name="_CopyFilesMarkedCopyLocal" />
</Project>

View File

@ -10,6 +10,7 @@ using System.Windows.Forms;
using OpenLiveWriter.Interop.Windows;
using OpenLiveWriter.Localization;
using OpenLiveWriter.Localization.Bidi;
using System.Diagnostics;
namespace OpenLiveWriter.CoreServices
{
@ -22,12 +23,14 @@ namespace OpenLiveWriter.CoreServices
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
private Label labelStatus;
private Bitmap _logoBitmap;
private PictureBox pictureBoxLogo;
private Bitmap _fdnLogoBitmap;
private PictureBox pictureBoxFdnLogo;
private System.Windows.Forms.Timer timerAnimation;
/// <summary>
/// Background image
/// </summary>
private Bitmap _backgroundImage;
private Bitmap _logoImage;
private int _ticks = 0;
public SplashScreen()
{
@ -37,168 +40,63 @@ namespace OpenLiveWriter.CoreServices
InitializeComponent();
DisplayHelper.Scale(this);
// Turn off CS_CLIPCHILDREN.
User32.SetWindowLong(Handle, GWL.STYLE, User32.GetWindowLong(Handle, GWL.STYLE) & ~WS.CLIPCHILDREN);
// Turn on double buffered painting.
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true);
if (!BidiHelper.IsRightToLeft)
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
//SetStyle(ControlStyles.UserPaint, true);
//SetStyle(ControlStyles.DoubleBuffer, true);
//if (!BidiHelper.IsRightToLeft)
// SetStyle(ControlStyles.AllPaintingInWmPaint, true);
_backgroundImage = DisplayHelper.ScaleBitmap(new Bitmap(this.GetType(), "Images.SplashScreen.png"));
_logoImage = DisplayHelper.ScaleBitmap(new Bitmap(this.GetType(), "Images.SplashScreenLogo.jpg"));
if (SystemInformation.HighContrast)
{
ImageHelper.ConvertToHighContrast(_backgroundImage);
ImageHelper.ConvertToHighContrast(_logoImage);
}
}
private const int WS_EX_TOOLWINDOW = 0x00000080;
private const int WS_EX_APPWINDOW = 0x00040000;
private const int WS_EX_LAYERED = 0x00080000;
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle &= ~WS_EX_APPWINDOW;
cp.ExStyle |= WS_EX_TOOLWINDOW;
cp.ExStyle |= WS_EX_LAYERED;
return cp;
}
//if (SystemInformation.HighContrast)
//{
// ImageHelper.ConvertToHighContrast(_backgroundImage);
// ImageHelper.ConvertToHighContrast(_logoImage);
//}
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
UpdateBitmap();
LoadScaledImages();
// Create the timer
timerAnimation = new System.Windows.Forms.Timer();
timerAnimation.Interval = 17; // 60 FPS rounded up
timerAnimation.Tick += new EventHandler(AnimationTick);
timerAnimation.Enabled = true;
timerAnimation.Start();
}
private void UpdateBitmap()
private void LoadScaledImages()
{
using (Bitmap bitmap = CreateBitmap())
{
IntPtr screenDC = User32.GetDC(IntPtr.Zero);
try
{
IntPtr memDC = Gdi32.CreateCompatibleDC(screenDC);
try
{
IntPtr hBitmap = bitmap.GetHbitmap(Color.FromArgb(0));
try
{
IntPtr hOrigBitmap = Gdi32.SelectObject(memDC, hBitmap);
try
{
POINT dst = new POINT();
dst.x = Left;
dst.y = Top;
const float scaleFactor = 2f; // Assume logos are already at 2x scaling
var fdnLogoBmp = new Bitmap(this.GetType(), "Images.NetFoundationLogo.png");
var logoBmp = new Bitmap(this.GetType(), "Images.SplashScreenLogo.png");
SIZE size = new SIZE();
size.cx = bitmap.Width;
size.cy = bitmap.Height;
var fdnLogoSize = new Size(
(int)Math.Ceiling(fdnLogoBmp.Width * (DisplayHelper.ScalingFactorX / scaleFactor)),
(int)Math.Ceiling(fdnLogoBmp.Height * (DisplayHelper.ScalingFactorY / scaleFactor)));
_fdnLogoBitmap = new Bitmap(fdnLogoBmp, fdnLogoSize);
pictureBoxFdnLogo.Image = _fdnLogoBitmap;
pictureBoxFdnLogo.Size = _fdnLogoBitmap.Size;
POINT src = new POINT();
src.x = 0;
src.y = 0;
User32.BLENDFUNCTION blendFunction = new User32.BLENDFUNCTION();
blendFunction.BlendOp = 0; // AC_SRC_OVER
blendFunction.BlendFlags = 0;
blendFunction.SourceConstantAlpha = 255;
blendFunction.AlphaFormat = 1; // AC_SRC_ALPHA
User32.UpdateLayeredWindow(Handle, screenDC, ref dst, ref size, memDC, ref src, 0, ref blendFunction, 2);
}
finally
{
Gdi32.SelectObject(memDC, hOrigBitmap);
}
}
finally
{
Gdi32.DeleteObject(hBitmap);
}
}
finally
{
Gdi32.DeleteDC(memDC);
}
}
finally
{
User32.ReleaseDC(IntPtr.Zero, screenDC);
}
}
var logoBmpSize = new Size(
(int)Math.Ceiling(logoBmp.Width * (DisplayHelper.ScalingFactorX / scaleFactor)),
(int)Math.Ceiling(logoBmp.Height * (DisplayHelper.ScalingFactorY / scaleFactor)));
_logoBitmap = new Bitmap(logoBmp, logoBmpSize);
pictureBoxLogo.Image = _logoBitmap;
pictureBoxLogo.Size = _logoBitmap.Size;
}
private Bitmap CreateBitmap()
public void ShowSplashScreen()
{
Bitmap bitmap = new Bitmap(_backgroundImage.Width, _backgroundImage.Height, PixelFormat.Format32bppArgb);
using (Graphics graphics = Graphics.FromImage(bitmap))
Thread thread = new Thread(() =>
{
BidiGraphics g = new BidiGraphics(graphics, bitmap.Size);
// draw transparent background image
g.DrawImage(false, _backgroundImage,
new Rectangle(0, 0, _backgroundImage.Width, _backgroundImage.Height));
// draw logo image
g.DrawImage(false, _logoImage, new Rectangle(
(ClientSize.Width - _logoImage.Width) / 2,
(int)Math.Ceiling(DisplayHelper.ScaleY(120)) - _logoImage.Height,
_logoImage.Width,
_logoImage.Height));
// draw copyright notice
string splashText = Res.Get(StringId.SplashScreenCopyrightNotice);
using (Font font = new Font(Font.FontFamily, 7.5f))
{
const int TEXT_PADDING_H = 36;
const int TEXT_PADDING_V = 26;
int textWidth = Size.Width - 2 * (int)Math.Ceiling(DisplayHelper.ScaleX(TEXT_PADDING_H));
int textHeight =
Convert.ToInt32(
(int)Math.Ceiling(DisplayHelper.ScaleY(
g.MeasureText(splashText, font, new Size(textWidth, 0), TextFormatFlags.WordBreak).Height
)),
CultureInfo.InvariantCulture);
// GDI text can't be drawn on an alpha-blended surface. So we render a black-on-white
// bitmap, then use a ColorMatrix to effectively turn it into an alpha mask.
using (Bitmap textBitmap = new Bitmap(textWidth, textHeight, PixelFormat.Format32bppRgb))
{
using (Graphics tbG = Graphics.FromImage(textBitmap))
{
tbG.FillRectangle(Brushes.Black, 0, 0, textWidth, textHeight);
new BidiGraphics(tbG, textBitmap.Size).
DrawText(splashText, font, new Rectangle(0, 0, textWidth, textHeight), Color.White, Color.Black, TextFormatFlags.WordBreak);
}
Rectangle textRect = new Rectangle(
(int)Math.Ceiling(DisplayHelper.ScaleX(TEXT_PADDING_H)),
ClientSize.Height - (int)Math.Ceiling(DisplayHelper.ScaleY(TEXT_PADDING_V)) - textHeight, textWidth, textHeight);
using (ImageAttributes ia = new ImageAttributes())
{
ColorMatrix cm = new ColorMatrix(new float[][]
{
new float[] {0, 0, 0, 1f/3f, 0},
new float[] {0, 0, 0, 1f/3f, 0},
new float[] {0, 0, 0, 1f/3f, 0},
new float[] {0, 0, 0, 0, 0},
new float[] {0.9372f, 0.9372f, 0.9372f, 0, 0},
ShowDialog();
});
ia.SetColorMatrix(cm);
g.DrawImage(false, textBitmap, textRect, 0, 0, textWidth, textHeight, GraphicsUnit.Pixel, ia);
}
}
}
}
return bitmap;
thread.Name = "Splash Screen Animation Thread";
thread.IsBackground = true;
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
}
/// <summary>
@ -223,21 +121,116 @@ namespace OpenLiveWriter.CoreServices
/// </summary>
private void InitializeComponent()
{
this.labelStatus = new System.Windows.Forms.Label();
this.pictureBoxFdnLogo = new System.Windows.Forms.PictureBox();
this.pictureBoxLogo = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxFdnLogo)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxLogo)).BeginInit();
this.SuspendLayout();
//
// labelStatus
//
this.labelStatus.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.labelStatus.AutoSize = true;
this.labelStatus.ForeColor = System.Drawing.Color.White;
this.labelStatus.Location = new System.Drawing.Point(19, 214);
this.labelStatus.Margin = new System.Windows.Forms.Padding(10, 0, 0, 10);
this.labelStatus.Name = "labelStatus";
this.labelStatus.Size = new System.Drawing.Size(57, 15);
this.labelStatus.TabIndex = 1;
this.labelStatus.Text = "Starting...";
//
// pictureBoxFdnLogo
//
this.pictureBoxFdnLogo.ErrorImage = null;
this.pictureBoxFdnLogo.InitialImage = null;
this.pictureBoxFdnLogo.Location = new System.Drawing.Point(20, 20);
this.pictureBoxFdnLogo.Name = "pictureBoxFdnLogo";
this.pictureBoxFdnLogo.Size = new System.Drawing.Size(20, 20);
this.pictureBoxFdnLogo.TabIndex = 2;
this.pictureBoxFdnLogo.TabStop = false;
//
// pictureBoxLogo
//
this.pictureBoxLogo.ErrorImage = null;
this.pictureBoxLogo.InitialImage = null;
this.pictureBoxLogo.Location = new System.Drawing.Point(20, 92);
this.pictureBoxLogo.Name = "pictureBoxLogo";
this.pictureBoxLogo.Size = new System.Drawing.Size(20, 20);
this.pictureBoxLogo.TabIndex = 3;
this.pictureBoxLogo.TabStop = false;
this.pictureBoxLogo.Visible = false;
//
// SplashScreen
//
this.AutoScaleMode = AutoScaleMode.None;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 14);
this.ClientSize = new System.Drawing.Size(380, 235);
this.Cursor = Cursors.AppStarting;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(162)))), ((int)(((byte)(93)))), ((int)(((byte)(162)))));
this.ClientSize = new System.Drawing.Size(439, 248);
this.Controls.Add(this.pictureBoxLogo);
this.Controls.Add(this.pictureBoxFdnLogo);
this.Controls.Add(this.labelStatus);
this.Cursor = System.Windows.Forms.Cursors.AppStarting;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "SplashScreen";
//if this inherits Yes from the parent the screenshot of the background is reversed
this.RightToLeftLayout = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
((System.ComponentModel.ISupportInitialize)(this.pictureBoxFdnLogo)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxLogo)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private void Label1_Click(object sender, EventArgs e)
{
}
private void AnimationTick(object sender, EventArgs e)
{
// .NET Foundation Logo linear slide animation
const int fdnLogoAnimTicks = 10;
const int fdnLogoAnimTarget = 20;
pictureBoxFdnLogo.Left = (int)Math.Min(DisplayHelper.ScalingFactorX * _ticks * ((float)fdnLogoAnimTarget / fdnLogoAnimTicks), DisplayHelper.ScalingFactorX * fdnLogoAnimTarget);
pictureBoxFdnLogo.Image = ChangeOpacity(_fdnLogoBitmap, (float)Math.Min((float)_ticks / fdnLogoAnimTicks, 1.0));
const int logoAnimStart = 10;
const int logoAnimEnd = logoAnimStart + 20;
int logoAnimBegin = (Width / 2) - (pictureBoxLogo.Width / 2) - (int)(40 * DisplayHelper.ScalingFactorX);
int logoAnimTarget = (Width / 2) - (pictureBoxLogo.Width / 2);
if(_ticks > logoAnimStart)
{
pictureBoxLogo.Visible = true;
double x = Math.Min((float)(_ticks - logoAnimStart) / (logoAnimEnd - logoAnimStart) +.1, 1.0);
pictureBoxLogo.Left = (int)Math.Min(logoAnimBegin + (Math.Pow(Math.Log10(x), 10) * (logoAnimTarget - logoAnimBegin) * DisplayHelper.ScalingFactorX), logoAnimTarget);
// Set logo transparency (float)Math.Min((float)(_ticks - logoAnimStart) / (logoAnimEnd - logoAnimStart), 1.0)
pictureBoxLogo.Image = ChangeOpacity(_logoBitmap, (float)x);
} else
{
pictureBoxLogo.Visible = false;
}
Update();
_ticks++;
}
private static Bitmap ChangeOpacity(Image img, float opacityvalue)
{
// Example from https://www.codeproject.com/Tips/201129/Change-Opacity-of-Image-in-C
Bitmap bmp = new Bitmap(img.Width, img.Height); // Determining Width and Height of Source Image
Graphics graphics = Graphics.FromImage(bmp);
ColorMatrix colormatrix = new ColorMatrix();
colormatrix.Matrix33 = opacityvalue;
ImageAttributes imgAttribute = new ImageAttributes();
imgAttribute.SetColorMatrix(colormatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
graphics.DrawImage(img, new Rectangle(0, 0, bmp.Width, bmp.Height), 0, 0, img.Width, img.Height, GraphicsUnit.Pixel, imgAttribute);
graphics.Dispose(); // Releasing all resource used by graphics
return bmp;
}
}
/// <summary>

View File

@ -3,7 +3,7 @@
<!--
Microsoft ResX Schema
Version 1.3
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
@ -14,16 +14,17 @@
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
@ -45,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
@ -59,18 +60,37 @@
: 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">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<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">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<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">
@ -89,42 +109,12 @@
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.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=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="$this.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>(Default)</value>
</data>
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>8, 8</value>
</data>
<data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</data>
<data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>80</value>
</data>
<data name="$this.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="$this.Name">
<value>SplashScreen</value>
</data>
</root>

View File

@ -168,8 +168,7 @@ namespace OpenLiveWriter
IDisposable splashScreen = null;
// Show the splash screen.
SplashScreen splashScreenForm = new SplashScreen();
splashScreenForm.Show();
splashScreenForm.Update();
splashScreenForm.ShowSplashScreen();
splashScreen = new FormSplashScreen(splashScreenForm);
LaunchFirstInstance(splashScreen, args);
@ -324,23 +323,23 @@ namespace OpenLiveWriter
ApplicationLauncher.LaunchBloggingForm(args, splashScreen, true);
}
if (splashScreen != null)
{
try
{
using (Form splashScreenForm = ((FormSplashScreen)splashScreen).Form)
{
if (splashScreenForm != null && !splashScreenForm.IsDisposed)
{
Application.Run(splashScreenForm);
}
}
}
catch (Exception e)
{
Debug.Fail("Failed to show splash screen: " + e);
}
}
//if (splashScreen != null)
//{
// try
// {
// using (Form splashScreenForm = ((FormSplashScreen)splashScreen).Form)
// {
// if (splashScreenForm != null && !splashScreenForm.IsDisposed)
// {
// Application.Run(splashScreenForm);
// }
// }
// }
// catch (Exception e)
// {
// Debug.Fail("Failed to show splash screen: " + e);
// }
//}
ManualKeepalive.Wait(true);
}
catch (DirectoryException ex)

View File

@ -15,19 +15,19 @@
<ProjectGuid>{195A60BF-7A4D-42E6-B5F4-FEBC679E19F0}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>OpenLiveWriter.Ribbon</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>