Changed: manage tile groups
This commit is contained in:
parent
be44cff6ff
commit
3b4f19ae40
@ -131,6 +131,9 @@
|
||||
<Compile Include="Windows\Forms\Tile\AddTileForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Windows\Forms\Tile\EditGroupForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Windows\Forms\Tile\EditTileForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@ -198,6 +201,9 @@
|
||||
<EmbeddedResource Include="Windows\Forms\Tile\AddTileForm.resx">
|
||||
<DependentUpon>AddTileForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Windows\Forms\Tile\EditGroupForm.resx">
|
||||
<DependentUpon>EditGroupForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Windows\Forms\Tile\EditTileForm.resx">
|
||||
<DependentUpon>EditTileForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
181
Windows/Forms/Tile/EditGroupForm.cs
Normal file
181
Windows/Forms/Tile/EditGroupForm.cs
Normal file
@ -0,0 +1,181 @@
|
||||
using AppLauncher.Models;
|
||||
using RyzStudio.Windows.ThemedForms;
|
||||
using System;
|
||||
|
||||
namespace AppLauncher.Windows.Forms
|
||||
{
|
||||
public class EditGroupForm : DialogForm
|
||||
{
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private Button button1;
|
||||
private PickerBox pickerBox1;
|
||||
private TextBox textBox1;
|
||||
protected TileContainer parentContainer = null;
|
||||
|
||||
public EditGroupForm() : base()
|
||||
{
|
||||
InitializeComponent();
|
||||
initialiseComponents2();
|
||||
}
|
||||
|
||||
public EditGroupForm(TileContainer container) : base()
|
||||
{
|
||||
parentContainer = container;
|
||||
|
||||
InitializeComponent();
|
||||
initialiseComponents2();
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditGroupForm));
|
||||
this.textBox1 = new RyzStudio.Windows.ThemedForms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.button1 = new RyzStudio.Windows.ThemedForms.Button();
|
||||
this.pickerBox1 = new RyzStudio.Windows.ThemedForms.PickerBox();
|
||||
((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 Group";
|
||||
//
|
||||
// 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;
|
||||
//
|
||||
// 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 = "Show Only Expanded";
|
||||
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;
|
||||
//
|
||||
// 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, 91);
|
||||
this.pickerBox1.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6);
|
||||
this.pickerBox1.Name = "pickerBox1";
|
||||
this.pickerBox1.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5);
|
||||
this.pickerBox1.Size = new System.Drawing.Size(140, 32);
|
||||
this.pickerBox1.SubmitButton = null;
|
||||
this.pickerBox1.TabIndex = 174;
|
||||
//
|
||||
// EditGroupForm
|
||||
//
|
||||
this.ClientSize = new System.Drawing.Size(400, 480);
|
||||
this.Controls.Add(this.pickerBox1);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Description = "Edit Group";
|
||||
this.Name = "EditGroupForm";
|
||||
this.Controls.SetChildIndex(this.imgbxClose, 0);
|
||||
this.Controls.SetChildIndex(this.lblDescription, 0);
|
||||
this.Controls.SetChildIndex(this.panel1, 0);
|
||||
this.Controls.SetChildIndex(this.area1, 0);
|
||||
this.Controls.SetChildIndex(this.textBox1, 0);
|
||||
this.Controls.SetChildIndex(this.label1, 0);
|
||||
this.Controls.SetChildIndex(this.label2, 0);
|
||||
this.Controls.SetChildIndex(this.button1, 0);
|
||||
this.Controls.SetChildIndex(this.pickerBox1, 0);
|
||||
((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
private void initialiseComponents2()
|
||||
{
|
||||
pickerBox1.ComboBox.Items.Clear();
|
||||
pickerBox1.ComboBox.Items.AddRange(new string[] { "No", "Yes" });
|
||||
if (pickerBox1.ComboBox.Items.Count > 0) pickerBox1.ComboBox.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
protected override void OnShown(EventArgs e)
|
||||
{
|
||||
base.OnShown(e);
|
||||
|
||||
if (parentContainer != null)
|
||||
{
|
||||
textBox1.Text = parentContainer.Model.Title;
|
||||
pickerBox1.ComboBox.SelectedIndex = (parentContainer.Model.IsExpanded ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
TileGroupModel model = parentContainer.Model;
|
||||
model.Title = textBox1.Text?.Trim();
|
||||
model.IsExclusive = (pickerBox1.ComboBox.SelectedIndex == 1);
|
||||
|
||||
parentContainer.LoadModel(model, false);
|
||||
|
||||
this.Close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
131
Windows/Forms/Tile/EditGroupForm.resx
Normal file
131
Windows/Forms/Tile/EditGroupForm.resx
Normal 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>
|
@ -20,17 +20,11 @@ namespace AppLauncher.Windows.Forms
|
||||
InitializeComponent();
|
||||
|
||||
this.ContextMenuStrip = contextMenuStrip1;
|
||||
//this.BackColor = Color.MistyRose;
|
||||
|
||||
label1.TileGroupPanel = this;
|
||||
|
||||
groupInfo = model;
|
||||
this.LoadModel(model);
|
||||
|
||||
label1.TitleText = groupInfo.Title;
|
||||
panel1.SetGridSize(groupInfo.GridSize.Width, groupInfo.GridSize.Height);
|
||||
this.Width = panel1.Width;
|
||||
label1.Checked = groupInfo.IsExpanded;
|
||||
panel1.LoadTiles(model.Items);
|
||||
panel1.Resize += panel1_Resize;
|
||||
}
|
||||
|
||||
@ -41,7 +35,7 @@ namespace AppLauncher.Windows.Forms
|
||||
label1.Width = panel1.Width;
|
||||
|
||||
this.Margin = new Padding(0, 0, 0, 0);
|
||||
this.Padding = new Padding(0, 0, 0, 20);
|
||||
this.Padding = new Padding(0, 0, 0, 10);
|
||||
//this.MaximumSize = new Size(panel1.Width, ExpandedHeight);
|
||||
//this.MinimumSize = new Size(panel1.Width, label1.Height);
|
||||
//this.Size = this.MaximumSize;
|
||||
@ -215,7 +209,23 @@ namespace AppLauncher.Windows.Forms
|
||||
|
||||
public void EditGroup()
|
||||
{
|
||||
EditGroupForm editForm = new EditGroupForm(this);
|
||||
editForm.ShowDialog();
|
||||
}
|
||||
|
||||
public void LoadModel(TileGroupModel model, bool loadTiles = true)
|
||||
{
|
||||
groupInfo = model;
|
||||
|
||||
label1.TitleText = groupInfo.Title;
|
||||
panel1.SetGridSize(groupInfo.GridSize.Width, groupInfo.GridSize.Height);
|
||||
this.Width = panel1.Width;
|
||||
label1.Checked = groupInfo.IsExpanded;
|
||||
|
||||
if (loadTiles)
|
||||
{
|
||||
panel1.LoadTiles(model.Items);
|
||||
}
|
||||
}
|
||||
|
||||
public void MoveTop()
|
||||
@ -280,8 +290,6 @@ namespace AppLauncher.Windows.Forms
|
||||
this.FlowLayoutPanel.Controls.Remove(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void addToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
AddTileForm addForm = new AddTileForm(panel1);
|
||||
|
@ -94,7 +94,10 @@ namespace AppLauncher.Windows.Forms
|
||||
List<TileModel> rs = new List<TileModel>();
|
||||
foreach (Item item in items)
|
||||
{
|
||||
rs.Add(item.Tile.ModelInfo);
|
||||
TileModel model = item.Tile.ModelInfo;
|
||||
model.Position = item.Coord;
|
||||
|
||||
rs.Add(model);
|
||||
}
|
||||
|
||||
return rs;
|
||||
@ -258,6 +261,11 @@ namespace AppLauncher.Windows.Forms
|
||||
return null;
|
||||
}
|
||||
|
||||
if (items.Count <= 0)
|
||||
{
|
||||
return findFirstFreeCoord();
|
||||
}
|
||||
|
||||
// only one available
|
||||
if (items.Count >= ((gridSize.X * gridSize.Y) - 1))
|
||||
{
|
||||
|
Reference in New Issue
Block a user