Skip to content

Commit 5d7295f

Browse files
committed
remove hokey update button animation.
1 parent 85ba63f commit 5d7295f

File tree

3 files changed

+17
-418
lines changed

3 files changed

+17
-418
lines changed

src/Application/FormMain.cs

+17-52
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,8 @@ private async void checkUpdatesToolStripMenuItem_Click(object sender, EventArgs
803803
var label = UpdateTooltips(update);
804804
string line = label.Split('\r')[0];
805805
ShowStatus(line);
806-
AnimateUpdateButton(UpdateRequired(update.Latest));
806+
ShowUpdateButton();
807+
this._delayedActions.StartDelayedAction("AnimateUpdateButton", () => AnimateUpdateButton(null), TimeSpan.FromMilliseconds(0));
807808
}
808809
}
809810
catch
@@ -812,60 +813,23 @@ private async void checkUpdatesToolStripMenuItem_Click(object sender, EventArgs
812813
this.statusStrip1.BackColor = saved;
813814
}
814815

815-
private void AnimateUpdateButton(bool updateAvailable)
816+
private void AnimateUpdateButton(string target)
816817
{
817-
string caption = updateAvailable ? SR.UpdateAvailableCaption : SR.UpToDate;
818-
//
819-
// animationCanvas1
820-
//
821-
var animationCanvas1 = new XmlNotepad.AnimationCanvas();
822-
animationCanvas1.Dock = System.Windows.Forms.DockStyle.Fill;
823-
animationCanvas1.Location = new System.Drawing.Point(0, 0);
824-
animationCanvas1.Margin = new System.Windows.Forms.Padding(0);
825-
animationCanvas1.Name = "animationCanvas1";
826-
animationCanvas1.Size = this.Size;
827-
animationCanvas1.TabIndex = 0;
828-
this.Controls.Add(animationCanvas1);
829-
830-
// give the AnimationCanvas the background image of the current state of this application so
831-
// that the animation looks like it is floating over this form. Using transparent Controls
832-
// doesn't work nicely with double buffered controls, and does an inefficient amount of repainting
833-
// and DrawToBitmap simply doesn't work at all for WebBrowser controls.
834-
Rectangle screenRectangle = this.RectangleToScreen(this.ClientRectangle);
835-
animationCanvas1.InitializeBackgroundFromScreen(screenRectangle.X, screenRectangle.Y + menuStrip1.Height + toolStrip1.Height);
836-
837-
int buttonWidth = 100;
838-
using (var g = this.CreateGraphics())
839-
{
840-
var size = g.MeasureString(caption, toolStripMenuItemUpdate.Font, this.Width);
841-
buttonWidth = (int)size.Width + (4 * 2);
842-
}
843-
844-
RectangleShape shape = new RectangleShape()
845-
{
846-
Fill = new System.Drawing.SolidBrush(this.toolStripMenuItemUpdate.BackColor),
847-
Label = caption,
848-
Font = this.Font,
849-
Foreground = new System.Drawing.SolidBrush(this.ForeColor)
850-
};
851-
852-
var animation = new BoundsAnimation()
818+
if (target == null)
853819
{
854-
Duration = TimeSpan.FromSeconds(1),
855-
End = new Rectangle(this.Width - 100, 0, 100, 30),
856-
Start = new Rectangle(0, this.Height - 30, this.Width, 30),
857-
TargetProperty = "Bounds",
858-
Function = new AnimationEaseInFunction()
859-
};
860-
animation.Completed += (s, e) =>
820+
target = this.toolStripMenuItemUpdate.Text;
821+
this.toolStripMenuItemUpdate.Text = "";
822+
}
823+
else if (target == this.toolStripMenuItemUpdate.Text)
861824
{
862-
this.Controls.Remove(animationCanvas1);
863-
ShowUpdateButton();
864-
};
865-
866-
shape.BeginAnimation(animation);
867-
animationCanvas1.Shapes.Add(shape);
868-
animationCanvas1.BringToFront();
825+
return; // we are finished.
826+
}
827+
else
828+
{
829+
// reveal single char at a time to catch the eye.
830+
this.toolStripMenuItemUpdate.Text = target.Substring(0, this.toolStripMenuItemUpdate.Text.Length + 1);
831+
}
832+
this._delayedActions.StartDelayedAction("AnimateUpdateButton", () => AnimateUpdateButton(target), TimeSpan.FromMilliseconds(20));
869833
}
870834

871835
protected virtual void TabControlViews_Selected(object sender, NoBorderTabControlEventArgs e)
@@ -1410,6 +1374,7 @@ public virtual void LoadConfig()
14101374
File.Delete(this.TemporaryConfigFile);
14111375
}
14121376
_settings.Load(this.TemporaryConfigFile);
1377+
_settings["SettingsLocation"] = (int)SettingsLocation.Roaming;
14131378
}
14141379
else
14151380
{

0 commit comments

Comments
 (0)