buttons added

This commit is contained in:
VictoriaPresnyakova 2022-12-04 17:12:26 +04:00
parent f80e3c2215
commit 8ac6c2144a
5 changed files with 94 additions and 25 deletions

View File

@ -29,6 +29,8 @@
private void InitializeComponent()
{
this.groupBoxTools = new System.Windows.Forms.GroupBox();
this.ButtonSortByColor = new System.Windows.Forms.Button();
this.ButtonSortByType = new System.Windows.Forms.Button();
this.groupBoxMaps = new System.Windows.Forms.GroupBox();
this.listBoxMaps = new System.Windows.Forms.ListBox();
this.buttonDeleteMap = new System.Windows.Forms.Button();
@ -59,6 +61,8 @@
//
// groupBoxTools
//
this.groupBoxTools.Controls.Add(this.ButtonSortByColor);
this.groupBoxTools.Controls.Add(this.ButtonSortByType);
this.groupBoxTools.Controls.Add(this.groupBoxMaps);
this.groupBoxTools.Controls.Add(this.buttonShowOnMap);
this.groupBoxTools.Controls.Add(this.buttonShowStorage);
@ -70,13 +74,33 @@
this.groupBoxTools.Controls.Add(this.buttonUp);
this.groupBoxTools.Controls.Add(this.buttonDown);
this.groupBoxTools.Dock = System.Windows.Forms.DockStyle.Right;
this.groupBoxTools.Location = new System.Drawing.Point(653, 36);
this.groupBoxTools.Location = new System.Drawing.Point(653, 33);
this.groupBoxTools.Name = "groupBoxTools";
this.groupBoxTools.Size = new System.Drawing.Size(303, 611);
this.groupBoxTools.Size = new System.Drawing.Size(303, 614);
this.groupBoxTools.TabIndex = 0;
this.groupBoxTools.TabStop = false;
this.groupBoxTools.Text = "Tools";
//
// ButtonSortByColor
//
this.ButtonSortByColor.Location = new System.Drawing.Point(24, 335);
this.ButtonSortByColor.Name = "ButtonSortByColor";
this.ButtonSortByColor.Size = new System.Drawing.Size(191, 26);
this.ButtonSortByColor.TabIndex = 7;
this.ButtonSortByColor.Text = "SortByColor";
this.ButtonSortByColor.UseVisualStyleBackColor = true;
this.ButtonSortByColor.Click += new System.EventHandler(this.ButtonSortByColor_Click);
//
// ButtonSortByType
//
this.ButtonSortByType.Location = new System.Drawing.Point(24, 298);
this.ButtonSortByType.Name = "ButtonSortByType";
this.ButtonSortByType.Size = new System.Drawing.Size(191, 31);
this.ButtonSortByType.TabIndex = 6;
this.ButtonSortByType.Text = "SortByType";
this.ButtonSortByType.UseVisualStyleBackColor = true;
this.ButtonSortByType.Click += new System.EventHandler(this.ButtonSortByType_Click);
//
// groupBoxMaps
//
this.groupBoxMaps.Controls.Add(this.listBoxMaps);
@ -86,7 +110,7 @@
this.groupBoxMaps.Controls.Add(this.comboBoxSelectorMap);
this.groupBoxMaps.Location = new System.Drawing.Point(10, 25);
this.groupBoxMaps.Name = "groupBoxMaps";
this.groupBoxMaps.Size = new System.Drawing.Size(213, 314);
this.groupBoxMaps.Size = new System.Drawing.Size(213, 267);
this.groupBoxMaps.TabIndex = 2;
this.groupBoxMaps.TabStop = false;
this.groupBoxMaps.Text = "Maps";
@ -141,9 +165,9 @@
//
// buttonShowOnMap
//
this.buttonShowOnMap.Location = new System.Drawing.Point(24, 490);
this.buttonShowOnMap.Location = new System.Drawing.Point(24, 509);
this.buttonShowOnMap.Name = "buttonShowOnMap";
this.buttonShowOnMap.Size = new System.Drawing.Size(191, 31);
this.buttonShowOnMap.Size = new System.Drawing.Size(191, 34);
this.buttonShowOnMap.TabIndex = 5;
this.buttonShowOnMap.Text = "ShowOnMap";
this.buttonShowOnMap.UseVisualStyleBackColor = true;
@ -151,9 +175,9 @@
//
// buttonShowStorage
//
this.buttonShowStorage.Location = new System.Drawing.Point(24, 451);
this.buttonShowStorage.Location = new System.Drawing.Point(24, 470);
this.buttonShowStorage.Name = "buttonShowStorage";
this.buttonShowStorage.Size = new System.Drawing.Size(191, 33);
this.buttonShowStorage.Size = new System.Drawing.Size(191, 36);
this.buttonShowStorage.TabIndex = 4;
this.buttonShowStorage.Text = "ShowStorage";
this.buttonShowStorage.UseVisualStyleBackColor = true;
@ -161,9 +185,9 @@
//
// buttonRemoveBoat
//
this.buttonRemoveBoat.Location = new System.Drawing.Point(24, 415);
this.buttonRemoveBoat.Location = new System.Drawing.Point(24, 434);
this.buttonRemoveBoat.Name = "buttonRemoveBoat";
this.buttonRemoveBoat.Size = new System.Drawing.Size(191, 30);
this.buttonRemoveBoat.Size = new System.Drawing.Size(191, 33);
this.buttonRemoveBoat.TabIndex = 3;
this.buttonRemoveBoat.Text = "RemoveBoat";
this.buttonRemoveBoat.UseVisualStyleBackColor = true;
@ -171,7 +195,7 @@
//
// maskedTextBoxPosition
//
this.maskedTextBoxPosition.Location = new System.Drawing.Point(24, 383);
this.maskedTextBoxPosition.Location = new System.Drawing.Point(24, 405);
this.maskedTextBoxPosition.Mask = "00";
this.maskedTextBoxPosition.Name = "maskedTextBoxPosition";
this.maskedTextBoxPosition.Size = new System.Drawing.Size(191, 26);
@ -179,9 +203,9 @@
//
// buttonAddBoat
//
this.buttonAddBoat.Location = new System.Drawing.Point(24, 345);
this.buttonAddBoat.Location = new System.Drawing.Point(24, 364);
this.buttonAddBoat.Name = "buttonAddBoat";
this.buttonAddBoat.Size = new System.Drawing.Size(191, 32);
this.buttonAddBoat.Size = new System.Drawing.Size(191, 35);
this.buttonAddBoat.TabIndex = 1;
this.buttonAddBoat.Text = "AddBoat";
this.buttonAddBoat.UseVisualStyleBackColor = true;
@ -192,9 +216,9 @@
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonLeft.BackgroundImage = global::Catamaran.Properties.Resources.Left;
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonLeft.Location = new System.Drawing.Point(10, 526);
this.buttonLeft.Location = new System.Drawing.Point(10, 548);
this.buttonLeft.Name = "buttonLeft";
this.buttonLeft.Size = new System.Drawing.Size(30, 30);
this.buttonLeft.Size = new System.Drawing.Size(30, 33);
this.buttonLeft.TabIndex = 4;
this.buttonLeft.UseVisualStyleBackColor = true;
this.buttonLeft.Click += new System.EventHandler(this.buttonMove_Click);
@ -204,9 +228,9 @@
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonRight.BackgroundImage = global::Catamaran.Properties.Resources.Right;
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonRight.Location = new System.Drawing.Point(70, 526);
this.buttonRight.Location = new System.Drawing.Point(70, 548);
this.buttonRight.Name = "buttonRight";
this.buttonRight.Size = new System.Drawing.Size(30, 30);
this.buttonRight.Size = new System.Drawing.Size(30, 33);
this.buttonRight.TabIndex = 5;
this.buttonRight.UseVisualStyleBackColor = true;
this.buttonRight.Click += new System.EventHandler(this.buttonMove_Click);
@ -216,9 +240,9 @@
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonUp.BackgroundImage = global::Catamaran.Properties.Resources.Up;
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonUp.Location = new System.Drawing.Point(40, 504);
this.buttonUp.Location = new System.Drawing.Point(40, 526);
this.buttonUp.Name = "buttonUp";
this.buttonUp.Size = new System.Drawing.Size(30, 30);
this.buttonUp.Size = new System.Drawing.Size(30, 33);
this.buttonUp.TabIndex = 2;
this.buttonUp.UseVisualStyleBackColor = true;
this.buttonUp.Click += new System.EventHandler(this.buttonMove_Click);
@ -228,9 +252,9 @@
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonDown.BackgroundImage = global::Catamaran.Properties.Resources.Down;
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonDown.Location = new System.Drawing.Point(40, 534);
this.buttonDown.Location = new System.Drawing.Point(40, 556);
this.buttonDown.Name = "buttonDown";
this.buttonDown.Size = new System.Drawing.Size(30, 30);
this.buttonDown.Size = new System.Drawing.Size(30, 33);
this.buttonDown.TabIndex = 3;
this.buttonDown.UseVisualStyleBackColor = true;
this.buttonDown.Click += new System.EventHandler(this.buttonMove_Click);
@ -238,9 +262,9 @@
// pictureBox
//
this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBox.Location = new System.Drawing.Point(0, 36);
this.pictureBox.Location = new System.Drawing.Point(0, 33);
this.pictureBox.Name = "pictureBox";
this.pictureBox.Size = new System.Drawing.Size(653, 611);
this.pictureBox.Size = new System.Drawing.Size(653, 614);
this.pictureBox.TabIndex = 1;
this.pictureBox.TabStop = false;
//
@ -252,7 +276,7 @@
this.fileToolStripMenuItem});
this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip";
this.menuStrip.Size = new System.Drawing.Size(956, 36);
this.menuStrip.Size = new System.Drawing.Size(956, 33);
this.menuStrip.TabIndex = 2;
this.menuStrip.Text = "menuStrip";
//
@ -262,7 +286,7 @@
this.saveToolStripMenuItem,
this.loadToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(54, 32);
this.fileToolStripMenuItem.Size = new System.Drawing.Size(54, 29);
this.fileToolStripMenuItem.Text = "File";
//
// saveToolStripMenuItem
@ -331,5 +355,7 @@
private System.Windows.Forms.ToolStripMenuItem loadToolStripMenuItem;
private System.Windows.Forms.OpenFileDialog openFileDialog;
private System.Windows.Forms.SaveFileDialog saveFileDialog;
private System.Windows.Forms.Button ButtonSortByColor;
private System.Windows.Forms.Button ButtonSortByType;
}
}

View File

@ -323,5 +323,26 @@ namespace Catamaran
}
}
}
/// <summary>
/// Сортировка по типу
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonSortByType_Click(object sender, EventArgs e)
{
if (listBoxMaps.SelectedIndex == -1)
{
return;
}
_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].Sort(new BoatCompareByType());
pictureBox.Image =_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
}
private void ButtonSortByColor_Click(object sender, EventArgs e)
{
// TODO прописать логику
}
}
}

View File

@ -126,4 +126,7 @@
<metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>357, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>26</value>
</metadata>
</root>

View File

@ -208,6 +208,13 @@ namespace Catamaran
_setBoats.Insert(DrawingObjectBoat.Create(rec) as T);
}
}
/// <summary>
/// Сортировка
/// </summary>
/// <param name="comparer"></param>
public void Sort(IComparer<T> comparer)
{
_setCars.SortSet(comparer);
}
}
}

View File

@ -145,5 +145,17 @@ namespace Catamaran
}
}
/// <summary>
/// Сортировка набора объектов
/// </summary>
/// <param name="comparer"></param>
public void SortSet(IComparer<T> comparer)
{
if (comparer == null)
{
return;
}
_places.Sort(comparer);
}чч
}
}