WIP: tile container animation

This commit is contained in:
Ray 2020-05-02 17:17:10 +01:00
parent caec9c7317
commit 2c116af5aa
13 changed files with 758 additions and 122 deletions

View File

@ -128,6 +128,9 @@
<Compile Include="RyzStudio\Windows\ThemedForms\UserControl.designer.cs">
<DependentUpon>UserControl.cs</DependentUpon>
</Compile>
<Compile Include="Windows\Forms\AddTileForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Windows\Forms\EditTileForm.cs">
<SubType>Form</SubType>
</Compile>
@ -192,6 +195,9 @@
<EmbeddedResource Include="RyzStudio\Windows\ThemedForms\TextButtonBox.resx">
<DependentUpon>TextButtonBox.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Windows\Forms\AddTileForm.resx">
<DependentUpon>AddTileForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Windows\Forms\EditTileForm.resx">
<DependentUpon>EditTileForm.cs</DependentUpon>
</EmbeddedResource>

1
MainForm.Designer.cs generated
View File

@ -88,6 +88,7 @@
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(600, 369);
this.flowLayoutPanel1.TabIndex = 27;
this.flowLayoutPanel1.WrapContents = false;
//
// button3
//

View File

@ -27,6 +27,23 @@ namespace AppLauncher
InitializeComponent();
}
//protected override void OnLoad(EventArgs e)
//{
// base.OnLoad(e);
//}
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
string jsonfigFilename = Path.ChangeExtension(Application.ExecutablePath, "jsonfig");
if (File.Exists(jsonfigFilename))
{
loadSession(jsonfigFilename);
}
}
private async void button1_Click(object sender, EventArgs e)
{
//if (this.Width > collapsedWidth)
@ -173,7 +190,7 @@ namespace AppLauncher
this.Close();
}
protected void loadSession(string filename)
protected async void loadSession(string filename)
{
string sourceCode = File.ReadAllText(filename);
if (string.IsNullOrWhiteSpace(sourceCode))
@ -193,13 +210,18 @@ namespace AppLauncher
{
TileContainer panel = new TileContainer(item);
flowLayoutPanel1.Controls.Add(panel);
if (item.IsExpanded)
{
//await panel.Expand();
}
}
}
private void button3_Click(object sender, EventArgs e)
{
loadSession(Application.StartupPath.TrimEnd('\\') + "\\test1.jsonfig");
// loadSession(Application.StartupPath.TrimEnd('\\') + "\\test1.jsonfig");
}

View File

@ -0,0 +1,374 @@
using AppLauncher.Models;
using RyzStudio.Windows.ThemedForms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AppLauncher.Windows.Forms
{
public class AddTileForm : DialogForm
{
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private TextButtonBox textBox2;
private TextBox textBox3;
private TextButtonBox textBox4;
private Button button1;
private PickerBox pickerBox1;
private PickerBox pickerBox2;
private RyzStudio.Windows.Forms.HorizontalSeparator horizontalSeparator1;
private RyzStudio.Windows.Forms.HorizontalSeparator horizontalSeparator2;
private TextBox textBox1;
protected TileLayoutPanel parentPanel = null;
public AddTileForm() : base()
{
InitializeComponent();
initialiseComponents2();
}
public AddTileForm(TileLayoutPanel panel) : base()
{
parentPanel = panel;
InitializeComponent();
initialiseComponents2();
}
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditTileForm));
this.textBox1 = new RyzStudio.Windows.ThemedForms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.textBox2 = new RyzStudio.Windows.ThemedForms.TextButtonBox();
this.textBox3 = new RyzStudio.Windows.ThemedForms.TextBox();
this.textBox4 = new RyzStudio.Windows.ThemedForms.TextButtonBox();
this.button1 = new RyzStudio.Windows.ThemedForms.Button();
this.pickerBox1 = new RyzStudio.Windows.ThemedForms.PickerBox();
this.pickerBox2 = new RyzStudio.Windows.ThemedForms.PickerBox();
this.horizontalSeparator1 = new RyzStudio.Windows.Forms.HorizontalSeparator();
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 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;
//
// 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);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(208, 32);
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);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(208, 32);
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);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(131, 32);
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);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(131, 32);
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);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(131, 32);
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);
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;
//
// textBox2
//
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);
this.textBox2.HighlightImage = global::AppLauncher.Properties.Resources.button16_file_add2;
this.textBox2.Location = new System.Drawing.Point(159, 91);
this.textBox2.Margin = new System.Windows.Forms.Padding(10, 3, 3, 3);
this.textBox2.Name = "textBox2";
this.textBox2.NormalImage = global::AppLauncher.Properties.Resources.button16_file_add;
this.textBox2.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9);
this.textBox2.Size = new System.Drawing.Size(220, 32);
this.textBox2.SubmitButton = null;
this.textBox2.TabIndex = 170;
this.textBox2.UseSystemPasswordChar = false;
//
// textBox3
//
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);
this.textBox3.Location = new System.Drawing.Point(159, 132);
this.textBox3.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6);
this.textBox3.Name = "textBox3";
this.textBox3.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9);
this.textBox3.Size = new System.Drawing.Size(220, 32);
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)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBox4.BackColor = System.Drawing.Color.Transparent;
this.textBox4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
this.textBox4.HighlightImage = global::AppLauncher.Properties.Resources.button16_folder_add2;
this.textBox4.Location = new System.Drawing.Point(159, 173);
this.textBox4.Margin = new System.Windows.Forms.Padding(10, 3, 3, 3);
this.textBox4.Name = "textBox4";
this.textBox4.NormalImage = global::AppLauncher.Properties.Resources.button16_folder_add;
this.textBox4.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9);
this.textBox4.Size = new System.Drawing.Size(220, 32);
this.textBox4.SubmitButton = null;
this.textBox4.TabIndex = 172;
this.textBox4.UseSystemPasswordChar = false;
//
// 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);
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)
| 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, 227);
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;
//
// pickerBox2
//
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);
this.pickerBox2.Location = new System.Drawing.Point(239, 268);
this.pickerBox2.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6);
this.pickerBox2.Name = "pickerBox2";
this.pickerBox2.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5);
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)
| 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)
| 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;
//
// EditTileForm
//
this.ClientSize = new System.Drawing.Size(400, 480);
this.Controls.Add(this.horizontalSeparator2);
this.Controls.Add(this.horizontalSeparator1);
this.Controls.Add(this.pickerBox2);
this.Controls.Add(this.pickerBox1);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox4);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.label6);
this.Controls.Add(this.label7);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1);
this.Description = "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);
this.Controls.SetChildIndex(this.label1, 0);
this.Controls.SetChildIndex(this.label2, 0);
this.Controls.SetChildIndex(this.label3, 0);
this.Controls.SetChildIndex(this.label4, 0);
this.Controls.SetChildIndex(this.label7, 0);
this.Controls.SetChildIndex(this.label6, 0);
this.Controls.SetChildIndex(this.textBox2, 0);
this.Controls.SetChildIndex(this.textBox3, 0);
this.Controls.SetChildIndex(this.textBox4, 0);
this.Controls.SetChildIndex(this.button1, 0);
this.Controls.SetChildIndex(this.pickerBox1, 0);
this.Controls.SetChildIndex(this.pickerBox2, 0);
this.Controls.SetChildIndex(this.horizontalSeparator1, 0);
this.Controls.SetChildIndex(this.horizontalSeparator2, 0);
((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).EndInit();
this.ResumeLayout(false);
}
private void initialiseComponents2()
{
pickerBox1.ComboBox.Items.Clear();
pickerBox1.ComboBox.Items.AddRange(new string[] { "Normal", "Hidden", "Minimized", "Maximized" });
if (pickerBox1.ComboBox.Items.Count > 0) pickerBox1.ComboBox.SelectedIndex = 0;
pickerBox2.ComboBox.Items.Clear();
pickerBox2.ComboBox.Items.AddRange(new string[] { "No", "Yes" });
if (pickerBox2.ComboBox.Items.Count > 0) pickerBox2.ComboBox.SelectedIndex = 0;
}
//protected override void OnShown(EventArgs e)
//{
// base.OnShown(e);
// if (parentPanel != null)
// {
// textBox1.Text = parentPanel.ModelInfo.Title;
// textBox2.Text = parentPanel.ModelInfo.ProcessFilename;
// textBox3.Text = parentPanel.ModelInfo.ProcessArgument;
// textBox4.Text = parentPanel.ModelInfo.ProcessWorkingDirectory;
// pickerBox1.ComboBox.SelectedIndex = (int)parentPanel.ModelInfo.ProcessWindowStyle;
// pickerBox2.ComboBox.SelectedIndex = (parentPanel.ModelInfo.ProcessAsAdmin ? 1 : 0);
// }
//}
private void button1_Click(object sender, EventArgs e)
{
TileModel model = new TileModel()
{
Title = textBox1.Text?.Trim(),
ProcessFilename = textBox2.Text?.Trim(),
ProcessArgument = textBox3.Text?.Trim(),
ProcessWorkingDirectory = textBox4.Text?.Trim(),
ProcessWindowStyle = (System.Diagnostics.ProcessWindowStyle)pickerBox1.ComboBox.SelectedIndex,
ProcessAsAdmin = (pickerBox2.ComboBox.SelectedIndex == 1)
};
//parentPanel.LoadInfo(model);
//parentPanel.Info.Title = textBox1.Text?.Trim();
//parentPanel.Info.ProcessFilename = textBox2.Text?.Trim();
//parentPanel.Info.ProcessArgument = textBox3.Text?.Trim();
//parentPanel.Info.ProcessWorkingDirectory = textBox4.Text?.Trim();
//parentPanel.Info.ProcessWindowStyle = (System.Diagnostics.ProcessWindowStyle) pickerBox1.ComboBox.SelectedIndex;
//parentPanel.Info.ProcessAsAdmin = (pickerBox2.ComboBox.SelectedIndex == 1);
this.Close();
}
}
}

View File

@ -0,0 +1,131 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="imgbxClose.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wwAADsMBx2+oZAAAABh0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMS4xYyqcSwAAANlJREFUOE+lU1sO
gjAQrHgRY6KemQ+VT9NrgAfgfRA+SawzdTAk2lhkkgm7s7vTAq0py/LUNM0dHEEXSfYWfd8fDQIOD23b
nvFMY6jeAcxpMFIwC1HX9YWzNOCWUunR4AxnvxpUVbV3zm2UGsbUlHoEDfBhdsgf4BWDCcmYGmtqCxtw
NeQcoJ6JjGn43hXy8CvIxDeIGbREZY+pHjLgtqeVHf7SzVq7VdmDM6x9GGj1/19h9UckVv3GWMwNRh5L
6dGYH+UCHCTQ9SfV+7pMvJIIaLL0Oudd1x2eUQ8MyeAeq0cAAAAASUVORK5CYII=
</value>
</data>
</root>

View File

@ -1,4 +1,5 @@
using RyzStudio.Windows.ThemedForms;
using AppLauncher.Models;
using RyzStudio.Windows.ThemedForms;
using System;
using System.Collections.Generic;
using System.Linq;
@ -225,6 +226,7 @@ namespace AppLauncher.Windows.Forms
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);
//
// pickerBox1
//
@ -335,15 +337,39 @@ namespace AppLauncher.Windows.Forms
if (parentPanel != null)
{
textBox1.Text = parentPanel.Info.Title;
textBox2.Text = parentPanel.Info.ProcessFilename;
textBox3.Text = parentPanel.Info.ProcessArgument;
textBox4.Text = parentPanel.Info.ProcessWorkingDirectory;
pickerBox1.ComboBox.SelectedIndex = (int)parentPanel.Info.ProcessWindowStyle;
pickerBox2.ComboBox.SelectedIndex = (parentPanel.Info.ProcessAsAdmin ? 1 : 0);
textBox1.Text = parentPanel.ModelInfo.Title;
textBox2.Text = parentPanel.ModelInfo.ProcessFilename;
textBox3.Text = parentPanel.ModelInfo.ProcessArgument;
textBox4.Text = parentPanel.ModelInfo.ProcessWorkingDirectory;
pickerBox1.ComboBox.SelectedIndex = (int)parentPanel.ModelInfo.ProcessWindowStyle;
pickerBox2.ComboBox.SelectedIndex = (parentPanel.ModelInfo.ProcessAsAdmin ? 1 : 0);
}
}
private void button1_Click(object sender, EventArgs e)
{
TileModel model = new TileModel()
{
Title = textBox1.Text?.Trim(),
ProcessFilename = textBox2.Text?.Trim(),
ProcessArgument = textBox3.Text?.Trim(),
ProcessWorkingDirectory = textBox4.Text?.Trim(),
ProcessWindowStyle = (System.Diagnostics.ProcessWindowStyle)pickerBox1.ComboBox.SelectedIndex,
ProcessAsAdmin = (pickerBox2.ComboBox.SelectedIndex == 1)
};
parentPanel.LoadInfo(model);
//parentPanel.Info.Title = textBox1.Text?.Trim();
//parentPanel.Info.ProcessFilename = textBox2.Text?.Trim();
//parentPanel.Info.ProcessArgument = textBox3.Text?.Trim();
//parentPanel.Info.ProcessWorkingDirectory = textBox4.Text?.Trim();
//parentPanel.Info.ProcessWindowStyle = (System.Diagnostics.ProcessWindowStyle) pickerBox1.ComboBox.SelectedIndex;
//parentPanel.Info.ProcessAsAdmin = (pickerBox2.ComboBox.SelectedIndex == 1);
this.Close();
}
}
}

View File

@ -28,8 +28,12 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.label1 = new AppLauncher.Windows.Forms.TileGroupLabel();
this.panel1 = new AppLauncher.Windows.Forms.TileLayoutPanel();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.addToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuStrip1.SuspendLayout();
this.SuspendLayout();
//
// label1
@ -57,6 +61,20 @@
this.panel1.Size = new System.Drawing.Size(223, 127);
this.panel1.TabIndex = 27;
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.addToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(181, 48);
//
// addToolStripMenuItem
//
this.addToolStripMenuItem.Name = "addToolStripMenuItem";
this.addToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.addToolStripMenuItem.Text = "&Add";
this.addToolStripMenuItem.Click += new System.EventHandler(this.addToolStripMenuItem_Click);
//
// TileContainer
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -66,6 +84,7 @@
this.Controls.Add(this.label1);
this.Name = "TileContainer";
this.Size = new System.Drawing.Size(370, 150);
this.contextMenuStrip1.ResumeLayout(false);
this.ResumeLayout(false);
}
@ -74,5 +93,7 @@
private TileGroupLabel label1;
private TileLayoutPanel panel1;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem addToolStripMenuItem;
}
}

View File

@ -17,11 +17,15 @@ namespace AppLauncher.Windows.Forms
protected int collapseIncrement = 6;
protected int expandIncrement = 8;
protected TileGroupModel groupInfo = null;
protected bool isAnimating = false;
public TileContainer(TileGroupModel model) : base()
{
InitializeComponent();
this.ContextMenuStrip = contextMenuStrip1;
//this.BackColor = Color.MistyRose;
label1.TileGroupPanel = this;
groupInfo = model;
@ -29,40 +33,36 @@ namespace AppLauncher.Windows.Forms
label1.TitleText = groupInfo.Title;
panel1.SetGridSize(groupInfo.GridSize.Width, groupInfo.GridSize.Height);
label1.Checked = groupInfo.IsExpanded;
//label1.Width = panel1.Width;
//label1.PanelHeight = panel1.Height;
//this.Margin = new Padding(0);
//this.Size = new Size(panel1.Width, (label1.Height + panel1.Height));
//this.MaximumSize = this.Size;
//this.MinimumSize = this.Size;
//this.BackColor = Color.MistyRose;
panel1.LoadTiles(model.Items);
}
protected override void OnLoad(EventArgs e)
protected override async void OnLoad(EventArgs e)
{
base.OnLoad(e);
label1.Width = panel1.Width;
this.Margin = new Padding(0);
this.MaximumSize = new Size(panel1.Width, (label1.Height + panel1.ExpandedHeight));
this.Margin = new Padding(0, 0, 0, 0);
this.Padding = new Padding(0, 0, 0, 20);
this.MaximumSize = new Size(panel1.Width, expandedHeight);
this.MinimumSize = new Size(panel1.Width, label1.Height);
this.Size = this.MaximumSize;
}
protected int collapseHeight => label1.Height + panel1.CollapseHeight;
protected int expandedHeight => label1.Height + panel1.ExpandedHeight;
protected int expandedHeight => label1.Height + panel1.ExpandedHeight + this.Padding.Top + this.Padding.Bottom;
public bool IsAnimating => isAnimating;
public async Task Collapse()
{
await Task.Run(() =>
{
if (isAnimating) return;
isAnimating = true;
while (this.Height > collapseHeight)
{
if (this.InvokeRequired)
@ -78,6 +78,8 @@ namespace AppLauncher.Windows.Forms
Thread.Sleep(10);
}
isAnimating = false;
});
}
@ -85,6 +87,10 @@ namespace AppLauncher.Windows.Forms
{
await Task.Run(() =>
{
if (isAnimating) return;
isAnimating = true;
if (this.InvokeRequired)
{
this.Invoke(new MethodInvoker(() => {
@ -95,6 +101,8 @@ namespace AppLauncher.Windows.Forms
{
this.Height = collapseHeight;
}
isAnimating = false;
});
}
@ -102,6 +110,10 @@ namespace AppLauncher.Windows.Forms
{
await Task.Run(() =>
{
if (isAnimating) return;
isAnimating = true;
while (this.Height < expandedHeight)
{
if (this.InvokeRequired)
@ -119,8 +131,40 @@ namespace AppLauncher.Windows.Forms
Thread.Sleep(10);
}
isAnimating = false;
});
}
public async Task InvalidateContainer(bool animate = true)
{
if (this.IsAnimating)
{
return;
}
if (label1.Checked)
{
await this.Expand();
}
else
{
if (animate)
{
await this.Collapse();
}
else
{
await this.CollapseNow();
}
}
}
private void addToolStripMenuItem_Click(object sender, EventArgs e)
{
AddTileForm addForm = new AddTileForm(panel1);
addForm.ShowDialog();
}
}
}

View File

@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -1,20 +1,15 @@
using System;
using System.ComponentModel;
using System.Threading.Tasks;
using System.ComponentModel;
using System.Windows.Forms;
namespace AppLauncher.Windows.Forms
{
public partial class TileGroupLabel : AUserControl
{
protected bool isChecked = false;
protected bool isChecked = true;
public TileGroupLabel() : base()
{
InitializeComponent();
this.Checked = false;
}
[Category("Appearance"), Browsable(true)]
@ -29,20 +24,18 @@ namespace AppLauncher.Windows.Forms
isChecked = value;
pictureBox1.BackgroundImage = (value) ? Properties.Resources.toggle_right_ea_16 : Properties.Resources.toggle_left_ea_16;
if (this.TileGroupPanel != null)
{
this.TileGroupPanel.InvalidateContainer();
}
}
}
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public TileContainer TileGroupPanel { get; set; } = null;
protected async override void OnLoad(EventArgs e)
{
base.OnLoad(e);
await invalidateToggle(false);
}
protected async void panel_MouseClick(object sender, MouseEventArgs e)
protected void panel_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button != MouseButtons.Left)
{
@ -50,32 +43,6 @@ namespace AppLauncher.Windows.Forms
}
this.Checked = !this.Checked;
await invalidateToggle();
}
protected async Task invalidateToggle(bool animate = true)
{
if (this.TileGroupPanel == null)
{
return;
}
if (this.Checked)
{
await this.TileGroupPanel.Expand();
}
else
{
if (animate)
{
await this.TileGroupPanel.Collapse();
}
else
{
await this.TileGroupPanel.CollapseNow();
}
}
}
}

View File

@ -56,6 +56,11 @@ namespace AppLauncher.Windows.Forms
public int ExpandedHeight => expandedHeight;
public void AddTile(TileModel tile)
{
}
public void Clear()
{
this.Controls.Clear();
@ -87,13 +92,6 @@ namespace AppLauncher.Windows.Forms
return new Point((x * this.TileSize), (y * this.TileSize));
}
public void SetGridSize(int width, int height)
{
expandedHeight = (this.TileSize * height);
this.Size = new Size((this.TileSize * width), expandedHeight);
}
public void LoadTiles(List<TileModel> tiles)
{
if (tiles == null)
@ -109,7 +107,7 @@ namespace AppLauncher.Windows.Forms
foreach (TileModel item in tiles)
{
// resolve final grid position
Point? confirmedPosition = resolvePosition(item.Position);
Point? confirmedPosition = resolveCoord(item.Position);
if (confirmedPosition == null)
{
continue;
@ -119,7 +117,7 @@ namespace AppLauncher.Windows.Forms
// place control
TilePanel panel = new TilePanel();
panel.LoadInfo(item);
panel.Location = convertPositionToLocation(confirmedPosition.Value);
panel.Location = convertCoordToLocation(confirmedPosition.Value);
items.Add(new Item()
{
@ -139,7 +137,7 @@ namespace AppLauncher.Windows.Forms
return;
}
Point newPosition = convertLocationToPosition(posX, posY);
Point newPosition = convertLocationToCoord(posX, posY);
if (!isTileInBounds(newPosition))
{
return;
@ -151,22 +149,40 @@ namespace AppLauncher.Windows.Forms
if (swapItem != null)
{
swapItem.Coord = item.Coord;
swapItem.Tile.Location = convertPositionToLocation(item.Coord);
swapItem.Tile.Location = convertCoordToLocation(item.Coord);
}
item.Coord = newPosition;
panel.Location = convertPositionToLocation(newPosition);
panel.Location = convertCoordToLocation(newPosition);
}
else
{
item.Coord = newPosition;
panel.Location = convertPositionToLocation(newPosition);
panel.Location = convertCoordToLocation(newPosition);
}
}
protected Point convertPositionToLocation(Point position) => new Point((position.X * this.TileSize), (position.Y * this.TileSize));
public void Remove(TilePanel panel)
{
Item m = items.Where(x => x.Tile.Equals(panel)).FirstOrDefault();
if (m != null)
{
items.Remove(m);
}
protected Point convertLocationToPosition(int posX, int posY)
this.Controls.Remove(panel);
}
public void SetGridSize(int width, int height)
{
expandedHeight = (this.TileSize * height);
this.Size = new Size((this.TileSize * width), expandedHeight);
}
protected Point convertCoordToLocation(Point position) => new Point((position.X * this.TileSize), (position.Y * this.TileSize));
protected Point convertLocationToCoord(int posX, int posY)
{
int x = (int)Math.Round(decimal.Divide(posX, this.TileSize));
int y = (int)Math.Round(decimal.Divide(posY, this.TileSize));
@ -177,47 +193,47 @@ namespace AppLauncher.Windows.Forms
return new Point(x, y);
}
protected Point? resolvePosition(Point position)
protected Point? resolveCoord(Point coord)
{
if (!isTileInBounds(position))
if (!isTileInBounds(coord))
{
return null;
}
if (!hasTile(position))
if (!hasTile(coord))
{
return position;
return coord;
}
return resolveNextPosition(position);
return resolveNextCoord(coord);
}
protected Point? resolveNextPosition(Point position)
protected Point? resolveNextCoord(Point coord)
{
Point gridSize = this.GridSize;
Point newPosition = position;
Point newCoord = coord;
while (true)
{
newPosition.X++;
newCoord.X++;
if (newPosition.X >= gridSize.X)
if (newCoord.X >= gridSize.X)
{
newPosition.Y++;
newPosition.X = 0;
newCoord.Y++;
newCoord.X = 0;
}
if (!isTileInBounds(newPosition))
if (!isTileInBounds(newCoord))
{
return null;
}
if (hasTile(newPosition))
if (hasTile(newCoord))
{
continue;
}
return newPosition;
return newCoord;
}
}

View File

@ -13,7 +13,7 @@ namespace AppLauncher.Windows.Forms
protected bool isDragging = false;
protected Point startPosition = new Point();
protected TileModel model = new TileModel();
protected TileModel modelInfo = new TileModel();
protected EditTileForm editForm = null;
public TilePanel() : base()
@ -40,7 +40,7 @@ namespace AppLauncher.Windows.Forms
public Image Image { get => pictureBox1.BackgroundImage; protected set => pictureBox1.BackgroundImage = value; }
[Browsable(false)]
public TileModel Info => model;
public TileModel ModelInfo => modelInfo;
public TileLayoutPanel PanelContainer
{
@ -62,25 +62,25 @@ namespace AppLauncher.Windows.Forms
public void LoadInfo(TileModel model)
{
this.model = model;
this.modelInfo = model;
this.Title = model.Title;
//this.Image = model.Icon;
this.Image = model.Icon;
//if (this.Image == null)
//{
// if (File.Exists(model.ProcessFilename))
// {
// try
// {
// this.Image = Icon.ExtractAssociatedIcon(model.ProcessFilename)?.ToBitmap();
// }
// catch
// {
if (this.Image == null)
{
if (File.Exists(model.ProcessFilename))
{
try
{
this.Image = Icon.ExtractAssociatedIcon(model.ProcessFilename)?.ToBitmap();
}
catch
{
// }
// }
//}
}
}
}
}
@ -127,27 +127,27 @@ namespace AppLauncher.Windows.Forms
private void TilePanel_MouseDoubleClick(object sender, MouseEventArgs e)
{
if (this.Info == null)
if (this.ModelInfo == null)
{
return;
}
if (string.IsNullOrWhiteSpace(this.Info.ProcessFilename))
if (string.IsNullOrWhiteSpace(this.ModelInfo.ProcessFilename))
{
return;
}
if (!File.Exists(this.Info.ProcessFilename))
if (!File.Exists(this.ModelInfo.ProcessFilename))
{
return;
}
ProcessStartInfo p = new ProcessStartInfo();
p.FileName = this.Info.ProcessFilename;
p.WindowStyle = this.Info.ProcessWindowStyle;
if (!string.IsNullOrWhiteSpace(this.Info.ProcessArgument)) p.Arguments = this.Info.ProcessArgument;
if (!string.IsNullOrWhiteSpace(this.Info.ProcessWorkingDirectory)) p.WorkingDirectory = this.Info.ProcessWorkingDirectory;
if (this.Info.ProcessAsAdmin) p.Verb = "runas";
p.FileName = this.ModelInfo.ProcessFilename;
p.WindowStyle = this.ModelInfo.ProcessWindowStyle;
if (!string.IsNullOrWhiteSpace(this.ModelInfo.ProcessArgument)) p.Arguments = this.ModelInfo.ProcessArgument;
if (!string.IsNullOrWhiteSpace(this.ModelInfo.ProcessWorkingDirectory)) p.WorkingDirectory = this.ModelInfo.ProcessWorkingDirectory;
if (this.ModelInfo.ProcessAsAdmin) p.Verb = "runas";
try
{
@ -172,7 +172,12 @@ namespace AppLauncher.Windows.Forms
private void removeToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.PanelContainer == null)
{
return;
}
this.PanelContainer.Remove(this);
}
}

View File

@ -87,11 +87,15 @@ namespace AppLauncher.Windows.Forms
if (isDragging)
{
Point pos = this.PointToScreen(e.Location);
int y = (pos.Y - windowOffset.Y);
int x = (pos.X - windowOffset.X);
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.Parent.Location = new Point(x, y);
this.Parent.Location = new Point(Screen.PrimaryScreen.WorkingArea.X, y);
//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.Parent.Location = new Point(Screen.PrimaryScreen.WorkingArea.X, y);
}
}
@ -116,5 +120,21 @@ namespace AppLauncher.Windows.Forms
await this.MainForm.ToggleSize();
}
//protected Point validateFormLocation(int x, int y)
//{
// Screen activeScreen = Screen.FromControl(this);
// int maxX = (activeScreen.WorkingArea.X + activeScreen.WorkingArea.Width) - this.Width;
// int maxY = (activeScreen.WorkingArea.Y + activeScreen.WorkingArea.Height) - this.Height;
// if (x < activeScreen.WorkingArea.X) x = activeScreen.WorkingArea.X;
// if (y < activeScreen.WorkingArea.Y) y = activeScreen.WorkingArea.Y;
// if (x > maxX) x = maxX;
// if (y > maxY) y = maxY;
// //y = activeScreen.WorkingArea.Y;
// return new Point(x, y);
//}
}
}