diff --git a/BuildingCalculator/BuildingCalculator/BuildingCalculator.csproj b/BuildingCalculator/BuildingCalculator/BuildingCalculator.csproj index c2301d5..e6c3751 100644 --- a/BuildingCalculator/BuildingCalculator/BuildingCalculator.csproj +++ b/BuildingCalculator/BuildingCalculator/BuildingCalculator.csproj @@ -108,6 +108,12 @@ SelectWorkTypes.cs + + UserControl + + + TextwithBut.cs + @@ -141,6 +147,9 @@ SelectWorkTypes.cs + + TextwithBut.cs + ResXFileCodeGenerator Resources.Designer.cs diff --git a/BuildingCalculator/BuildingCalculator/Classes/Function.cs b/BuildingCalculator/BuildingCalculator/Classes/Function.cs index 81692e0..015ebc4 100644 --- a/BuildingCalculator/BuildingCalculator/Classes/Function.cs +++ b/BuildingCalculator/BuildingCalculator/Classes/Function.cs @@ -22,6 +22,8 @@ public enum ValidateType { Default,OnlyText,OnlyNumbers, UserValidate } public static ContextMenuStrip ContextMenu(Control control,List names,List funcs) { ContextMenuStrip menu = new ContextMenuStrip(); + menu.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + for (int i=0;i private void InitializeComponent() { - this.listBox1 = new System.Windows.Forms.ListBox(); - this.textBox1 = new System.Windows.Forms.TextBox(); - this.textBox2 = new System.Windows.Forms.TextBox(); - this.button1 = new System.Windows.Forms.Button(); - this.textBox3 = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.button3 = new System.Windows.Forms.Button(); - this.comboBox1 = new System.Windows.Forms.ComboBox(); - this.label4 = new System.Windows.Forms.Label(); + this.Listofparams = new System.Windows.Forms.ListBox(); + this.WorkTypeNameInp = new System.Windows.Forms.TextBox(); + this.formula = new System.Windows.Forms.TextBox(); + this.WorkTypeName = new System.Windows.Forms.Label(); + this.formulat = new System.Windows.Forms.Label(); + this.ParamsT = new System.Windows.Forms.Label(); + this.AddType = new System.Windows.Forms.Button(); + this.Category = new System.Windows.Forms.ComboBox(); + this.CategoryT = new System.Windows.Forms.Label(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.parameters = new BuildingCalculator.FormComponents.TextwithBut(); + this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // - // listBox1 - // - this.listBox1.Dock = System.Windows.Forms.DockStyle.Right; - this.listBox1.FormattingEnabled = true; - this.listBox1.ItemHeight = 20; - this.listBox1.Location = new System.Drawing.Point(920, 0); - this.listBox1.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); - this.listBox1.Name = "listBox1"; - this.listBox1.Size = new System.Drawing.Size(403, 523); - this.listBox1.TabIndex = 0; - this.listBox1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listBox1_KeyDown); - this.listBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.listBox1_MouseDown); - // - // textBox1 - // - this.textBox1.Location = new System.Drawing.Point(320, 51); - this.textBox1.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); - this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(210, 26); - this.textBox1.TabIndex = 1; - // - // textBox2 - // - this.textBox2.Location = new System.Drawing.Point(573, 166); - this.textBox2.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); - this.textBox2.Multiline = true; - this.textBox2.Name = "textBox2"; - this.textBox2.Size = new System.Drawing.Size(306, 102); - this.textBox2.TabIndex = 2; - // - // button1 - // - this.button1.Location = new System.Drawing.Point(573, 286); - this.button1.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(206, 35); - this.button1.TabIndex = 3; - this.button1.Text = "Добавить параметр"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // textBox3 - // - this.textBox3.AllowDrop = true; - this.textBox3.Location = new System.Drawing.Point(39, 166); - this.textBox3.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); - this.textBox3.Multiline = true; - this.textBox3.Name = "textBox3"; - this.textBox3.Size = new System.Drawing.Size(330, 102); - this.textBox3.TabIndex = 4; - this.textBox3.Text = "0"; - this.textBox3.DragDrop += new System.Windows.Forms.DragEventHandler(this.textBox3_DragDrop); - this.textBox3.DragEnter += new System.Windows.Forms.DragEventHandler(this.textBox3_DragEnter); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(254, 8); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(122, 20); - this.label1.TabIndex = 5; - this.label1.Text = "Наименование"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(228, 128); - this.label2.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(79, 20); - this.label2.TabIndex = 6; - this.label2.Text = "Формула"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(660, 128); - this.label3.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(97, 20); - this.label3.TabIndex = 7; - this.label3.Text = "Параметры"; - // - // button3 - // - this.button3.Location = new System.Drawing.Point(250, 355); - this.button3.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); - this.button3.Name = "button3"; - this.button3.Size = new System.Drawing.Size(285, 89); - this.button3.TabIndex = 9; - this.button3.Text = "Добавить тип работ"; - this.button3.UseVisualStyleBackColor = true; - this.button3.Click += new System.EventHandler(this.button3_Click); - // - // comboBox1 - // - this.comboBox1.Cursor = System.Windows.Forms.Cursors.Default; - this.comboBox1.FormattingEnabled = true; - this.comboBox1.Items.AddRange(new object[] { + // Listofparams + // + this.Listofparams.Dock = System.Windows.Forms.DockStyle.Fill; + this.Listofparams.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.Listofparams.FormattingEnabled = true; + this.Listofparams.ItemHeight = 29; + this.Listofparams.Location = new System.Drawing.Point(593, 8); + this.Listofparams.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); + this.Listofparams.Name = "Listofparams"; + this.tableLayoutPanel1.SetRowSpan(this.Listofparams, 5); + this.Listofparams.Size = new System.Drawing.Size(382, 684); + this.Listofparams.TabIndex = 0; + this.Listofparams.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listBox1_KeyDown); + this.Listofparams.MouseDown += new System.Windows.Forms.MouseEventHandler(this.listBox1_MouseDown); + // + // WorkTypeNameInp + // + this.WorkTypeNameInp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); + this.WorkTypeNameInp.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.WorkTypeNameInp.Location = new System.Drawing.Point(39, 59); + this.WorkTypeNameInp.Margin = new System.Windows.Forms.Padding(5, 10, 5, 10); + this.WorkTypeNameInp.Multiline = true; + this.WorkTypeNameInp.Name = "WorkTypeNameInp"; + this.WorkTypeNameInp.Size = new System.Drawing.Size(181, 37); + this.WorkTypeNameInp.TabIndex = 1; + // + // formula + // + this.formula.AllowDrop = true; + this.formula.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); + this.formula.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.formula.Location = new System.Drawing.Point(34, 145); + this.formula.Margin = new System.Windows.Forms.Padding(5, 10, 5, 10); + this.formula.Multiline = true; + this.formula.Name = "formula"; + this.formula.Size = new System.Drawing.Size(191, 102); + this.formula.TabIndex = 4; + this.formula.Text = "0"; + this.formula.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.formula.DragDrop += new System.Windows.Forms.DragEventHandler(this.textBox3_DragDrop); + this.formula.DragEnter += new System.Windows.Forms.DragEventHandler(this.textBox3_DragEnter); + // + // WorkTypeName + // + this.WorkTypeName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); + this.WorkTypeName.AutoSize = true; + this.WorkTypeName.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.WorkTypeName.Location = new System.Drawing.Point(41, 10); + this.WorkTypeName.Margin = new System.Windows.Forms.Padding(5, 10, 5, 10); + this.WorkTypeName.Name = "WorkTypeName"; + this.WorkTypeName.Size = new System.Drawing.Size(176, 29); + this.WorkTypeName.TabIndex = 5; + this.WorkTypeName.Text = "Наименование"; + // + // formulat + // + this.formulat.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); + this.formulat.AutoSize = true; + this.formulat.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.formulat.Location = new System.Drawing.Point(73, 106); + this.formulat.Margin = new System.Windows.Forms.Padding(10, 0, 10, 0); + this.formulat.Name = "formulat"; + this.formulat.Size = new System.Drawing.Size(113, 29); + this.formulat.TabIndex = 6; + this.formulat.Text = "Формула"; + this.formulat.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // ParamsT + // + this.ParamsT.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); + this.ParamsT.AutoSize = true; + this.ParamsT.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.ParamsT.Location = new System.Drawing.Point(352, 106); + this.ParamsT.Margin = new System.Windows.Forms.Padding(10, 0, 10, 0); + this.ParamsT.Name = "ParamsT"; + this.ParamsT.Size = new System.Drawing.Size(141, 29); + this.ParamsT.TabIndex = 7; + this.ParamsT.Text = "Параметры"; + this.ParamsT.Click += new System.EventHandler(this.label3_Click); + // + // AddType + // + this.AddType.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.tableLayoutPanel1.SetColumnSpan(this.AddType, 2); + this.AddType.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.AddType.Location = new System.Drawing.Point(147, 267); + this.AddType.Margin = new System.Windows.Forms.Padding(5, 10, 5, 10); + this.AddType.Name = "AddType"; + this.AddType.Size = new System.Drawing.Size(293, 42); + this.AddType.TabIndex = 9; + this.AddType.Text = "Добавить тип работ"; + this.AddType.UseVisualStyleBackColor = true; + this.AddType.Click += new System.EventHandler(this.AddWorkType); + // + // Category + // + this.Category.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); + this.Category.Cursor = System.Windows.Forms.Cursors.Default; + this.Category.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.Category.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.Category.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.Category.FormattingEnabled = true; + this.Category.Items.AddRange(new object[] { "Стены", "Пол", "Потолок", "Пол периметр", "Потолок периметр", "Разное"}); - this.comboBox1.Location = new System.Drawing.Point(381, 238); - this.comboBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.comboBox1.Name = "comboBox1"; - this.comboBox1.Size = new System.Drawing.Size(180, 28); - this.comboBox1.TabIndex = 10; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(381, 214); - this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(89, 20); - this.label4.TabIndex = 11; - this.label4.Text = "Категория"; + this.Category.Location = new System.Drawing.Point(323, 59); + this.Category.Margin = new System.Windows.Forms.Padding(5, 10, 5, 10); + this.Category.Name = "Category"; + this.Category.Size = new System.Drawing.Size(200, 37); + this.Category.TabIndex = 10; + // + // CategoryT + // + this.CategoryT.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); + this.CategoryT.AutoSize = true; + this.CategoryT.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.CategoryT.Location = new System.Drawing.Point(360, 10); + this.CategoryT.Margin = new System.Windows.Forms.Padding(5, 10, 5, 10); + this.CategoryT.Name = "CategoryT"; + this.CategoryT.Size = new System.Drawing.Size(125, 29); + this.CategoryT.TabIndex = 11; + this.CategoryT.Text = "Категория"; + this.CategoryT.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 3; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 26.4637F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.48946F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 40.04684F)); + this.tableLayoutPanel1.Controls.Add(this.WorkTypeName, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.Category, 1, 1); + this.tableLayoutPanel1.Controls.Add(this.WorkTypeNameInp, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.Listofparams, 2, 0); + this.tableLayoutPanel1.Controls.Add(this.CategoryT, 1, 0); + this.tableLayoutPanel1.Controls.Add(this.formulat, 0, 2); + this.tableLayoutPanel1.Controls.Add(this.ParamsT, 1, 2); + this.tableLayoutPanel1.Controls.Add(this.parameters, 1, 3); + this.tableLayoutPanel1.Controls.Add(this.formula, 0, 3); + this.tableLayoutPanel1.Controls.Add(this.AddType, 0, 4); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 3; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(981, 335); + this.tableLayoutPanel1.TabIndex = 12; + this.tableLayoutPanel1.Paint += new System.Windows.Forms.PaintEventHandler(this.tableLayoutPanel1_Paint); + // + // parameters + // + this.parameters.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); + this.parameters.Location = new System.Drawing.Point(310, 145); + this.parameters.Margin = new System.Windows.Forms.Padding(10); + this.parameters.Name = "parameters"; + this.parameters.Size = new System.Drawing.Size(226, 102); + this.parameters.TabIndex = 12; // // CreateWorkTypeForm // this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1323, 523); - this.Controls.Add(this.label4); - this.Controls.Add(this.comboBox1); - this.Controls.Add(this.button3); - this.Controls.Add(this.label3); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); - this.Controls.Add(this.textBox3); - this.Controls.Add(this.button1); - this.Controls.Add(this.textBox2); - this.Controls.Add(this.textBox1); - this.Controls.Add(this.listBox1); + this.ClientSize = new System.Drawing.Size(981, 335); + this.Controls.Add(this.tableLayoutPanel1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.Name = "CreateWorkTypeForm"; - this.Text = "CreateWorkTypeForm"; + this.Text = "Создать тип работ"; this.Load += new System.EventHandler(this.CreateWorkTypeForm_Load); + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); this.ResumeLayout(false); - this.PerformLayout(); } #endregion - private System.Windows.Forms.ListBox listBox1; - private System.Windows.Forms.TextBox textBox1; - private System.Windows.Forms.TextBox textBox2; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.TextBox textBox3; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.ComboBox comboBox1; - private System.Windows.Forms.Label label4; - internal System.Windows.Forms.Button button3; + private System.Windows.Forms.ListBox Listofparams; + private System.Windows.Forms.TextBox WorkTypeNameInp; + private System.Windows.Forms.TextBox formula; + private System.Windows.Forms.Label WorkTypeName; + private System.Windows.Forms.Label formulat; + private System.Windows.Forms.Label ParamsT; + private System.Windows.Forms.ComboBox Category; + private System.Windows.Forms.Label CategoryT; + internal System.Windows.Forms.Button AddType; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private FormComponents.TextwithBut parameters; } } \ No newline at end of file diff --git a/BuildingCalculator/BuildingCalculator/FormComponents/CreateWorkTypeForm.cs b/BuildingCalculator/BuildingCalculator/FormComponents/CreateWorkTypeForm.cs index 2e48cfa..adcd641 100644 --- a/BuildingCalculator/BuildingCalculator/FormComponents/CreateWorkTypeForm.cs +++ b/BuildingCalculator/BuildingCalculator/FormComponents/CreateWorkTypeForm.cs @@ -21,14 +21,16 @@ public CreateWorkTypeForm() List names = new List() { "Удалить" + }; List functions = new List() { - Remove + Remove_Param }; - Functions.ContextMenu(listBox1, names, functions); + Functions.ContextMenu(Listofparams, names, functions); FormClosing += new FormClosingEventHandler(_FormClosing); - Button = button3; + Button = AddType; + parameters.Button.Click += Add_Param; } private void _FormClosing(object sender, FormClosingEventArgs e) { @@ -38,72 +40,51 @@ private void _FormClosing(object sender, FormClosingEventArgs e) this.Hide(); } } - private void button1_Click(object sender, EventArgs e) + private void Add_Param(object sender, EventArgs e) { - if (textBox2.Text != ""){ - listBox1.Items.Add(textBox2.Text); - textBox2.Text = ""; + if (parameters.TextBox.Text != ""){ + Listofparams.Items.Add(parameters.TextBox.Text); + parameters.TextBox.Text = ""; } } - private void Remove(object sender, EventArgs e) + private void Remove_Param(object sender, EventArgs e) { - if (listBox1.SelectedItem != null) - listBox1.Items.RemoveAt(listBox1.SelectedIndex); - } - private void button3_Click(object sender, EventArgs e) - { - WorkTypeClass work = new WorkTypeClass(); - work.article = textBox1.Text; - work.formula = textBox3.Text; - var numer = listBox1.Items.GetEnumerator(); - while (numer.MoveNext()) - work.parametrs.Add(numer.Current.ToString()); - work.category = (WorkTypeClass.Category)(comboBox1.SelectedIndex); - if (DelegateAssemblyService.isCreatedCorrect(work)) - { - JSONSerializeService.AddToOutput(work); - if (RedactedItemIndex != null) - { - JSONSerializeService.OutputItems.RemoveAt((int)RedactedItemIndex); - RedactedItemIndex = null; - - } - JSONSerializeService.Save(); - this.Hide(); - } - else - MessageBox.Show("Параметры обьекта заданны некоректно."); + if (Listofparams.SelectedItem != null) + Listofparams.Items.RemoveAt(Listofparams.SelectedIndex); } static CreateWorkTypeForm cwf = new CreateWorkTypeForm(); static int? RedactedItemIndex = null; public static void CreateWorkType(WorkTypeClass obj=null) { + cwf.Top = (ActiveForm.Top + (ActiveForm.Height / 2)) - cwf.Height / 2; + cwf.Left = (ActiveForm.Left + (ActiveForm.Width / 2)) - cwf.Width / 2; + cwf.StartPosition = FormStartPosition.Manual; cwf.Show(); if (obj != null) { RedactedItemIndex = JSONSerializeService.OutputItems.IndexOf(obj); - cwf.textBox1.Text = obj.article; - cwf.textBox3.Text = obj.formula; - cwf.listBox1.Items.Clear(); + cwf.WorkTypeNameInp.Text = obj.article; + cwf.formula.Text = obj.formula; + cwf.Listofparams.Items.Clear(); foreach (string str in obj.parametrs) - cwf.listBox1.Items.Add(str); + cwf.Listofparams.Items.Add(str); switch (obj.category) { - case WorkTypeClass.Category.walls:cwf.comboBox1.SelectedIndex = 0; break; - case WorkTypeClass.Category.floor: cwf.comboBox1.SelectedIndex = 1; break; - case WorkTypeClass.Category.ceiling: cwf.comboBox1.SelectedIndex = 2; break; - case WorkTypeClass.Category.floorPer: cwf.comboBox1.SelectedIndex = 3; break; - case WorkTypeClass.Category.ceilingPer: cwf.comboBox1.SelectedIndex = 4; break; - case WorkTypeClass.Category.other: cwf.comboBox1.SelectedIndex = 5; break; - default:cwf.comboBox1.SelectedIndex = 5;break; + case WorkTypeClass.Category.walls:cwf.Category.SelectedIndex = 0; break; + case WorkTypeClass.Category.floor: cwf.Category.SelectedIndex = 1; break; + case WorkTypeClass.Category.ceiling: cwf.Category.SelectedIndex = 2; break; + case WorkTypeClass.Category.floorPer: cwf.Category.SelectedIndex = 3; break; + case WorkTypeClass.Category.ceilingPer: cwf.Category.SelectedIndex = 4; break; + case WorkTypeClass.Category.other: cwf.Category.SelectedIndex = 5; break; + default:cwf.Category.SelectedIndex = 5;break; } } else { - cwf.comboBox1.SelectedIndex = 3; - cwf.textBox1.Text = ""; - cwf.textBox3.Text = ""; - cwf.listBox1.Items.Clear(); + cwf.Category.SelectedIndex = 3; + cwf.WorkTypeNameInp.Text = ""; + cwf.formula.Text = ""; + cwf.Listofparams.Items.Clear(); } } @@ -123,8 +104,8 @@ private void listBox1_KeyDown(object sender, KeyEventArgs e) private void listBox1_MouseDown(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Right) - if(listBox1.SelectedItem != null && listBox1.SelectedItem.ToString() != "Журнал пуст") - listBox1.DoDragDrop(listBox1.SelectedItem, DragDropEffects.Copy); + if(Listofparams.SelectedItem != null && Listofparams.SelectedItem.ToString() != "Журнал пуст") + Listofparams.DoDragDrop(Listofparams.SelectedItem, DragDropEffects.Copy); } private void textBox3_DragDrop(object sender, DragEventArgs e) @@ -132,12 +113,44 @@ private void textBox3_DragDrop(object sender, DragEventArgs e) if (e.Effect == DragDropEffects.Copy || e.Effect == DragDropEffects.Move) { - textBox3.Text += e.Data.GetData(DataFormats.Text); + formula.Text += e.Data.GetData(DataFormats.Text); } } private void textBox3_DragEnter(object sender, DragEventArgs e) { e.Effect = DragDropEffects.Copy; } + private void label3_Click(object sender, EventArgs e) + { + + } + private void tableLayoutPanel1_Paint(object sender, PaintEventArgs e) + { + + } + private void AddWorkType(object sender, EventArgs e) + { + WorkTypeClass work = new WorkTypeClass(); + work.article = WorkTypeName.Text; + work.formula = formulat.Text; + var numer = Listofparams.Items.GetEnumerator(); + while (numer.MoveNext()) + work.parametrs.Add(numer.Current.ToString()); + work.category = (WorkTypeClass.Category)(Category.SelectedIndex); + if (DelegateAssemblyService.isCreatedCorrect(work)) + { + JSONSerializeService.AddToOutput(work); + if (RedactedItemIndex != null) + { + JSONSerializeService.OutputItems.RemoveAt((int)RedactedItemIndex); + RedactedItemIndex = null; + + } + JSONSerializeService.Save(); + this.Hide(); + } + else + MessageBox.Show("Параметры обьекта заданны некоректно."); + } } } diff --git a/BuildingCalculator/BuildingCalculator/FormComponents/Form1.Designer.cs b/BuildingCalculator/BuildingCalculator/FormComponents/Form1.Designer.cs index 7222a65..d0069ea 100644 --- a/BuildingCalculator/BuildingCalculator/FormComponents/Form1.Designer.cs +++ b/BuildingCalculator/BuildingCalculator/FormComponents/Form1.Designer.cs @@ -43,13 +43,14 @@ private void InitializeComponent() // // menuStrip1 // + this.menuStrip1.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.menuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.опцииToolStripMenuItem, this.рассчитатьToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(700, 33); + this.menuStrip1.Size = new System.Drawing.Size(669, 37); this.menuStrip1.TabIndex = 20; this.menuStrip1.Text = "menuStrip1"; // @@ -57,21 +58,22 @@ private void InitializeComponent() // this.опцииToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.админкаToolStripMenuItem}); + this.опцииToolStripMenuItem.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.опцииToolStripMenuItem.Name = "опцииToolStripMenuItem"; - this.опцииToolStripMenuItem.Size = new System.Drawing.Size(79, 29); + this.опцииToolStripMenuItem.Size = new System.Drawing.Size(94, 33); this.опцииToolStripMenuItem.Text = "Опции"; // // админкаToolStripMenuItem // this.админкаToolStripMenuItem.Name = "админкаToolStripMenuItem"; - this.админкаToolStripMenuItem.Size = new System.Drawing.Size(169, 30); + this.админкаToolStripMenuItem.Size = new System.Drawing.Size(210, 34); this.админкаToolStripMenuItem.Text = "Админка"; this.админкаToolStripMenuItem.Click += new System.EventHandler(this.админкаToolStripMenuItem_Click); // // рассчитатьToolStripMenuItem // this.рассчитатьToolStripMenuItem.Name = "рассчитатьToolStripMenuItem"; - this.рассчитатьToolStripMenuItem.Size = new System.Drawing.Size(111, 29); + this.рассчитатьToolStripMenuItem.Size = new System.Drawing.Size(151, 33); this.рассчитатьToolStripMenuItem.Text = "Рассчитать"; this.рассчитатьToolStripMenuItem.Click += new System.EventHandler(this.Calculate); // @@ -80,10 +82,11 @@ private void InitializeComponent() this.RoomTabs.Controls.Add(this.FirstRoom); this.RoomTabs.Controls.Add(this.AddRoom); this.RoomTabs.Dock = System.Windows.Forms.DockStyle.Fill; - this.RoomTabs.Location = new System.Drawing.Point(0, 33); + this.RoomTabs.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.RoomTabs.Location = new System.Drawing.Point(0, 37); this.RoomTabs.Name = "RoomTabs"; this.RoomTabs.SelectedIndex = 0; - this.RoomTabs.Size = new System.Drawing.Size(700, 454); + this.RoomTabs.Size = new System.Drawing.Size(669, 467); this.RoomTabs.TabIndex = 34; this.RoomTabs.TabStop = false; this.RoomTabs.Selecting += new System.Windows.Forms.TabControlCancelEventHandler(this.RoomTabs_Selecting); @@ -92,10 +95,10 @@ private void InitializeComponent() // FirstRoom // this.FirstRoom.Controls.Add(this.tabContent1); - this.FirstRoom.Location = new System.Drawing.Point(4, 29); + this.FirstRoom.Location = new System.Drawing.Point(4, 38); this.FirstRoom.Name = "FirstRoom"; this.FirstRoom.Padding = new System.Windows.Forms.Padding(3); - this.FirstRoom.Size = new System.Drawing.Size(692, 421); + this.FirstRoom.Size = new System.Drawing.Size(661, 425); this.FirstRoom.TabIndex = 0; this.FirstRoom.Text = "Комната"; this.FirstRoom.UseVisualStyleBackColor = true; @@ -103,16 +106,18 @@ private void InitializeComponent() // tabContent1 // this.tabContent1.BackColor = System.Drawing.SystemColors.Window; - this.tabContent1.Location = new System.Drawing.Point(-4, 0); + this.tabContent1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tabContent1.Font = new System.Drawing.Font("Roboto Light", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.tabContent1.Location = new System.Drawing.Point(3, 3); this.tabContent1.Name = "tabContent1"; - this.tabContent1.Size = new System.Drawing.Size(598, 406); + this.tabContent1.Size = new System.Drawing.Size(655, 419); this.tabContent1.TabIndex = 0; // // AddRoom // - this.AddRoom.Location = new System.Drawing.Point(4, 29); + this.AddRoom.Location = new System.Drawing.Point(4, 38); this.AddRoom.Name = "AddRoom"; - this.AddRoom.Size = new System.Drawing.Size(692, 421); + this.AddRoom.Size = new System.Drawing.Size(661, 425); this.AddRoom.TabIndex = 1; this.AddRoom.Text = "+"; this.AddRoom.UseVisualStyleBackColor = true; @@ -121,12 +126,16 @@ private void InitializeComponent() // this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(700, 487); + this.ClientSize = new System.Drawing.Size(669, 504); this.Controls.Add(this.RoomTabs); this.Controls.Add(this.menuStrip1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; this.MainMenuStrip = this.menuStrip1; this.Margin = new System.Windows.Forms.Padding(2); + this.MaximizeBox = false; + this.MinimizeBox = false; this.Name = "Form1"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Калькулятор"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); this.Load += new System.EventHandler(this.Form1_Load); diff --git a/BuildingCalculator/BuildingCalculator/FormComponents/Form1.cs b/BuildingCalculator/BuildingCalculator/FormComponents/Form1.cs index 6204ab7..5efb3a9 100644 --- a/BuildingCalculator/BuildingCalculator/FormComponents/Form1.cs +++ b/BuildingCalculator/BuildingCalculator/FormComponents/Form1.cs @@ -44,6 +44,9 @@ private void Form1_Load(object sender, EventArgs e) private void админкаToolStripMenuItem_Click(object sender, EventArgs e) { Form lf = LoginClass.SignIn(); + lf.Top = (this.Top + (this.Height / 2)) - lf.Height / 2; + lf.Left = (this.Left + (this.Width / 2)) - lf.Width / 2; + lf.StartPosition = FormStartPosition.Manual; lf.Show(); } private void Form1_FormClosing(object sender, FormClosingEventArgs e) diff --git a/BuildingCalculator/BuildingCalculator/FormComponents/LogInForm.Designer.cs b/BuildingCalculator/BuildingCalculator/FormComponents/LogInForm.Designer.cs index 537da24..54f5ea4 100644 --- a/BuildingCalculator/BuildingCalculator/FormComponents/LogInForm.Designer.cs +++ b/BuildingCalculator/BuildingCalculator/FormComponents/LogInForm.Designer.cs @@ -28,93 +28,143 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.textBox1 = new System.Windows.Forms.TextBox(); - this.textBox2 = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.button1 = new System.Windows.Forms.Button(); - this.checkBox1 = new System.Windows.Forms.CheckBox(); + this.LoginInp = new System.Windows.Forms.TextBox(); + this.PassInp = new System.Windows.Forms.TextBox(); + this.LoginT = new System.Windows.Forms.Label(); + this.PassT = new System.Windows.Forms.Label(); + this.Log_In = new System.Windows.Forms.Button(); + this.Rememberme = new System.Windows.Forms.CheckBox(); + this.MarkUp = new System.Windows.Forms.TableLayoutPanel(); + this.MarkUp.SuspendLayout(); this.SuspendLayout(); // - // textBox1 + // LoginInp // - this.textBox1.Location = new System.Drawing.Point(24, 35); - this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(227, 20); - this.textBox1.TabIndex = 0; + this.LoginInp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); + this.LoginInp.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.LoginInp.Location = new System.Drawing.Point(61, 44); + this.LoginInp.Margin = new System.Windows.Forms.Padding(0, 5, 0, 5); + this.LoginInp.Multiline = true; + this.LoginInp.Name = "LoginInp"; + this.LoginInp.Size = new System.Drawing.Size(160, 35); + this.LoginInp.TabIndex = 0; + this.LoginInp.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.LoginInp.TextChanged += new System.EventHandler(this.textBox1_TextChanged); // - // textBox2 + // PassInp // - this.textBox2.Location = new System.Drawing.Point(24, 127); - this.textBox2.Name = "textBox2"; - this.textBox2.PasswordChar = '*'; - this.textBox2.Size = new System.Drawing.Size(227, 20); - this.textBox2.TabIndex = 1; + this.PassInp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); + this.PassInp.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.PassInp.Location = new System.Drawing.Point(61, 128); + this.PassInp.Margin = new System.Windows.Forms.Padding(0, 5, 0, 5); + this.PassInp.Multiline = true; + this.PassInp.Name = "PassInp"; + this.PassInp.PasswordChar = '*'; + this.PassInp.Size = new System.Drawing.Size(160, 35); + this.PassInp.TabIndex = 1; + this.PassInp.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; // - // label1 + // LoginT // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(21, 19); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(38, 13); - this.label1.TabIndex = 2; - this.label1.Text = "Логин"; + this.LoginT.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); + this.LoginT.AutoSize = true; + this.LoginT.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.LoginT.Location = new System.Drawing.Point(96, 5); + this.LoginT.Margin = new System.Windows.Forms.Padding(0, 5, 0, 5); + this.LoginT.Name = "LoginT"; + this.LoginT.Size = new System.Drawing.Size(89, 29); + this.LoginT.TabIndex = 2; + this.LoginT.Text = "Логин:"; + this.LoginT.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // label2 + // PassT // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(21, 111); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(45, 13); - this.label2.TabIndex = 3; - this.label2.Text = "Пароль"; + this.PassT.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); + this.PassT.AutoSize = true; + this.PassT.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.PassT.Location = new System.Drawing.Point(88, 89); + this.PassT.Margin = new System.Windows.Forms.Padding(0, 5, 0, 5); + this.PassT.Name = "PassT"; + this.PassT.Size = new System.Drawing.Size(105, 29); + this.PassT.TabIndex = 3; + this.PassT.Text = "Пароль:"; // - // button1 + // Log_In // - this.button1.Location = new System.Drawing.Point(24, 190); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(227, 23); - this.button1.TabIndex = 4; - this.button1.Text = "войти"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); + this.Log_In.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.Log_In.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.Log_In.Location = new System.Drawing.Point(66, 222); + this.Log_In.Margin = new System.Windows.Forms.Padding(0, 5, 0, 5); + this.Log_In.Name = "Log_In"; + this.Log_In.Size = new System.Drawing.Size(150, 53); + this.Log_In.TabIndex = 4; + this.Log_In.Text = "Войти"; + this.Log_In.UseVisualStyleBackColor = true; + this.Log_In.Click += new System.EventHandler(this.button1_Click); // - // checkBox1 + // Rememberme // - this.checkBox1.AutoSize = true; - this.checkBox1.Location = new System.Drawing.Point(87, 167); - this.checkBox1.Name = "checkBox1"; - this.checkBox1.Size = new System.Drawing.Size(111, 17); - this.checkBox1.TabIndex = 5; - this.checkBox1.Text = "Запомнить меня"; - this.checkBox1.UseVisualStyleBackColor = true; + this.Rememberme.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); + this.Rememberme.AutoSize = true; + this.Rememberme.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.Rememberme.Location = new System.Drawing.Point(23, 173); + this.Rememberme.Margin = new System.Windows.Forms.Padding(0, 5, 0, 5); + this.Rememberme.Name = "Rememberme"; + this.Rememberme.Size = new System.Drawing.Size(236, 33); + this.Rememberme.TabIndex = 5; + this.Rememberme.Text = "Запомнить меня"; + this.Rememberme.UseVisualStyleBackColor = true; + // + // MarkUp + // + this.MarkUp.ColumnCount = 1; + this.MarkUp.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.MarkUp.Controls.Add(this.LoginT, 0, 0); + this.MarkUp.Controls.Add(this.Rememberme, 0, 5); + this.MarkUp.Controls.Add(this.LoginInp, 0, 1); + this.MarkUp.Controls.Add(this.PassT, 0, 2); + this.MarkUp.Controls.Add(this.PassInp, 0, 4); + this.MarkUp.Controls.Add(this.Log_In, 0, 6); + this.MarkUp.Dock = System.Windows.Forms.DockStyle.Fill; + this.MarkUp.Location = new System.Drawing.Point(0, 0); + this.MarkUp.Name = "MarkUp"; + this.MarkUp.RowCount = 7; + this.MarkUp.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.MarkUp.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.MarkUp.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.MarkUp.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.MarkUp.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.MarkUp.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.MarkUp.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.MarkUp.Size = new System.Drawing.Size(282, 280); + this.MarkUp.TabIndex = 6; // // LogInForm // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(278, 245); - this.Controls.Add(this.checkBox1); - this.Controls.Add(this.button1); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); - this.Controls.Add(this.textBox2); - this.Controls.Add(this.textBox1); + this.ClientSize = new System.Drawing.Size(282, 280); + this.Controls.Add(this.MarkUp); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; + this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.Name = "LogInForm"; - this.Text = "LogInForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Войти в админ-панель"; this.Load += new System.EventHandler(this.LogInForm_Load); + this.MarkUp.ResumeLayout(false); + this.MarkUp.PerformLayout(); this.ResumeLayout(false); - this.PerformLayout(); } #endregion - private System.Windows.Forms.TextBox textBox1; - private System.Windows.Forms.TextBox textBox2; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.CheckBox checkBox1; + private System.Windows.Forms.TextBox LoginInp; + private System.Windows.Forms.TextBox PassInp; + private System.Windows.Forms.Label LoginT; + private System.Windows.Forms.Label PassT; + private System.Windows.Forms.Button Log_In; + private System.Windows.Forms.CheckBox Rememberme; + private System.Windows.Forms.TableLayoutPanel MarkUp; } } \ No newline at end of file diff --git a/BuildingCalculator/BuildingCalculator/FormComponents/LogInForm.cs b/BuildingCalculator/BuildingCalculator/FormComponents/LogInForm.cs index 18a7229..5c1aab5 100644 --- a/BuildingCalculator/BuildingCalculator/FormComponents/LogInForm.cs +++ b/BuildingCalculator/BuildingCalculator/FormComponents/LogInForm.cs @@ -18,9 +18,11 @@ public LogInForm() InitializeComponent(); + MaximizeBox = false; + MinimizeBox = false; login = LoginClass.login; pass = LoginClass.pass; - this.FormClosing += new FormClosingEventHandler(_FormClosing); + FormClosing += new FormClosingEventHandler(_FormClosing); } @@ -41,7 +43,6 @@ private void LogInForm_Load(object sender, EventArgs e) - } private void button1_Click(object sender, EventArgs e) @@ -51,8 +52,8 @@ private void button1_Click(object sender, EventArgs e) string PasInp; try { - LogInp = textBox1.Text.Substring(0, LoginClass.login.Length); - PasInp = textBox2.Text.Substring(0, LoginClass.pass.Length); + LogInp = LoginInp.Text.Substring(0, LoginClass.login.Length); + PasInp = PassInp.Text.Substring(0, LoginClass.pass.Length); } catch { @@ -61,14 +62,22 @@ private void button1_Click(object sender, EventArgs e) if (LogInp == login && PasInp == pass) { - if (checkBox1.Checked) + if (Rememberme.Checked) ConfigWorksService.ChangeValue("Remembered", "true"); LoginClass.IsLoged = true; + LoginClass.af.Top = (this.Top + (this.Height / 2)) - LoginClass.af.Height / 2; + LoginClass.af.Left = (this.Top + (this.Height / 2)) - LoginClass.af.Height / 2; + LoginClass.af.StartPosition = FormStartPosition.Manual; LoginClass.af.Show(); this.Hide(); } } + + private void textBox1_TextChanged(object sender, EventArgs e) + { + + } } } diff --git a/BuildingCalculator/BuildingCalculator/FormComponents/MultiSliders.Designer.cs b/BuildingCalculator/BuildingCalculator/FormComponents/MultiSliders.Designer.cs index 3dc75e1..3576097 100644 --- a/BuildingCalculator/BuildingCalculator/FormComponents/MultiSliders.Designer.cs +++ b/BuildingCalculator/BuildingCalculator/FormComponents/MultiSliders.Designer.cs @@ -45,7 +45,7 @@ private void InitializeComponent() // ElementsNames // this.ElementsNames.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.ElementsNames.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.ElementsNames.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.ElementsNames.FormattingEnabled = true; this.ElementsNames.Location = new System.Drawing.Point(6, 3); this.ElementsNames.Name = "ElementsNames"; diff --git a/BuildingCalculator/BuildingCalculator/FormComponents/Slider.Designer.cs b/BuildingCalculator/BuildingCalculator/FormComponents/Slider.Designer.cs index 01aa71e..9de347c 100644 --- a/BuildingCalculator/BuildingCalculator/FormComponents/Slider.Designer.cs +++ b/BuildingCalculator/BuildingCalculator/FormComponents/Slider.Designer.cs @@ -78,7 +78,7 @@ private void InitializeComponent() this.Remove.Dock = System.Windows.Forms.DockStyle.Fill; this.Remove.FlatAppearance.BorderSize = 0; this.Remove.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.Remove.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.Remove.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.Remove.Location = new System.Drawing.Point(3, 3); this.Remove.Name = "Remove"; this.Remove.Padding = new System.Windows.Forms.Padding(2); @@ -97,7 +97,7 @@ private void InitializeComponent() this.Add.Dock = System.Windows.Forms.DockStyle.Fill; this.Add.FlatAppearance.BorderSize = 0; this.Add.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.Add.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.Add.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.Add.Location = new System.Drawing.Point(146, 3); this.Add.Name = "Add"; this.Add.Padding = new System.Windows.Forms.Padding(2); @@ -116,7 +116,7 @@ private void InitializeComponent() this.Prev.Dock = System.Windows.Forms.DockStyle.Fill; this.Prev.FlatAppearance.BorderSize = 0; this.Prev.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.Prev.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.Prev.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.Prev.Location = new System.Drawing.Point(3, 244); this.Prev.Name = "Prev"; this.Prev.Padding = new System.Windows.Forms.Padding(2); @@ -135,7 +135,7 @@ private void InitializeComponent() this.Next.Dock = System.Windows.Forms.DockStyle.Fill; this.Next.FlatAppearance.BorderSize = 0; this.Next.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.Next.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.Next.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.Next.Location = new System.Drawing.Point(146, 244); this.Next.Name = "Next"; this.Next.Padding = new System.Windows.Forms.Padding(2); @@ -149,7 +149,7 @@ private void InitializeComponent() // this.CurrentIndex.AutoSize = true; this.CurrentIndex.Dock = System.Windows.Forms.DockStyle.Fill; - this.CurrentIndex.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.CurrentIndex.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.CurrentIndex.Location = new System.Drawing.Point(74, 0); this.CurrentIndex.Name = "CurrentIndex"; this.CurrentIndex.Size = new System.Drawing.Size(66, 49); @@ -162,7 +162,7 @@ private void InitializeComponent() this.WidthT.AutoSize = true; this.Markup.SetColumnSpan(this.WidthT, 3); this.WidthT.Dock = System.Windows.Forms.DockStyle.Fill; - this.WidthT.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.WidthT.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.WidthT.Location = new System.Drawing.Point(3, 49); this.WidthT.Name = "WidthT"; this.WidthT.Size = new System.Drawing.Size(210, 48); @@ -175,9 +175,8 @@ private void InitializeComponent() this.Width.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.Width.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.Markup.SetColumnSpan(this.Width, 3); - this.Width.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.Width.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.Width.Location = new System.Drawing.Point(3, 100); this.Width.MaxLength = 4; this.Width.Multiline = true; @@ -189,10 +188,9 @@ private void InitializeComponent() // // Height // - this.Height.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.Markup.SetColumnSpan(this.Height, 3); this.Height.Dock = System.Windows.Forms.DockStyle.Fill; - this.Height.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.Height.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.Height.Location = new System.Drawing.Point(3, 196); this.Height.MaxLength = 4; this.Height.Multiline = true; @@ -207,7 +205,7 @@ private void InitializeComponent() this.HeightT.AutoSize = true; this.Markup.SetColumnSpan(this.HeightT, 3); this.HeightT.Dock = System.Windows.Forms.DockStyle.Fill; - this.HeightT.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.HeightT.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.HeightT.Location = new System.Drawing.Point(3, 145); this.HeightT.Name = "HeightT"; this.HeightT.Size = new System.Drawing.Size(210, 48); diff --git a/BuildingCalculator/BuildingCalculator/FormComponents/TabContent.Designer.cs b/BuildingCalculator/BuildingCalculator/FormComponents/TabContent.Designer.cs index 82518cd..0229c22 100644 --- a/BuildingCalculator/BuildingCalculator/FormComponents/TabContent.Designer.cs +++ b/BuildingCalculator/BuildingCalculator/FormComponents/TabContent.Designer.cs @@ -30,13 +30,13 @@ private void InitializeComponent() { this.multiSliders1 = new BuildingCalculator.MultiSliders(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.Height = new System.Windows.Forms.TextBox(); + this.HeightT = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.Width = new System.Windows.Forms.TextBox(); this.Length = new System.Windows.Forms.TextBox(); this.LengthT = new System.Windows.Forms.Label(); this.WidthT = new System.Windows.Forms.Label(); - this.Height = new System.Windows.Forms.TextBox(); - this.HeightT = new System.Windows.Forms.Label(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // @@ -56,26 +56,48 @@ private void InitializeComponent() this.groupBox1.Controls.Add(this.Length); this.groupBox1.Controls.Add(this.LengthT); this.groupBox1.Controls.Add(this.WidthT); + this.groupBox1.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.groupBox1.Location = new System.Drawing.Point(55, 36); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(210, 362); this.groupBox1.TabIndex = 32; this.groupBox1.TabStop = false; // + // Height + // + this.Height.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.Height.Location = new System.Drawing.Point(21, 299); + this.Height.MaxLength = 4; + this.Height.Multiline = true; + this.Height.Name = "Height"; + this.Height.Size = new System.Drawing.Size(172, 45); + this.Height.TabIndex = 30; + this.Height.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + // + // HeightT + // + this.HeightT.AutoSize = true; + this.HeightT.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.HeightT.Location = new System.Drawing.Point(58, 254); + this.HeightT.Name = "HeightT"; + this.HeightT.Size = new System.Drawing.Size(95, 29); + this.HeightT.TabIndex = 29; + this.HeightT.Text = "Высота"; + // // label3 // this.label3.AutoSize = true; this.label3.BackColor = System.Drawing.SystemColors.Window; - this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.label3.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.label3.Location = new System.Drawing.Point(49, -3); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(114, 29); + this.label3.Size = new System.Drawing.Size(109, 29); this.label3.TabIndex = 28; this.label3.Text = "Комната"; // // Width // - this.Width.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.Width.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.Width.Location = new System.Drawing.Point(21, 194); this.Width.MaxLength = 4; this.Width.Multiline = true; @@ -86,7 +108,7 @@ private void InitializeComponent() // // Length // - this.Length.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.Length.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.Length.Location = new System.Drawing.Point(21, 90); this.Length.MaxLength = 4; this.Length.Multiline = true; @@ -98,44 +120,23 @@ private void InitializeComponent() // LengthT // this.LengthT.AutoSize = true; - this.LengthT.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.LengthT.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.LengthT.Location = new System.Drawing.Point(67, 46); this.LengthT.Name = "LengthT"; - this.LengthT.Size = new System.Drawing.Size(87, 29); + this.LengthT.Size = new System.Drawing.Size(83, 29); this.LengthT.TabIndex = 23; this.LengthT.Text = "Длина"; // // WidthT // this.WidthT.AutoSize = true; - this.WidthT.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.WidthT.Font = new System.Drawing.Font("Roboto Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.WidthT.Location = new System.Drawing.Point(58, 149); this.WidthT.Name = "WidthT"; - this.WidthT.Size = new System.Drawing.Size(105, 29); + this.WidthT.Size = new System.Drawing.Size(100, 29); this.WidthT.TabIndex = 22; this.WidthT.Text = "Ширина"; // - // Height - // - this.Height.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.Height.Location = new System.Drawing.Point(21, 299); - this.Height.MaxLength = 4; - this.Height.Multiline = true; - this.Height.Name = "Height"; - this.Height.Size = new System.Drawing.Size(172, 45); - this.Height.TabIndex = 30; - this.Height.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // - // HeightT - // - this.HeightT.AutoSize = true; - this.HeightT.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.HeightT.Location = new System.Drawing.Point(58, 254); - this.HeightT.Name = "HeightT"; - this.HeightT.Size = new System.Drawing.Size(97, 29); - this.HeightT.TabIndex = 29; - this.HeightT.Text = "Высота"; - // // TabContent // this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); diff --git a/BuildingCalculator/BuildingCalculator/FormComponents/TextwithBut.Designer.cs b/BuildingCalculator/BuildingCalculator/FormComponents/TextwithBut.Designer.cs new file mode 100644 index 0000000..865de90 --- /dev/null +++ b/BuildingCalculator/BuildingCalculator/FormComponents/TextwithBut.Designer.cs @@ -0,0 +1,73 @@ +namespace BuildingCalculator.FormComponents +{ + partial class TextwithBut + { + /// + /// Обязательная переменная конструктора. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Освободить все используемые ресурсы. + /// + /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Код, автоматически созданный конструктором компонентов + + /// + /// Требуемый метод для поддержки конструктора — не изменяйте + /// содержимое этого метода с помощью редактора кода. + /// + private void InitializeComponent() + { + this.textBox1 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.textBox1.Location = new System.Drawing.Point(0, 0); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(209, 126); + this.textBox1.TabIndex = 0; + this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged); + // + // button1 + // + this.button1.Dock = System.Windows.Forms.DockStyle.Right; + this.button1.Location = new System.Drawing.Point(184, 0); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(25, 126); + this.button1.TabIndex = 1; + this.button1.Text = "+"; + this.button1.UseVisualStyleBackColor = true; + // + // TextwithBut + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox1); + this.Name = "TextwithBut"; + this.Size = new System.Drawing.Size(209, 126); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Button button1; + } +} diff --git a/BuildingCalculator/BuildingCalculator/FormComponents/TextwithBut.cs b/BuildingCalculator/BuildingCalculator/FormComponents/TextwithBut.cs new file mode 100644 index 0000000..1aed632 --- /dev/null +++ b/BuildingCalculator/BuildingCalculator/FormComponents/TextwithBut.cs @@ -0,0 +1,29 @@ +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; + +namespace BuildingCalculator.FormComponents +{ + public partial class TextwithBut : UserControl + { + public Button Button { get; set; } + public TextBox TextBox { get; set; } + public TextwithBut() + { + InitializeComponent(); + Button = button1; + TextBox = textBox1; + } + + private void textBox1_TextChanged(object sender, EventArgs e) + { + + } + } +} diff --git a/BuildingCalculator/BuildingCalculator/FormComponents/TextwithBut.resx b/BuildingCalculator/BuildingCalculator/FormComponents/TextwithBut.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/BuildingCalculator/BuildingCalculator/FormComponents/TextwithBut.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file