This commit is contained in:
Pipiaka 2024-05-31 00:48:37 +04:00
parent e12182dbf3
commit f74fd6dc1a
6 changed files with 205 additions and 120 deletions

View File

@ -1,8 +1,5 @@
 using BackpackGreedyAlgorithm.Algorithm;
using BackpackGreedyAlgorithm.Algorithm;
using BackpackGreedyAlgorithm.Storages; using BackpackGreedyAlgorithm.Storages;
using static System.Runtime.InteropServices.JavaScript.JSType;
namespace BackpackGreedyAlgorithm.Communications; namespace BackpackGreedyAlgorithm.Communications;
@ -16,7 +13,7 @@ public class Manager
/// <summary> /// <summary>
/// Реализатор /// Реализатор
/// </summary> /// </summary>
GreedyAlgorithm backpack; private GreedyAlgorithm _backpack;
/// <summary> /// <summary>
/// Конструктор /// Конструктор
@ -24,11 +21,11 @@ public class Manager
/// <param name="data">Параметры для работы алгоритма</param> /// <param name="data">Параметры для работы алгоритма</param>
public Manager(Datas? data) public Manager(Datas? data)
{ {
backpack = new GreedyAlgorithm(data); _backpack = new GreedyAlgorithm(data);
if (data != null) if (data != null)
{ {
backpack.SaveStatus(); _backpack.SaveStatus();
storage.AddStatus(backpack.status); storage.AddStatus(_backpack.status);
} }
} }
@ -38,9 +35,9 @@ public class Manager
/// <returns>Хранилище с результатом шага</returns> /// <returns>Хранилище с результатом шага</returns>
public Storage MakeStap() public Storage MakeStap()
{ {
backpack.PutGem(); _backpack.PutGem();
backpack.SaveStatus(); _backpack.SaveStatus();
storage.AddStatus(backpack.status); if (_backpack.status.maxWeight > _backpack.status.weight + _backpack.status.gems[_backpack.status.gems.Count - 1].weight) storage.AddStatus(_backpack.status);
return storage; return storage;
} }
@ -51,7 +48,7 @@ public class Manager
/// <param name="storage">Хранилище</param> /// <param name="storage">Хранилище</param>
public void SetStatusAlgoritm(Status status, Storage storage) public void SetStatusAlgoritm(Status status, Storage storage)
{ {
backpack.ReturnToStatus(status); _backpack.ReturnToStatus(status);
this.storage = storage; this.storage = storage;
} }
} }

View File

@ -16,12 +16,12 @@ public class Visualizer
private string _weightBackpack; private string _weightBackpack;
/// <summary> /// <summary>
/// /// Текст с ценностью рюкзака
/// </summary> /// </summary>
private Label _valueL; private Label _valueL;
/// <summary> /// <summary>
/// /// Текст с весом рюкзака
/// </summary> /// </summary>
private Label _weightL; private Label _weightL;
@ -73,6 +73,9 @@ public class Visualizer
case "panelWeight": case "panelWeight":
GetLabel((Panel)info, "labelWeight").Text = gem.weight.ToString(); GetLabel((Panel)info, "labelWeight").Text = gem.weight.ToString();
break; break;
case "labelId":
((Label)info).Text = gem.id.ToString();
break;
default: default:
break; break;
} }

View File

@ -78,26 +78,29 @@
labelAboutAlgoritm = new Label(); labelAboutAlgoritm = new Label();
labelInfo = new Label(); labelInfo = new Label();
groupBoxMainWindow = new GroupBox(); groupBoxMainWindow = new GroupBox();
label13 = new Label();
panel8 = new Panel();
label14 = new Label();
label30 = new Label(); label30 = new Label();
buttonData = new Button(); buttonData = new Button();
label29 = new Label(); label29 = new Label();
label28 = new Label(); label28 = new Label();
label27 = new Label();
label26 = new Label(); label26 = new Label();
label25 = new Label(); label25 = new Label();
panel7 = new Panel(); panel7 = new Panel();
label24 = new Label(); label24 = new Label();
pictureBox1 = new PictureBox(); pictureBox1 = new PictureBox();
groupBoxTools = new GroupBox(); groupBoxTools = new GroupBox();
buttonStart = new Button(); buttonReset = new Button();
buttonStep = new Button(); buttonStepPrev = new Button();
buttonStepNext = new Button();
panelElem = new Panel(); panelElem = new Panel();
panelWeight0 = new Panel(); panelWeight0 = new Panel();
pictureBoxElem0 = new PictureBox(); pictureBoxElem0 = new PictureBox();
panelValue0 = new Panel(); panelValue0 = new Panel();
panel8 = new Panel(); label15 = new Label();
label13 = new Label(); label27 = new Label();
label14 = new Label(); label31 = new Label();
groupBoxAboutAlgoritm.SuspendLayout(); groupBoxAboutAlgoritm.SuspendLayout();
groupBox3.SuspendLayout(); groupBox3.SuspendLayout();
groupBox1.SuspendLayout(); groupBox1.SuspendLayout();
@ -115,12 +118,12 @@
groupBoxInfo.SuspendLayout(); groupBoxInfo.SuspendLayout();
groupBox2.SuspendLayout(); groupBox2.SuspendLayout();
groupBoxMainWindow.SuspendLayout(); groupBoxMainWindow.SuspendLayout();
panel8.SuspendLayout();
panel7.SuspendLayout(); panel7.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit(); ((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
groupBoxTools.SuspendLayout(); groupBoxTools.SuspendLayout();
panelElem.SuspendLayout(); panelElem.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBoxElem0).BeginInit(); ((System.ComponentModel.ISupportInitialize)pictureBoxElem0).BeginInit();
panel8.SuspendLayout();
SuspendLayout(); SuspendLayout();
// //
// groupBoxAboutAlgoritm // groupBoxAboutAlgoritm
@ -647,13 +650,15 @@
// //
// groupBoxMainWindow // groupBoxMainWindow
// //
groupBoxMainWindow.Controls.Add(label31);
groupBoxMainWindow.Controls.Add(label27);
groupBoxMainWindow.Controls.Add(label15);
groupBoxMainWindow.Controls.Add(label13); groupBoxMainWindow.Controls.Add(label13);
groupBoxMainWindow.Controls.Add(panel8); groupBoxMainWindow.Controls.Add(panel8);
groupBoxMainWindow.Controls.Add(label30); groupBoxMainWindow.Controls.Add(label30);
groupBoxMainWindow.Controls.Add(buttonData); groupBoxMainWindow.Controls.Add(buttonData);
groupBoxMainWindow.Controls.Add(label29); groupBoxMainWindow.Controls.Add(label29);
groupBoxMainWindow.Controls.Add(label28); groupBoxMainWindow.Controls.Add(label28);
groupBoxMainWindow.Controls.Add(label27);
groupBoxMainWindow.Controls.Add(label26); groupBoxMainWindow.Controls.Add(label26);
groupBoxMainWindow.Controls.Add(label25); groupBoxMainWindow.Controls.Add(label25);
groupBoxMainWindow.Controls.Add(panel7); groupBoxMainWindow.Controls.Add(panel7);
@ -668,10 +673,40 @@
groupBoxMainWindow.Text = "О главном окне"; groupBoxMainWindow.Text = "О главном окне";
groupBoxMainWindow.Visible = false; groupBoxMainWindow.Visible = false;
// //
// label13
//
label13.AutoSize = true;
label13.Location = new Point(241, 297);
label13.Name = "label13";
label13.Size = new Size(146, 20);
label13.TabIndex = 27;
label13.Text = "- Текущая ценность";
//
// panel8
//
panel8.BackgroundImage = (Image)resources.GetObject("panel8.BackgroundImage");
panel8.BackgroundImageLayout = ImageLayout.Zoom;
panel8.Controls.Add(label14);
panel8.Location = new Point(168, 267);
panel8.Name = "panel8";
panel8.Size = new Size(74, 78);
panel8.TabIndex = 26;
//
// label14
//
label14.AutoSize = true;
label14.BackColor = Color.Transparent;
label14.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
label14.Location = new Point(29, 29);
label14.Name = "label14";
label14.Size = new Size(18, 20);
label14.TabIndex = 28;
label14.Text = "0";
//
// label30 // label30
// //
label30.AutoSize = true; label30.AutoSize = true;
label30.Location = new Point(501, 153); label30.Location = new Point(496, 176);
label30.Name = "label30"; label30.Name = "label30";
label30.Size = new Size(228, 20); label30.Size = new Size(228, 20);
label30.TabIndex = 25; label30.TabIndex = 25;
@ -679,7 +714,7 @@
// //
// buttonData // buttonData
// //
buttonData.Location = new Point(343, 149); buttonData.Location = new Point(338, 172);
buttonData.Name = "buttonData"; buttonData.Name = "buttonData";
buttonData.Size = new Size(157, 29); buttonData.Size = new Size(157, 29);
buttonData.TabIndex = 24; buttonData.TabIndex = 24;
@ -698,20 +733,11 @@
// label28 // label28
// //
label28.AutoSize = true; label28.AutoSize = true;
label28.Location = new Point(501, 95); label28.Location = new Point(501, 53);
label28.Name = "label28"; label28.Name = "label28";
label28.Size = new Size(287, 20); label28.Size = new Size(236, 20);
label28.TabIndex = 22; label28.TabIndex = 22;
label28.Text = "- Сделать шаг в выполнении алгоритма"; label28.Text = "- Сделать вперёд шаг алгоритма";
//
// label27
//
label27.AutoSize = true;
label27.Location = new Point(501, 60);
label27.Name = "label27";
label27.Size = new Size(157, 20);
label27.TabIndex = 21;
label27.Text = "- Запустить алгоритм";
// //
// label26 // label26
// //
@ -765,32 +791,42 @@
// //
// groupBoxTools // groupBoxTools
// //
groupBoxTools.Controls.Add(buttonStart); groupBoxTools.Controls.Add(buttonReset);
groupBoxTools.Controls.Add(buttonStep); groupBoxTools.Controls.Add(buttonStepPrev);
groupBoxTools.Controls.Add(buttonStepNext);
groupBoxTools.Location = new Point(337, 23); groupBoxTools.Location = new Point(337, 23);
groupBoxTools.Name = "groupBoxTools"; groupBoxTools.Name = "groupBoxTools";
groupBoxTools.Size = new Size(169, 117); groupBoxTools.Size = new Size(169, 143);
groupBoxTools.TabIndex = 15; groupBoxTools.TabIndex = 15;
groupBoxTools.TabStop = false; groupBoxTools.TabStop = false;
groupBoxTools.Text = "Инструменты"; groupBoxTools.Text = "Инструменты";
// //
// buttonStart // buttonReset
// //
buttonStart.Location = new Point(6, 33); buttonReset.Location = new Point(12, 94);
buttonStart.Name = "buttonStart"; buttonReset.Name = "buttonReset";
buttonStart.Size = new Size(157, 29); buttonReset.Size = new Size(146, 29);
buttonStart.TabIndex = 2; buttonReset.TabIndex = 7;
buttonStart.Text = "Запустить"; buttonReset.Text = "Сброс";
buttonStart.UseVisualStyleBackColor = true; buttonReset.UseVisualStyleBackColor = true;
// //
// buttonStep // buttonStepPrev
// //
buttonStep.Location = new Point(6, 68); buttonStepPrev.Location = new Point(12, 59);
buttonStep.Name = "buttonStep"; buttonStepPrev.Name = "buttonStepPrev";
buttonStep.Size = new Size(157, 29); buttonStepPrev.Size = new Size(146, 29);
buttonStep.TabIndex = 0; buttonStepPrev.TabIndex = 6;
buttonStep.Text = "Шаг"; buttonStepPrev.Text = "Шаг назад";
buttonStep.UseVisualStyleBackColor = true; buttonStepPrev.UseVisualStyleBackColor = true;
//
// buttonStepNext
//
buttonStepNext.Location = new Point(12, 25);
buttonStepNext.Name = "buttonStepNext";
buttonStepNext.Size = new Size(146, 29);
buttonStepNext.TabIndex = 5;
buttonStepNext.Text = "Шаг вперёд";
buttonStepNext.UseVisualStyleBackColor = true;
// //
// panelElem // panelElem
// //
@ -831,35 +867,32 @@
panelValue0.Size = new Size(48, 47); panelValue0.Size = new Size(48, 47);
panelValue0.TabIndex = 10; panelValue0.TabIndex = 10;
// //
// panel8 // label15
// //
panel8.BackgroundImage = (Image)resources.GetObject("panel8.BackgroundImage"); label15.AutoSize = true;
panel8.BackgroundImageLayout = ImageLayout.Zoom; label15.Location = new Point(501, 87);
panel8.Controls.Add(label14); label15.Name = "label15";
panel8.Location = new Point(168, 267); label15.Size = new Size(226, 20);
panel8.Name = "panel8"; label15.TabIndex = 28;
panel8.Size = new Size(74, 78); label15.Text = "- Сделать шаг назад алгоритма";
panel8.TabIndex = 26;
// //
// label13 // label27
// //
label13.AutoSize = true; label27.AutoSize = true;
label13.Location = new Point(241, 297); label27.Location = new Point(501, 120);
label13.Name = "label13"; label27.Name = "label27";
label13.Size = new Size(146, 20); label27.Size = new Size(218, 20);
label13.TabIndex = 27; label27.TabIndex = 29;
label13.Text = "- Текущая ценность"; label27.Text = "- Сбросить алгоритм к началу";
// //
// label14 // label31
// //
label14.AutoSize = true; label31.AutoSize = true;
label14.BackColor = Color.Transparent; label31.Location = new Point(496, 265);
label14.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); label31.Name = "label31";
label14.Location = new Point(29, 29); label31.Size = new Size(312, 100);
label14.Name = "label14"; label31.TabIndex = 30;
label14.Size = new Size(18, 20); label31.Text = "Так же в алгоритме присутствует\r\nвозможность сохранения и загрузки\r\n\r\nЗагрузка: Файл -> Загрузить (CTRL+L)\r\nСохранение: Файл -> Сохранить (CTRL+S)\r\n";
label14.TabIndex = 28;
label14.Text = "0";
// //
// InformationForm // InformationForm
// //
@ -902,14 +935,14 @@
groupBox2.PerformLayout(); groupBox2.PerformLayout();
groupBoxMainWindow.ResumeLayout(false); groupBoxMainWindow.ResumeLayout(false);
groupBoxMainWindow.PerformLayout(); groupBoxMainWindow.PerformLayout();
panel8.ResumeLayout(false);
panel8.PerformLayout();
panel7.ResumeLayout(false); panel7.ResumeLayout(false);
panel7.PerformLayout(); panel7.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit(); ((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
groupBoxTools.ResumeLayout(false); groupBoxTools.ResumeLayout(false);
panelElem.ResumeLayout(false); panelElem.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)pictureBoxElem0).EndInit(); ((System.ComponentModel.ISupportInitialize)pictureBoxElem0).EndInit();
panel8.ResumeLayout(false);
panel8.PerformLayout();
ResumeLayout(false); ResumeLayout(false);
} }
@ -968,8 +1001,6 @@
private PictureBox pictureBoxElem0; private PictureBox pictureBoxElem0;
private Panel panelValue0; private Panel panelValue0;
private GroupBox groupBoxTools; private GroupBox groupBoxTools;
private Button buttonStart;
private Button buttonStep;
private Panel panel7; private Panel panel7;
private Label label24; private Label label24;
private PictureBox pictureBox1; private PictureBox pictureBox1;
@ -977,11 +1008,16 @@
private Label label25; private Label label25;
private Label label29; private Label label29;
private Label label28; private Label label28;
private Label label27;
private Label label30; private Label label30;
private Button buttonData; private Button buttonData;
private Label label13; private Label label13;
private Panel panel8; private Panel panel8;
private Label label14; private Label label14;
private Button buttonReset;
private Button buttonStepPrev;
private Button buttonStepNext;
private Label label31;
private Label label27;
private Label label15;
} }
} }

View File

@ -1,5 +1,4 @@
using BackpackGreedyAlgorithm.Algorithm; using BackpackGreedyAlgorithm.Algorithm;
using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
namespace BackpackGreedyAlgorithm; namespace BackpackGreedyAlgorithm;
@ -187,7 +186,5 @@ public partial class InputForm : Form
private void PanelElement_DragEnter(object sender, DragEventArgs e) private void PanelElement_DragEnter(object sender, DragEventArgs e)
{ {
e.Effect = e.Data.GetDataPresent(typeof(Bitmap)) ? DragDropEffects.Copy : DragDropEffects.None; e.Effect = e.Data.GetDataPresent(typeof(Bitmap)) ? DragDropEffects.Copy : DragDropEffects.None;
} }
// TODO Сделать кнопку рандомайзер значений
} }

View File

@ -234,11 +234,14 @@
// //
labelValue0.AutoSize = true; labelValue0.AutoSize = true;
labelValue0.BackColor = Color.Transparent; labelValue0.BackColor = Color.Transparent;
labelValue0.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelValue0.Location = new Point(1, 12); labelValue0.Location = new Point(1, 12);
labelValue0.MinimumSize = new Size(48, 0);
labelValue0.Name = "labelValue0"; labelValue0.Name = "labelValue0";
labelValue0.Size = new Size(45, 20); labelValue0.Size = new Size(48, 20);
labelValue0.TabIndex = 15; labelValue0.TabIndex = 15;
labelValue0.Text = "None"; labelValue0.Text = "None";
labelValue0.TextAlign = ContentAlignment.MiddleCenter;
// //
// panelWeight0 // panelWeight0
// //
@ -254,12 +257,15 @@
// //
labelWeight0.AutoSize = true; labelWeight0.AutoSize = true;
labelWeight0.BackColor = Color.Transparent; labelWeight0.BackColor = Color.Transparent;
labelWeight0.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelWeight0.ForeColor = Color.White; labelWeight0.ForeColor = Color.White;
labelWeight0.Location = new Point(2, 21); labelWeight0.Location = new Point(2, 21);
labelWeight0.MinimumSize = new Size(48, 0);
labelWeight0.Name = "labelWeight0"; labelWeight0.Name = "labelWeight0";
labelWeight0.Size = new Size(45, 20); labelWeight0.Size = new Size(48, 20);
labelWeight0.TabIndex = 14; labelWeight0.TabIndex = 14;
labelWeight0.Text = "None"; labelWeight0.Text = "None";
labelWeight0.TextAlign = ContentAlignment.MiddleCenter;
// //
// pictureBoxElem0 // pictureBoxElem0
// //
@ -308,11 +314,13 @@
labelBackpackWeight.AutoSize = true; labelBackpackWeight.AutoSize = true;
labelBackpackWeight.BackColor = Color.Transparent; labelBackpackWeight.BackColor = Color.Transparent;
labelBackpackWeight.ForeColor = Color.White; labelBackpackWeight.ForeColor = Color.White;
labelBackpackWeight.Location = new Point(14, 45); labelBackpackWeight.Location = new Point(0, 45);
labelBackpackWeight.MinimumSize = new Size(74, 0);
labelBackpackWeight.Name = "labelBackpackWeight"; labelBackpackWeight.Name = "labelBackpackWeight";
labelBackpackWeight.Size = new Size(45, 20); labelBackpackWeight.Size = new Size(74, 20);
labelBackpackWeight.TabIndex = 0; labelBackpackWeight.TabIndex = 0;
labelBackpackWeight.Text = "None"; labelBackpackWeight.Text = "None";
labelBackpackWeight.TextAlign = ContentAlignment.MiddleCenter;
// //
// panelBackpackValue // panelBackpackValue
// //
@ -329,11 +337,13 @@
labelBackpackValue.AutoSize = true; labelBackpackValue.AutoSize = true;
labelBackpackValue.BackColor = Color.Transparent; labelBackpackValue.BackColor = Color.Transparent;
labelBackpackValue.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); labelBackpackValue.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelBackpackValue.Location = new Point(13, 30); labelBackpackValue.Location = new Point(0, 28);
labelBackpackValue.MinimumSize = new Size(74, 0);
labelBackpackValue.Name = "labelBackpackValue"; labelBackpackValue.Name = "labelBackpackValue";
labelBackpackValue.Size = new Size(47, 20); labelBackpackValue.Size = new Size(74, 20);
labelBackpackValue.TabIndex = 0; labelBackpackValue.TabIndex = 0;
labelBackpackValue.Text = "None"; labelBackpackValue.Text = "None";
labelBackpackValue.TextAlign = ContentAlignment.MiddleCenter;
// //
// groupBoxElems // groupBoxElems
// //
@ -380,12 +390,15 @@
// //
labelWeight8.AutoSize = true; labelWeight8.AutoSize = true;
labelWeight8.BackColor = Color.Transparent; labelWeight8.BackColor = Color.Transparent;
labelWeight8.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelWeight8.ForeColor = Color.White; labelWeight8.ForeColor = Color.White;
labelWeight8.Location = new Point(2, 21); labelWeight8.Location = new Point(2, 21);
labelWeight8.MinimumSize = new Size(48, 0);
labelWeight8.Name = "labelWeight8"; labelWeight8.Name = "labelWeight8";
labelWeight8.Size = new Size(45, 20); labelWeight8.Size = new Size(48, 20);
labelWeight8.TabIndex = 14; labelWeight8.TabIndex = 14;
labelWeight8.Text = "None"; labelWeight8.Text = "None";
labelWeight8.TextAlign = ContentAlignment.MiddleCenter;
// //
// labelId8 // labelId8
// //
@ -421,11 +434,14 @@
// //
labelValue8.AutoSize = true; labelValue8.AutoSize = true;
labelValue8.BackColor = Color.Transparent; labelValue8.BackColor = Color.Transparent;
labelValue8.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelValue8.Location = new Point(1, 12); labelValue8.Location = new Point(1, 12);
labelValue8.MinimumSize = new Size(48, 0);
labelValue8.Name = "labelValue8"; labelValue8.Name = "labelValue8";
labelValue8.Size = new Size(45, 20); labelValue8.Size = new Size(48, 20);
labelValue8.TabIndex = 15; labelValue8.TabIndex = 15;
labelValue8.Text = "None"; labelValue8.Text = "None";
labelValue8.TextAlign = ContentAlignment.MiddleCenter;
// //
// panelElem7 // panelElem7
// //
@ -453,12 +469,15 @@
// //
labelWeight7.AutoSize = true; labelWeight7.AutoSize = true;
labelWeight7.BackColor = Color.Transparent; labelWeight7.BackColor = Color.Transparent;
labelWeight7.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelWeight7.ForeColor = Color.White; labelWeight7.ForeColor = Color.White;
labelWeight7.Location = new Point(2, 21); labelWeight7.Location = new Point(2, 21);
labelWeight7.MinimumSize = new Size(48, 0);
labelWeight7.Name = "labelWeight7"; labelWeight7.Name = "labelWeight7";
labelWeight7.Size = new Size(45, 20); labelWeight7.Size = new Size(48, 20);
labelWeight7.TabIndex = 14; labelWeight7.TabIndex = 14;
labelWeight7.Text = "None"; labelWeight7.Text = "None";
labelWeight7.TextAlign = ContentAlignment.MiddleCenter;
// //
// labelId7 // labelId7
// //
@ -494,11 +513,14 @@
// //
labelValue7.AutoSize = true; labelValue7.AutoSize = true;
labelValue7.BackColor = Color.Transparent; labelValue7.BackColor = Color.Transparent;
labelValue7.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelValue7.Location = new Point(1, 12); labelValue7.Location = new Point(1, 12);
labelValue7.MinimumSize = new Size(48, 0);
labelValue7.Name = "labelValue7"; labelValue7.Name = "labelValue7";
labelValue7.Size = new Size(45, 20); labelValue7.Size = new Size(48, 20);
labelValue7.TabIndex = 15; labelValue7.TabIndex = 15;
labelValue7.Text = "None"; labelValue7.Text = "None";
labelValue7.TextAlign = ContentAlignment.MiddleCenter;
// //
// panelElem6 // panelElem6
// //
@ -526,12 +548,15 @@
// //
labelWeight6.AutoSize = true; labelWeight6.AutoSize = true;
labelWeight6.BackColor = Color.Transparent; labelWeight6.BackColor = Color.Transparent;
labelWeight6.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelWeight6.ForeColor = Color.White; labelWeight6.ForeColor = Color.White;
labelWeight6.Location = new Point(2, 21); labelWeight6.Location = new Point(2, 21);
labelWeight6.MinimumSize = new Size(48, 0);
labelWeight6.Name = "labelWeight6"; labelWeight6.Name = "labelWeight6";
labelWeight6.Size = new Size(45, 20); labelWeight6.Size = new Size(48, 20);
labelWeight6.TabIndex = 14; labelWeight6.TabIndex = 14;
labelWeight6.Text = "None"; labelWeight6.Text = "None";
labelWeight6.TextAlign = ContentAlignment.MiddleCenter;
// //
// labelId6 // labelId6
// //
@ -567,11 +592,14 @@
// //
labelValue6.AutoSize = true; labelValue6.AutoSize = true;
labelValue6.BackColor = Color.Transparent; labelValue6.BackColor = Color.Transparent;
labelValue6.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelValue6.Location = new Point(1, 12); labelValue6.Location = new Point(1, 12);
labelValue6.MinimumSize = new Size(48, 0);
labelValue6.Name = "labelValue6"; labelValue6.Name = "labelValue6";
labelValue6.Size = new Size(45, 20); labelValue6.Size = new Size(48, 20);
labelValue6.TabIndex = 15; labelValue6.TabIndex = 15;
labelValue6.Text = "None"; labelValue6.Text = "None";
labelValue6.TextAlign = ContentAlignment.MiddleCenter;
// //
// panelElem5 // panelElem5
// //
@ -599,12 +627,15 @@
// //
labelWeight5.AutoSize = true; labelWeight5.AutoSize = true;
labelWeight5.BackColor = Color.Transparent; labelWeight5.BackColor = Color.Transparent;
labelWeight5.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelWeight5.ForeColor = Color.White; labelWeight5.ForeColor = Color.White;
labelWeight5.Location = new Point(2, 21); labelWeight5.Location = new Point(2, 21);
labelWeight5.MinimumSize = new Size(48, 0);
labelWeight5.Name = "labelWeight5"; labelWeight5.Name = "labelWeight5";
labelWeight5.Size = new Size(45, 20); labelWeight5.Size = new Size(48, 20);
labelWeight5.TabIndex = 14; labelWeight5.TabIndex = 14;
labelWeight5.Text = "None"; labelWeight5.Text = "None";
labelWeight5.TextAlign = ContentAlignment.MiddleCenter;
// //
// labelId5 // labelId5
// //
@ -640,11 +671,14 @@
// //
labelValue5.AutoSize = true; labelValue5.AutoSize = true;
labelValue5.BackColor = Color.Transparent; labelValue5.BackColor = Color.Transparent;
labelValue5.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelValue5.Location = new Point(1, 12); labelValue5.Location = new Point(1, 12);
labelValue5.MinimumSize = new Size(48, 0);
labelValue5.Name = "labelValue5"; labelValue5.Name = "labelValue5";
labelValue5.Size = new Size(45, 20); labelValue5.Size = new Size(48, 20);
labelValue5.TabIndex = 15; labelValue5.TabIndex = 15;
labelValue5.Text = "None"; labelValue5.Text = "None";
labelValue5.TextAlign = ContentAlignment.MiddleCenter;
// //
// panelElem4 // panelElem4
// //
@ -672,12 +706,15 @@
// //
labelWeight4.AutoSize = true; labelWeight4.AutoSize = true;
labelWeight4.BackColor = Color.Transparent; labelWeight4.BackColor = Color.Transparent;
labelWeight4.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelWeight4.ForeColor = Color.White; labelWeight4.ForeColor = Color.White;
labelWeight4.Location = new Point(2, 21); labelWeight4.Location = new Point(2, 21);
labelWeight4.MinimumSize = new Size(48, 0);
labelWeight4.Name = "labelWeight4"; labelWeight4.Name = "labelWeight4";
labelWeight4.Size = new Size(45, 20); labelWeight4.Size = new Size(48, 20);
labelWeight4.TabIndex = 14; labelWeight4.TabIndex = 14;
labelWeight4.Text = "None"; labelWeight4.Text = "None";
labelWeight4.TextAlign = ContentAlignment.MiddleCenter;
// //
// labelId4 // labelId4
// //
@ -713,11 +750,14 @@
// //
labelValue4.AutoSize = true; labelValue4.AutoSize = true;
labelValue4.BackColor = Color.Transparent; labelValue4.BackColor = Color.Transparent;
labelValue4.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelValue4.Location = new Point(1, 12); labelValue4.Location = new Point(1, 12);
labelValue4.MinimumSize = new Size(48, 0);
labelValue4.Name = "labelValue4"; labelValue4.Name = "labelValue4";
labelValue4.Size = new Size(45, 20); labelValue4.Size = new Size(48, 20);
labelValue4.TabIndex = 15; labelValue4.TabIndex = 15;
labelValue4.Text = "None"; labelValue4.Text = "None";
labelValue4.TextAlign = ContentAlignment.MiddleCenter;
// //
// panelElem3 // panelElem3
// //
@ -745,12 +785,15 @@
// //
labelWeight3.AutoSize = true; labelWeight3.AutoSize = true;
labelWeight3.BackColor = Color.Transparent; labelWeight3.BackColor = Color.Transparent;
labelWeight3.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelWeight3.ForeColor = Color.White; labelWeight3.ForeColor = Color.White;
labelWeight3.Location = new Point(2, 21); labelWeight3.Location = new Point(2, 21);
labelWeight3.MinimumSize = new Size(48, 0);
labelWeight3.Name = "labelWeight3"; labelWeight3.Name = "labelWeight3";
labelWeight3.Size = new Size(45, 20); labelWeight3.Size = new Size(48, 20);
labelWeight3.TabIndex = 14; labelWeight3.TabIndex = 14;
labelWeight3.Text = "None"; labelWeight3.Text = "None";
labelWeight3.TextAlign = ContentAlignment.MiddleCenter;
// //
// labelId3 // labelId3
// //
@ -786,11 +829,14 @@
// //
labelValue3.AutoSize = true; labelValue3.AutoSize = true;
labelValue3.BackColor = Color.Transparent; labelValue3.BackColor = Color.Transparent;
labelValue3.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelValue3.Location = new Point(1, 12); labelValue3.Location = new Point(1, 12);
labelValue3.MinimumSize = new Size(48, 0);
labelValue3.Name = "labelValue3"; labelValue3.Name = "labelValue3";
labelValue3.Size = new Size(45, 20); labelValue3.Size = new Size(48, 20);
labelValue3.TabIndex = 15; labelValue3.TabIndex = 15;
labelValue3.Text = "None"; labelValue3.Text = "None";
labelValue3.TextAlign = ContentAlignment.MiddleCenter;
// //
// panelElem2 // panelElem2
// //
@ -818,12 +864,15 @@
// //
labelWeight2.AutoSize = true; labelWeight2.AutoSize = true;
labelWeight2.BackColor = Color.Transparent; labelWeight2.BackColor = Color.Transparent;
labelWeight2.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelWeight2.ForeColor = Color.White; labelWeight2.ForeColor = Color.White;
labelWeight2.Location = new Point(2, 21); labelWeight2.Location = new Point(2, 21);
labelWeight2.MinimumSize = new Size(48, 0);
labelWeight2.Name = "labelWeight2"; labelWeight2.Name = "labelWeight2";
labelWeight2.Size = new Size(45, 20); labelWeight2.Size = new Size(48, 20);
labelWeight2.TabIndex = 14; labelWeight2.TabIndex = 14;
labelWeight2.Text = "None"; labelWeight2.Text = "None";
labelWeight2.TextAlign = ContentAlignment.MiddleCenter;
// //
// labelId2 // labelId2
// //
@ -859,11 +908,14 @@
// //
labelValue2.AutoSize = true; labelValue2.AutoSize = true;
labelValue2.BackColor = Color.Transparent; labelValue2.BackColor = Color.Transparent;
labelValue2.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelValue2.Location = new Point(1, 12); labelValue2.Location = new Point(1, 12);
labelValue2.MinimumSize = new Size(48, 0);
labelValue2.Name = "labelValue2"; labelValue2.Name = "labelValue2";
labelValue2.Size = new Size(45, 20); labelValue2.Size = new Size(48, 20);
labelValue2.TabIndex = 15; labelValue2.TabIndex = 15;
labelValue2.Text = "None"; labelValue2.Text = "None";
labelValue2.TextAlign = ContentAlignment.MiddleCenter;
// //
// panelElem1 // panelElem1
// //
@ -891,12 +943,15 @@
// //
labelWeight1.AutoSize = true; labelWeight1.AutoSize = true;
labelWeight1.BackColor = Color.Transparent; labelWeight1.BackColor = Color.Transparent;
labelWeight1.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelWeight1.ForeColor = Color.White; labelWeight1.ForeColor = Color.White;
labelWeight1.Location = new Point(2, 21); labelWeight1.Location = new Point(2, 21);
labelWeight1.MinimumSize = new Size(48, 0);
labelWeight1.Name = "labelWeight1"; labelWeight1.Name = "labelWeight1";
labelWeight1.Size = new Size(45, 20); labelWeight1.Size = new Size(48, 20);
labelWeight1.TabIndex = 14; labelWeight1.TabIndex = 14;
labelWeight1.Text = "None"; labelWeight1.Text = "None";
labelWeight1.TextAlign = ContentAlignment.MiddleCenter;
// //
// labelId1 // labelId1
// //
@ -932,16 +987,19 @@
// //
labelValue1.AutoSize = true; labelValue1.AutoSize = true;
labelValue1.BackColor = Color.Transparent; labelValue1.BackColor = Color.Transparent;
labelValue1.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelValue1.Location = new Point(1, 12); labelValue1.Location = new Point(1, 12);
labelValue1.MinimumSize = new Size(48, 0);
labelValue1.Name = "labelValue1"; labelValue1.Name = "labelValue1";
labelValue1.Size = new Size(45, 20); labelValue1.Size = new Size(48, 20);
labelValue1.TabIndex = 15; labelValue1.TabIndex = 15;
labelValue1.Text = "None"; labelValue1.Text = "None";
labelValue1.TextAlign = ContentAlignment.MiddleCenter;
// //
// menuStrip // menuStrip
// //
menuStrip.ImageScalingSize = new Size(20, 20); menuStrip.ImageScalingSize = new Size(20, 20);
menuStrip.Items.AddRange(new ToolStripItem[] { менюToolStripMenuItem, файлToolStripMenuItem }); menuStrip.Items.AddRange(new ToolStripItem[] { файлToolStripMenuItem, менюToolStripMenuItem });
menuStrip.Location = new Point(0, 0); menuStrip.Location = new Point(0, 0);
menuStrip.Name = "menuStrip"; menuStrip.Name = "menuStrip";
menuStrip.Size = new Size(677, 28); menuStrip.Size = new Size(677, 28);
@ -952,13 +1010,13 @@
// //
менюToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { infoToolStripMenuItem }); менюToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { infoToolStripMenuItem });
менюToolStripMenuItem.Name = енюToolStripMenuItem"; менюToolStripMenuItem.Name = енюToolStripMenuItem";
менюToolStripMenuItem.Size = new Size(65, 24); менюToolStripMenuItem.Size = new Size(81, 24);
менюToolStripMenuItem.Text = "Меню"; менюToolStripMenuItem.Text = "Справка";
// //
// infoToolStripMenuItem // infoToolStripMenuItem
// //
infoToolStripMenuItem.Name = "infoToolStripMenuItem"; infoToolStripMenuItem.Name = "infoToolStripMenuItem";
infoToolStripMenuItem.Size = new Size(131, 26); infoToolStripMenuItem.Size = new Size(224, 26);
infoToolStripMenuItem.Text = "Инфо"; infoToolStripMenuItem.Text = "Инфо";
infoToolStripMenuItem.Click += InfoToolStripMenuItem_Click; infoToolStripMenuItem.Click += InfoToolStripMenuItem_Click;
// //
@ -973,7 +1031,7 @@
// //
SaveToolStripMenuItem.Name = "SaveToolStripMenuItem"; SaveToolStripMenuItem.Name = "SaveToolStripMenuItem";
SaveToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.S; SaveToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.S;
SaveToolStripMenuItem.Size = new Size(224, 26); SaveToolStripMenuItem.Size = new Size(216, 26);
SaveToolStripMenuItem.Text = "Сохранить"; SaveToolStripMenuItem.Text = "Сохранить";
SaveToolStripMenuItem.Click += SaveToolStripMenuItem_Click; SaveToolStripMenuItem.Click += SaveToolStripMenuItem_Click;
// //
@ -981,7 +1039,7 @@
// //
LoadToolStripMenuItem.Name = "LoadToolStripMenuItem"; LoadToolStripMenuItem.Name = "LoadToolStripMenuItem";
LoadToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.L; LoadToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.L;
LoadToolStripMenuItem.Size = new Size(224, 26); LoadToolStripMenuItem.Size = new Size(216, 26);
LoadToolStripMenuItem.Text = "Загрузить"; LoadToolStripMenuItem.Text = "Загрузить";
LoadToolStripMenuItem.Click += LoadToolStripMenuItem_Click; LoadToolStripMenuItem.Click += LoadToolStripMenuItem_Click;
// //

View File

@ -1,7 +1,6 @@
using BackpackGreedyAlgorithm.Storages; using BackpackGreedyAlgorithm.Storages;
using BackpackGreedyAlgorithm.Communications; using BackpackGreedyAlgorithm.Communications;
using BackpackGreedyAlgorithm.Algorithm; using BackpackGreedyAlgorithm.Algorithm;
using static System.Runtime.InteropServices.JavaScript.JSType;
namespace BackpackGreedyAlgorithm; namespace BackpackGreedyAlgorithm;
@ -106,11 +105,6 @@ public partial class MainForm : Form
groupBoxTools.Enabled = true; groupBoxTools.Enabled = true;
} }
// TODO Сделать меню с функциями:
// - Сохранения
// - Загрузки
/// <summary> /// <summary>
/// Выпадающее меню для сохранения данных /// Выпадающее меню для сохранения данных
/// </summary> /// </summary>