Merge branch 'release/0.1.1.153' into 'master'
Release/0.1.1.153 See merge request SympatheticFire/linear-app-launcher!7
This commit is contained in:
commit
b5a404735d
@ -290,6 +290,21 @@ namespace RyzStudio.Windows.Forms
|
||||
return rv;
|
||||
}
|
||||
|
||||
public static void SetChecked(ToolStripMenuItem control, bool value)
|
||||
{
|
||||
if (control.GetCurrentParent().InvokeRequired)
|
||||
{
|
||||
control.GetCurrentParent().Invoke(new MethodInvoker(() =>
|
||||
{
|
||||
control.Checked = value;
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
control.Checked = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetEnable(Control control, bool value)
|
||||
{
|
||||
if (control.InvokeRequired)
|
||||
@ -355,6 +370,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, Size value)
|
||||
|
38
MainForm.Designer.cs
generated
38
MainForm.Designer.cs
generated
@ -42,6 +42,7 @@
|
||||
this.toolStripMenuItem10 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem11 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem9 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.optionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@ -55,6 +56,7 @@
|
||||
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
|
||||
this.contextMenuStrip2 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.exitToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem12 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
this.contextMenuStrip2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
@ -67,7 +69,7 @@
|
||||
this.toolStripMenuItem9,
|
||||
this.helpToolStripMenuItem});
|
||||
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);
|
||||
//
|
||||
// toolStripMenuItem4
|
||||
@ -83,7 +85,7 @@
|
||||
this.toolStripMenuItem10,
|
||||
this.exitToolStripMenuItem});
|
||||
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";
|
||||
//
|
||||
// toolStripMenuItem5
|
||||
@ -146,15 +148,24 @@
|
||||
// toolStripMenuItem3
|
||||
//
|
||||
this.toolStripMenuItem3.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripMenuItem12,
|
||||
this.toolStripMenuItem11,
|
||||
this.toolStripMenuItem1});
|
||||
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";
|
||||
//
|
||||
// toolStripMenuItem11
|
||||
//
|
||||
this.toolStripMenuItem11.Name = "toolStripMenuItem11";
|
||||
this.toolStripMenuItem11.Size = new System.Drawing.Size(222, 22);
|
||||
this.toolStripMenuItem11.Text = "Enable &Animation";
|
||||
this.toolStripMenuItem11.Click += new System.EventHandler(this.toolStripMenuItem11_Click);
|
||||
//
|
||||
// toolStripMenuItem1
|
||||
//
|
||||
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
|
||||
this.toolStripMenuItem1.Size = new System.Drawing.Size(152, 22);
|
||||
this.toolStripMenuItem1.Size = new System.Drawing.Size(222, 22);
|
||||
this.toolStripMenuItem1.Text = "Always On &Top";
|
||||
this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click);
|
||||
//
|
||||
@ -163,7 +174,7 @@
|
||||
this.toolStripMenuItem9.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.optionToolStripMenuItem});
|
||||
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";
|
||||
//
|
||||
// optionToolStripMenuItem
|
||||
@ -180,7 +191,7 @@
|
||||
this.toolStripSeparator1,
|
||||
this.aboutToolStripMenuItem});
|
||||
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";
|
||||
//
|
||||
// viewHelpToolStripMenuItem
|
||||
@ -240,15 +251,22 @@
|
||||
this.contextMenuStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.exitToolStripMenuItem1});
|
||||
this.contextMenuStrip2.Name = "contextMenuStrip2";
|
||||
this.contextMenuStrip2.Size = new System.Drawing.Size(181, 48);
|
||||
this.contextMenuStrip2.Size = new System.Drawing.Size(94, 26);
|
||||
//
|
||||
// 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.Click += new System.EventHandler(this.exitToolStripMenuItem1_Click);
|
||||
//
|
||||
// toolStripMenuItem12
|
||||
//
|
||||
this.toolStripMenuItem12.Name = "toolStripMenuItem12";
|
||||
this.toolStripMenuItem12.Size = new System.Drawing.Size(222, 22);
|
||||
this.toolStripMenuItem12.Text = "Enable &Big Icons (In Folders)";
|
||||
this.toolStripMenuItem12.Click += new System.EventHandler(this.toolStripMenuItem12_Click);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@ -258,7 +276,7 @@
|
||||
this.ClientSize = new System.Drawing.Size(633, 400);
|
||||
this.Controls.Add(this.flowLayoutPanel1);
|
||||
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.Text = "Launcher";
|
||||
this.TitleContextMenuStrip = this.contextMenuStrip1;
|
||||
@ -294,6 +312,8 @@
|
||||
private System.Windows.Forms.NotifyIcon notifyIcon1;
|
||||
private System.Windows.Forms.ContextMenuStrip contextMenuStrip2;
|
||||
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem1;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem11;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem12;
|
||||
}
|
||||
}
|
||||
|
||||
|
52
MainForm.cs
52
MainForm.cs
@ -63,6 +63,7 @@ namespace AppLauncher
|
||||
else
|
||||
{
|
||||
this.CurrentSession = new LauncherSession();
|
||||
ThreadControl.SetSize(this, this.MinimumSize);
|
||||
ThreadControl.SetVisible(this, true);
|
||||
}
|
||||
}
|
||||
@ -373,24 +374,23 @@ namespace AppLauncher
|
||||
return;
|
||||
}
|
||||
|
||||
LauncherSession loadedSession = JsonConvert.DeserializeObject<LauncherSession>(sourceCode);
|
||||
if (loadedSession == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// load options
|
||||
this.CurrentSession = loadedSession.ToSimple();
|
||||
this.CurrentSession = JsonConvert.DeserializeObject<LauncherSession>(sourceCode);
|
||||
if (this.CurrentSession == null)
|
||||
{
|
||||
this.CurrentSession = new LauncherSession();
|
||||
}
|
||||
|
||||
// load tiles
|
||||
int maxWidth = 0;
|
||||
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);
|
||||
|
||||
maxWidth = Math.Max(maxWidth, panel.Width);
|
||||
|
||||
ThreadControl.Add(flowLayoutPanel1, panel);
|
||||
@ -399,10 +399,13 @@ namespace AppLauncher
|
||||
|
||||
// ui
|
||||
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.SetVisible(this, true);
|
||||
ThreadControl.SetChecked(toolStripMenuItem11, this.CurrentSession.EnableAnimation);
|
||||
ThreadControl.SetChecked(toolStripMenuItem12, this.CurrentSession.EnableBigIconInFolder);
|
||||
|
||||
if (this.InvokeRequired)
|
||||
{
|
||||
@ -460,12 +463,17 @@ namespace AppLauncher
|
||||
isBusy = true;
|
||||
|
||||
// update session
|
||||
if (this.CurrentSession == null)
|
||||
{
|
||||
this.CurrentSession = new LauncherSession();
|
||||
}
|
||||
|
||||
this.CurrentSession.DefaultHeight = this.Height;
|
||||
this.CurrentSession.AlwaysOnTop = this.TopMost;
|
||||
this.CurrentSession.StartPosition = this.Location;
|
||||
|
||||
// save
|
||||
LauncherSession saveSession = this.CurrentSession.ToSimple();
|
||||
saveSession.Groups = new List<TileGroupModel>();
|
||||
this.CurrentSession.Groups = new List<TileGroupModel>();
|
||||
for (int i = 0; i < flowLayoutPanel1.Controls.Count; i++)
|
||||
{
|
||||
if (flowLayoutPanel1.Controls[i].GetType() != typeof(TTilePanelLayout))
|
||||
@ -474,12 +482,12 @@ namespace AppLauncher
|
||||
}
|
||||
|
||||
TTilePanelLayout container = flowLayoutPanel1.Controls[i] as TTilePanelLayout;
|
||||
saveSession.Groups.Add(container.Model);
|
||||
this.CurrentSession.Groups.Add(container.Model);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
File.WriteAllText(filename, JsonConvert.SerializeObject(saveSession));
|
||||
File.WriteAllText(filename, JsonConvert.SerializeObject(this.CurrentSession));
|
||||
|
||||
if (showNotices)
|
||||
{
|
||||
@ -553,5 +561,23 @@ namespace AppLauncher
|
||||
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;
|
||||
}
|
||||
|
||||
private void toolStripMenuItem12_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.CurrentSession == null) return;
|
||||
|
||||
this.CurrentSession.EnableBigIconInFolder = !this.CurrentSession.EnableBigIconInFolder;
|
||||
|
||||
toolStripMenuItem12.Checked = this.CurrentSession.EnableBigIconInFolder;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
|
||||
namespace AppLauncher.Models
|
||||
{
|
||||
@ -25,25 +26,16 @@ namespace AppLauncher.Models
|
||||
|
||||
public int DefaultHeight { get; set; } = 280;
|
||||
public HotKeyOptions HotKey { get; set; } = null;
|
||||
|
||||
public bool AlwaysOnTop { get; set; } = false;
|
||||
public bool EnableAnimation { get; set; } = false;
|
||||
public bool EnableBigIconInFolder { get; set; } = false;
|
||||
|
||||
public bool HideOnClose { get; set; } = false;
|
||||
public bool HideOnClick { get; set; } = false;
|
||||
public AutoSaveOption AutoSave { get; set; } = AutoSaveOption.Prompt;
|
||||
public List<TileGroupModel> Groups { get; set; } = new List<TileGroupModel>();
|
||||
|
||||
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
|
||||
};
|
||||
}
|
||||
public Point StartPosition { get; set; } = Point.Empty;
|
||||
|
||||
}
|
||||
}
|
@ -33,4 +33,4 @@ using System.Runtime.InteropServices;
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.1.1.144")]
|
||||
[assembly: AssemblyFileVersion("0.1.1.153")]
|
||||
|
@ -24,6 +24,7 @@ namespace AppLauncher.Windows.Forms
|
||||
this.BackColor = Color.FromArgb(250, 250, 250);
|
||||
this.ContextMenuStrip = contextMenuStrip1;
|
||||
this.DoubleBuffered = true;
|
||||
this.AllowDrop = true;
|
||||
|
||||
label1.ForeColor = Color.FromArgb(99, 105, 119);
|
||||
label1.Font = new Font(this.Font.FontFamily, 8.25F);
|
||||
@ -76,6 +77,83 @@ namespace AppLauncher.Windows.Forms
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDragDrop(DragEventArgs e)
|
||||
{
|
||||
string[] fileList = e.Data.GetData(DataFormats.FileDrop) as string[];
|
||||
|
||||
if (this.ModelInfo.IsGroup)
|
||||
{
|
||||
this.DropFileList(fileList);
|
||||
|
||||
invalidateGroupMenu(this.ModelInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.PanelContainer != null)
|
||||
{
|
||||
this.PanelContainer.DropFileList(fileList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDragOver(DragEventArgs e)
|
||||
{
|
||||
base.OnDragDrop(e);
|
||||
|
||||
e.Effect = (e.Data.GetDataPresent(DataFormats.FileDrop)) ? DragDropEffects.Link : DragDropEffects.None;
|
||||
}
|
||||
|
||||
public void DropFileList(string[] fileList)
|
||||
{
|
||||
if (fileList == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (fileList.Length <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(fileList[0]))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TileModel model = new TileModel()
|
||||
{
|
||||
ProcessFilename = fileList[0],
|
||||
Title = Path.GetFileName(fileList[0])
|
||||
};
|
||||
|
||||
// exe
|
||||
if (Path.GetExtension(fileList[0]).Equals(".exe", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
if (File.Exists(fileList[0]))
|
||||
{
|
||||
try
|
||||
{
|
||||
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(fileList[0]);
|
||||
if (fvi != null)
|
||||
{
|
||||
model.Title = fvi.ProductName;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(model.Title))
|
||||
{
|
||||
model.Title = Path.GetFileNameWithoutExtension(fileList[0]);
|
||||
}
|
||||
}
|
||||
|
||||
this.ModelInfo.Items.Add(model);
|
||||
}
|
||||
|
||||
public void LoadInfo(TileModel model)
|
||||
{
|
||||
this.modelInfo = model;
|
||||
@ -149,6 +227,8 @@ namespace AppLauncher.Windows.Forms
|
||||
{
|
||||
if (groupContextMenu != null)
|
||||
{
|
||||
invalidateGroupMenuSize();
|
||||
|
||||
groupContextMenu.Show(this, e.Location);
|
||||
}
|
||||
}
|
||||
@ -263,7 +343,11 @@ namespace AppLauncher.Windows.Forms
|
||||
|
||||
protected void invalidateGroupMenu(TileModel model)
|
||||
{
|
||||
if (groupContextMenu == null) groupContextMenu = new ContextMenuStrip();
|
||||
if (groupContextMenu == null)
|
||||
{
|
||||
groupContextMenu = new ContextMenuStrip();
|
||||
}
|
||||
|
||||
groupContextMenu.Items.Clear();
|
||||
|
||||
if (model.Items == null)
|
||||
@ -278,7 +362,26 @@ namespace AppLauncher.Windows.Forms
|
||||
toolItem.Tag = item;
|
||||
toolItem.Click += toolItem_Click;
|
||||
}
|
||||
}
|
||||
|
||||
protected void invalidateGroupMenuSize()
|
||||
{
|
||||
if (this.PanelContainer != null)
|
||||
{
|
||||
if (this.PanelContainer.MainForm != null)
|
||||
{
|
||||
if (this.PanelContainer.MainForm.CurrentSession != null)
|
||||
{
|
||||
if (this.PanelContainer.MainForm.CurrentSession.EnableBigIconInFolder)
|
||||
{
|
||||
groupContextMenu.ImageScalingSize = new Size(24, 24);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
groupContextMenu.ImageScalingSize = new Size(16, 16);
|
||||
}
|
||||
|
||||
protected MainForm findMainForm()
|
||||
|
@ -55,53 +55,8 @@ namespace AppLauncher.Windows.Forms
|
||||
protected override void OnDragDrop(DragEventArgs e)
|
||||
{
|
||||
string[] fileList = e.Data.GetData(DataFormats.FileDrop) as string[];
|
||||
if (fileList == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (fileList.Length <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(fileList[0]))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TileModel model = new TileModel()
|
||||
{
|
||||
ProcessFilename = fileList[0],
|
||||
Title = Path.GetFileName(fileList[0])
|
||||
};
|
||||
|
||||
// exe
|
||||
if (Path.GetExtension(fileList[0]).Equals(".exe", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
if (File.Exists(fileList[0]))
|
||||
{
|
||||
try
|
||||
{
|
||||
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(fileList[0]);
|
||||
if (fvi != null)
|
||||
{
|
||||
model.Title = fvi.ProductName;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(model.Title))
|
||||
{
|
||||
model.Title = Path.GetFileNameWithoutExtension(fileList[0]);
|
||||
}
|
||||
}
|
||||
|
||||
this.AddTile(model);
|
||||
this.DropFileList(fileList);
|
||||
}
|
||||
|
||||
protected override void OnDragOver(DragEventArgs e)
|
||||
@ -174,12 +129,80 @@ namespace AppLauncher.Windows.Forms
|
||||
}
|
||||
}
|
||||
|
||||
public bool EnableAnimation { get; set; } = true;
|
||||
public bool EnableAnimation
|
||||
{
|
||||
get
|
||||
{
|
||||
MainForm mainForm = this.MainForm;
|
||||
if (mainForm == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mainForm.CurrentSession == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return mainForm.CurrentSession.EnableAnimation;
|
||||
}
|
||||
}
|
||||
|
||||
public int CollapseHeight => labelHeight + collapseHeight;
|
||||
|
||||
public int ExpandedHeight => expandedHeight + this.Padding.Bottom;
|
||||
|
||||
public void DropFileList(string[] fileList)
|
||||
{
|
||||
if (fileList == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (fileList.Length <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(fileList[0]))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TileModel model = new TileModel()
|
||||
{
|
||||
ProcessFilename = fileList[0],
|
||||
Title = Path.GetFileName(fileList[0])
|
||||
};
|
||||
|
||||
// exe
|
||||
if (Path.GetExtension(fileList[0]).Equals(".exe", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
if (File.Exists(fileList[0]))
|
||||
{
|
||||
try
|
||||
{
|
||||
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(fileList[0]);
|
||||
if (fvi != null)
|
||||
{
|
||||
model.Title = fvi.ProductName;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(model.Title))
|
||||
{
|
||||
model.Title = Path.GetFileNameWithoutExtension(fileList[0]);
|
||||
}
|
||||
}
|
||||
|
||||
this.AddTile(model);
|
||||
}
|
||||
|
||||
public TileGroupModel Model
|
||||
{
|
||||
get
|
||||
@ -215,6 +238,30 @@ namespace AppLauncher.Windows.Forms
|
||||
}
|
||||
}
|
||||
|
||||
public MainForm MainForm
|
||||
{
|
||||
get
|
||||
{
|
||||
FlowLayoutPanel layoutPanel = this.FlowLayoutPanel;
|
||||
if (layoutPanel == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (layoutPanel.Parent == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (layoutPanel.Parent.GetType() != typeof(MainForm))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return layoutPanel.Parent as MainForm;
|
||||
}
|
||||
}
|
||||
|
||||
public List<TileModel> Tiles
|
||||
{
|
||||
get
|
||||
|
Reference in New Issue
Block a user