Added: toggle animation
This commit is contained in:
parent
705c76ad76
commit
fdf3ccbc1d
@ -355,6 +355,20 @@ namespace RyzStudio.Windows.Forms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void SetLocation(Control control, Point value)
|
||||||
|
{
|
||||||
|
if (control.InvokeRequired)
|
||||||
|
{
|
||||||
|
control.Invoke(new MethodInvoker(() => {
|
||||||
|
control.Location = value;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
control.Location = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void SetSize(Control control, int width, int height) => SetSize(control, new Size(width, height));
|
public static void SetSize(Control control, int width, int height) => SetSize(control, new Size(width, height));
|
||||||
|
|
||||||
public static void SetSize(Control control, Size value)
|
public static void SetSize(Control control, Size value)
|
||||||
|
28
MainForm.Designer.cs
generated
28
MainForm.Designer.cs
generated
@ -55,6 +55,7 @@
|
|||||||
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
|
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
|
||||||
this.contextMenuStrip2 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
this.contextMenuStrip2 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||||
this.exitToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
this.exitToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.toolStripMenuItem11 = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.contextMenuStrip1.SuspendLayout();
|
this.contextMenuStrip1.SuspendLayout();
|
||||||
this.contextMenuStrip2.SuspendLayout();
|
this.contextMenuStrip2.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
@ -67,7 +68,7 @@
|
|||||||
this.toolStripMenuItem9,
|
this.toolStripMenuItem9,
|
||||||
this.helpToolStripMenuItem});
|
this.helpToolStripMenuItem});
|
||||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||||
this.contextMenuStrip1.Size = new System.Drawing.Size(102, 92);
|
this.contextMenuStrip1.Size = new System.Drawing.Size(181, 114);
|
||||||
this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);
|
this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);
|
||||||
//
|
//
|
||||||
// toolStripMenuItem4
|
// toolStripMenuItem4
|
||||||
@ -83,7 +84,7 @@
|
|||||||
this.toolStripMenuItem10,
|
this.toolStripMenuItem10,
|
||||||
this.exitToolStripMenuItem});
|
this.exitToolStripMenuItem});
|
||||||
this.toolStripMenuItem4.Name = "toolStripMenuItem4";
|
this.toolStripMenuItem4.Name = "toolStripMenuItem4";
|
||||||
this.toolStripMenuItem4.Size = new System.Drawing.Size(101, 22);
|
this.toolStripMenuItem4.Size = new System.Drawing.Size(180, 22);
|
||||||
this.toolStripMenuItem4.Text = "&File";
|
this.toolStripMenuItem4.Text = "&File";
|
||||||
//
|
//
|
||||||
// toolStripMenuItem5
|
// toolStripMenuItem5
|
||||||
@ -146,15 +147,16 @@
|
|||||||
// toolStripMenuItem3
|
// toolStripMenuItem3
|
||||||
//
|
//
|
||||||
this.toolStripMenuItem3.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.toolStripMenuItem3.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.toolStripMenuItem11,
|
||||||
this.toolStripMenuItem1});
|
this.toolStripMenuItem1});
|
||||||
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
|
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
|
||||||
this.toolStripMenuItem3.Size = new System.Drawing.Size(101, 22);
|
this.toolStripMenuItem3.Size = new System.Drawing.Size(180, 22);
|
||||||
this.toolStripMenuItem3.Text = "&View";
|
this.toolStripMenuItem3.Text = "&View";
|
||||||
//
|
//
|
||||||
// toolStripMenuItem1
|
// toolStripMenuItem1
|
||||||
//
|
//
|
||||||
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
|
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
|
||||||
this.toolStripMenuItem1.Size = new System.Drawing.Size(152, 22);
|
this.toolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
|
||||||
this.toolStripMenuItem1.Text = "Always On &Top";
|
this.toolStripMenuItem1.Text = "Always On &Top";
|
||||||
this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click);
|
this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click);
|
||||||
//
|
//
|
||||||
@ -163,7 +165,7 @@
|
|||||||
this.toolStripMenuItem9.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.toolStripMenuItem9.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.optionToolStripMenuItem});
|
this.optionToolStripMenuItem});
|
||||||
this.toolStripMenuItem9.Name = "toolStripMenuItem9";
|
this.toolStripMenuItem9.Name = "toolStripMenuItem9";
|
||||||
this.toolStripMenuItem9.Size = new System.Drawing.Size(101, 22);
|
this.toolStripMenuItem9.Size = new System.Drawing.Size(180, 22);
|
||||||
this.toolStripMenuItem9.Text = "&Tools";
|
this.toolStripMenuItem9.Text = "&Tools";
|
||||||
//
|
//
|
||||||
// optionToolStripMenuItem
|
// optionToolStripMenuItem
|
||||||
@ -180,7 +182,7 @@
|
|||||||
this.toolStripSeparator1,
|
this.toolStripSeparator1,
|
||||||
this.aboutToolStripMenuItem});
|
this.aboutToolStripMenuItem});
|
||||||
this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";
|
this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";
|
||||||
this.helpToolStripMenuItem.Size = new System.Drawing.Size(101, 22);
|
this.helpToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
this.helpToolStripMenuItem.Text = "&Help";
|
this.helpToolStripMenuItem.Text = "&Help";
|
||||||
//
|
//
|
||||||
// viewHelpToolStripMenuItem
|
// viewHelpToolStripMenuItem
|
||||||
@ -240,15 +242,22 @@
|
|||||||
this.contextMenuStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.contextMenuStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.exitToolStripMenuItem1});
|
this.exitToolStripMenuItem1});
|
||||||
this.contextMenuStrip2.Name = "contextMenuStrip2";
|
this.contextMenuStrip2.Name = "contextMenuStrip2";
|
||||||
this.contextMenuStrip2.Size = new System.Drawing.Size(181, 48);
|
this.contextMenuStrip2.Size = new System.Drawing.Size(94, 26);
|
||||||
//
|
//
|
||||||
// exitToolStripMenuItem1
|
// exitToolStripMenuItem1
|
||||||
//
|
//
|
||||||
this.exitToolStripMenuItem1.Name = "exitToolStripMenuItem1";
|
this.exitToolStripMenuItem1.Name = "exitToolStripMenuItem1";
|
||||||
this.exitToolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
|
this.exitToolStripMenuItem1.Size = new System.Drawing.Size(93, 22);
|
||||||
this.exitToolStripMenuItem1.Text = "E&xit";
|
this.exitToolStripMenuItem1.Text = "E&xit";
|
||||||
this.exitToolStripMenuItem1.Click += new System.EventHandler(this.exitToolStripMenuItem1_Click);
|
this.exitToolStripMenuItem1.Click += new System.EventHandler(this.exitToolStripMenuItem1_Click);
|
||||||
//
|
//
|
||||||
|
// toolStripMenuItem11
|
||||||
|
//
|
||||||
|
this.toolStripMenuItem11.Name = "toolStripMenuItem11";
|
||||||
|
this.toolStripMenuItem11.Size = new System.Drawing.Size(180, 22);
|
||||||
|
this.toolStripMenuItem11.Text = "Enable &Animation";
|
||||||
|
this.toolStripMenuItem11.Click += new System.EventHandler(this.toolStripMenuItem11_Click);
|
||||||
|
//
|
||||||
// MainForm
|
// MainForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
@ -258,7 +267,7 @@
|
|||||||
this.ClientSize = new System.Drawing.Size(633, 400);
|
this.ClientSize = new System.Drawing.Size(633, 400);
|
||||||
this.Controls.Add(this.flowLayoutPanel1);
|
this.Controls.Add(this.flowLayoutPanel1);
|
||||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
this.MinimumSize = new System.Drawing.Size(633, 280);
|
this.MinimumSize = new System.Drawing.Size(420, 280);
|
||||||
this.Name = "MainForm";
|
this.Name = "MainForm";
|
||||||
this.Text = "Launcher";
|
this.Text = "Launcher";
|
||||||
this.TitleContextMenuStrip = this.contextMenuStrip1;
|
this.TitleContextMenuStrip = this.contextMenuStrip1;
|
||||||
@ -294,6 +303,7 @@
|
|||||||
private System.Windows.Forms.NotifyIcon notifyIcon1;
|
private System.Windows.Forms.NotifyIcon notifyIcon1;
|
||||||
private System.Windows.Forms.ContextMenuStrip contextMenuStrip2;
|
private System.Windows.Forms.ContextMenuStrip contextMenuStrip2;
|
||||||
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem1;
|
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem1;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem11;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
53
MainForm.cs
53
MainForm.cs
@ -63,6 +63,7 @@ namespace AppLauncher
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.CurrentSession = new LauncherSession();
|
this.CurrentSession = new LauncherSession();
|
||||||
|
ThreadControl.SetSize(this, this.MinimumSize);
|
||||||
ThreadControl.SetVisible(this, true);
|
ThreadControl.SetVisible(this, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -373,24 +374,24 @@ namespace AppLauncher
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LauncherSession loadedSession = JsonConvert.DeserializeObject<LauncherSession>(sourceCode);
|
|
||||||
if (loadedSession == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// load options
|
// load options
|
||||||
this.CurrentSession = loadedSession.ToSimple();
|
this.CurrentSession = JsonConvert.DeserializeObject<LauncherSession>(sourceCode);
|
||||||
|
if (this.CurrentSession == null)
|
||||||
|
{
|
||||||
|
this.CurrentSession = new LauncherSession();
|
||||||
|
}
|
||||||
|
|
||||||
// load tiles
|
// load tiles
|
||||||
int maxWidth = 0;
|
int maxWidth = 0;
|
||||||
ThreadControl.Clear(flowLayoutPanel1);
|
ThreadControl.Clear(flowLayoutPanel1);
|
||||||
|
|
||||||
if (loadedSession.Groups != null)
|
if (this.CurrentSession.Groups != null)
|
||||||
{
|
{
|
||||||
foreach (TileGroupModel item in loadedSession.Groups)
|
foreach (TileGroupModel item in this.CurrentSession.Groups)
|
||||||
{
|
{
|
||||||
TTilePanelLayout panel = new TTilePanelLayout(item);
|
TTilePanelLayout panel = new TTilePanelLayout(item);
|
||||||
|
panel.EnableAnimation = this.CurrentSession.EnableAnimation;
|
||||||
|
|
||||||
maxWidth = Math.Max(maxWidth, panel.Width);
|
maxWidth = Math.Max(maxWidth, panel.Width);
|
||||||
|
|
||||||
ThreadControl.Add(flowLayoutPanel1, panel);
|
ThreadControl.Add(flowLayoutPanel1, panel);
|
||||||
@ -399,6 +400,7 @@ namespace AppLauncher
|
|||||||
|
|
||||||
// ui
|
// ui
|
||||||
ThreadControl.SetSize(this, (maxWidth + SystemInformation.VerticalScrollBarWidth + 20 + flowLayoutPanel1.Left), this.CurrentSession.DefaultHeight);
|
ThreadControl.SetSize(this, (maxWidth + SystemInformation.VerticalScrollBarWidth + 20 + flowLayoutPanel1.Left), this.CurrentSession.DefaultHeight);
|
||||||
|
if (!this.CurrentSession.StartPosition.IsEmpty) ThreadControl.SetLocation(this, this.CurrentSession.StartPosition);
|
||||||
|
|
||||||
//
|
//
|
||||||
ThreadControl.SetTopMost(this, this.CurrentSession.AlwaysOnTop);
|
ThreadControl.SetTopMost(this, this.CurrentSession.AlwaysOnTop);
|
||||||
@ -460,12 +462,17 @@ namespace AppLauncher
|
|||||||
isBusy = true;
|
isBusy = true;
|
||||||
|
|
||||||
// update session
|
// update session
|
||||||
|
if (this.CurrentSession == null)
|
||||||
|
{
|
||||||
|
this.CurrentSession = new LauncherSession();
|
||||||
|
}
|
||||||
|
|
||||||
this.CurrentSession.DefaultHeight = this.Height;
|
this.CurrentSession.DefaultHeight = this.Height;
|
||||||
this.CurrentSession.AlwaysOnTop = this.TopMost;
|
this.CurrentSession.AlwaysOnTop = this.TopMost;
|
||||||
|
this.CurrentSession.StartPosition = this.Location;
|
||||||
|
|
||||||
// save
|
// save
|
||||||
LauncherSession saveSession = this.CurrentSession.ToSimple();
|
this.CurrentSession.Groups = new List<TileGroupModel>();
|
||||||
saveSession.Groups = new List<TileGroupModel>();
|
|
||||||
for (int i = 0; i < flowLayoutPanel1.Controls.Count; i++)
|
for (int i = 0; i < flowLayoutPanel1.Controls.Count; i++)
|
||||||
{
|
{
|
||||||
if (flowLayoutPanel1.Controls[i].GetType() != typeof(TTilePanelLayout))
|
if (flowLayoutPanel1.Controls[i].GetType() != typeof(TTilePanelLayout))
|
||||||
@ -474,12 +481,12 @@ namespace AppLauncher
|
|||||||
}
|
}
|
||||||
|
|
||||||
TTilePanelLayout container = flowLayoutPanel1.Controls[i] as TTilePanelLayout;
|
TTilePanelLayout container = flowLayoutPanel1.Controls[i] as TTilePanelLayout;
|
||||||
saveSession.Groups.Add(container.Model);
|
this.CurrentSession.Groups.Add(container.Model);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File.WriteAllText(filename, JsonConvert.SerializeObject(saveSession));
|
File.WriteAllText(filename, JsonConvert.SerializeObject(this.CurrentSession));
|
||||||
|
|
||||||
if (showNotices)
|
if (showNotices)
|
||||||
{
|
{
|
||||||
@ -553,5 +560,25 @@ namespace AppLauncher
|
|||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void toolStripMenuItem11_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (this.CurrentSession == null) return;
|
||||||
|
|
||||||
|
this.CurrentSession.EnableAnimation = !this.CurrentSession.EnableAnimation;
|
||||||
|
|
||||||
|
toolStripMenuItem11.Checked = this.CurrentSession.EnableAnimation;
|
||||||
|
|
||||||
|
for (int i = 0; i < flowLayoutPanel1.Controls.Count; i++)
|
||||||
|
{
|
||||||
|
if (flowLayoutPanel1.Controls[i].GetType() != typeof(TTilePanelLayout))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
TTilePanelLayout container = flowLayoutPanel1.Controls[i] as TTilePanelLayout;
|
||||||
|
container.EnableAnimation = this.CurrentSession.EnableAnimation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
namespace AppLauncher.Models
|
namespace AppLauncher.Models
|
||||||
{
|
{
|
||||||
@ -25,25 +26,15 @@ namespace AppLauncher.Models
|
|||||||
|
|
||||||
public int DefaultHeight { get; set; } = 280;
|
public int DefaultHeight { get; set; } = 280;
|
||||||
public HotKeyOptions HotKey { get; set; } = null;
|
public HotKeyOptions HotKey { get; set; } = null;
|
||||||
|
|
||||||
public bool AlwaysOnTop { get; set; } = false;
|
public bool AlwaysOnTop { get; set; } = false;
|
||||||
|
public bool EnableAnimation { get; set; } = false;
|
||||||
|
|
||||||
public bool HideOnClose { get; set; } = false;
|
public bool HideOnClose { get; set; } = false;
|
||||||
public bool HideOnClick { get; set; } = false;
|
public bool HideOnClick { get; set; } = false;
|
||||||
public AutoSaveOption AutoSave { get; set; } = AutoSaveOption.Prompt;
|
public AutoSaveOption AutoSave { get; set; } = AutoSaveOption.Prompt;
|
||||||
public List<TileGroupModel> Groups { get; set; } = new List<TileGroupModel>();
|
public List<TileGroupModel> Groups { get; set; } = new List<TileGroupModel>();
|
||||||
|
public Point StartPosition { get; set; } = Point.Empty;
|
||||||
public LauncherSession ToSimple()
|
|
||||||
{
|
|
||||||
return new LauncherSession()
|
|
||||||
{
|
|
||||||
DefaultHeight = this.DefaultHeight,
|
|
||||||
HotKey = this.HotKey,
|
|
||||||
AlwaysOnTop = this.AlwaysOnTop,
|
|
||||||
HideOnClose = this.HideOnClose,
|
|
||||||
HideOnClick = this.HideOnClick,
|
|
||||||
AutoSave = this.AutoSave,
|
|
||||||
Groups = null
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -33,4 +33,4 @@ using System.Runtime.InteropServices;
|
|||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
[assembly: AssemblyFileVersion("0.1.1.144")]
|
[assembly: AssemblyFileVersion("0.1.1.153")]
|
||||||
|
Reference in New Issue
Block a user