This repository has been archived on 2024-08-06. You can view files and clone it, but cannot push or open issues or pull requests.
linear-app-launcher/Windows/Forms/Tile/EditGroupForm.cs

188 lines
8.7 KiB
C#
Raw Normal View History

2020-05-03 21:58:49 +00:00
using AppLauncher.Models;
using RyzStudio.Windows.ThemedForms;
using System;
namespace AppLauncher.Windows.Forms
{
2020-05-10 10:45:54 +00:00
public class EditGroupForm : TDialogForm
2020-05-03 21:58:49 +00:00
{
2020-05-17 01:17:30 +00:00
public static void ShowDialog(TTilePanelLayout control)
{
EditGroupForm form = new EditGroupForm();
form.TilePanelLayout = control;
form.ShowDialog();
}
2020-05-03 21:58:49 +00:00
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
2020-05-10 10:45:54 +00:00
private TButton button1;
private TPickerBox pickerBox1;
private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2;
2020-05-10 10:45:54 +00:00
private TTextBox textBox1;
2020-05-17 01:17:30 +00:00
public TTilePanelLayout TilePanelLayout { get; set; } = null;
2020-05-03 21:58:49 +00:00
public EditGroupForm() : base()
{
InitializeComponent();
2020-05-17 01:17:30 +00:00
pickerBox1.ComboBox.Items.Clear();
pickerBox1.ComboBox.Items.AddRange(new string[] { "No", "Yes" });
if (pickerBox1.ComboBox.Items.Count > 0) pickerBox1.ComboBox.SelectedIndex = 0;
2020-05-03 21:58:49 +00:00
}
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditGroupForm));
2020-05-10 10:45:54 +00:00
this.textBox1 = new RyzStudio.Windows.ThemedForms.TTextBox();
2020-05-03 21:58:49 +00:00
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
2020-05-10 10:45:54 +00:00
this.button1 = new RyzStudio.Windows.ThemedForms.TButton();
this.pickerBox1 = new RyzStudio.Windows.ThemedForms.TPickerBox();
this.horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator();
2020-05-03 21:58:49 +00:00
((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit();
this.SuspendLayout();
//
2020-05-03 21:58:49 +00:00
// imgbxClose
//
2020-05-03 21:58:49 +00:00
this.imgbxClose.Image = ((System.Drawing.Image)(resources.GetObject("imgbxClose.Image")));
this.imgbxClose.Location = new System.Drawing.Point(367, 5);
//
2020-05-03 21:58:49 +00:00
// panel1
//
2020-05-03 21:58:49 +00:00
this.panel1.Location = new System.Drawing.Point(394, 474);
//
2020-05-03 21:58:49 +00:00
// area1
//
2020-05-03 21:58:49 +00:00
this.area1.Location = new System.Drawing.Point(1, 474);
this.area1.Size = new System.Drawing.Size(392, 5);
//
2020-05-03 21:58:49 +00:00
// textBox1
//
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
2020-05-03 21:58:49 +00:00
| 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;
//
2020-05-03 21:58:49 +00:00
// label2
//
2020-05-03 21:58:49 +00:00
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);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(131, 32);
this.label2.TabIndex = 155;
this.label2.Text = "Show Only Expanded";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
2020-05-03 21:58:49 +00:00
// label1
//
2020-05-03 21:58:49 +00:00
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;
//
2020-05-03 21:58:49 +00:00
// button1
//
2020-05-03 21:58:49 +00:00
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.IsSelected = false;
2020-05-03 21:58:49 +00:00
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);
this.button1.TabIndex = 173;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
2020-05-03 21:58:49 +00:00
// pickerBox1
//
this.pickerBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
2020-05-03 21:58:49 +00:00
| System.Windows.Forms.AnchorStyles.Right)));
this.pickerBox1.BackColor = System.Drawing.Color.Transparent;
this.pickerBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
this.pickerBox1.Location = new System.Drawing.Point(239, 91);
this.pickerBox1.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6);
this.pickerBox1.Name = "pickerBox1";
this.pickerBox1.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5);
this.pickerBox1.Size = new System.Drawing.Size(140, 32);
this.pickerBox1.SubmitButton = null;
this.pickerBox1.TabIndex = 174;
//
// 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, 133);
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 = 182;
//
2020-05-03 21:58:49 +00:00
// EditGroupForm
//
2020-05-03 21:58:49 +00:00
this.ClientSize = new System.Drawing.Size(400, 480);
this.Controls.Add(this.horizontalSeparator2);
2020-05-03 21:58:49 +00:00
this.Controls.Add(this.pickerBox1);
this.Controls.Add(this.button1);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1);
this.Name = "EditGroupForm";
this.Text = "Edit Group";
this.Title = "Edit Group";
2020-05-03 21:58:49 +00:00
this.Controls.SetChildIndex(this.imgbxClose, 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.label2, 0);
this.Controls.SetChildIndex(this.button1, 0);
this.Controls.SetChildIndex(this.pickerBox1, 0);
this.Controls.SetChildIndex(this.horizontalSeparator2, 0);
2020-05-03 21:58:49 +00:00
((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).EndInit();
this.ResumeLayout(false);
}
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
2020-05-17 01:17:30 +00:00
if (this.TilePanelLayout != null)
2020-05-03 21:58:49 +00:00
{
2020-05-17 01:17:30 +00:00
textBox1.Text = this.TilePanelLayout.Model.Title;
pickerBox1.ComboBox.SelectedIndex = (this.TilePanelLayout.Model.IsExclusive ? 1 : 0);
2020-05-03 21:58:49 +00:00
}
}
private void button1_Click(object sender, EventArgs e)
{
2020-05-17 01:17:30 +00:00
TileGroupModel model = this.TilePanelLayout.Model;
2020-05-03 21:58:49 +00:00
model.Title = textBox1.Text?.Trim();
model.IsExclusive = (pickerBox1.ComboBox.SelectedIndex == 1);
2020-05-17 01:17:30 +00:00
this.TilePanelLayout.UpdateModel(model);
2020-05-03 21:58:49 +00:00
this.Close();
}
}
}