From f68901e3816ef95575786c27391f9c8ebffaef45 Mon Sep 17 00:00:00 2001 From: Professional Date: Thu, 1 May 2025 22:46:44 +0700 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=B8=D0=BD=D1=82=D0=B5=D1=80=D1=84=D0=B5=D0=B9?= =?UTF-8?q?=D1=81=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.config | 12 +- Form1.Designer.cs | 466 ++++++++++++++++++++----------- Form1.cs | 2 +- Form1.resx | 3 + FormManageStores.Designer.cs | 228 ++++++++------- FormManageStores.cs | 136 ++++++--- Program.cs | 12 +- Properties/Resources.Designer.cs | 68 ++--- SKLADm.csproj | 43 ++- packages.config | 10 +- 10 files changed, 625 insertions(+), 355 deletions(-) diff --git a/App.config b/App.config index 4a9f8d0..ed15e60 100644 --- a/App.config +++ b/App.config @@ -1,18 +1,18 @@ - + - -
+ +
- + - + - \ No newline at end of file + diff --git a/Form1.Designer.cs b/Form1.Designer.cs index bf0f3ca..6130c05 100644 --- a/Form1.Designer.cs +++ b/Form1.Designer.cs @@ -1,14 +1,4 @@ -//------------------------------------------------------------------------------ -// -// Этот код создан программой. -// Исполняемая версия:4.0.30319.42000 -// -// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае -// повторной генерации кода. -// -//------------------------------------------------------------------------------ - -namespace OzonInternalLabelPrinter // Убедитесь, что это ваше пространство имен +namespace OzonInternalLabelPrinter // Убедитесь, что это ваше пространство имен { partial class Form1 { @@ -26,9 +16,9 @@ namespace OzonInternalLabelPrinter // Убедитесь, что это ваше if (disposing && (components != null)) { components.Dispose(); - // Освобождаем ресурсы, созданные в коде Form1.cs - _httpClient?.Dispose(); - _printDocForSetup?.Dispose(); // Добавлено освобождение PrintDocument + // Добавьте сюда Dispose для ваших неуправляемых ресурсов, если они есть + // _httpClient?.Dispose(); // Пример + // _printDocForSetup?.Dispose(); // Пример } base.Dispose(disposing); } @@ -41,183 +31,345 @@ namespace OzonInternalLabelPrinter // Убедитесь, что это ваше /// private void InitializeComponent() { - this.label3 = new System.Windows.Forms.Label(); - this.txtOfferId = new System.Windows.Forms.TextBox(); - this.btnGetData = new System.Windows.Forms.Button(); - this.lblProductName = new System.Windows.Forms.Label(); - this.lblProductSku = new System.Windows.Forms.Label(); - this.lblProductBarcode = new System.Windows.Forms.Label(); - this.btnPrintLabel = new System.Windows.Forms.Button(); - this.lblStatus = new System.Windows.Forms.Label(); - this.cmbStores = new System.Windows.Forms.ComboBox(); - this.btnManageStores = new System.Windows.Forms.Button(); - this.labelStore = new System.Windows.Forms.Label(); - this.btnPageSetup = new System.Windows.Forms.Button(); // Объявление кнопки Настройки - this.pageSetupDialog1 = new System.Windows.Forms.PageSetupDialog(); // Объявление диалога Настройки + this.lblStatus = new MaterialSkin.Controls.MaterialLabel(); + this.cmbStores = new MaterialSkin.Controls.MaterialComboBox(); + this.btnManageStores = new MaterialSkin.Controls.MaterialButton(); + this.btnPageSetup = new MaterialSkin.Controls.MaterialButton(); + this.btnPrintLabel = new MaterialSkin.Controls.MaterialButton(); + this.lblProductBarcode = new MaterialSkin.Controls.MaterialLabel(); + this.lblProductSku = new MaterialSkin.Controls.MaterialLabel(); + this.lblProductName = new MaterialSkin.Controls.MaterialLabel(); + this.btnGetData = new MaterialSkin.Controls.MaterialButton(); + this.txtOfferId = new MaterialSkin.Controls.MaterialTextBox2(); + this.pageSetupDialog1 = new System.Windows.Forms.PageSetupDialog(); + this.materialCard1 = new MaterialSkin.Controls.MaterialCard(); + this.materialLabel1 = new MaterialSkin.Controls.MaterialLabel(); + this.materialCard2 = new MaterialSkin.Controls.MaterialCard(); + this.materialCard3 = new MaterialSkin.Controls.MaterialCard(); + this.materialCard1.SuspendLayout(); + this.materialCard2.SuspendLayout(); + this.materialCard3.SuspendLayout(); this.SuspendLayout(); - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(12, 94); // Скорректировано - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(51, 13); - this.label3.TabIndex = 4; - this.label3.Text = "Артикул:"; - // - // txtOfferId - // - this.txtOfferId.Enabled = false; - this.txtOfferId.Location = new System.Drawing.Point(88, 91); // Скорректировано - this.txtOfferId.Name = "txtOfferId"; - this.txtOfferId.Size = new System.Drawing.Size(176, 20); - this.txtOfferId.TabIndex = 3; // TabIndex изменен - this.txtOfferId.TextChanged += new System.EventHandler(this.txtOfferId_TextChanged); - // - // btnGetData - // - this.btnGetData.Enabled = false; - this.btnGetData.Location = new System.Drawing.Point(270, 89); // Скорректировано - this.btnGetData.Name = "btnGetData"; - this.btnGetData.Size = new System.Drawing.Size(118, 23); - this.btnGetData.TabIndex = 4; // TabIndex изменен - this.btnGetData.Text = "Получить данные"; - this.btnGetData.UseVisualStyleBackColor = true; - this.btnGetData.Click += new System.EventHandler(this.btnGetData_Click); - // - // lblProductName - // - this.lblProductName.AutoSize = true; - this.lblProductName.Location = new System.Drawing.Point(12, 133); // Скорректировано - this.lblProductName.Name = "lblProductName"; - this.lblProductName.Size = new System.Drawing.Size(60, 13); - this.lblProductName.TabIndex = 5; - this.lblProductName.Text = "Название:"; - // - // lblProductSku - // - this.lblProductSku.AutoSize = true; - this.lblProductSku.Location = new System.Drawing.Point(12, 156); // Скорректировано - this.lblProductSku.Name = "lblProductSku"; - this.lblProductSku.Size = new System.Drawing.Size(51, 13); - this.lblProductSku.TabIndex = 6; - this.lblProductSku.Text = "Артикул:"; - // - // lblProductBarcode - // - this.lblProductBarcode.AutoSize = true; - this.lblProductBarcode.Location = new System.Drawing.Point(12, 179); // Скорректировано - this.lblProductBarcode.Name = "lblProductBarcode"; - this.lblProductBarcode.Size = new System.Drawing.Size(59, 13); - this.lblProductBarcode.TabIndex = 7; - this.lblProductBarcode.Text = "Штрихкод:"; - // - // btnPrintLabel - // - this.btnPrintLabel.Enabled = false; - this.btnPrintLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.btnPrintLabel.Location = new System.Drawing.Point(16, 214); // Скорректировано - this.btnPrintLabel.Name = "btnPrintLabel"; - this.btnPrintLabel.Size = new System.Drawing.Size(373, 33); - this.btnPrintLabel.TabIndex = 8; // TabIndex изменен - this.btnPrintLabel.Text = "Печать этикетки"; - this.btnPrintLabel.UseVisualStyleBackColor = true; - this.btnPrintLabel.Click += new System.EventHandler(this.btnPrintLabel_Click); - // + // // lblStatus - // + // + this.lblStatus.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.lblStatus.AutoSize = true; - this.lblStatus.Location = new System.Drawing.Point(13, 260); // Скорректировано + this.lblStatus.Depth = 0; + this.lblStatus.Font = new System.Drawing.Font("Roboto", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.lblStatus.FontType = MaterialSkin.MaterialSkinManager.fontType.Caption; + this.lblStatus.Location = new System.Drawing.Point(14, 478); + this.lblStatus.MouseState = MaterialSkin.MouseState.HOVER; this.lblStatus.Name = "lblStatus"; - this.lblStatus.Size = new System.Drawing.Size(44, 13); - this.lblStatus.TabIndex = 9; + this.lblStatus.Size = new System.Drawing.Size(43, 14); + this.lblStatus.TabIndex = 7; this.lblStatus.Text = "Статус:"; - // + // // cmbStores - // + // + this.cmbStores.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.cmbStores.AutoResize = false; + this.cmbStores.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); + this.cmbStores.Depth = 0; + this.cmbStores.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawVariable; + this.cmbStores.DropDownHeight = 118; this.cmbStores.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbStores.DropDownWidth = 121; + this.cmbStores.Enabled = false; + this.cmbStores.Font = new System.Drawing.Font("Microsoft Sans Serif", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel); + this.cmbStores.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.cmbStores.FormattingEnabled = true; - this.cmbStores.Location = new System.Drawing.Point(88, 24); + this.cmbStores.Hint = "Выберите магазин"; + this.cmbStores.IntegralHeight = false; + this.cmbStores.ItemHeight = 29; + this.cmbStores.Location = new System.Drawing.Point(17, 38); + this.cmbStores.MaxDropDownItems = 4; + this.cmbStores.MouseState = MaterialSkin.MouseState.OUT; this.cmbStores.Name = "cmbStores"; - this.cmbStores.Size = new System.Drawing.Size(176, 21); + this.cmbStores.Size = new System.Drawing.Size(248, 35); + this.cmbStores.StartIndex = 0; this.cmbStores.TabIndex = 0; + this.cmbStores.UseTallSize = false; this.cmbStores.SelectedIndexChanged += new System.EventHandler(this.cmbStores_SelectedIndexChanged); - // + // // btnManageStores - // - this.btnManageStores.Location = new System.Drawing.Point(270, 23); + // + this.btnManageStores.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnManageStores.AutoSize = false; + this.btnManageStores.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnManageStores.Density = MaterialSkin.Controls.MaterialButton.MaterialButtonDensity.Default; + this.btnManageStores.Depth = 0; + this.btnManageStores.HighEmphasis = false; + this.btnManageStores.Icon = null; + this.btnManageStores.Location = new System.Drawing.Point(281, 38); + this.btnManageStores.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6); + this.btnManageStores.MouseState = MaterialSkin.MouseState.HOVER; this.btnManageStores.Name = "btnManageStores"; - this.btnManageStores.Size = new System.Drawing.Size(118, 23); + this.btnManageStores.NoAccentTextColor = System.Drawing.Color.Empty; + this.btnManageStores.Size = new System.Drawing.Size(148, 36); this.btnManageStores.TabIndex = 1; - this.btnManageStores.Text = "Упр. магазинами..."; + this.btnManageStores.Text = "Упр. магазинами"; + this.btnManageStores.Type = MaterialSkin.Controls.MaterialButton.MaterialButtonType.Outlined; + this.btnManageStores.UseAccentColor = false; this.btnManageStores.UseVisualStyleBackColor = true; this.btnManageStores.Click += new System.EventHandler(this.btnManageStores_Click); - // - // labelStore - // - this.labelStore.AutoSize = true; - this.labelStore.Location = new System.Drawing.Point(12, 27); - this.labelStore.Name = "labelStore"; - this.labelStore.Size = new System.Drawing.Size(54, 13); - this.labelStore.TabIndex = 15; - this.labelStore.Text = "Магазин:"; - // + // // btnPageSetup - // *** Новая кнопка Настройки принтера *** - this.btnPageSetup.Location = new System.Drawing.Point(270, 53); + // + this.btnPageSetup.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnPageSetup.AutoSize = false; + this.btnPageSetup.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnPageSetup.Density = MaterialSkin.Controls.MaterialButton.MaterialButtonDensity.Default; + this.btnPageSetup.Depth = 0; + this.btnPageSetup.Enabled = false; + this.btnPageSetup.HighEmphasis = false; + this.btnPageSetup.Icon = null; + this.btnPageSetup.Location = new System.Drawing.Point(281, 84); + this.btnPageSetup.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6); + this.btnPageSetup.MouseState = MaterialSkin.MouseState.HOVER; this.btnPageSetup.Name = "btnPageSetup"; - this.btnPageSetup.Size = new System.Drawing.Size(118, 23); - this.btnPageSetup.TabIndex = 2; // Изменен TabIndex - this.btnPageSetup.Text = "Настройка принтера"; + this.btnPageSetup.NoAccentTextColor = System.Drawing.Color.Empty; + this.btnPageSetup.Size = new System.Drawing.Size(148, 36); + this.btnPageSetup.TabIndex = 2; + this.btnPageSetup.Text = "Настр. принтера"; + this.btnPageSetup.Type = MaterialSkin.Controls.MaterialButton.MaterialButtonType.Outlined; + this.btnPageSetup.UseAccentColor = false; this.btnPageSetup.UseVisualStyleBackColor = true; this.btnPageSetup.Click += new System.EventHandler(this.btnPageSetup_Click); - // + // + // btnPrintLabel + // + this.btnPrintLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.btnPrintLabel.AutoSize = false; + this.btnPrintLabel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnPrintLabel.Density = MaterialSkin.Controls.MaterialButton.MaterialButtonDensity.Default; + this.btnPrintLabel.Depth = 0; + this.btnPrintLabel.Enabled = false; + this.btnPrintLabel.HighEmphasis = true; + this.btnPrintLabel.Icon = null; + this.btnPrintLabel.Location = new System.Drawing.Point(17, 422); + this.btnPrintLabel.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6); + this.btnPrintLabel.MouseState = MaterialSkin.MouseState.HOVER; + this.btnPrintLabel.Name = "btnPrintLabel"; + this.btnPrintLabel.NoAccentTextColor = System.Drawing.Color.Empty; + this.btnPrintLabel.Size = new System.Drawing.Size(446, 36); + this.btnPrintLabel.TabIndex = 6; + this.btnPrintLabel.Text = "Печать Этикетки"; + this.btnPrintLabel.Type = MaterialSkin.Controls.MaterialButton.MaterialButtonType.Contained; + this.btnPrintLabel.UseAccentColor = true; + this.btnPrintLabel.UseVisualStyleBackColor = true; + this.btnPrintLabel.Click += new System.EventHandler(this.btnPrintLabel_Click); + // + // lblProductBarcode + // + this.lblProductBarcode.AutoSize = true; + this.lblProductBarcode.Depth = 0; + this.lblProductBarcode.Font = new System.Drawing.Font("Roboto", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.lblProductBarcode.Location = new System.Drawing.Point(14, 68); + this.lblProductBarcode.MouseState = MaterialSkin.MouseState.HOVER; + this.lblProductBarcode.Name = "lblProductBarcode"; + this.lblProductBarcode.Size = new System.Drawing.Size(82, 19); + this.lblProductBarcode.TabIndex = 2; + this.lblProductBarcode.Text = "Штрихкод:"; + // + // lblProductSku + // + this.lblProductSku.AutoSize = true; + this.lblProductSku.Depth = 0; + this.lblProductSku.Font = new System.Drawing.Font("Roboto", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.lblProductSku.Location = new System.Drawing.Point(14, 42); + this.lblProductSku.MouseState = MaterialSkin.MouseState.HOVER; + this.lblProductSku.Name = "lblProductSku"; + this.lblProductSku.Size = new System.Drawing.Size(67, 19); + this.lblProductSku.TabIndex = 1; + this.lblProductSku.Text = "Артикул:"; + // + // lblProductName + // + this.lblProductName.AutoSize = true; + this.lblProductName.Depth = 0; + this.lblProductName.Font = new System.Drawing.Font("Roboto", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.lblProductName.Location = new System.Drawing.Point(14, 16); + this.lblProductName.MouseState = MaterialSkin.MouseState.HOVER; + this.lblProductName.Name = "lblProductName"; + this.lblProductName.Size = new System.Drawing.Size(77, 19); + this.lblProductName.TabIndex = 0; + this.lblProductName.Text = "Название:"; + // + // btnGetData + // + this.btnGetData.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnGetData.AutoSize = false; + this.btnGetData.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnGetData.Density = MaterialSkin.Controls.MaterialButton.MaterialButtonDensity.Default; + this.btnGetData.Depth = 0; + this.btnGetData.Enabled = false; + this.btnGetData.HighEmphasis = true; + this.btnGetData.Icon = null; + this.btnGetData.Location = new System.Drawing.Point(284, 21); + this.btnGetData.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6); + this.btnGetData.MouseState = MaterialSkin.MouseState.HOVER; + this.btnGetData.Name = "btnGetData"; + this.btnGetData.NoAccentTextColor = System.Drawing.Color.Empty; + this.btnGetData.Size = new System.Drawing.Size(143, 36); + this.btnGetData.TabIndex = 4; + this.btnGetData.Text = "Получить данные"; + this.btnGetData.Type = MaterialSkin.Controls.MaterialButton.MaterialButtonType.Contained; + this.btnGetData.UseAccentColor = false; + this.btnGetData.UseVisualStyleBackColor = true; + this.btnGetData.Click += new System.EventHandler(this.btnGetData_Click); + // + // txtOfferId + // + this.txtOfferId.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtOfferId.AnimateReadOnly = false; + this.txtOfferId.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; + this.txtOfferId.CharacterCasing = System.Windows.Forms.CharacterCasing.Normal; + this.txtOfferId.Depth = 0; + this.txtOfferId.Enabled = false; + this.txtOfferId.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.txtOfferId.HideSelection = true; + this.txtOfferId.Hint = "Артикул товара (offer_id)"; + this.txtOfferId.LeadingIcon = null; + this.txtOfferId.Location = new System.Drawing.Point(17, 14); + this.txtOfferId.MaxLength = 50; + this.txtOfferId.MouseState = MaterialSkin.MouseState.OUT; + this.txtOfferId.Name = "txtOfferId"; + this.txtOfferId.PasswordChar = '\0'; + this.txtOfferId.PrefixSuffixText = null; + this.txtOfferId.ReadOnly = false; + this.txtOfferId.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.txtOfferId.SelectedText = ""; + this.txtOfferId.SelectionLength = 0; + this.txtOfferId.SelectionStart = 0; + this.txtOfferId.ShortcutsEnabled = true; + this.txtOfferId.Size = new System.Drawing.Size(254, 48); + this.txtOfferId.TabIndex = 3; + this.txtOfferId.TabStop = false; + this.txtOfferId.TextAlign = System.Windows.Forms.HorizontalAlignment.Left; + this.txtOfferId.TrailingIcon = null; + this.txtOfferId.UseSystemPasswordChar = false; + this.txtOfferId.TextChanged += new System.EventHandler(this.txtOfferId_TextChanged); + // // pageSetupDialog1 - // *** Диалог настройки страницы *** - this.pageSetupDialog1 = new System.Windows.Forms.PageSetupDialog(); + // this.pageSetupDialog1.EnableMetric = true; - // + // + // materialCard1 + // + this.materialCard1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.materialCard1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); + this.materialCard1.Controls.Add(this.materialLabel1); + this.materialCard1.Controls.Add(this.cmbStores); + this.materialCard1.Controls.Add(this.btnManageStores); + this.materialCard1.Controls.Add(this.btnPageSetup); + this.materialCard1.Depth = 0; + this.materialCard1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.materialCard1.Location = new System.Drawing.Point(17, 78); + this.materialCard1.Margin = new System.Windows.Forms.Padding(14); + this.materialCard1.MouseState = MaterialSkin.MouseState.HOVER; + this.materialCard1.Name = "materialCard1"; + this.materialCard1.Padding = new System.Windows.Forms.Padding(14); + this.materialCard1.Size = new System.Drawing.Size(446, 137); + this.materialCard1.TabIndex = 0; + // + // materialLabel1 + // + this.materialLabel1.AutoSize = true; + this.materialLabel1.Depth = 0; + this.materialLabel1.Font = new System.Drawing.Font("Roboto", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.materialLabel1.Location = new System.Drawing.Point(17, 14); + this.materialLabel1.MouseState = MaterialSkin.MouseState.HOVER; + this.materialLabel1.Name = "materialLabel1"; + this.materialLabel1.Size = new System.Drawing.Size(126, 19); + this.materialLabel1.TabIndex = 3; + this.materialLabel1.Text = "Выбор магазина"; + // + // materialCard2 + // + this.materialCard2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.materialCard2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); + this.materialCard2.Controls.Add(this.txtOfferId); + this.materialCard2.Controls.Add(this.btnGetData); + this.materialCard2.Depth = 0; + this.materialCard2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.materialCard2.Location = new System.Drawing.Point(17, 218); + this.materialCard2.Margin = new System.Windows.Forms.Padding(14); + this.materialCard2.MouseState = MaterialSkin.MouseState.HOVER; + this.materialCard2.Name = "materialCard2"; + this.materialCard2.Padding = new System.Windows.Forms.Padding(14); + this.materialCard2.Size = new System.Drawing.Size(446, 75); + this.materialCard2.TabIndex = 1; + // + // materialCard3 + // + this.materialCard3.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.materialCard3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); + this.materialCard3.Controls.Add(this.lblProductName); + this.materialCard3.Controls.Add(this.lblProductSku); + this.materialCard3.Controls.Add(this.lblProductBarcode); + this.materialCard3.Depth = 0; + this.materialCard3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.materialCard3.Location = new System.Drawing.Point(17, 297); + this.materialCard3.Margin = new System.Windows.Forms.Padding(14); + this.materialCard3.MinimumSize = new System.Drawing.Size(0, 100); + this.materialCard3.MouseState = MaterialSkin.MouseState.HOVER; + this.materialCard3.Name = "materialCard3"; + this.materialCard3.Padding = new System.Windows.Forms.Padding(14); + this.materialCard3.Size = new System.Drawing.Size(446, 105); + this.materialCard3.TabIndex = 5; + // // Form1 - // + // + this.AcceptButton = this.btnGetData; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(404, 288); // Скорректирован размер - this.Controls.Add(this.btnPageSetup); // Добавлена кнопка - this.Controls.Add(this.labelStore); - this.Controls.Add(this.btnManageStores); - this.Controls.Add(this.cmbStores); - this.Controls.Add(this.lblStatus); + this.ClientSize = new System.Drawing.Size(480, 502); + this.Controls.Add(this.materialCard1); + this.Controls.Add(this.materialCard2); + this.Controls.Add(this.materialCard3); this.Controls.Add(this.btnPrintLabel); - this.Controls.Add(this.lblProductBarcode); - this.Controls.Add(this.lblProductSku); - this.Controls.Add(this.lblProductName); - this.Controls.Add(this.btnGetData); - this.Controls.Add(this.txtOfferId); - this.Controls.Add(this.label3); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Controls.Add(this.lblStatus); this.MaximizeBox = false; + this.MinimizeBox = false; this.Name = "Form1"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Генератор внутренних этикеток Ozon"; + this.Text = "Генератор Этикеток Ozon"; + this.materialCard1.ResumeLayout(false); + this.materialCard1.PerformLayout(); + this.materialCard2.ResumeLayout(false); + this.materialCard3.ResumeLayout(false); + this.materialCard3.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); - } + } // Конец InitializeComponent #endregion - private System.Windows.Forms.Label label3; - private System.Windows.Forms.TextBox txtOfferId; - private System.Windows.Forms.Button btnGetData; - private System.Windows.Forms.Label lblProductName; - private System.Windows.Forms.Label lblProductSku; - private System.Windows.Forms.Label lblProductBarcode; - private System.Windows.Forms.Button btnPrintLabel; - private System.Windows.Forms.Label lblStatus; - private System.Windows.Forms.ComboBox cmbStores; - private System.Windows.Forms.Button btnManageStores; - private System.Windows.Forms.Label labelStore; - private System.Windows.Forms.Button btnPageSetup; // Добавлено - private System.Windows.Forms.PageSetupDialog pageSetupDialog1; // Добавлено + // Обновляем список полей класса + private MaterialSkin.Controls.MaterialLabel lblStatus; + private MaterialSkin.Controls.MaterialComboBox cmbStores; + private MaterialSkin.Controls.MaterialButton btnManageStores; + private MaterialSkin.Controls.MaterialButton btnPageSetup; + private MaterialSkin.Controls.MaterialButton btnPrintLabel; // Имя оставлено + private MaterialSkin.Controls.MaterialLabel lblProductBarcode; + private MaterialSkin.Controls.MaterialLabel lblProductSku; + private MaterialSkin.Controls.MaterialLabel lblProductName; + private MaterialSkin.Controls.MaterialButton btnGetData; + private MaterialSkin.Controls.MaterialTextBox2 txtOfferId; // Имя оставлено + private System.Windows.Forms.PageSetupDialog pageSetupDialog1; + private MaterialSkin.Controls.MaterialCard materialCard1; + private MaterialSkin.Controls.MaterialLabel materialLabel1; + private MaterialSkin.Controls.MaterialCard materialCard2; + private MaterialSkin.Controls.MaterialCard materialCard3; + // MaterialDivider убран } } \ No newline at end of file diff --git a/Form1.cs b/Form1.cs index 0194b77..209ae50 100644 --- a/Form1.cs +++ b/Form1.cs @@ -20,7 +20,7 @@ using ZXing.Windows.Compatibility; namespace OzonInternalLabelPrinter // Убедитесь, что это ваше пространство имен { - public partial class Form1 : Form + public partial class Form1 : MaterialSkin.Controls.MaterialForm // <-- Должно быть так { private HttpClient _httpClient; // Bitmap больше не нужен как поле класса diff --git a/Form1.resx b/Form1.resx index 1af7de1..6a68c91 100644 --- a/Form1.resx +++ b/Form1.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/FormManageStores.Designer.cs b/FormManageStores.Designer.cs index 09e93fd..13151d4 100644 --- a/FormManageStores.Designer.cs +++ b/FormManageStores.Designer.cs @@ -1,4 +1,6 @@ -namespace SKLADm +using MaterialSkin.Controls; // Добавлено + +namespace OzonInternalLabelPrinter // Замените на ваше пространство имен { partial class FormManageStores { @@ -28,174 +30,204 @@ /// private void InitializeComponent() { - this.lstStores = new System.Windows.Forms.ListBox(); - this.label1 = new System.Windows.Forms.Label(); + this.lstStores = new MaterialSkin.Controls.MaterialListBox(); // Изменено на MaterialListBox this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.btnAddStore = new System.Windows.Forms.Button(); - this.txtEditApiKey = new System.Windows.Forms.TextBox(); - this.label4 = new System.Windows.Forms.Label(); - this.txtEditClientId = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this.txtStoreName = new System.Windows.Forms.TextBox(); - this.label2 = new System.Windows.Forms.Label(); - this.btnDeleteStore = new System.Windows.Forms.Button(); - this.btnClose = new System.Windows.Forms.Button(); + this.btnAddStore = new MaterialSkin.Controls.MaterialButton(); // Изменено + this.txtEditApiKey = new MaterialSkin.Controls.MaterialTextBox(); // Изменено + this.txtEditClientId = new MaterialSkin.Controls.MaterialTextBox(); // Изменено + this.txtStoreName = new MaterialSkin.Controls.MaterialTextBox(); // Изменено + this.btnDeleteStore = new MaterialSkin.Controls.MaterialButton(); // Изменено + this.btnClose = new MaterialSkin.Controls.MaterialButton(); // Изменено this.groupBox1.SuspendLayout(); this.SuspendLayout(); // // lstStores // - this.lstStores.FormattingEnabled = true; - this.lstStores.Location = new System.Drawing.Point(12, 25); + this.lstStores.BackColor = System.Drawing.Color.White; + this.lstStores.BorderColor = System.Drawing.Color.LightGray; + this.lstStores.Depth = 0; + this.lstStores.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.lstStores.Location = new System.Drawing.Point(17, 77); // Сдвинуто вниз под Material Bar + this.lstStores.MouseState = MaterialSkin.MouseState.HOVER; this.lstStores.Name = "lstStores"; - this.lstStores.Size = new System.Drawing.Size(188, 199); // Adjust height as needed + this.lstStores.SelectedIndex = -1; + this.lstStores.SelectedItem = null; + this.lstStores.Size = new System.Drawing.Size(220, 231); // Примерный размер this.lstStores.TabIndex = 0; - // Add event handler if you want to display details on selection: - // this.lstStores.SelectedIndexChanged += new System.EventHandler(this.lstStores_SelectedIndexChanged); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 9); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(121, 13); - this.label1.TabIndex = 1; - this.label1.Text = "Сохраненные магазины:"; + // Можно добавить обработчик для отображения деталей при выборе + // this.lstStores.SelectedIndexChanged += new MaterialSkin.Controls.MaterialListBox.SelectedIndexChangedEventHandler(this.lstStores_SelectedIndexChanged); // // groupBox1 // this.groupBox1.Controls.Add(this.btnAddStore); this.groupBox1.Controls.Add(this.txtEditApiKey); - this.groupBox1.Controls.Add(this.label4); this.groupBox1.Controls.Add(this.txtEditClientId); - this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.txtStoreName); - this.groupBox1.Controls.Add(this.label2); - this.groupBox1.Location = new System.Drawing.Point(219, 25); + this.groupBox1.Location = new System.Drawing.Point(258, 77); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(303, 155); // Adjust size as needed + this.groupBox1.Size = new System.Drawing.Size(313, 231); // Примерный размер this.groupBox1.TabIndex = 2; this.groupBox1.TabStop = false; - this.groupBox1.Text = "Добавить новый магазин"; + this.groupBox1.Text = "Добавить/Редактировать магазин"; // // btnAddStore // - this.btnAddStore.Location = new System.Drawing.Point(196, 118); + this.btnAddStore.AutoSize = false; + this.btnAddStore.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnAddStore.Density = MaterialSkin.Controls.MaterialButton.MaterialButtonDensity.Default; + this.btnAddStore.Depth = 0; + this.btnAddStore.HighEmphasis = true; + this.btnAddStore.Icon = null; + this.btnAddStore.Location = new System.Drawing.Point(188, 186); + this.btnAddStore.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6); + this.btnAddStore.MouseState = MaterialSkin.MouseState.HOVER; this.btnAddStore.Name = "btnAddStore"; - this.btnAddStore.Size = new System.Drawing.Size(97, 23); - this.btnAddStore.TabIndex = 6; + this.btnAddStore.NoAccentTextColor = System.Drawing.Color.Empty; + this.btnAddStore.Size = new System.Drawing.Size(115, 36); + this.btnAddStore.TabIndex = 3; // Последний таб в группе this.btnAddStore.Text = "Добавить"; + this.btnAddStore.Type = MaterialSkin.Controls.MaterialButton.MaterialButtonType.Contained; + this.btnAddStore.UseAccentColor = false; this.btnAddStore.UseVisualStyleBackColor = true; this.btnAddStore.Click += new System.EventHandler(this.btnAddStore_Click); // // txtEditApiKey // - this.txtEditApiKey.Location = new System.Drawing.Point(74, 86); + this.txtEditApiKey.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtEditApiKey.AnimateReadOnly = false; + this.txtEditApiKey.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.txtEditApiKey.Depth = 0; + this.txtEditApiKey.Font = new System.Drawing.Font("Roboto", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.txtEditApiKey.Hint = "Api-Key"; + this.txtEditApiKey.LeadingIcon = null; + this.txtEditApiKey.Location = new System.Drawing.Point(15, 130); + this.txtEditApiKey.MaxLength = 200; // Увеличил + this.txtEditApiKey.MouseState = MaterialSkin.MouseState.OUT; + this.txtEditApiKey.Multiline = false; this.txtEditApiKey.Name = "txtEditApiKey"; - this.txtEditApiKey.PasswordChar = '*'; - this.txtEditApiKey.Size = new System.Drawing.Size(219, 20); - this.txtEditApiKey.TabIndex = 5; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(16, 89); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(48, 13); - this.label4.TabIndex = 4; - this.label4.Text = "Api-Key:"; + this.txtEditApiKey.Password = true; // Маска + this.txtEditApiKey.Size = new System.Drawing.Size(288, 50); + this.txtEditApiKey.TabIndex = 2; + this.txtEditApiKey.Text = ""; + this.txtEditApiKey.TrailingIcon = null; // // txtEditClientId // - this.txtEditClientId.Location = new System.Drawing.Point(74, 57); + this.txtEditClientId.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtEditClientId.AnimateReadOnly = false; + this.txtEditClientId.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.txtEditClientId.Depth = 0; + this.txtEditClientId.Font = new System.Drawing.Font("Roboto", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.txtEditClientId.Hint = "Client ID"; + this.txtEditClientId.LeadingIcon = null; + this.txtEditClientId.Location = new System.Drawing.Point(15, 78); + this.txtEditClientId.MaxLength = 50; + this.txtEditClientId.MouseState = MaterialSkin.MouseState.OUT; + this.txtEditClientId.Multiline = false; this.txtEditClientId.Name = "txtEditClientId"; - this.txtEditClientId.Size = new System.Drawing.Size(219, 20); - this.txtEditClientId.TabIndex = 3; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(16, 60); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(50, 13); - this.label3.TabIndex = 2; - this.label3.Text = "Client ID:"; + this.txtEditClientId.Size = new System.Drawing.Size(288, 50); + this.txtEditClientId.TabIndex = 1; + this.txtEditClientId.Text = ""; + this.txtEditClientId.TrailingIcon = null; // // txtStoreName // - this.txtStoreName.Location = new System.Drawing.Point(74, 28); + this.txtStoreName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtStoreName.AnimateReadOnly = false; + this.txtStoreName.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.txtStoreName.Depth = 0; + this.txtStoreName.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.txtStoreName.Hint = "Название магазина"; + this.txtStoreName.LeadingIcon = null; + this.txtStoreName.Location = new System.Drawing.Point(15, 26); + this.txtStoreName.MaxLength = 50; + this.txtStoreName.MouseState = MaterialSkin.MouseState.OUT; + this.txtStoreName.Multiline = false; this.txtStoreName.Name = "txtStoreName"; - this.txtStoreName.Size = new System.Drawing.Size(219, 20); - this.txtStoreName.TabIndex = 1; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(16, 31); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(60, 13); - this.label2.TabIndex = 0; - this.label2.Text = "Название:"; + this.txtStoreName.Size = new System.Drawing.Size(288, 50); + this.txtStoreName.TabIndex = 0; + this.txtStoreName.Text = ""; + this.txtStoreName.TrailingIcon = null; // // btnDeleteStore // - this.btnDeleteStore.Location = new System.Drawing.Point(12, 230); // Position below listbox + this.btnDeleteStore.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.btnDeleteStore.AutoSize = false; + this.btnDeleteStore.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnDeleteStore.Density = MaterialSkin.Controls.MaterialButton.MaterialButtonDensity.Default; + this.btnDeleteStore.Depth = 0; + this.btnDeleteStore.HighEmphasis = false; // Менее важная + this.btnDeleteStore.Icon = null; // Можно добавить иконку корзины + this.btnDeleteStore.Location = new System.Drawing.Point(17, 317); + this.btnDeleteStore.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6); + this.btnDeleteStore.MouseState = MaterialSkin.MouseState.HOVER; this.btnDeleteStore.Name = "btnDeleteStore"; - this.btnDeleteStore.Size = new System.Drawing.Size(188, 23); + this.btnDeleteStore.NoAccentTextColor = System.Drawing.Color.Empty; + this.btnDeleteStore.Size = new System.Drawing.Size(220, 36); this.btnDeleteStore.TabIndex = 3; this.btnDeleteStore.Text = "Удалить выбранный"; + this.btnDeleteStore.Type = MaterialSkin.Controls.MaterialButton.MaterialButtonType.Outlined; // Другой стиль + this.btnDeleteStore.UseAccentColor = false; this.btnDeleteStore.UseVisualStyleBackColor = true; this.btnDeleteStore.Click += new System.EventHandler(this.btnDeleteStore_Click); // // btnClose // - this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel; // Makes Esc close the form - this.btnClose.Location = new System.Drawing.Point(447, 230); // Position bottom right + this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnClose.AutoSize = false; + this.btnClose.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnClose.Density = MaterialSkin.Controls.MaterialButton.MaterialButtonDensity.Default; + this.btnClose.Depth = 0; + this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel; // Esc + this.btnClose.HighEmphasis = true; + this.btnClose.Icon = null; + this.btnClose.Location = new System.Drawing.Point(471, 317); + this.btnClose.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6); + this.btnClose.MouseState = MaterialSkin.MouseState.HOVER; this.btnClose.Name = "btnClose"; - this.btnClose.Size = new System.Drawing.Size(75, 23); + this.btnClose.NoAccentTextColor = System.Drawing.Color.Empty; + this.btnClose.Size = new System.Drawing.Size(100, 36); this.btnClose.TabIndex = 4; this.btnClose.Text = "Закрыть"; + this.btnClose.Type = MaterialSkin.Controls.MaterialButton.MaterialButtonType.Contained; + this.btnClose.UseAccentColor = false; this.btnClose.UseVisualStyleBackColor = true; this.btnClose.Click += new System.EventHandler(this.btnClose_Click); // // FormManageStores // - this.AcceptButton = this.btnAddStore; // Enter in groupbox adds store + this.AcceptButton = this.btnAddStore; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.btnClose; // Esc closes form - this.ClientSize = new System.Drawing.Size(534, 267); // Adjust size as needed + this.CancelButton = this.btnClose; + this.ClientSize = new System.Drawing.Size(588, 368); // Размер окна this.Controls.Add(this.btnClose); this.Controls.Add(this.btnDeleteStore); this.Controls.Add(this.groupBox1); - this.Controls.Add(this.label1); this.Controls.Add(this.lstStores); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; // Prevent resizing this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "FormManageStores"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; // Center over Form1 + this.Padding = new System.Windows.Forms.Padding(3, 64, 3, 3); // Отступ под Material Bar + this.Sizable = false; // Запрет изменения размера + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Управление магазинами Ozon"; this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); this.ResumeLayout(false); - this.PerformLayout(); } #endregion - - private System.Windows.Forms.ListBox lstStores; - private System.Windows.Forms.Label label1; + private MaterialSkin.Controls.MaterialListBox lstStores; // Изменено private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.Button btnAddStore; - private System.Windows.Forms.TextBox txtEditApiKey; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.TextBox txtEditClientId; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.TextBox txtStoreName; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Button btnDeleteStore; - private System.Windows.Forms.Button btnClose; + private MaterialSkin.Controls.MaterialButton btnAddStore; // Изменено + private MaterialSkin.Controls.MaterialTextBox txtEditApiKey; // Изменено + private MaterialSkin.Controls.MaterialTextBox txtEditClientId; // Изменено + private MaterialSkin.Controls.MaterialTextBox txtStoreName; // Изменено + private MaterialSkin.Controls.MaterialButton btnDeleteStore; // Изменено + private MaterialSkin.Controls.MaterialButton btnClose; // Изменено } -} +} \ No newline at end of file diff --git a/FormManageStores.cs b/FormManageStores.cs index 41df99e..56e14e8 100644 --- a/FormManageStores.cs +++ b/FormManageStores.cs @@ -1,27 +1,36 @@ -using Newtonsoft.Json; -using OzonInternalLabelPrinter; // Добавляем пространство имен для OzonStore -using System; +using System; using System.Collections.Generic; using System.Linq; -using System.Security.Cryptography; // Для ProtectedData +using System.Security.Cryptography; using System.Text; using System.Windows.Forms; +using MaterialSkin; // Используем MaterialSkin +using MaterialSkin.Controls; // Используем MaterialSkin +using Newtonsoft.Json; +using SKLADm.Properties; // Используем Settings -namespace SKLADm +namespace OzonInternalLabelPrinter // Замените на ваше пространство имен { - public partial class FormManageStores : Form + // Наследуемся от MaterialForm + public partial class FormManageStores : MaterialForm { private List _stores; - // Энтропия для шифрования (можно оставить null или использовать свой секрет) - private static readonly byte[] s_entropy = null; // Или Encoding.UTF8.GetBytes("MyOptionalEntropy"); + // Энтропия (можно оставить null или использовать свой секрет, ГЛАВНОЕ - одинаковый в Form1 и FormManageStores) + private static readonly byte[] s_entropy = null; public FormManageStores() { InitializeComponent(); + + // Настройка MaterialSkin для этой формы + var materialSkinManager = MaterialSkinManager.Instance; + materialSkinManager.AddFormToManage(this); + // Тема и схема наследуются от Form1, т.к. она тоже управляется менеджером + LoadStoresToListBox(); } - // --- Шифрование Api-Key --- + // Шифрование Api-Key private string EncryptApiKey(string apiKey) { if (string.IsNullOrEmpty(apiKey)) return string.Empty; @@ -33,15 +42,15 @@ namespace SKLADm } catch (Exception ex) { - MessageBox.Show($"Ошибка шифрования ключа: {ex.Message}", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); - return null; // Возвращаем null при ошибке + MaterialMessageBox.Show(this, $"Ошибка шифрования ключа: {ex.Message}", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return null; } } - // --- Загрузка магазинов из настроек --- + // Загрузка магазинов из настроек в ListBox private void LoadStoresToListBox() { - string json = Properties.Settings.Default.SavedStoresJson; + string json = Settings.Default.SavedStoresJson; _stores = new List(); if (!string.IsNullOrEmpty(json)) { @@ -51,100 +60,139 @@ namespace SKLADm } catch (Exception ex) { - MessageBox.Show($"Ошибка загрузки списка магазинов: {ex.Message}", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Warning); - _stores = new List(); // Создаем пустой список при ошибке + MaterialMessageBox.Show(this, $"Ошибка загрузки списка магазинов: {ex.Message}", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Warning); + _stores = new List(); } } + // Сортируем по имени для удобства + _stores = _stores.OrderBy(s => s.StoreName).ToList(); UpdateListBox(); } - // --- Сохранение магазинов в настройки --- + // Сохранение магазинов в настройки private void SaveStores() { try { + // Сортируем перед сохранением + _stores = _stores.OrderBy(s => s.StoreName).ToList(); string json = JsonConvert.SerializeObject(_stores, Formatting.Indented); - Properties.Settings.Default.SavedStoresJson = json; - Properties.Settings.Default.Save(); + Settings.Default.SavedStoresJson = json; + Settings.Default.Save(); // Сохраняем изменения } catch (Exception ex) { - MessageBox.Show($"Ошибка сохранения списка магазинов: {ex.Message}", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + MaterialMessageBox.Show(this, $"Ошибка сохранения списка магазинов: {ex.Message}", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } - // --- Обновление ListBox --- + // Обновление MaterialListBox private void UpdateListBox() { - lstStores.DataSource = null; // Сначала отвязываем источник - lstStores.DataSource = _stores; // Привязываем обновленный список - lstStores.DisplayMember = "StoreName"; // Отображаем имя + lstStores.Items.Clear(); // Очищаем старые элементы + if (_stores != null) + { + foreach (var store in _stores) + { + // Добавляем каждый магазин как MaterialListBoxItem + lstStores.Items.Add(new MaterialListBoxItem(store.StoreName) { Tag = store }); + } + } + // Очищаем поля редактирования + // txtStoreName.Clear(); + // txtEditClientId.Clear(); + // txtEditApiKey.Clear(); + // lstStores.SelectedIndex = -1; // Сбрасываем выбор } - // --- Кнопка "Добавить магазин" --- + // Кнопка "Добавить магазин" private void btnAddStore_Click(object sender, EventArgs e) { string storeName = txtStoreName.Text.Trim(); string clientId = txtEditClientId.Text.Trim(); - string apiKey = txtEditApiKey.Text.Trim(); // Берем ключ как есть + string apiKey = txtEditApiKey.Text; // Не Trim(), т.к. ключи могут иметь пробелы if (string.IsNullOrEmpty(storeName) || string.IsNullOrEmpty(clientId) || string.IsNullOrEmpty(apiKey)) { - MessageBox.Show("Пожалуйста, заполните все поля: Название, Client ID, Api-Key.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Warning); + MaterialMessageBox.Show(this, "Пожалуйста, заполните все поля: Название, Client ID, Api-Key.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } - // Проверяем, нет ли уже магазина с таким именем + // Проверяем уникальность имени if (_stores.Any(s => s.StoreName.Equals(storeName, StringComparison.OrdinalIgnoreCase))) { - MessageBox.Show("Магазин с таким названием уже существует.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Warning); + MaterialMessageBox.Show(this, "Магазин с таким названием уже существует.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } - - // Шифруем ключ - string encryptedKey = EncryptApiKey(apiKey); - if (encryptedKey == null) // Если шифрование не удалось + // Проверяем уникальность Client ID (опционально, но полезно) + if (_stores.Any(s => s.ClientId.Equals(clientId, StringComparison.OrdinalIgnoreCase))) { - return; + if (MaterialMessageBox.Show(this, "Магазин с таким Client ID уже существует. Все равно добавить?", "Предупреждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } } - // Создаем и добавляем магазин + + string encryptedKey = EncryptApiKey(apiKey); + if (encryptedKey == null) return; // Ошибка шифрования уже показана + OzonStore newStore = new OzonStore(storeName, clientId, encryptedKey); _stores.Add(newStore); - // Сохраняем и обновляем список SaveStores(); UpdateListBox(); - // Очищаем поля ввода + // Очищаем поля после добавления txtStoreName.Clear(); txtEditClientId.Clear(); txtEditApiKey.Clear(); + txtStoreName.Focus(); // Фокус на первое поле } - // --- Кнопка "Удалить выбранный" (Опционально) --- + // Кнопка "Удалить выбранный" private void btnDeleteStore_Click(object sender, EventArgs e) { - if (lstStores.SelectedItem is OzonStore selectedStore) + if (lstStores.SelectedItem is MaterialListBoxItem selectedItem && selectedItem.Tag is OzonStore selectedStore) { - if (MessageBox.Show($"Вы уверены, что хотите удалить магазин '{selectedStore.StoreName}'?", "Подтверждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + if (MaterialMessageBox.Show(this, $"Вы уверены, что хотите удалить магазин '{selectedStore.StoreName}'?", "Подтверждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { _stores.Remove(selectedStore); SaveStores(); - UpdateListBox(); + UpdateListBox(); // Обновляем список на форме } } else { - MessageBox.Show("Выберите магазин для удаления.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Information); + MaterialMessageBox.Show(this, "Выберите магазин для удаления из списка.", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information); } } - // --- Кнопка "Закрыть" --- + // Кнопка "Закрыть" private void btnClose_Click(object sender, EventArgs e) { - this.DialogResult = DialogResult.OK; // Указываем, что форма закрыта штатно + this.DialogResult = DialogResult.OK; // Возвращаем OK при закрытии this.Close(); } + + // Можно добавить обработчик lstStores_SelectedIndexChanged, если нужно + // отображать ClientID (но не ApiKey!) при выборе магазина в списке. + /* + private void lstStores_SelectedIndexChanged(MaterialListBoxItem item) + { + if (item != null && item.Tag is OzonStore selectedStore) + { + txtStoreName.Text = selectedStore.StoreName; + txtEditClientId.Text = selectedStore.ClientId; + txtEditApiKey.Text = ""; // Никогда не показываем ключ + } + else + { + txtStoreName.Clear(); + txtEditClientId.Clear(); + txtEditApiKey.Clear(); + } + } + */ } -} +} \ No newline at end of file diff --git a/Program.cs b/Program.cs index 93fa4e4..bd88c5d 100644 --- a/Program.cs +++ b/Program.cs @@ -1,13 +1,9 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using System.Windows.Forms; -using OzonInternalLabelPrinter; // Добавляем директиву using для пространства имен с Form1 -namespace SKLADm +namespace OzonInternalLabelPrinter // Замените на ваше пространство имен { - internal static class Program + static class Program { /// /// Главная точка входа для приложения. @@ -17,7 +13,7 @@ namespace SKLADm { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Form1()); + Application.Run(new Form1()); // Запускаем Form1 } } -} +} \ No newline at end of file diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs index 6630341..2b451d5 100644 --- a/Properties/Resources.Designer.cs +++ b/Properties/Resources.Designer.cs @@ -1,69 +1,61 @@ //------------------------------------------------------------------------------ // -// Этот код создан программным средством. -// Версия среды выполнения: 4.0.30319.42000 +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 // -// Изменения в этом файле могут привести к неправильному поведению и будут утрачены, если -// код создан повторно. +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. // //------------------------------------------------------------------------------ -namespace SKLADm.Properties -{ - - +namespace SKLADm.Properties { + using System; + + /// - /// Класс ресурсов со строгим типом для поиска локализованных строк и пр. + /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д. /// - // Этот класс был автоматически создан при помощи StronglyTypedResourceBuilder - // класс с помощью таких средств, как ResGen или Visual Studio. - // Для добавления или удаления члена измените файл .ResX, а затем перезапустите ResGen - // с параметром /str или заново постройте свой VS-проект. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + // Этот класс создан автоматически классом StronglyTypedResourceBuilder + // с помощью такого средства, как ResGen или Visual Studio. + // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen + // с параметром /str или перестройте свой проект VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - + internal class Resources { + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { + internal Resources() { } - + /// - /// Возврат кэшированного экземпляра ResourceManager, используемого этим классом. + /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SKLADm.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } - + /// - /// Переопределяет свойство CurrentUICulture текущего потока для всех - /// подстановки ресурсов с помощью этого класса ресурсов со строгим типом. + /// Перезаписывает свойство CurrentUICulture текущего потока для всех + /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { + internal static global::System.Globalization.CultureInfo Culture { + get { return resourceCulture; } - set - { + set { resourceCulture = value; } } diff --git a/SKLADm.csproj b/SKLADm.csproj index 502966b..19e7f7b 100644 --- a/SKLADm.csproj +++ b/SKLADm.csproj @@ -8,12 +8,13 @@ WinExe SKLADm SKLADm - v4.6.2 + v4.8 512 true true + AnyCPU @@ -35,25 +36,63 @@ 4 + + packages\MaterialSkin.2.2.3.1\lib\net48\MaterialSkin.dll + packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll + + packages\System.Drawing.Common.8.0.12\lib\net462\System.Drawing.Common.dll + + packages\System.IO.4.3.0\lib\net462\System.IO.dll + True + + + packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll + True + True + + + packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll + True + True + + + packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net463\System.Security.Cryptography.Algorithms.dll + True + True + + + packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll + True + True + + + packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll + True + True + packages\System.Security.Cryptography.ProtectedData.9.0.4\lib\net462\System.Security.Cryptography.ProtectedData.dll + + packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll + True + True + - diff --git a/packages.config b/packages.config index c09cfa3..e7c9d35 100644 --- a/packages.config +++ b/packages.config @@ -1,10 +1,18 @@  + + + + + + + - + + \ No newline at end of file