diff --git a/LinearAppLauncher.csproj b/LinearAppLauncher.csproj index 46d5330..95f690c 100644 --- a/LinearAppLauncher.csproj +++ b/LinearAppLauncher.csproj @@ -68,6 +68,9 @@ Resources.resx + + Component + UserControl @@ -83,8 +86,6 @@ Button.cs - - Form @@ -128,12 +129,18 @@ UserControl.cs + + Form + Form Form + + Form + Form @@ -198,12 +205,18 @@ TextButtonBox.cs + + AddListTileForm.cs + AddTileForm.cs EditGroupForm.cs + + EditListTileForm.cs + EditTileForm.cs diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index 0b32b86..89888e2 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -115,6 +115,7 @@ this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.flowLayoutPanel1.Location = new System.Drawing.Point(12, 59); this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Padding = new System.Windows.Forms.Padding(0, 0, 10, 0); this.flowLayoutPanel1.Size = new System.Drawing.Size(600, 361); this.flowLayoutPanel1.TabIndex = 27; this.flowLayoutPanel1.WrapContents = false; diff --git a/MainForm.cs b/MainForm.cs index 77fbd79..4972c09 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -3,6 +3,7 @@ using AppLauncher.Windows.Forms; using Newtonsoft.Json; using System; using System.Collections.Generic; +using System.Drawing; using System.IO; using System.Threading.Tasks; using System.Windows.Forms; @@ -18,10 +19,21 @@ namespace AppLauncher public MainForm() : base() { InitializeComponent(); + + //this.Visible = false; + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + //this.Visible = false; } protected override void OnShown(EventArgs e) { + this.Visible = false; + base.OnShown(e); string jsonfigFilename = Path.ChangeExtension(Application.ExecutablePath, "jsonfig"); @@ -30,6 +42,8 @@ namespace AppLauncher loadSession(jsonfigFilename); } + this.Location = this.DefaultLocation; + this.Visible = true; } public async Task ToggleSize() @@ -182,7 +196,7 @@ namespace AppLauncher flowLayoutPanel1.Controls.Add(panel); } - flowLayoutPanel1.Width = maxWidth + SystemInformation.VerticalScrollBarWidth; + flowLayoutPanel1.Width = maxWidth + SystemInformation.VerticalScrollBarWidth + 20; //this.Width = flowLayoutPanel1.Width + (flowLayoutPanel1.Left * 2); this.Width = flowLayoutPanel1.Width + flowLayoutPanel1.Left; diff --git a/RyzStudio/Windows/Forms/FlatButton.cs b/RyzStudio/Windows/Forms/FlatButton.cs new file mode 100644 index 0000000..35c3e40 --- /dev/null +++ b/RyzStudio/Windows/Forms/FlatButton.cs @@ -0,0 +1,112 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace RyzStudio.Windows.Forms +{ + public class FlatButton : Label + { + public class Style + { + public Color BackColour { get; set; } = Color.Transparent; + public Color PenColour { get; set; } = Color.Transparent; + } + + public enum State + { + Idle = 0, + Hover, + Down + } + + protected State controlState = State.Idle; + + public FlatButton() : base() + { + this.AutoSize = false; + this.ImageAlign = ContentAlignment.MiddleCenter; + this.TextAlign = ContentAlignment.MiddleCenter; + + // customise + this.StyleOver = new Style() + { + BackColour = Color.FromArgb(51, 51, 51), + PenColour = Color.White + }; + this.StyleDown = new Style() + { + BackColour = Color.FromArgb(179, 179, 179), + PenColour = Color.Black + }; + this.StyleDefault = new Style() + { + BackColour = Color.White, + PenColour = Color.Black + }; + + this.VisualState = State.Idle; + + this.Click += delegate { this.OnClick(null); }; + this.MouseEnter += delegate { this.VisualState = State.Hover; }; + this.MouseLeave += delegate { this.VisualState = State.Idle; }; + this.MouseDown += delegate { this.VisualState = State.Down; }; + this.MouseUp += delegate { this.VisualState = State.Idle; }; + } + + protected State VisualState + { + get { return controlState; } + set + { + switch (value) + { + case State.Idle: + if (this.VisualState == State.Down) + { + updateButton(StyleOver); + } + else + { + updateButton(StyleDefault); + } + + break; + case State.Hover: + updateButton(StyleOver); + break; + case State.Down: + updateButton(StyleDown); + break; + default: + updateButton(StyleDefault); + break; + } + + controlState = value; + } + } + + protected void updateButton(Style style) + { + this.ForeColor = style.PenColour; + this.BackColor = style.BackColour; + } + + [Browsable(false)] + public Style StyleOver { get; set; } = new Style(); + + [Browsable(false)] + public Style StyleDown { get; set; } = new Style(); + + [Browsable(false)] + public Style StyleDefault { get; set; } = new Style(); + + public void PerformClick() => this.OnClick(null); + + } +} diff --git a/RyzStudio/Windows/ThemedForms/Button.cs b/RyzStudio/Windows/ThemedForms/Button.cs index dc40b99..36fc99e 100644 --- a/RyzStudio/Windows/ThemedForms/Button.cs +++ b/RyzStudio/Windows/ThemedForms/Button.cs @@ -1,13 +1,26 @@ namespace RyzStudio.Windows.ThemedForms { - using RyzStudio.Drawing; using System; - using System.ComponentModel; - using System.Drawing; + using System.ComponentModel; + using System.Drawing; - public partial class Button : RyzStudio.Windows.ThemedForms.UserControl + public partial class Button : RyzStudio.Windows.ThemedForms.UserControl { - protected ButtonState buttonState = ButtonState.Normal; + public class Style + { + public Color BackColour { get; set; } = Color.Transparent; + public Color PenColour { get; set; } = Color.Transparent; + public Image ForeImage { get; set; } = null; + } + + public enum State + { + Idle = 0, + Hover, + Down + } + + protected State controlState = State.Idle; public Button() : base() { @@ -16,34 +29,48 @@ label1.ImageAlign = ContentAlignment.MiddleCenter; label1.Click += delegate { this.OnClick(null); }; - label1.MouseEnter += delegate { this.VisualState = ButtonState.Hover; }; - label1.MouseLeave += delegate { this.VisualState = ButtonState.Normal; }; - label1.MouseDown += delegate { this.VisualState = ButtonState.Down; }; - label1.MouseUp += delegate { this.VisualState = ButtonState.Normal; }; - + label1.MouseEnter += delegate { this.VisualState = State.Hover; }; + label1.MouseLeave += delegate { this.VisualState = State.Idle; }; + label1.MouseDown += delegate { this.VisualState = State.Down; }; + label1.MouseUp += delegate { this.VisualState = State.Idle; }; } - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); // customise - this.StyleOver = new ButtonStyle(Color.FromArgb(51, 51, 51), Color.White, this.OverImage); - this.StyleDown = new ButtonStyle(Color.FromArgb(179, 179, 179), Color.Black, this.DownImage); - this.StyleDefault = new ButtonStyle(Color.White, Color.Black, this.DefaultImage); + this.StyleOver = new Style() + { + BackColour = Color.FromArgb(51, 51, 51), + PenColour = Color.White, + ForeImage = this.OverImage + }; + this.StyleDown = new Style() + { + BackColour = Color.FromArgb(179, 179, 179), + PenColour = Color.Black, + ForeImage = this.DownImage + }; + this.StyleDefault = new Style() + { + BackColour = Color.White, + PenColour = Color.Black, + ForeImage = this.DefaultImage + }; - this.VisualState = ButtonState.Normal; + this.VisualState = State.Idle; } - protected ButtonState VisualState + protected State VisualState { - get { return buttonState; } + get { return controlState; } set { switch (value) { - case ButtonState.Normal: - if (this.VisualState == ButtonState.Down) + case State.Idle: + if (this.VisualState == State.Down) { updateButton(StyleOver); } @@ -53,10 +80,10 @@ } break; - case ButtonState.Hover: + case State.Hover: updateButton(StyleOver); break; - case ButtonState.Down: + case State.Down: updateButton(StyleDown); break; default: @@ -64,22 +91,15 @@ break; } - buttonState = value; + controlState = value; } } - protected void updateButton(ButtonStyle style) + protected void updateButton(Style style) { label1.ForeColor = style.PenColour; label1.BackColor = style.BackColour; label1.Image = style.ForeImage; - - //var rect = label1.ClientRectangle; - ////rect.Inflate(-3, -3); - //Rectangoid area = new Rectangoid(rect, 3, 1); - - //label1.Region = new Region(area.ToGraphicsPath()); - } [Browsable(true)] @@ -98,14 +118,14 @@ [Category("Appearance")] public Image DefaultImage { get; set; } = null; - [Browsable(false)] - public ButtonStyle StyleOver { get; set; } = new ButtonStyle(Color.FromArgb(71, 142, 203), Color.FromArgb(250, 250, 250)); + [Browsable(false)] + public Style StyleOver { get; set; } = new Style(); [Browsable(false)] - public ButtonStyle StyleDown { get; set; } = new ButtonStyle(Color.FromArgb(61, 132, 193), Color.FromArgb(250, 250, 250)); + public Style StyleDown { get; set; } = new Style(); [Browsable(false)] - public ButtonStyle StyleDefault { get; set; } = new ButtonStyle(Color.FromArgb(51, 122, 183), Color.FromArgb(250, 250, 250)); + public Style StyleDefault { get; set; } = new Style(); public void PerformClick() => this.OnClick(null); } diff --git a/Windows/Forms/AForm.cs b/Windows/Forms/AForm.cs index 428f7e1..3cfa1c0 100644 --- a/Windows/Forms/AForm.cs +++ b/Windows/Forms/AForm.cs @@ -12,9 +12,6 @@ namespace AppLauncher.Windows.Forms { public class AForm : Form { - //private bool windowDragging = false; - //private Point windowOffset = new Point(); - public AForm() : base() { if (!this.DesignMode) @@ -33,9 +30,14 @@ namespace AppLauncher.Windows.Forms return; } - int requestedHeight = (int)Math.Floor(decimal.Divide((Screen.PrimaryScreen.WorkingArea.Height - this.Height), 2)); + //int requestedHeight = (int)Math.Floor(decimal.Divide((Screen.PrimaryScreen.WorkingArea.Height - this.Height), 2)); + //this.Location = new Point(Screen.PrimaryScreen.WorkingArea.X, (Screen.PrimaryScreen.WorkingArea.Y + requestedHeight)); - this.Location = new Point(Screen.PrimaryScreen.WorkingArea.X, (Screen.PrimaryScreen.WorkingArea.Y + requestedHeight)); + //Point newPosition = new Point(Cursor.Position.X, Cursor.Position.Y); + //newPosition.X -= (this.Width / 2); + //newPosition.Y -= (this.Height / 2); + + //this.Location = newPosition; } protected override void OnPaintBackground(PaintEventArgs e) @@ -53,53 +55,20 @@ namespace AppLauncher.Windows.Forms //g.DrawRectangle(new Pen(new SolidBrush(Color.Red), 1), this.DisplayRectangle); } - //protected override void OnPaint(PaintEventArgs e) - //{ - // base.OnPaint(e); + protected Point DefaultLocation + { + get + { + Point newPosition = new Point(Cursor.Position.X, Cursor.Position.Y); + newPosition.X -= (this.Width / 2); + newPosition.Y -= (this.Height / 2); - // if (this.BackgroundImage == null) - // { - // return; - // } + newPosition.X = Math.Max(newPosition.X, Screen.PrimaryScreen.WorkingArea.Left); + newPosition.Y = Math.Max(newPosition.Y, Screen.PrimaryScreen.WorkingArea.Top); - // Graphics g = e.Graphics; - - // g.TextRenderingHint = TextRenderingHint.AntiAlias; - // g.InterpolationMode = InterpolationMode.HighQualityBilinear; - // g.PixelOffsetMode = PixelOffsetMode.HighQuality; - // g.SmoothingMode = SmoothingMode.HighQuality; - - // g.DrawImage(this.BackgroundImage, Point.Empty); - //} - - //protected void windowMoveControl_MouseDown(object sender, MouseEventArgs e) - //{ - // if (e.Button != MouseButtons.Left) - // { - // return; - // } - - // windowDragging = true; - // windowOffset = e.Location; - //} - - //protected void windowMoveControl_MouseUp(object sender, MouseEventArgs e) - //{ - // windowDragging = false; - //} - - //protected void windowMoveControl_MouseMove(object sender, MouseEventArgs e) - //{ - // if (windowDragging) - // { - // Point pos = this.PointToScreen(e.Location); - - // int y = Math.Max((pos.Y - windowOffset.Y), Screen.PrimaryScreen.WorkingArea.Y); - // y = Math.Min(y, (Screen.PrimaryScreen.WorkingArea.Y + Screen.PrimaryScreen.WorkingArea.Height) - this.Height); - - // this.Location = new Point(Screen.PrimaryScreen.WorkingArea.X, y); - // } - //} + return newPosition; + } + } } -} +} \ No newline at end of file diff --git a/Windows/Forms/Tile/AddListTileForm.cs b/Windows/Forms/Tile/AddListTileForm.cs new file mode 100644 index 0000000..cbf5794 --- /dev/null +++ b/Windows/Forms/Tile/AddListTileForm.cs @@ -0,0 +1,165 @@ +using AppLauncher.Models; +using RyzStudio.Windows.ThemedForms; +using System; + +namespace AppLauncher.Windows.Forms +{ + public class AddListTileForm : DialogForm + { + public static void ShowDialog(TileLayoutPanel panel) + { + AddListTileForm form = new AddListTileForm(panel); + form.ShowDialog(); + } + + private System.Windows.Forms.Label label1; + private Button button1; + private RyzStudio.Windows.Forms.HorizontalSeparator horizontalSeparator1; + private TextBox textBox1; + protected TileLayoutPanel parentPanel = null; + + public AddListTileForm() : base() + { + InitializeComponent(); + } + + public AddListTileForm(TileLayoutPanel panel) : base() + { + parentPanel = panel; + + InitializeComponent(); + } + + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AddListTileForm)); + RyzStudio.Windows.ThemedForms.Button.Style style4 = new RyzStudio.Windows.ThemedForms.Button.Style(); + RyzStudio.Windows.ThemedForms.Button.Style style5 = new RyzStudio.Windows.ThemedForms.Button.Style(); + RyzStudio.Windows.ThemedForms.Button.Style style6 = new RyzStudio.Windows.ThemedForms.Button.Style(); + this.textBox1 = new RyzStudio.Windows.ThemedForms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.button1 = new RyzStudio.Windows.ThemedForms.Button(); + this.horizontalSeparator1 = new RyzStudio.Windows.Forms.HorizontalSeparator(); + ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit(); + this.SuspendLayout(); + // + // imgbxClose + // + 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); + // + // area1 + // + this.area1.Location = new System.Drawing.Point(1, 474); + this.area1.Size = new System.Drawing.Size(392, 5); + // + // textBox1 + // + this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBox1.BackColor = System.Drawing.Color.Transparent; + this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); + this.textBox1.Location = new System.Drawing.Point(159, 50); + this.textBox1.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6); + this.textBox1.Name = "textBox1"; + this.textBox1.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9); + this.textBox1.Size = new System.Drawing.Size(220, 32); + this.textBox1.SubmitButton = null; + this.textBox1.TabIndex = 152; + this.textBox1.UseSystemPasswordChar = false; + // + // label1 + // + this.label1.BackColor = System.Drawing.Color.Transparent; + this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(95)))), ((int)(((byte)(99)))), ((int)(((byte)(104))))); + this.label1.Location = new System.Drawing.Point(18, 50); + this.label1.Margin = new System.Windows.Forms.Padding(0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(131, 32); + this.label1.TabIndex = 153; + this.label1.Text = "Title"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // button1 + // + this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.button1.BackColor = System.Drawing.Color.Transparent; + this.button1.DefaultImage = null; + this.button1.DownImage = null; + this.button1.LabelText = "&Save"; + this.button1.Location = new System.Drawing.Point(251, 427); + this.button1.Name = "button1"; + 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; + this.button1.TabIndex = 173; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // horizontalSeparator1 + // + this.horizontalSeparator1.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; + // + // AddListTileForm + // + this.ClientSize = new System.Drawing.Size(400, 480); + this.Controls.Add(this.horizontalSeparator1); + this.Controls.Add(this.button1); + this.Controls.Add(this.label1); + this.Controls.Add(this.textBox1); + this.Description = "Add List Tile"; + this.Name = "AddListTileForm"; + 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); + ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).EndInit(); + this.ResumeLayout(false); + + } + + private void button1_Click(object sender, EventArgs e) + { + TileModel model = new TileModel() + { + Title = textBox1.Text?.Trim(), + IsGroup = true + }; + + parentPanel.AddTile(model); + + this.Close(); + } + + } +} \ No newline at end of file diff --git a/Windows/Forms/Tile/AddListTileForm.resx b/Windows/Forms/Tile/AddListTileForm.resx new file mode 100644 index 0000000..3747e00 --- /dev/null +++ b/Windows/Forms/Tile/AddListTileForm.resx @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAABh0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMS4xYyqcSwAAANlJREFUOE+lU1sO + gjAQrHgRY6KemQ+VT9NrgAfgfRA+SawzdTAk2lhkkgm7s7vTAq0py/LUNM0dHEEXSfYWfd8fDQIOD23b + nvFMY6jeAcxpMFIwC1HX9YWzNOCWUunR4AxnvxpUVbV3zm2UGsbUlHoEDfBhdsgf4BWDCcmYGmtqCxtw + NeQcoJ6JjGn43hXy8CvIxDeIGbREZY+pHjLgtqeVHf7SzVq7VdmDM6x9GGj1/19h9UckVv3GWMwNRh5L + 6dGYH+UCHCTQ9SfV+7pMvJIIaLL0Oudd1x2eUQ8MyeAeq0cAAAAASUVORK5CYII= + + + \ No newline at end of file diff --git a/Windows/Forms/Tile/AddTileForm.cs b/Windows/Forms/Tile/AddTileForm.cs index 147c10f..9aa8bd1 100644 --- a/Windows/Forms/Tile/AddTileForm.cs +++ b/Windows/Forms/Tile/AddTileForm.cs @@ -11,6 +11,12 @@ namespace AppLauncher.Windows.Forms { public class AddTileForm : DialogForm { + public static void ShowDialog(TileLayoutPanel panel) + { + AddTileForm form = new AddTileForm(panel); + form.ShowDialog(); + } + private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label4; @@ -47,6 +53,9 @@ namespace AppLauncher.Windows.Forms private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AddTileForm)); + RyzStudio.Windows.ThemedForms.Button.Style style1 = new RyzStudio.Windows.ThemedForms.Button.Style(); + RyzStudio.Windows.ThemedForms.Button.Style style2 = new RyzStudio.Windows.ThemedForms.Button.Style(); + RyzStudio.Windows.ThemedForms.Button.Style style3 = new RyzStudio.Windows.ThemedForms.Button.Style(); this.textBox1 = new RyzStudio.Windows.ThemedForms.TextBox(); this.label6 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); @@ -66,29 +75,29 @@ namespace AppLauncher.Windows.Forms this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit(); this.SuspendLayout(); - // + // // imgbxClose - // + // 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 = "Edit Tile"; - // + this.lblDescription.Text = "Add Tile"; + // // panel1 - // + // this.panel1.Location = new System.Drawing.Point(394, 474); - // + // // area1 - // + // this.area1.Location = new System.Drawing.Point(1, 474); this.area1.Size = new System.Drawing.Size(392, 5); - // + // // textBox1 - // - this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + // + this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.textBox1.BackColor = System.Drawing.Color.Transparent; this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); @@ -100,9 +109,9 @@ namespace AppLauncher.Windows.Forms this.textBox1.SubmitButton = null; this.textBox1.TabIndex = 152; this.textBox1.UseSystemPasswordChar = false; - // + // // label6 - // + // this.label6.BackColor = System.Drawing.Color.Transparent; this.label6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(95)))), ((int)(((byte)(99)))), ((int)(((byte)(104))))); this.label6.Location = new System.Drawing.Point(18, 268); @@ -111,9 +120,9 @@ namespace AppLauncher.Windows.Forms this.label6.TabIndex = 163; this.label6.Text = "Run As Admin"; this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // + // // label7 - // + // this.label7.BackColor = System.Drawing.Color.Transparent; this.label7.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(95)))), ((int)(((byte)(99)))), ((int)(((byte)(104))))); this.label7.Location = new System.Drawing.Point(18, 227); @@ -122,9 +131,9 @@ namespace AppLauncher.Windows.Forms this.label7.TabIndex = 161; this.label7.Text = "Window Style"; this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // + // // label4 - // + // this.label4.BackColor = System.Drawing.Color.Transparent; this.label4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(95)))), ((int)(((byte)(99)))), ((int)(((byte)(104))))); this.label4.Location = new System.Drawing.Point(18, 173); @@ -133,9 +142,9 @@ namespace AppLauncher.Windows.Forms this.label4.TabIndex = 159; this.label4.Text = "Working Directory"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // + // // label3 - // + // this.label3.BackColor = System.Drawing.Color.Transparent; this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(95)))), ((int)(((byte)(99)))), ((int)(((byte)(104))))); this.label3.Location = new System.Drawing.Point(18, 132); @@ -144,9 +153,9 @@ namespace AppLauncher.Windows.Forms this.label3.TabIndex = 157; this.label3.Text = "Argument"; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // + // // 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, 91); @@ -155,9 +164,9 @@ namespace AppLauncher.Windows.Forms this.label2.TabIndex = 155; this.label2.Text = "Filename"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // + // // label1 - // + // this.label1.BackColor = System.Drawing.Color.Transparent; this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(95)))), ((int)(((byte)(99)))), ((int)(((byte)(104))))); this.label1.Location = new System.Drawing.Point(18, 50); @@ -167,10 +176,10 @@ namespace AppLauncher.Windows.Forms this.label1.TabIndex = 153; this.label1.Text = "Title"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // + // // textBox2 - // - this.textBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + // + this.textBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.textBox2.BackColor = System.Drawing.Color.Transparent; this.textBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); @@ -185,10 +194,10 @@ namespace AppLauncher.Windows.Forms this.textBox2.TabIndex = 170; this.textBox2.UseSystemPasswordChar = false; this.textBox2.OnButtonClick += new System.EventHandler(this.textBox2_OnButtonClick); - // + // // textBox3 - // - this.textBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + // + this.textBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.textBox3.BackColor = System.Drawing.Color.Transparent; this.textBox3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); @@ -200,10 +209,10 @@ namespace AppLauncher.Windows.Forms this.textBox3.SubmitButton = null; this.textBox3.TabIndex = 171; this.textBox3.UseSystemPasswordChar = false; - // + // // textBox4 - // - this.textBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + // + this.textBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.textBox4.BackColor = System.Drawing.Color.Transparent; this.textBox4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); @@ -218,9 +227,9 @@ namespace AppLauncher.Windows.Forms this.textBox4.TabIndex = 172; this.textBox4.UseSystemPasswordChar = false; this.textBox4.OnButtonClick += new System.EventHandler(this.textBox4_OnButtonClick); - // + // // button1 - // + // this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.button1.BackColor = System.Drawing.Color.Transparent; this.button1.DefaultImage = null; @@ -231,12 +240,24 @@ 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); + style1.BackColour = System.Drawing.Color.White; + style1.ForeImage = null; + style1.PenColour = System.Drawing.Color.Black; + this.button1.StyleDefault = style1; + style2.BackColour = System.Drawing.Color.FromArgb(((int)(((byte)(179)))), ((int)(((byte)(179)))), ((int)(((byte)(179))))); + style2.ForeImage = null; + style2.PenColour = System.Drawing.Color.Black; + this.button1.StyleDown = style2; + style3.BackColour = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + style3.ForeImage = null; + style3.PenColour = System.Drawing.Color.White; + this.button1.StyleOver = style3; this.button1.TabIndex = 173; this.button1.Click += new System.EventHandler(this.button1_Click); - // + // // pickerBox1 - // - this.pickerBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + // + this.pickerBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.pickerBox1.BackColor = System.Drawing.Color.Transparent; this.pickerBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); @@ -247,10 +268,10 @@ namespace AppLauncher.Windows.Forms this.pickerBox1.Size = new System.Drawing.Size(140, 32); this.pickerBox1.SubmitButton = null; this.pickerBox1.TabIndex = 174; - // + // // pickerBox2 - // - this.pickerBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + // + this.pickerBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.pickerBox2.BackColor = System.Drawing.Color.Transparent; this.pickerBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); @@ -261,38 +282,38 @@ namespace AppLauncher.Windows.Forms this.pickerBox2.Size = new System.Drawing.Size(140, 32); this.pickerBox2.SubmitButton = null; this.pickerBox2.TabIndex = 175; - // + // // horizontalSeparator1 - // - this.horizontalSeparator1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + // + this.horizontalSeparator1.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, 215); 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; - // + // // horizontalSeparator2 - // - this.horizontalSeparator2.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.horizontalSeparator2.Location = new System.Drawing.Point(10, 310); 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; - // + // // folderBrowserDialog1 - // + // this.folderBrowserDialog1.Description = "Choose a directory"; - // + // // openFileDialog1 - // + // this.openFileDialog1.Filter = "All files|*"; this.openFileDialog1.Title = "Choose a file"; - // + // // AddTileForm - // + // this.ClientSize = new System.Drawing.Size(400, 480); this.Controls.Add(this.horizontalSeparator2); this.Controls.Add(this.horizontalSeparator1); @@ -309,7 +330,7 @@ namespace AppLauncher.Windows.Forms this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Controls.Add(this.textBox1); - this.Description = "Edit Tile"; + this.Description = "Add Tile"; this.Name = "AddTileForm"; this.Controls.SetChildIndex(this.imgbxClose, 0); this.Controls.SetChildIndex(this.lblDescription, 0); diff --git a/Windows/Forms/Tile/EditListTileForm.cs b/Windows/Forms/Tile/EditListTileForm.cs new file mode 100644 index 0000000..e5f8e6e --- /dev/null +++ b/Windows/Forms/Tile/EditListTileForm.cs @@ -0,0 +1,175 @@ +using AppLauncher.Models; +using RyzStudio.Windows.ThemedForms; +using System; + +namespace AppLauncher.Windows.Forms +{ + public class EditListTileForm : DialogForm + { + public static void ShowDialog(TilePanel panel) + { + EditListTileForm form = new EditListTileForm(panel); + form.ShowDialog(); + } + + private System.Windows.Forms.Label label1; + private Button button1; + private RyzStudio.Windows.Forms.HorizontalSeparator horizontalSeparator2; + private TextBox textBox1; + protected TilePanel parentPanel = null; + + public EditListTileForm() : base() + { + InitializeComponent(); + } + + public EditListTileForm(TilePanel panel) : base() + { + parentPanel = panel; + + InitializeComponent(); + } + + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditListTileForm)); + RyzStudio.Windows.ThemedForms.Button.Style style4 = new RyzStudio.Windows.ThemedForms.Button.Style(); + RyzStudio.Windows.ThemedForms.Button.Style style5 = new RyzStudio.Windows.ThemedForms.Button.Style(); + RyzStudio.Windows.ThemedForms.Button.Style style6 = new RyzStudio.Windows.ThemedForms.Button.Style(); + this.textBox1 = new RyzStudio.Windows.ThemedForms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.button1 = new RyzStudio.Windows.ThemedForms.Button(); + this.horizontalSeparator2 = new RyzStudio.Windows.Forms.HorizontalSeparator(); + ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit(); + this.SuspendLayout(); + // + // imgbxClose + // + 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 = "Edit List Tile"; + // + // panel1 + // + this.panel1.Location = new System.Drawing.Point(394, 474); + // + // area1 + // + this.area1.Location = new System.Drawing.Point(1, 474); + this.area1.Size = new System.Drawing.Size(392, 5); + // + // textBox1 + // + this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBox1.BackColor = System.Drawing.Color.Transparent; + this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); + this.textBox1.Location = new System.Drawing.Point(159, 50); + this.textBox1.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6); + this.textBox1.Name = "textBox1"; + this.textBox1.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9); + this.textBox1.Size = new System.Drawing.Size(220, 32); + this.textBox1.SubmitButton = null; + this.textBox1.TabIndex = 152; + this.textBox1.UseSystemPasswordChar = false; + // + // label1 + // + this.label1.BackColor = System.Drawing.Color.Transparent; + this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(95)))), ((int)(((byte)(99)))), ((int)(((byte)(104))))); + this.label1.Location = new System.Drawing.Point(18, 50); + this.label1.Margin = new System.Windows.Forms.Padding(0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(131, 32); + this.label1.TabIndex = 153; + this.label1.Text = "Title"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // button1 + // + this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.button1.BackColor = System.Drawing.Color.Transparent; + this.button1.DefaultImage = null; + this.button1.DownImage = null; + this.button1.LabelText = "&Save"; + this.button1.Location = new System.Drawing.Point(251, 427); + this.button1.Name = "button1"; + 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; + this.button1.TabIndex = 173; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // horizontalSeparator2 + // + this.horizontalSeparator2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + 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; + // + // EditListTileForm + // + this.ClientSize = new System.Drawing.Size(400, 480); + this.Controls.Add(this.horizontalSeparator2); + this.Controls.Add(this.button1); + this.Controls.Add(this.label1); + this.Controls.Add(this.textBox1); + this.Description = "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); + this.Controls.SetChildIndex(this.label1, 0); + this.Controls.SetChildIndex(this.button1, 0); + this.Controls.SetChildIndex(this.horizontalSeparator2, 0); + ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).EndInit(); + this.ResumeLayout(false); + + } + + protected override void OnShown(EventArgs e) + { + base.OnShown(e); + + if (parentPanel != null) + { + textBox1.Text = parentPanel.ModelInfo.Title; + } + } + + private void button1_Click(object sender, EventArgs e) + { + TileModel model = new TileModel() + { + Title = textBox1.Text?.Trim(), + IsGroup = true + }; + + parentPanel.LoadInfo(model); + + this.Close(); + } + + } +} \ No newline at end of file diff --git a/Windows/Forms/Tile/EditListTileForm.resx b/Windows/Forms/Tile/EditListTileForm.resx new file mode 100644 index 0000000..3747e00 --- /dev/null +++ b/Windows/Forms/Tile/EditListTileForm.resx @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAABh0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMS4xYyqcSwAAANlJREFUOE+lU1sO + gjAQrHgRY6KemQ+VT9NrgAfgfRA+SawzdTAk2lhkkgm7s7vTAq0py/LUNM0dHEEXSfYWfd8fDQIOD23b + nvFMY6jeAcxpMFIwC1HX9YWzNOCWUunR4AxnvxpUVbV3zm2UGsbUlHoEDfBhdsgf4BWDCcmYGmtqCxtw + NeQcoJ6JjGn43hXy8CvIxDeIGbREZY+pHjLgtqeVHf7SzVq7VdmDM6x9GGj1/19h9UckVv3GWMwNRh5L + 6dGYH+UCHCTQ9SfV+7pMvJIIaLL0Oudd1x2eUQ8MyeAeq0cAAAAASUVORK5CYII= + + + \ No newline at end of file diff --git a/Windows/Forms/Tile/EditTileForm.cs b/Windows/Forms/Tile/EditTileForm.cs index ca83bd8..8198f34 100644 --- a/Windows/Forms/Tile/EditTileForm.cs +++ b/Windows/Forms/Tile/EditTileForm.cs @@ -1,16 +1,18 @@ using AppLauncher.Models; using RyzStudio.Windows.ThemedForms; using System; -using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace AppLauncher.Windows.Forms { public class EditTileForm : DialogForm { + public static void ShowDialog(TilePanel panel) + { + EditTileForm form = new EditTileForm(panel); + form.ShowDialog(); + } + private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label4; diff --git a/Windows/Forms/Tile/TileLayoutContainer.Designer.cs b/Windows/Forms/Tile/TileLayoutContainer.Designer.cs index a311414..408b0d8 100644 --- a/Windows/Forms/Tile/TileLayoutContainer.Designer.cs +++ b/Windows/Forms/Tile/TileLayoutContainer.Designer.cs @@ -33,6 +33,7 @@ this.panel1 = new AppLauncher.Windows.Forms.TileLayoutPanel(); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.addToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.addListToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.contextMenuStrip1.SuspendLayout(); this.SuspendLayout(); // @@ -65,25 +66,33 @@ // contextMenuStrip1 // this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.addToolStripMenuItem}); + this.addToolStripMenuItem, + this.addListToolStripMenuItem}); this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(181, 48); + this.contextMenuStrip1.Size = new System.Drawing.Size(181, 70); // // addToolStripMenuItem // this.addToolStripMenuItem.Name = "addToolStripMenuItem"; this.addToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.addToolStripMenuItem.Text = "&Add Tile"; - this.addToolStripMenuItem.Click += new System.EventHandler(this.addToolStripMenuItem_Click); + this.addToolStripMenuItem.Click += new System.EventHandler(this.addTileMenuItem_Click); // - // TileContainer + // addListToolStripMenuItem + // + this.addListToolStripMenuItem.Name = "addListToolStripMenuItem"; + this.addListToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.addListToolStripMenuItem.Text = "Add &List Tile"; + this.addListToolStripMenuItem.Click += new System.EventHandler(this.addListTileMenuItem_Click); + // + // TileLayoutContainer // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Transparent; this.Controls.Add(this.panel1); this.Controls.Add(this.label1); - this.Name = "TileContainer"; + this.Name = "TileLayoutContainer"; this.Size = new System.Drawing.Size(370, 150); this.contextMenuStrip1.ResumeLayout(false); this.ResumeLayout(false); @@ -96,5 +105,6 @@ private TileLayoutPanel panel1; private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; private System.Windows.Forms.ToolStripMenuItem addToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem addListToolStripMenuItem; } } diff --git a/Windows/Forms/Tile/TileLayoutContainer.cs b/Windows/Forms/Tile/TileLayoutContainer.cs index 35d240a..95f6287 100644 --- a/Windows/Forms/Tile/TileLayoutContainer.cs +++ b/Windows/Forms/Tile/TileLayoutContainer.cs @@ -296,11 +296,9 @@ namespace AppLauncher.Windows.Forms this.FlowLayoutPanel.Controls.Remove(this); } - private void addToolStripMenuItem_Click(object sender, EventArgs e) - { - AddTileForm addForm = new AddTileForm(panel1); - addForm.ShowDialog(); - } + private void addTileMenuItem_Click(object sender, EventArgs e) => AddTileForm.ShowDialog(panel1); + + private void addListTileMenuItem_Click(object sender, EventArgs e) => AddListTileForm.ShowDialog(panel1); } } diff --git a/Windows/Forms/Tile/TilePanel.Designer.cs b/Windows/Forms/Tile/TilePanel.Designer.cs index f0dcc0f..4706771 100644 --- a/Windows/Forms/Tile/TilePanel.Designer.cs +++ b/Windows/Forms/Tile/TilePanel.Designer.cs @@ -51,6 +51,7 @@ this.label1.Size = new System.Drawing.Size(70, 13); this.label1.TabIndex = 24; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.panel_MouseClick); this.label1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.panel_MouseDoubleClick); // // contextMenuStrip1 @@ -88,6 +89,7 @@ this.pictureBox1.Size = new System.Drawing.Size(70, 38); this.pictureBox1.TabIndex = 25; this.pictureBox1.TabStop = false; + this.pictureBox1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.panel_MouseClick); this.pictureBox1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.panel_MouseDoubleClick); // // TilePanel @@ -103,6 +105,7 @@ this.MinimumSize = new System.Drawing.Size(70, 70); this.Name = "TilePanel"; this.Size = new System.Drawing.Size(70, 70); + this.MouseClick += new System.Windows.Forms.MouseEventHandler(this.panel_MouseClick); this.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.panel_MouseDoubleClick); this.contextMenuStrip1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); diff --git a/Windows/Forms/Tile/TilePanel.cs b/Windows/Forms/Tile/TilePanel.cs index 4d01a5b..d93995b 100644 --- a/Windows/Forms/Tile/TilePanel.cs +++ b/Windows/Forms/Tile/TilePanel.cs @@ -14,7 +14,6 @@ namespace AppLauncher.Windows.Forms protected Point startPosition = new Point(); protected TileModel modelInfo = new TileModel(); - protected EditTileForm editForm = null; public TilePanel() : base() { @@ -65,19 +64,27 @@ namespace AppLauncher.Windows.Forms this.modelInfo = model; this.Title = model.Title; - this.Image = model.Icon; - if (this.Image == null) + if (this.modelInfo.IsGroup) { - if (File.Exists(model.ProcessFilename)) - { - try - { - this.Image = Icon.ExtractAssociatedIcon(model.ProcessFilename)?.ToBitmap(); - } - catch - { + this.Image = Properties.Resources.folder_ea_32; + } + else + { + this.Image = model.Icon; + if (this.Image == null) + { + if (File.Exists(model.ProcessFilename)) + { + try + { + this.Image = Icon.ExtractAssociatedIcon(model.ProcessFilename)?.ToBitmap(); + } + catch + { + + } } } } @@ -128,13 +135,45 @@ namespace AppLauncher.Windows.Forms } } + private void panel_MouseClick(object sender, MouseEventArgs e) + { + if (e.Button != MouseButtons.Left) + { + return; + } + + if (this.ModelInfo == null) + { + return; + } + + if (this.ModelInfo.IsGroup) + { + + } + else + { + panel_MouseDoubleClick(sender, e); + } + } + private void panel_MouseDoubleClick(object sender, MouseEventArgs e) { + if (e.Button != MouseButtons.Left) + { + return; + } + if (this.ModelInfo == null) { return; } + if (this.ModelInfo.IsGroup) + { + return; + } + if (string.IsNullOrWhiteSpace(this.ModelInfo.ProcessFilename)) { return; @@ -164,8 +203,14 @@ namespace AppLauncher.Windows.Forms private void editToolStripMenuItem_Click(object sender, EventArgs e) { - if (editForm == null) editForm = new EditTileForm(this); - editForm.ShowDialog(); + if (this.ModelInfo.IsGroup) + { + EditListTileForm.ShowDialog(this); + } + else + { + EditTileForm.ShowDialog(this); + } } private void removeToolStripMenuItem_Click(object sender, EventArgs e)