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

View File

@ -10,6 +10,7 @@ using System.Windows.Forms;
using OpenLiveWriter.Interop.Windows; using OpenLiveWriter.Interop.Windows;
using OpenLiveWriter.Localization; using OpenLiveWriter.Localization;
using OpenLiveWriter.Localization.Bidi; using OpenLiveWriter.Localization.Bidi;
using System.Diagnostics;
namespace OpenLiveWriter.CoreServices namespace OpenLiveWriter.CoreServices
{ {
@ -22,12 +23,14 @@ namespace OpenLiveWriter.CoreServices
/// Required designer variable. /// Required designer variable.
/// </summary> /// </summary>
private System.ComponentModel.Container components = null; 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> private int _ticks = 0;
/// Background image
/// </summary>
private Bitmap _backgroundImage;
private Bitmap _logoImage;
public SplashScreen() public SplashScreen()
{ {
@ -37,168 +40,63 @@ namespace OpenLiveWriter.CoreServices
InitializeComponent(); InitializeComponent();
DisplayHelper.Scale(this); DisplayHelper.Scale(this);
// Turn off CS_CLIPCHILDREN.
User32.SetWindowLong(Handle, GWL.STYLE, User32.GetWindowLong(Handle, GWL.STYLE) & ~WS.CLIPCHILDREN);
// Turn on double buffered painting. // Turn on double buffered painting.
SetStyle(ControlStyles.UserPaint, true); //SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true); //SetStyle(ControlStyles.DoubleBuffer, true);
if (!BidiHelper.IsRightToLeft) //if (!BidiHelper.IsRightToLeft)
SetStyle(ControlStyles.AllPaintingInWmPaint, true); // SetStyle(ControlStyles.AllPaintingInWmPaint, true);
_backgroundImage = DisplayHelper.ScaleBitmap(new Bitmap(this.GetType(), "Images.SplashScreen.png")); //if (SystemInformation.HighContrast)
_logoImage = DisplayHelper.ScaleBitmap(new Bitmap(this.GetType(), "Images.SplashScreenLogo.jpg")); //{
// ImageHelper.ConvertToHighContrast(_backgroundImage);
if (SystemInformation.HighContrast) // ImageHelper.ConvertToHighContrast(_logoImage);
{ //}
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;
}
} }
protected override void OnLoad(EventArgs e) protected override void OnLoad(EventArgs e)
{ {
base.OnLoad(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()) const float scaleFactor = 2f; // Assume logos are already at 2x scaling
{ var fdnLogoBmp = new Bitmap(this.GetType(), "Images.NetFoundationLogo.png");
IntPtr screenDC = User32.GetDC(IntPtr.Zero); var logoBmp = new Bitmap(this.GetType(), "Images.SplashScreenLogo.png");
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;
SIZE size = new SIZE(); var fdnLogoSize = new Size(
size.cx = bitmap.Width; (int)Math.Ceiling(fdnLogoBmp.Width * (DisplayHelper.ScalingFactorX / scaleFactor)),
size.cy = bitmap.Height; (int)Math.Ceiling(fdnLogoBmp.Height * (DisplayHelper.ScalingFactorY / scaleFactor)));
_fdnLogoBitmap = new Bitmap(fdnLogoBmp, fdnLogoSize);
pictureBoxFdnLogo.Image = _fdnLogoBitmap;
pictureBoxFdnLogo.Size = _fdnLogoBitmap.Size;
POINT src = new POINT(); var logoBmpSize = new Size(
src.x = 0; (int)Math.Ceiling(logoBmp.Width * (DisplayHelper.ScalingFactorX / scaleFactor)),
src.y = 0; (int)Math.Ceiling(logoBmp.Height * (DisplayHelper.ScalingFactorY / scaleFactor)));
_logoBitmap = new Bitmap(logoBmp, logoBmpSize);
User32.BLENDFUNCTION blendFunction = new User32.BLENDFUNCTION(); pictureBoxLogo.Image = _logoBitmap;
blendFunction.BlendOp = 0; // AC_SRC_OVER pictureBoxLogo.Size = _logoBitmap.Size;
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);
}
}
} }
private Bitmap CreateBitmap() public void ShowSplashScreen()
{ {
Bitmap bitmap = new Bitmap(_backgroundImage.Width, _backgroundImage.Height, PixelFormat.Format32bppArgb); Thread thread = new Thread(() =>
using (Graphics graphics = Graphics.FromImage(bitmap))
{ {
BidiGraphics g = new BidiGraphics(graphics, bitmap.Size); ShowDialog();
});
// draw transparent background image thread.Name = "Splash Screen Animation Thread";
g.DrawImage(false, _backgroundImage, thread.IsBackground = true;
new Rectangle(0, 0, _backgroundImage.Width, _backgroundImage.Height)); thread.SetApartmentState(ApartmentState.STA);
thread.Start();
// 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},
});
ia.SetColorMatrix(cm);
g.DrawImage(false, textBitmap, textRect, 0, 0, textWidth, textHeight, GraphicsUnit.Pixel, ia);
}
}
}
}
return bitmap;
} }
/// <summary> /// <summary>
@ -223,21 +121,116 @@ namespace OpenLiveWriter.CoreServices
/// </summary> /// </summary>
private void InitializeComponent() 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 // SplashScreen
// //
this.AutoScaleMode = AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 14); this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(162)))), ((int)(((byte)(93)))), ((int)(((byte)(162)))));
this.ClientSize = new System.Drawing.Size(380, 235); this.ClientSize = new System.Drawing.Size(439, 248);
this.Cursor = Cursors.AppStarting; 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.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "SplashScreen"; this.Name = "SplashScreen";
//if this inherits Yes from the parent the screenshot of the background is reversed
this.RightToLeftLayout = false;
this.ShowInTaskbar = false; this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 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 #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> /// <summary>

View File

@ -3,7 +3,7 @@
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
Version 1.3 Version 2.0
The primary goals of this format is to allow a simple XML format The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the that is mostly human readable. The generation and parsing of the
@ -14,16 +14,17 @@
... ado.net/XML headers & schema ... ... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader> <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="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, 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="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> <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>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <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> </data>
There are any number of "resheader" rows that contain simple There are any number of "resheader" rows that contain simple
@ -35,7 +36,7 @@
Classes that don't support this are serialized and stored with the Classes that don't support this are serialized and stored with the
mimetype set. mimetype set.
The mimetype is used forserialized objects, and tells the The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly: extensible. For a given mimetype the value must be set accordingly:
@ -45,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64 mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 mimetype: application/x-microsoft.net.object.soap.base64
@ -59,18 +60,37 @@
: and then encoded with base64 encoding. : 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: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:element name="root" msdata:IsDataSet="true">
<xsd:complexType> <xsd:complexType>
<xsd:choice maxOccurs="unbounded"> <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:element name="data">
<xsd:complexType> <xsd:complexType>
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <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:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence> </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="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="resheader"> <xsd:element name="resheader">
@ -89,42 +109,12 @@
<value>text/microsoft-resx</value> <value>text/microsoft-resx</value>
</resheader> </resheader>
<resheader name="version"> <resheader name="version">
<value>1.3</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <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>
<resheader name="writer"> <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> </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> </root>

View File

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

View File

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