WIP: refactoring + tile layout

This commit is contained in:
Ray 2020-04-11 18:43:20 +01:00
parent 06f570122c
commit c9edc93e40
23 changed files with 1078 additions and 491 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/.vs /.vs
/bin /bin
/obj /obj
/packages

View File

@ -36,6 +36,9 @@
<NoWin32Manifest>true</NoWin32Manifest> <NoWin32Manifest>true</NoWin32Manifest>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
@ -49,12 +52,14 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Models\TileModel.cs" />
<Compile Include="MainForm.cs"> <Compile Include="MainForm.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="MainForm.Designer.cs"> <Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon> <DependentUpon>MainForm.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Models\TileGroupModel.cs" />
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs"> <Compile Include="Properties\Resources.Designer.cs">
@ -68,19 +73,25 @@
<Compile Include="Windows\Forms\AUserControl.cs"> <Compile Include="Windows\Forms\AUserControl.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
<Compile Include="Windows\Forms\HeadingPanel.cs"> <Compile Include="Windows\Forms\Tile\TileGroupLabel.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
<Compile Include="Windows\Forms\HeadingPanel.Designer.cs"> <Compile Include="Windows\Forms\Tile\TileGroupLabel.Designer.cs">
<DependentUpon>HeadingPanel.cs</DependentUpon> <DependentUpon>TileGroupLabel.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Windows\Forms\TilePanelContainer.cs"> <Compile Include="Windows\Forms\Tile\TileContainer.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
<Compile Include="Windows\Forms\TilePanel.cs"> <Compile Include="Windows\Forms\Tile\TileContainer.Designer.cs">
<DependentUpon>TileContainer.cs</DependentUpon>
</Compile>
<Compile Include="Windows\Forms\Tile\TileLayoutPanel.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
<Compile Include="Windows\Forms\TilePanel.Designer.cs"> <Compile Include="Windows\Forms\Tile\TilePanel.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Windows\Forms\Tile\TilePanel.Designer.cs">
<DependentUpon>TilePanel.cs</DependentUpon> <DependentUpon>TilePanel.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Windows\Forms\TitlePanel.cs"> <Compile Include="Windows\Forms\TitlePanel.cs">
@ -96,15 +107,22 @@
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Windows\Forms\HeadingPanel.resx"> <EmbeddedResource Include="Windows\Forms\Tile\TileGroupLabel.resx">
<DependentUpon>HeadingPanel.cs</DependentUpon> <DependentUpon>TileGroupLabel.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Windows\Forms\TilePanel.resx"> <EmbeddedResource Include="Windows\Forms\Tile\TileContainer.resx">
<DependentUpon>TileContainer.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Windows\Forms\Tile\TileLayoutPanel.resx">
<DependentUpon>TileLayoutPanel.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Windows\Forms\Tile\TilePanel.resx">
<DependentUpon>TilePanel.cs</DependentUpon> <DependentUpon>TilePanel.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Windows\Forms\TitlePanel.resx"> <EmbeddedResource Include="Windows\Forms\TitlePanel.resx">
<DependentUpon>TitlePanel.cs</DependentUpon> <DependentUpon>TitlePanel.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
@ -136,5 +154,8 @@
<ItemGroup> <ItemGroup>
<None Include="Resources\folder-ea-32.png" /> <None Include="Resources\folder-ea-32.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="DTO\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

214
MainForm.Designer.cs generated
View File

@ -28,22 +28,17 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container();
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.titlePanel1 = new AppLauncher.Windows.Forms.TitlePanel(); this.titlePanel1 = new AppLauncher.Windows.Forms.TitlePanel();
this.headingPanel1 = new AppLauncher.Windows.Forms.HeadingPanel(); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.panel6 = new System.Windows.Forms.Panel(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.panel7 = new System.Windows.Forms.Panel();
this.button2 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button();
this.tilePanel2 = new AppLauncher.Windows.Forms.TilePanel();
this.tilePanel1 = new AppLauncher.Windows.Forms.TilePanel();
this.panel4 = new System.Windows.Forms.Panel();
this.panel1 = new System.Windows.Forms.Panel();
this.tilePanelContainer1 = new AppLauncher.Windows.Forms.TilePanelContainer();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.headingPanel2 = new AppLauncher.Windows.Forms.HeadingPanel(); this.button3 = new System.Windows.Forms.Button();
this.headingPanel3 = new AppLauncher.Windows.Forms.HeadingPanel(); this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.flowLayoutPanel1.SuspendLayout(); this.contextMenuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// button1 // button1
@ -56,57 +51,31 @@
this.button1.UseVisualStyleBackColor = true; this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click); this.button1.Click += new System.EventHandler(this.button1_Click);
// //
// richTextBox1
//
this.richTextBox1.Location = new System.Drawing.Point(412, 69);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(215, 88);
this.richTextBox1.TabIndex = 2;
this.richTextBox1.Text = "";
//
// titlePanel1 // titlePanel1
// //
this.titlePanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.titlePanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.titlePanel1.Location = new System.Drawing.Point(0, 0); this.titlePanel1.Location = new System.Drawing.Point(0, 0);
this.titlePanel1.MainMenu = this.contextMenuStrip1;
this.titlePanel1.MinimumSize = new System.Drawing.Size(40, 40); this.titlePanel1.MinimumSize = new System.Drawing.Size(40, 40);
this.titlePanel1.Name = "titlePanel1"; this.titlePanel1.Name = "titlePanel1";
this.titlePanel1.Size = new System.Drawing.Size(800, 40); this.titlePanel1.Size = new System.Drawing.Size(800, 40);
this.titlePanel1.TabIndex = 8; this.titlePanel1.TabIndex = 8;
this.titlePanel1.TitleText = "Launcher"; this.titlePanel1.TitleText = "Launcher";
// //
// headingPanel1 // contextMenuStrip1
// //
this.headingPanel1.AutoScrollMargin = new System.Drawing.Size(0, 0); this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.headingPanel1.AutoScrollMinSize = new System.Drawing.Size(0, 0); this.exitToolStripMenuItem});
this.headingPanel1.Checked = false; this.contextMenuStrip1.Name = "contextMenuStrip1";
this.headingPanel1.Location = new System.Drawing.Point(12, 64); this.contextMenuStrip1.Size = new System.Drawing.Size(94, 26);
this.headingPanel1.MinimumSize = new System.Drawing.Size(100, 20);
this.headingPanel1.Name = "headingPanel1";
this.headingPanel1.Size = new System.Drawing.Size(291, 20);
this.headingPanel1.TabIndex = 9;
this.headingPanel1.TilePanelContainer = null;
this.headingPanel1.TitleText = "Featured";
// //
// panel6 // exitToolStripMenuItem
// //
this.panel6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.panel6.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.exitToolStripMenuItem.Size = new System.Drawing.Size(93, 22);
this.panel6.Location = new System.Drawing.Point(233, 90); this.exitToolStripMenuItem.Text = "E&xit";
this.panel6.Margin = new System.Windows.Forms.Padding(3, 3, 0, 0); this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
this.panel6.Name = "panel6";
this.panel6.Size = new System.Drawing.Size(70, 70);
this.panel6.TabIndex = 12;
//
// panel7
//
this.panel7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68)))));
this.panel7.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.panel7.Location = new System.Drawing.Point(160, 90);
this.panel7.Margin = new System.Windows.Forms.Padding(3, 3, 0, 0);
this.panel7.Name = "panel7";
this.panel7.Size = new System.Drawing.Size(70, 70);
this.panel7.TabIndex = 11;
// //
// button2 // button2
// //
@ -118,117 +87,32 @@
this.button2.UseVisualStyleBackColor = true; this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click); this.button2.Click += new System.EventHandler(this.button2_Click);
// //
// tilePanel2
//
this.tilePanel2.AutoScrollMargin = new System.Drawing.Size(0, 0);
this.tilePanel2.AutoScrollMinSize = new System.Drawing.Size(0, 0);
this.tilePanel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68)))));
this.tilePanel2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(234)))), ((int)(((byte)(234)))), ((int)(((byte)(234)))));
this.tilePanel2.IconImage = global::AppLauncher.Properties.Resources.folder_ea_32;
this.tilePanel2.Location = new System.Drawing.Point(726, 46);
this.tilePanel2.Margin = new System.Windows.Forms.Padding(3, 3, 0, 0);
this.tilePanel2.MaximumSize = new System.Drawing.Size(70, 70);
this.tilePanel2.MinimumSize = new System.Drawing.Size(70, 70);
this.tilePanel2.Name = "tilePanel2";
this.tilePanel2.ProcessArgument = null;
this.tilePanel2.ProcessFilename = null;
this.tilePanel2.ProcessWindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
this.tilePanel2.ProcessWorkingDirectory = null;
this.tilePanel2.Size = new System.Drawing.Size(70, 70);
this.tilePanel2.TabIndex = 25;
this.tilePanel2.TitleText = "Accessories";
//
// tilePanel1
//
this.tilePanel1.AutoScrollMargin = new System.Drawing.Size(0, 0);
this.tilePanel1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
this.tilePanel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68)))));
this.tilePanel1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(234)))), ((int)(((byte)(234)))), ((int)(((byte)(234)))));
this.tilePanel1.IconImage = global::AppLauncher.Properties.Resources.mail_ea_32;
this.tilePanel1.Location = new System.Drawing.Point(653, 46);
this.tilePanel1.Margin = new System.Windows.Forms.Padding(3, 3, 0, 0);
this.tilePanel1.MaximumSize = new System.Drawing.Size(70, 70);
this.tilePanel1.MinimumSize = new System.Drawing.Size(70, 70);
this.tilePanel1.Name = "tilePanel1";
this.tilePanel1.ProcessArgument = null;
this.tilePanel1.ProcessFilename = null;
this.tilePanel1.ProcessWindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
this.tilePanel1.ProcessWorkingDirectory = null;
this.tilePanel1.Size = new System.Drawing.Size(70, 70);
this.tilePanel1.TabIndex = 24;
this.tilePanel1.TitleText = "Mail";
//
// panel4
//
this.panel4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68)))));
this.panel4.BackgroundImage = global::AppLauncher.Properties.Resources.mail_ea_32;
this.panel4.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.panel4.Location = new System.Drawing.Point(87, 90);
this.panel4.Margin = new System.Windows.Forms.Padding(3, 3, 0, 0);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(70, 70);
this.panel4.TabIndex = 10;
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68)))));
this.panel1.BackgroundImage = global::AppLauncher.Properties.Resources.chrome_ea_32;
this.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.panel1.Location = new System.Drawing.Point(14, 90);
this.panel1.Margin = new System.Windows.Forms.Padding(3, 3, 0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(70, 70);
this.panel1.TabIndex = 3;
//
// tilePanelContainer1
//
this.tilePanelContainer1.AutoScrollMargin = new System.Drawing.Size(0, 0);
this.tilePanelContainer1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
this.tilePanelContainer1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(255)))));
this.tilePanelContainer1.Location = new System.Drawing.Point(2, 23);
this.tilePanelContainer1.Margin = new System.Windows.Forms.Padding(2, 0, 0, 0);
this.tilePanelContainer1.Name = "tilePanelContainer1";
this.tilePanelContainer1.Size = new System.Drawing.Size(584, 146);
this.tilePanelContainer1.TabIndex = 26;
//
// flowLayoutPanel1 // flowLayoutPanel1
// //
this.flowLayoutPanel1.Controls.Add(this.headingPanel2);
this.flowLayoutPanel1.Controls.Add(this.tilePanelContainer1);
this.flowLayoutPanel1.Controls.Add(this.headingPanel3);
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel1.Location = new System.Drawing.Point(12, 163); this.flowLayoutPanel1.Location = new System.Drawing.Point(12, 59);
this.flowLayoutPanel1.Name = "flowLayoutPanel1"; this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(615, 265); this.flowLayoutPanel1.Size = new System.Drawing.Size(672, 369);
this.flowLayoutPanel1.TabIndex = 27; this.flowLayoutPanel1.TabIndex = 27;
// //
// headingPanel2 // button3
// //
this.headingPanel2.AutoScrollMargin = new System.Drawing.Size(0, 0); this.button3.Location = new System.Drawing.Point(722, 355);
this.headingPanel2.AutoScrollMinSize = new System.Drawing.Size(0, 0); this.button3.Name = "button3";
this.headingPanel2.Checked = false; this.button3.Size = new System.Drawing.Size(78, 40);
this.headingPanel2.Location = new System.Drawing.Point(0, 0); this.button3.TabIndex = 28;
this.headingPanel2.Margin = new System.Windows.Forms.Padding(0, 0, 0, 3); this.button3.Text = "button3";
this.headingPanel2.MinimumSize = new System.Drawing.Size(100, 20); this.button3.UseVisualStyleBackColor = true;
this.headingPanel2.Name = "headingPanel2"; this.button3.Click += new System.EventHandler(this.button3_Click);
this.headingPanel2.Size = new System.Drawing.Size(223, 20);
this.headingPanel2.TabIndex = 10;
this.headingPanel2.TilePanelContainer = this.tilePanelContainer1;
this.headingPanel2.TitleText = "Featured";
// //
// headingPanel3 // pictureBox1
// //
this.headingPanel3.AutoScrollMargin = new System.Drawing.Size(0, 0); this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.headingPanel3.AutoScrollMinSize = new System.Drawing.Size(0, 0); this.pictureBox1.Location = new System.Drawing.Point(695, 96);
this.headingPanel3.Checked = false; this.pictureBox1.Name = "pictureBox1";
this.headingPanel3.Location = new System.Drawing.Point(0, 169); this.pictureBox1.Size = new System.Drawing.Size(100, 109);
this.headingPanel3.Margin = new System.Windows.Forms.Padding(0, 0, 0, 3); this.pictureBox1.TabIndex = 29;
this.headingPanel3.MinimumSize = new System.Drawing.Size(100, 20); this.pictureBox1.TabStop = false;
this.headingPanel3.Name = "headingPanel3";
this.headingPanel3.Size = new System.Drawing.Size(223, 20);
this.headingPanel3.TabIndex = 27;
this.headingPanel3.TilePanelContainer = null;
this.headingPanel3.TitleText = "Featured";
// //
// MainForm // MainForm
// //
@ -237,21 +121,16 @@
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(83)))), ((int)(((byte)(93))))); this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(83)))), ((int)(((byte)(93)))));
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.ClientSize = new System.Drawing.Size(800, 440); this.ClientSize = new System.Drawing.Size(800, 440);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.button3);
this.Controls.Add(this.flowLayoutPanel1); this.Controls.Add(this.flowLayoutPanel1);
this.Controls.Add(this.tilePanel2);
this.Controls.Add(this.tilePanel1);
this.Controls.Add(this.button2); this.Controls.Add(this.button2);
this.Controls.Add(this.panel6);
this.Controls.Add(this.panel7);
this.Controls.Add(this.panel4);
this.Controls.Add(this.headingPanel1);
this.Controls.Add(this.titlePanel1); this.Controls.Add(this.titlePanel1);
this.Controls.Add(this.panel1);
this.Controls.Add(this.richTextBox1);
this.Controls.Add(this.button1); this.Controls.Add(this.button1);
this.Name = "MainForm"; this.Name = "MainForm";
this.Text = "Form1"; this.Text = "Form1";
this.flowLayoutPanel1.ResumeLayout(false); this.contextMenuStrip1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -259,20 +138,13 @@
#endregion #endregion
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button1;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.Panel panel1;
private Windows.Forms.TitlePanel titlePanel1; private Windows.Forms.TitlePanel titlePanel1;
private Windows.Forms.HeadingPanel headingPanel1;
private System.Windows.Forms.Panel panel4;
private System.Windows.Forms.Panel panel6;
private System.Windows.Forms.Panel panel7;
private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button2;
private Windows.Forms.TilePanel tilePanel1;
private Windows.Forms.TilePanel tilePanel2;
private Windows.Forms.TilePanelContainer tilePanelContainer1;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private Windows.Forms.HeadingPanel headingPanel2; private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private Windows.Forms.HeadingPanel headingPanel3; private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.PictureBox pictureBox1;
} }
} }

View File

@ -1,4 +1,6 @@
using AppLauncher.Windows.Forms; using AppLauncher.Models;
using AppLauncher.Windows.Forms;
using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@ -7,6 +9,7 @@ using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Drawing.Text; using System.Drawing.Text;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -21,7 +24,7 @@ namespace AppLauncher
{ {
InitializeComponent(); InitializeComponent();
//headingPanel2.Checked = true;
} }
private async void button1_Click(object sender, EventArgs e) private async void button1_Click(object sender, EventArgs e)
@ -39,6 +42,41 @@ namespace AppLauncher
private void button2_Click(object sender, EventArgs e) private void button2_Click(object sender, EventArgs e)
{ {
//List<TileGroupModel> groupList = new List<TileGroupModel>();
//TileGroupModel group1 = new TileGroupModel()
//{
// Title = "Featured",
// IsExpanded = true,
// Items = new List<TileModel>(),
// GridSize = new Size(8, 2)
//};
//group1.Items.Add(new TileModel()
//{
// Title = "CubicExplorer",
// Icon = null,
// Position = new Point(0, 0),
// ProcessFilename = @"C:\B\Portable Files\CubicExplorer\v0.95.1\CubicExplorer.exe",
// ProcessWorkingDirectory = @"N:\D"
//});
//group1.Items.Add(new TileModel()
//{
// Title = "VeraCrypt",
// Icon = null,
// Position = new Point(1, 0),
// ProcessFilename = @"C:\B\Portable Files\VeraCrypt\VeraCrypt-x64.exe",
// ProcessWorkingDirectory = @"L:\"
//});
//groupList.Add(group1);
//File.WriteAllText(Application.StartupPath.TrimEnd('\\') + "\\test1.jsonfig", JsonConvert.SerializeObject(groupList));
//ProcessStartInfo process = new ProcessStartInfo(); //ProcessStartInfo process = new ProcessStartInfo();
//process.FileName = @"C:\B\Portable Files (pure)\Build and Deploy Utility\v0.2.0.046 alpha\badutil.exe"; //process.FileName = @"C:\B\Portable Files (pure)\Build and Deploy Utility\v0.2.0.046 alpha\badutil.exe";
//process.Arguments = ""; //process.Arguments = "";
@ -48,11 +86,11 @@ namespace AppLauncher
//richTextBox1.Text += tilePanelContainer1.GridSize.ToString() + Environment.NewLine; //richTextBox1.Text += tilePanelContainer1.GridSize.ToString() + Environment.NewLine;
tilePanelContainer1.Controls.Add(tilePanel1); //tilePanelContainer1.Controls.Add(tilePanel1);
tilePanel1.Location = new Point(0, 0); //tilePanel1.Location = new Point(0, 0);
tilePanelContainer1.Controls.Add(tilePanel2); //tilePanelContainer1.Controls.Add(tilePanel2);
tilePanel2.Location = new Point(0, 0); //tilePanel2.Location = new Point(0, 0);
@ -106,17 +144,39 @@ namespace AppLauncher
}); });
} }
//private void Form1_MouseDown(object sender, MouseEventArgs e) private void exitToolStripMenuItem_Click(object sender, EventArgs e)
//{ {
// const int WM_NCLBUTTONDOWN = 0xA1; this.Close();
// const int HT_CAPTION = 0x2; }
// this.Capture = false; protected void loadSession(string filename)
{
string sourceCode = File.ReadAllText(filename);
if (string.IsNullOrWhiteSpace(sourceCode))
{
return;
}
// Message msg = Message.Create(this.Handle, WM_NCLBUTTONDOWN, (IntPtr)HT_CAPTION, IntPtr.Zero); List<TileGroupModel> rs = JsonConvert.DeserializeObject<List<TileGroupModel>>(sourceCode);
if (rs == null)
{
return;
}
// WndProc(ref msg); flowLayoutPanel1.Controls.Clear();
//}
foreach (TileGroupModel item in rs)
{
TileContainer panel = new TileContainer(item);
flowLayoutPanel1.Controls.Add(panel);
}
} }
private void button3_Click(object sender, EventArgs e)
{
loadSession(Application.StartupPath.TrimEnd('\\') + "\\test1.jsonfig");
}
}
} }

View File

@ -117,4 +117,7 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </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> </root>

14
Models/TileGroupModel.cs Normal file
View File

@ -0,0 +1,14 @@
using System.Collections.Generic;
using System.Drawing;
namespace AppLauncher.Models
{
public class TileGroupModel
{
public string Title { get; set; }
public bool IsExpanded { get; set; } = false;
public bool IsExclusive { get; set; } = false;
public List<TileModel> Items { get; set; } = new List<TileModel>();
public Size GridSize = new Size(0, 0);
}
}

22
Models/TileModel.cs Normal file
View File

@ -0,0 +1,22 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
namespace AppLauncher.Models
{
public class TileModel
{
public string Title { get; set; }
public Image Icon { get; set; }
public string ProcessFilename { get; set; }
public string ProcessArgument { get; set; }
public string ProcessWorkingDirectory { get; set; }
public ProcessWindowStyle ProcessWindowStyle { get; set; } = ProcessWindowStyle.Normal;
public bool ProcessAsAdmin { get; set; } = false;
public Point Position { get; set; }
public bool IsGroup { get; set; } = false;
protected List<TileModel> Items { get; set; } = new List<TileModel>();
}
}

View File

@ -0,0 +1,78 @@
namespace AppLauncher.Windows.Forms
{
partial class TileContainer
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new AppLauncher.Windows.Forms.TileGroupLabel();
this.panel1 = new AppLauncher.Windows.Forms.TileLayoutPanel();
this.SuspendLayout();
//
// label1
//
this.label1.AutoScrollMargin = new System.Drawing.Size(0, 0);
this.label1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
this.label1.Checked = false;
this.label1.Location = new System.Drawing.Point(0, 0);
this.label1.Margin = new System.Windows.Forms.Padding(0, 0, 0, 3);
this.label1.MinimumSize = new System.Drawing.Size(100, 20);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(223, 20);
this.label1.TabIndex = 11;
this.label1.TileGroupPanel = null;
this.label1.TitleText = "Featured";
//
// panel1
//
this.panel1.AutoScrollMargin = new System.Drawing.Size(0, 0);
this.panel1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
this.panel1.BackColor = System.Drawing.Color.Transparent;
this.panel1.Location = new System.Drawing.Point(0, 23);
this.panel1.Margin = new System.Windows.Forms.Padding(2, 0, 0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(223, 127);
this.panel1.TabIndex = 27;
//
// TileContainer
//
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.Size = new System.Drawing.Size(370, 150);
this.ResumeLayout(false);
}
#endregion
private TileGroupLabel label1;
private TileLayoutPanel panel1;
}
}

View File

@ -0,0 +1,124 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;
using AppLauncher.Models;
namespace AppLauncher.Windows.Forms
{
public partial class TileContainer : AUserControl
{
protected int collapseIncrement = 6;
protected int expandIncrement = 8;
protected TileGroupModel groupInfo = null;
public TileContainer(TileGroupModel model) : base()
{
InitializeComponent();
label1.TileGroupPanel = this;
groupInfo = model;
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;
panel1.LoadTiles(model.Items);
}
protected override 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.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;
public async Task Collapse()
{
await Task.Run(() =>
{
while (this.Height > collapseHeight)
{
if (this.InvokeRequired)
{
this.Invoke(new MethodInvoker(() => {
this.Height -= collapseIncrement;
}));
}
else
{
this.Height -= collapseIncrement;
}
Thread.Sleep(10);
}
});
}
public async Task CollapseNow()
{
await Task.Run(() =>
{
if (this.InvokeRequired)
{
this.Invoke(new MethodInvoker(() => {
this.Height = collapseHeight;
}));
}
else
{
this.Height = collapseHeight;
}
});
}
public async Task Expand()
{
await Task.Run(() =>
{
while (this.Height < expandedHeight)
{
if (this.InvokeRequired)
{
this.Invoke(new MethodInvoker(() => {
this.Height += expandIncrement;
this.Invalidate();
}));
}
else
{
this.Height += expandIncrement;
this.Invalidate();
}
Thread.Sleep(10);
}
});
}
}
}

View File

@ -1,6 +1,6 @@
namespace AppLauncher.Windows.Forms namespace AppLauncher.Windows.Forms
{ {
partial class HeadingPanel partial class TileGroupLabel
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
@ -48,8 +48,8 @@
this.label1.Size = new System.Drawing.Size(575, 20); this.label1.Size = new System.Drawing.Size(575, 20);
this.label1.TabIndex = 8; this.label1.TabIndex = 8;
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.label1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.HeadingPanel_MouseClick); this.label1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.panel_MouseClick);
this.label1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.HeadingPanel_MouseClick); this.label1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.panel_MouseClick);
// //
// pictureBox1 // pictureBox1
// //
@ -67,8 +67,8 @@
this.pictureBox1.Size = new System.Drawing.Size(20, 20); this.pictureBox1.Size = new System.Drawing.Size(20, 20);
this.pictureBox1.TabIndex = 7; this.pictureBox1.TabIndex = 7;
this.pictureBox1.TabStop = false; this.pictureBox1.TabStop = false;
this.pictureBox1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.HeadingPanel_MouseClick); this.pictureBox1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.panel_MouseClick);
this.pictureBox1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.HeadingPanel_MouseClick); this.pictureBox1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.panel_MouseClick);
// //
// HeadingPanel // HeadingPanel
// //
@ -79,7 +79,7 @@
this.MinimumSize = new System.Drawing.Size(100, 20); this.MinimumSize = new System.Drawing.Size(100, 20);
this.Name = "HeadingPanel"; this.Name = "HeadingPanel";
this.Size = new System.Drawing.Size(600, 20); this.Size = new System.Drawing.Size(600, 20);
this.MouseClick += new System.Windows.Forms.MouseEventHandler(this.HeadingPanel_MouseClick); this.MouseClick += new System.Windows.Forms.MouseEventHandler(this.panel_MouseClick);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);

View File

@ -5,11 +5,11 @@ using System.Windows.Forms;
namespace AppLauncher.Windows.Forms namespace AppLauncher.Windows.Forms
{ {
public partial class HeadingPanel : AUserControl public partial class TileGroupLabel : AUserControl
{ {
protected bool isChecked = false; protected bool isChecked = false;
public HeadingPanel() : base() public TileGroupLabel() : base()
{ {
InitializeComponent(); InitializeComponent();
@ -32,26 +32,17 @@ namespace AppLauncher.Windows.Forms
} }
} }
public TilePanelContainer TilePanelContainer { get; set; } = null; [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public TileContainer TileGroupPanel { get; set; } = null;
protected async override void OnLoad(EventArgs e) protected async override void OnLoad(EventArgs e)
{ {
base.OnLoad(e); base.OnLoad(e);
if (this.TilePanelContainer != null) await invalidateToggle(false);
{
if (this.Checked)
{
await this.TilePanelContainer.Expand(120);
}
else
{
await this.TilePanelContainer.Collapse(0);
}
}
} }
private async void HeadingPanel_MouseClick(object sender, MouseEventArgs e) protected async void panel_MouseClick(object sender, MouseEventArgs e)
{ {
if (e.Button != MouseButtons.Left) if (e.Button != MouseButtons.Left)
{ {
@ -60,15 +51,29 @@ namespace AppLauncher.Windows.Forms
this.Checked = !this.Checked; this.Checked = !this.Checked;
if (this.TilePanelContainer != null) await invalidateToggle();
}
protected async Task invalidateToggle(bool animate = true)
{ {
if (this.TileGroupPanel == null)
{
return;
}
if (this.Checked) if (this.Checked)
{ {
await this.TilePanelContainer.Expand(120); await this.TileGroupPanel.Expand();
} }
else else
{ {
await this.TilePanelContainer.Collapse(0); if (animate)
{
await this.TileGroupPanel.Collapse();
}
else
{
await this.TileGroupPanel.CollapseNow();
} }
} }
} }

View File

@ -0,0 +1,220 @@
using AppLauncher.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AppLauncher.Windows.Forms
{
public class TileLayoutPanel : AUserControl
{
public class Item
{
public TilePanel Tile { get; set; }
public Point Coord { get; set; } = new Point(0, 0);
}
protected readonly int tileSize = 70;
protected readonly int margin = 3;
protected int collapseHeight = 0;
protected int expandedHeight = 0;
protected List<Item> items = new List<Item>();
public TileLayoutPanel() : base()
{
this.BackColor = System.Drawing.Color.Transparent;
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
OnResize(e);
}
public Point GridSize
{
get
{
int w = (int)Math.Floor(decimal.Divide(this.Width, this.TileSize));
int h = (int)Math.Floor(decimal.Divide(this.Height, this.TileSize));
return new Point(w, h);
}
}
public int TileSize => (tileSize + margin);
public int CollapseHeight => collapseHeight;
public int ExpandedHeight => expandedHeight;
public void Clear()
{
this.Controls.Clear();
}
//public Point GetTileCoord(Point location) => this.GetTileCoord(location.X, location.Y);
//public Point GetTileCoord(int posX, int posY)
//{
// int x = (int)Math.Round(decimal.Divide(posX, this.TileSize));
// int y = (int)Math.Round(decimal.Divide(posY, this.TileSize));
// if (x < 0) x = 0;
// if (y < 0) y = 0;
// return new Point(x, y);
//}
//public Point GetTilePosition(Point location) => this.GetTilePosition(location.X, location.Y);
public Point GetTilePosition(int posX, int posY)
{
int x = (int)Math.Round(decimal.Divide(posX, this.TileSize));
int y = (int)Math.Round(decimal.Divide(posY, this.TileSize));
if (x < 0) x = 0;
if (y < 0) y = 0;
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)
{
return;
}
if (tiles.Count() <= 0)
{
return;
}
foreach (TileModel item in tiles)
{
// resolve final grid position
Point? confirmedPosition = resolvePosition(item.Position);
if (confirmedPosition == null)
{
continue;
}
// place control
TilePanel panel = new TilePanel();
panel.LoadInfo(item);
panel.Location = convertPositionToLocation(confirmedPosition.Value);
items.Add(new Item()
{
Tile = panel,
Coord = confirmedPosition.Value
});
this.Controls.Add(panel);
}
}
public void MoveTile(TilePanel panel, int posX, int posY)
{
}
protected Point convertPositionToLocation(Point position) => new Point((position.X * this.TileSize), (position.Y * this.TileSize));
protected Point? resolvePosition(Point position)
{
if (!isTileInBounds(position))
{
return null;
}
if (!hasTile(position))
{
return position;
}
return resolveNextPosition(position);
}
protected Point? resolveNextPosition(Point position)
{
Point gridSize = this.GridSize;
Point newPosition = position;
while (true)
{
newPosition.X++;
if (newPosition.X >= gridSize.X)
{
newPosition.Y++;
newPosition.X = 0;
}
if (!isTileInBounds(newPosition))
{
return null;
}
if (hasTile(newPosition))
{
continue;
}
return newPosition;
}
}
protected bool hasTile(Point position)
{
if (items == null)
{
return false;
}
if (items.Count <= 0)
{
return false;
}
return (items.Count(x => x.Coord.Equals(position)) > 0);
}
protected bool isTileInBounds(Point position)
{
Point gridSize = this.GridSize;
if (position.X > gridSize.X)
{
return false;
}
if (position.Y > gridSize.Y)
{
return false;
}
return true;
}
}
}

View File

@ -0,0 +1,120 @@
<?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>
</root>

View File

@ -44,6 +44,8 @@
this.label1.Size = new System.Drawing.Size(70, 13); this.label1.Size = new System.Drawing.Size(70, 13);
this.label1.TabIndex = 24; this.label1.TabIndex = 24;
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.label1.Click += new System.EventHandler(this.TilePanel_Click);
this.label1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.TilePanel_MouseDoubleClick);
// //
// pictureBox1 // pictureBox1
// //
@ -57,6 +59,8 @@
this.pictureBox1.Size = new System.Drawing.Size(70, 38); this.pictureBox1.Size = new System.Drawing.Size(70, 38);
this.pictureBox1.TabIndex = 25; this.pictureBox1.TabIndex = 25;
this.pictureBox1.TabStop = false; this.pictureBox1.TabStop = false;
this.pictureBox1.Click += new System.EventHandler(this.TilePanel_Click);
this.pictureBox1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.TilePanel_MouseDoubleClick);
// //
// TilePanel // TilePanel
// //
@ -71,6 +75,8 @@
this.MinimumSize = new System.Drawing.Size(70, 70); this.MinimumSize = new System.Drawing.Size(70, 70);
this.Name = "TilePanel"; this.Name = "TilePanel";
this.Size = new System.Drawing.Size(70, 70); this.Size = new System.Drawing.Size(70, 70);
this.Click += new System.EventHandler(this.TilePanel_Click);
this.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.TilePanel_MouseDoubleClick);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);

View File

@ -0,0 +1,174 @@
using AppLauncher.Models;
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
namespace AppLauncher.Windows.Forms
{
public partial class TilePanel : AUserControl
{
protected bool isDragging = false;
protected Point startPosition = new Point();
protected TileModel model = new TileModel();
public TilePanel() : base()
{
InitializeComponent();
this.MouseDown += panel_MouseDown;
this.MouseUp += panel_MouseUp;
this.MouseMove += panel_MouseMove;
pictureBox1.MouseDown += panel_MouseDown;
pictureBox1.MouseUp += panel_MouseUp;
pictureBox1.MouseMove += panel_MouseMove;
label1.MouseDown += panel_MouseDown;
label1.MouseUp += panel_MouseUp;
label1.MouseMove += panel_MouseMove;
}
[Category("Appearance"), Browsable(true)]
public string Title { get => label1.Text; protected set => label1.Text = value; }
[Category("Appearance"), Browsable(true)]
public Image Image { get => pictureBox1.BackgroundImage; protected set => pictureBox1.BackgroundImage = value; }
[Browsable(false)]
public TileModel Info => model;
//[Browsable(false)]
//public string ProcessArgument { get; set; }
//[Browsable(false)]
//public string ProcessWorkingDirectory { get; set; }
//[Browsable(false)]
//public ProcessWindowStyle ProcessWindowStyle { get; set; } = ProcessWindowStyle.Normal;
public TileLayoutPanel PanelContainer
{
get
{
if (this.Parent == null)
{
return null;
}
if (this.Parent.GetType() != typeof(TileLayoutPanel))
{
return null;
}
return (TileLayoutPanel)this.Parent;
}
}
public void LoadInfo(TileModel model)
{
this.model = model;
this.Title = model.Title;
this.Image = model.Icon;
if (this.Image == null)
{
if (File.Exists(model.ProcessFilename))
{
try
{
this.Image = Icon.ExtractAssociatedIcon(model.ProcessFilename)?.ToBitmap();
}
catch
{
}
}
}
}
private void panel_MouseDown(object sender, MouseEventArgs e)
{
TileLayoutPanel container = this.PanelContainer;
if (container == null)
{
return;
}
if (e.Button != MouseButtons.Left)
{
return;
}
this.BringToFront();
isDragging = true;
startPosition = e.Location;
}
private void panel_MouseUp(object sender, MouseEventArgs e)
{
isDragging = false;
}
private void panel_MouseMove(object sender, MouseEventArgs e)
{
if (isDragging)
{
TileLayoutPanel layoutPanel = this.PanelContainer;
if (layoutPanel == null)
{
return;
}
int x = (this.Location.X + (e.Location.X - startPosition.X));
int y = (this.Location.Y + (e.Location.Y - startPosition.Y));
//this.Location = layoutPanel.GetTilePosition(x, y);
layoutPanel.MoveTile(this, x, y);
}
}
private void TilePanel_MouseDoubleClick(object sender, MouseEventArgs e)
{
if (this.Info == null)
{
return;
}
if (string.IsNullOrWhiteSpace(this.Info.ProcessFilename))
{
return;
}
if (!File.Exists(this.Info.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";
try
{
Process.Start(p);
}
catch
{
// do nothing
}
}
private void TilePanel_Click(object sender, EventArgs e)
{
// do nothing yet
}
}
}

View File

@ -0,0 +1,120 @@
<?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>
</root>

View File

@ -1,150 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
namespace AppLauncher.Windows.Forms
{
public partial class TilePanel : AUserControl
{
protected bool isDragging = false;
protected Point startPosition = new Point();
public TilePanel() : base()
{
InitializeComponent();
this.MouseDown += panel_MouseDown;
this.MouseUp += panel_MouseUp;
this.MouseMove += panel_MouseMove;
pictureBox1.MouseDown += panel_MouseDown;
pictureBox1.MouseUp += panel_MouseUp;
pictureBox1.MouseMove += panel_MouseMove;
label1.MouseDown += panel_MouseDown;
label1.MouseUp += panel_MouseUp;
label1.MouseMove += panel_MouseMove;
}
protected override void OnLocationChanged(EventArgs e)
{
base.OnLocationChanged(e);
if (this.Parent != null)
{
if (this.Parent.GetType() == typeof(TilePanelContainer))
{
TilePanelContainer container = (TilePanelContainer)this.Parent;
Point p = container.GetTilePosition(this.Location);
//label1.Text = p.X.ToString() + ", " + p.Y.ToString();
}
}
}
[Category("Appearance"), Browsable(true)]
public string TitleText { get => label1.Text; set => label1.Text = value; }
[Category("Appearance"), Browsable(true)]
public Image IconImage { get => pictureBox1.BackgroundImage; set => pictureBox1.BackgroundImage = value; }
[Browsable(false)]
public string ProcessFilename { get; set; }
[Browsable(false)]
public string ProcessArgument { get; set; }
[Browsable(false)]
public string ProcessWorkingDirectory { get; set; }
[Browsable(false)]
public ProcessWindowStyle ProcessWindowStyle { get; set; } = ProcessWindowStyle.Normal;
public TilePanelContainer PanelContainer
{
get
{
if (this.Parent == null)
{
return null;
}
if (this.Parent.GetType() != typeof(TilePanelContainer))
{
return null;
}
return (TilePanelContainer)this.Parent;
}
}
private void panel_MouseDown(object sender, MouseEventArgs e)
{
TilePanelContainer container = this.PanelContainer;
if (container == null)
{
return;
}
if (e.Button != MouseButtons.Left)
{
return;
}
isDragging = true;
startPosition = e.Location;
}
private void panel_MouseUp(object sender, MouseEventArgs e)
{
isDragging = false;
}
private void panel_MouseMove(object sender, MouseEventArgs e)
{
if (isDragging)
{
TilePanelContainer container = this.PanelContainer;
if (container == null)
{
return;
}
//label1.Text = e.Location.ToString();
//this.Location = new Point(e.Location.X - windowOffset.X, e.Location.Y - windowOffset.Y);
//int x = parentPosition.X + (e.Location.X - positionOffset.X);
//int y = parentPosition.Y + (e.Location.Y - positionOffset.Y);
//this.Location = new Point(x, y);
//int x = (tilePosition.X + e.Location.X);
//int y = (tilePosition.Y + e.Location.Y);
int x = (this.Location.X + (e.Location.X - startPosition.X));
int y = (this.Location.Y + (e.Location.Y - startPosition.Y));
this.Location = container.GetTilePosition(x, y);
//label1.Text = x.ToString() + ", " + y.ToString();
//label1.Text = e.X.ToString() + ", " + e.Y.ToString();
//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.Parent.Location = new Point(Screen.PrimaryScreen.WorkingArea.X, y);
}
}
}
}

View File

@ -1,121 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AppLauncher.Windows.Forms
{
public class TilePanelContainer : AUserControl
{
protected readonly int tileSize = 70;
protected readonly int margin = 3;
public TilePanelContainer() : base()
{
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
OnResize(e);
}
public Point GridSize
{
get
{
int w = (int)Math.Floor(decimal.Divide(this.Width, this.TileSize));
int h = (int)Math.Floor(decimal.Divide(this.Height, this.TileSize));
return new Point(w, h);
}
}
public int TileSize => (tileSize + margin);
public async Task Collapse(int height, int increment = 6)
{
await Task.Run(() =>
{
while (this.Height > height)
{
if (this.InvokeRequired)
{
this.Invoke(new MethodInvoker(() => {
this.Height -= increment;
}));
}
else
{
this.Height -= increment;
}
Thread.Sleep(10);
}
});
}
public async Task Expand(int height, int increment = 8)
{
await Task.Run(() =>
{
while (this.Height < height)
{
if (this.InvokeRequired)
{
this.Invoke(new MethodInvoker(() => {
this.Height += increment;
this.Invalidate();
}));
}
else
{
this.Height += increment;
this.Invalidate();
}
Thread.Sleep(10);
}
});
}
public Point GetTileCoord(Point location) => this.GetTileCoord(location.X, location.Y);
public Point GetTileCoord(int posX, int posY)
{
int x = (int)Math.Round(decimal.Divide(posX, this.TileSize));
int y = (int)Math.Round(decimal.Divide(posY, this.TileSize));
if (x < 0) x = 0;
if (y < 0) y = 0;
return new Point(x, y);
}
public Point GetTilePosition(Point location) => this.GetTilePosition(location.X, location.Y);
public Point GetTilePosition(int posX, int posY)
{
int x = (int)Math.Round(decimal.Divide(posX, this.TileSize));
int y = (int)Math.Round(decimal.Divide(posY, this.TileSize));
if (x < 0) x = 0;
if (y < 0) y = 0;
return new Point((x * this.TileSize), (y * this.TileSize));
}
public void SetGridSize(int width, int height)
{
this.Size = new Size((this.TileSize * width), (this.TileSize * height));
}
}
}

View File

@ -48,6 +48,7 @@
this.pictureBox1.Size = new System.Drawing.Size(40, 40); this.pictureBox1.Size = new System.Drawing.Size(40, 40);
this.pictureBox1.TabIndex = 5; this.pictureBox1.TabIndex = 5;
this.pictureBox1.TabStop = false; this.pictureBox1.TabStop = false;
this.pictureBox1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseUp);
// //
// label1 // label1
// //

View File

@ -42,6 +42,8 @@ namespace AppLauncher.Windows.Forms
set => label1.Text = value; set => label1.Text = value;
} }
public ContextMenuStrip MainMenu { get; set; } = null;
protected void parentForm_MouseDown(object sender, MouseEventArgs e) protected void parentForm_MouseDown(object sender, MouseEventArgs e)
{ {
if (e.Button != MouseButtons.Left) if (e.Button != MouseButtons.Left)
@ -71,5 +73,16 @@ namespace AppLauncher.Windows.Forms
} }
} }
private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
if (this.MainMenu != null)
{
this.MainMenu.Show(this.PointToScreen(e.Location));
}
}
}
} }
} }

4
packages.config Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net472" />
</packages>