Changed: tile list group with coord

This commit is contained in:
Ray committed 2020-05-17 03:24:46 +01:00
1 parent d4258b39eb
commit 2e111a3bce
12 files changed
+350 -249

No files matched your search

+164 -36
View File
@@ -1,24 +1,33 @@
using AppLauncher.Models;
using RyzStudio.Windows.ThemedForms;
using System;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Windows.Forms;
namespace AppLauncher.Windows.Forms
{
public class AddListTileForm : TDialogForm
{
public static void ShowDialog(TTilePanelLayout control)
public static void ShowDialog(TTilePanelLayout control, Point coord)
{
AddListTileForm form = new AddListTileForm();
form.TilePanelLayout = control;
form.AimCoord = coord;
form.ShowDialog();
}
private System.Windows.Forms.Label label1;
private TButton button1;
private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator1;
private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2;
private TTextBox textBox1;
private TListBox listBox1;
private System.Windows.Forms.Label label2;
public TTilePanelLayout TilePanelLayout { get; set; } = null;
public Point AimCoord { get; set; } = new Point(-1, -1);
public AddListTileForm() : base()
{
@@ -28,13 +37,15 @@ namespace AppLauncher.Windows.Forms
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AddListTileForm));
RyzStudio.Windows.ThemedForms.TButton.ButtonStyle style4 = new RyzStudio.Windows.ThemedForms.TButton.ButtonStyle();
RyzStudio.Windows.ThemedForms.TButton.ButtonStyle style5 = new RyzStudio.Windows.ThemedForms.TButton.ButtonStyle();
RyzStudio.Windows.ThemedForms.TButton.ButtonStyle style6 = new RyzStudio.Windows.ThemedForms.TButton.ButtonStyle();
RyzStudio.Windows.ThemedForms.TButton.ButtonStyle buttonStyle1 = new RyzStudio.Windows.ThemedForms.TButton.ButtonStyle();
RyzStudio.Windows.ThemedForms.TButton.ButtonStyle buttonStyle2 = new RyzStudio.Windows.ThemedForms.TButton.ButtonStyle();
RyzStudio.Windows.ThemedForms.TButton.ButtonStyle buttonStyle3 = new RyzStudio.Windows.ThemedForms.TButton.ButtonStyle();
this.textBox1 = new RyzStudio.Windows.ThemedForms.TTextBox();
this.label1 = new System.Windows.Forms.Label();
this.button1 = new RyzStudio.Windows.ThemedForms.TButton();
this.horizontalSeparator1 = new RyzStudio.Windows.Forms.THorizontalSeparator();
this.horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator();
this.listBox1 = new RyzStudio.Windows.ThemedForms.TListBox();
this.label2 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit();
this.SuspendLayout();
//
@@ -43,11 +54,6 @@ namespace AppLauncher.Windows.Forms
this.imgbxClose.Image = ((System.Drawing.Image)(resources.GetObject("imgbxClose.Image")));
this.imgbxClose.Location = new System.Drawing.Point(367, 5);
//
// lblDescription
//
this.lblDescription.Size = new System.Drawing.Size(359, 30);
this.lblDescription.Text = "Add List Tile";
//
// panel1
//
this.panel1.Location = new System.Drawing.Point(394, 474);
@@ -96,48 +102,82 @@ namespace AppLauncher.Windows.Forms
this.button1.OverImage = null;
this.button1.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3);
this.button1.Size = new System.Drawing.Size(128, 32);
style4.BackColour = System.Drawing.Color.White;
style4.ForeImage = null;
style4.PenColour = System.Drawing.Color.Black;
this.button1.StyleDefault = style4;
style5.BackColour = System.Drawing.Color.FromArgb(((int)(((byte)(179)))), ((int)(((byte)(179)))), ((int)(((byte)(179)))));
style5.ForeImage = null;
style5.PenColour = System.Drawing.Color.Black;
this.button1.StyleDown = style5;
style6.BackColour = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51)))));
style6.ForeImage = null;
style6.PenColour = System.Drawing.Color.White;
this.button1.StyleOver = style6;
buttonStyle1.BackColour = System.Drawing.Color.White;
buttonStyle1.ForeImage = null;
buttonStyle1.PenColour = System.Drawing.Color.Black;
this.button1.StyleDefault = buttonStyle1;
buttonStyle2.BackColour = System.Drawing.Color.FromArgb(((int)(((byte)(179)))), ((int)(((byte)(179)))), ((int)(((byte)(179)))));
buttonStyle2.ForeImage = null;
buttonStyle2.PenColour = System.Drawing.Color.Black;
this.button1.StyleDown = buttonStyle2;
buttonStyle3.BackColour = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51)))));
buttonStyle3.ForeImage = null;
buttonStyle3.PenColour = System.Drawing.Color.White;
this.button1.StyleOver = buttonStyle3;
this.button1.TabIndex = 173;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// horizontalSeparator1
// horizontalSeparator2
//
this.horizontalSeparator1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
this.horizontalSeparator2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.horizontalSeparator1.Location = new System.Drawing.Point(10, 92);
this.horizontalSeparator1.MaximumSize = new System.Drawing.Size(4920, 2);
this.horizontalSeparator1.Name = "horizontalSeparator1";
this.horizontalSeparator1.Size = new System.Drawing.Size(380, 2);
this.horizontalSeparator1.TabIndex = 176;
this.horizontalSeparator2.Location = new System.Drawing.Point(10, 92);
this.horizontalSeparator2.MaximumSize = new System.Drawing.Size(4920, 2);
this.horizontalSeparator2.Name = "horizontalSeparator2";
this.horizontalSeparator2.Size = new System.Drawing.Size(380, 2);
this.horizontalSeparator2.TabIndex = 177;
//
// AddListTileForm
// listBox1
//
this.listBox1.AllowDrop = true;
this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.listBox1.BackColor = System.Drawing.Color.Transparent;
this.listBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
this.listBox1.Location = new System.Drawing.Point(159, 101);
this.listBox1.Margin = new System.Windows.Forms.Padding(10, 4, 10, 4);
this.listBox1.Name = "listBox1";
this.listBox1.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5);
this.listBox1.Size = new System.Drawing.Size(220, 280);
this.listBox1.SubmitButton = null;
this.listBox1.TabIndex = 180;
this.listBox1.OnAdd += new System.EventHandler(this.listBox1_OnAdd);
this.listBox1.OnEdit += new System.EventHandler(this.listBox1_OnEdit);
this.listBox1.DragDrop += new System.Windows.Forms.DragEventHandler(this.listBox1_DragDrop);
this.listBox1.DragOver += new System.Windows.Forms.DragEventHandler(this.listBox1_DragOver);
//
// label2
//
this.label2.BackColor = System.Drawing.Color.Transparent;
this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(95)))), ((int)(((byte)(99)))), ((int)(((byte)(104)))));
this.label2.Location = new System.Drawing.Point(18, 104);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(131, 32);
this.label2.TabIndex = 181;
this.label2.Text = "List";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// EditListTileForm2
//
this.ClientSize = new System.Drawing.Size(400, 480);
this.Controls.Add(this.horizontalSeparator1);
this.Controls.Add(this.label2);
this.Controls.Add(this.listBox1);
this.Controls.Add(this.horizontalSeparator2);
this.Controls.Add(this.button1);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1);
this.Description = "Add List Tile";
this.Name = "AddListTileForm";
this.Name = "EditListTileForm2";
this.Title = "Add List Tile";
this.Controls.SetChildIndex(this.imgbxClose, 0);
this.Controls.SetChildIndex(this.lblDescription, 0);
this.Controls.SetChildIndex(this.panel1, 0);
this.Controls.SetChildIndex(this.area1, 0);
this.Controls.SetChildIndex(this.textBox1, 0);
this.Controls.SetChildIndex(this.label1, 0);
this.Controls.SetChildIndex(this.button1, 0);
this.Controls.SetChildIndex(this.horizontalSeparator1, 0);
this.Controls.SetChildIndex(this.horizontalSeparator2, 0);
this.Controls.SetChildIndex(this.listBox1, 0);
this.Controls.SetChildIndex(this.label2, 0);
((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).EndInit();
this.ResumeLayout(false);
@@ -151,10 +191,98 @@ namespace AppLauncher.Windows.Forms
IsGroup = true
};
if (!this.AimCoord.Equals(new Point(-1, -1)))
{
model.Position = this.AimCoord;
}
model.Items = new System.Collections.Generic.List<TileModel>();
foreach (TileModel item in listBox1.ListBox.Items.OfType<TileModel>())
{
if (item.IsGroup)
{
continue;
}
model.Items.Add(item);
}
this.TilePanelLayout.AddTile(model);
this.Close();
}
private void listBox1_OnAdd(object sender, EventArgs e) => AddTileForm.ShowDialog(listBox1);
private void listBox1_OnEdit(object sender, EventArgs e)
{
if (listBox1.ListBox.Items.Count <= 0)
{
return;
}
EditTileForm.ShowDialog(listBox1);
}
private void listBox1_DragOver(object sender, System.Windows.Forms.DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
e.Effect = DragDropEffects.Link;
}
else
{
e.Effect = DragDropEffects.None;
}
}
private void listBox1_DragDrop(object sender, 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
}
}
}
listBox1.ListBox.Items.Add(model);
}
}
}
+2 -6
View File
@@ -84,10 +84,7 @@ namespace AppLauncher.Windows.Forms
this.imgbxClose.Image = ((System.Drawing.Image)(resources.GetObject("imgbxClose.Image")));
this.imgbxClose.Location = new System.Drawing.Point(367, 5);
//
// lblDescription
//
this.lblDescription.Size = new System.Drawing.Size(359, 30);
this.lblDescription.Text = "Add Tile";
this.Text = "Add Tile";
//
// panel1
//
@@ -324,10 +321,9 @@ namespace AppLauncher.Windows.Forms
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1);
this.Description = "Add Tile";
this.Title = "Add Tile";
this.Name = "AddTileForm";
this.Controls.SetChildIndex(this.imgbxClose, 0);
this.Controls.SetChildIndex(this.lblDescription, 0);
this.Controls.SetChildIndex(this.panel1, 0);
this.Controls.SetChildIndex(this.area1, 0);
this.Controls.SetChildIndex(this.textBox1, 0);
+2 -4
View File
@@ -48,8 +48,7 @@ namespace AppLauncher.Windows.Forms
//
// lblDescription
//
this.lblDescription.Size = new System.Drawing.Size(359, 30);
this.lblDescription.Text = "Edit Group";
this.Text = "Edit Group";
//
// panel1
//
@@ -135,10 +134,9 @@ namespace AppLauncher.Windows.Forms
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1);
this.Description = "Edit Group";
this.Title = "Edit Group";
this.Name = "EditGroupForm";
this.Controls.SetChildIndex(this.imgbxClose, 0);
this.Controls.SetChildIndex(this.lblDescription, 0);
this.Controls.SetChildIndex(this.panel1, 0);
this.Controls.SetChildIndex(this.area1, 0);
this.Controls.SetChildIndex(this.textBox1, 0);
+67 -4
View File
@@ -1,7 +1,10 @@
using AppLauncher.Models;
using RyzStudio.Windows.ThemedForms;
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Windows.Forms;
namespace AppLauncher.Windows.Forms
{
@@ -50,8 +53,7 @@ namespace AppLauncher.Windows.Forms
//
// lblDescription
//
this.lblDescription.Size = new System.Drawing.Size(359, 30);
this.lblDescription.Text = "Edit List Tile";
this.Title = "Edit List Tile";
//
// panel1
//
@@ -128,6 +130,7 @@ namespace AppLauncher.Windows.Forms
//
// listBox1
//
this.listBox1.AllowDrop = true;
this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
@@ -142,6 +145,8 @@ namespace AppLauncher.Windows.Forms
this.listBox1.TabIndex = 180;
this.listBox1.OnAdd += new System.EventHandler(this.listBox1_OnAdd);
this.listBox1.OnEdit += new System.EventHandler(this.listBox1_OnEdit);
this.listBox1.DragDrop += new System.Windows.Forms.DragEventHandler(this.listBox1_DragDrop);
this.listBox1.DragOver += new System.Windows.Forms.DragEventHandler(this.listBox1_DragOver);
//
// label2
//
@@ -163,10 +168,9 @@ namespace AppLauncher.Windows.Forms
this.Controls.Add(this.button1);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1);
this.Description = "Edit List Tile";
this.Title = "Edit List Tile";
this.Name = "EditListTileForm";
this.Controls.SetChildIndex(this.imgbxClose, 0);
this.Controls.SetChildIndex(this.lblDescription, 0);
this.Controls.SetChildIndex(this.panel1, 0);
this.Controls.SetChildIndex(this.area1, 0);
this.Controls.SetChildIndex(this.textBox1, 0);
@@ -242,5 +246,64 @@ namespace AppLauncher.Windows.Forms
EditTileForm.ShowDialog(listBox1);
}
private void listBox1_DragOver(object sender, System.Windows.Forms.DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
e.Effect = DragDropEffects.Link;
}
else
{
e.Effect = DragDropEffects.None;
}
}
private void listBox1_DragDrop(object sender, 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
}
}
}
listBox1.ListBox.Items.Add(model);
}
}
}
+2 -4
View File
@@ -83,8 +83,7 @@ namespace AppLauncher.Windows.Forms
//
// lblDescription
//
this.lblDescription.Size = new System.Drawing.Size(359, 30);
this.lblDescription.Text = "Edit Tile";
this.Title = "Edit Tile";
//
// panel1
//
@@ -321,10 +320,9 @@ namespace AppLauncher.Windows.Forms
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1);
this.Description = "Edit Tile";
this.Title = "Edit Tile";
this.Name = "EditTileForm";
this.Controls.SetChildIndex(this.imgbxClose, 0);
this.Controls.SetChildIndex(this.lblDescription, 0);
this.Controls.SetChildIndex(this.panel1, 0);
this.Controls.SetChildIndex(this.area1, 0);
this.Controls.SetChildIndex(this.textBox1, 0);
+6 -1
View File
@@ -740,7 +740,12 @@ namespace AppLauncher.Windows.Forms
AddTileForm.ShowDialog(this, coord);
}
private void addListTileMenuItem_Click(object sender, EventArgs e) => AddListTileForm.ShowDialog(this);
private void addListTileMenuItem_Click(object sender, EventArgs e)
{
Point coord = convertLocationToCoord(lastMousePosition.X, lastMousePosition.Y);
AddListTileForm.ShowDialog(this, coord);
}
private void addGroupMenuItem_Click(object sender, EventArgs e) => this.AddGroup();