Bladeren bron

- Add ResetCfg button to FormLauncher
- Fix loading Variants, Categories from configuration in ProductEditForm

Dalibor Votruba 1 jaar geleden
bovenliggende
commit
bb8ee27270

+ 1 - 1
App.config

@@ -44,7 +44,7 @@
                 <value>True</value>
             </setting>
             <setting name="PredefinedVariants" serializeAs="String">
-                <value>Foto 10x15cm=150;Foto 15x23cm=120;Foto 20x30cm=100;Magnetka 10x13cm=25,Obraz na plátně 30x45cm=250,Hrnek s potiskem=70
+                <value>Foto 10x15cm=150;Foto 15x23cm=120;Foto 20x30cm=100;Magnetka 10x13cm=25;Obraz na plátně 30x45cm=250;Hrnek s potiskem=70
 </value>
             </setting>
             <setting name="PredefinedCategories" serializeAs="String">

+ 14 - 1
FormLauncher.Designer.cs

@@ -32,6 +32,7 @@
             pictureBox1 = new PictureBox();
             butFormBatch = new Button();
             butProductEdit = new Button();
+            butResetCfg = new Button();
             ((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
             SuspendLayout();
             // 
@@ -66,11 +67,22 @@
             butProductEdit.UseVisualStyleBackColor = true;
             butProductEdit.Click += butProductEdit_Click;
             // 
+            // butResetCfg
+            // 
+            butResetCfg.Location = new Point(390, 75);
+            butResetCfg.Name = "butResetCfg";
+            butResetCfg.Size = new Size(72, 25);
+            butResetCfg.TabIndex = 4;
+            butResetCfg.Text = "Reset CFG";
+            butResetCfg.UseVisualStyleBackColor = true;
+            butResetCfg.Click += butResetCfg_Click;
+            // 
             // FormLauncher
             // 
             AutoScaleDimensions = new SizeF(7F, 15F);
             AutoScaleMode = AutoScaleMode.Font;
-            ClientSize = new Size(478, 104);
+            ClientSize = new Size(478, 109);
+            Controls.Add(butResetCfg);
             Controls.Add(butProductEdit);
             Controls.Add(butFormBatch);
             Controls.Add(pictureBox1);
@@ -91,5 +103,6 @@
         private PictureBox pictureBox1;
         private Button butFormBatch;
         private Button butProductEdit;
+        private Button butResetCfg;
     }
 }

+ 10 - 1
FormLauncher.cs

@@ -1,4 +1,5 @@
-using System;
+using qdr.app.studiou.orders2printpack.Properties;
+using System;
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Data;
@@ -33,5 +34,13 @@ namespace qdr.app.studiou.orders2printpack
             var form = new FormProductEdit();
             form.Show(this);
         }
+        
+        private void butResetCfg_Click(object sender, EventArgs e)
+        {
+            AppSettings.Default.Reset();
+            AppSettings.Default.Reload();
+            AppSettings.Default.Save();
+            MessageBox.Show("Konfigurace nastavena do výchozího nastavení.", "Reset konfigurace", MessageBoxButtons.OK, MessageBoxIcon.Information);
+        }
     }
 }

+ 1 - 0
FormProductEdit.cs

@@ -41,6 +41,7 @@ namespace qdr.app.studiou.orders2printpack
             _storage.AppendVariantsFromString(AppSettings.Default.PredefinedVariants);
             _storage.AppendCategoriesFromString(AppSettings.Default.PredefinedCategories);
             tsslblOutput.Text = "Soubor nezadán";
+            RefreshViews();
             RefreshTools();
         }
         #endregion

+ 2 - 2
ProductStorage/ProductStorage.cs

@@ -176,12 +176,12 @@ namespace qdr.app.studiou.orders2printpack.ProductStorage
 
         public string GetVariantsAsString()
         {
-            return string.Join(";", _variants.Select(x => x.ToString()));
+            return string.Join(";", _variants.Select(x => x.Name + "=" + x.Price.ToString()));
         }
 
         public string GetCategoriesAsString()
         {
-            return string.Join(";", _categories.Select(x => x.ToString()));
+            return string.Join(";", _categories.Select(x => x.Name));
         }
 
 

+ 2 - 2
Properties/AppSettings.Designer.cs

@@ -169,8 +169,8 @@ namespace qdr.app.studiou.orders2printpack.Properties {
         
         [global::System.Configuration.UserScopedSettingAttribute()]
         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
-        [global::System.Configuration.DefaultSettingValueAttribute("Foto 10x15cm=150;Foto 15x23cm=120;Foto 20x30cm=100;Magnetka 10x13cm=25,Obraz na p" +
-            "látně 30x45cm=250,Hrnek s potiskem=70\r\n")]
+        [global::System.Configuration.DefaultSettingValueAttribute("Foto 10x15cm=150;Foto 15x23cm=120;Foto 20x30cm=100;Magnetka 10x13cm=25;Obraz na p" +
+            "látně 30x45cm=250;Hrnek s potiskem=70\r\n")]
         public string PredefinedVariants {
             get {
                 return ((string)(this["PredefinedVariants"]));

+ 1 - 1
Properties/AppSettings.settings

@@ -39,7 +39,7 @@
       <Value Profile="(Default)">True</Value>
     </Setting>
     <Setting Name="PredefinedVariants" Type="System.String" Scope="User">
-      <Value Profile="(Default)">Foto 10x15cm=150;Foto 15x23cm=120;Foto 20x30cm=100;Magnetka 10x13cm=25,Obraz na plátně 30x45cm=250,Hrnek s potiskem=70
+      <Value Profile="(Default)">Foto 10x15cm=150;Foto 15x23cm=120;Foto 20x30cm=100;Magnetka 10x13cm=25;Obraz na plátně 30x45cm=250;Hrnek s potiskem=70
 </Value>
     </Setting>
     <Setting Name="PredefinedCategories" Type="System.String" Scope="User">