OSDN Git Service

Validate the specified interval in OptionDialog
authorKazuhiro <fujieda@users.osdn.me>
Mon, 21 Sep 2015 14:22:14 +0000 (23:22 +0900)
committerKazuhiro <fujieda@users.osdn.me>
Tue, 22 Sep 2015 09:02:53 +0000 (18:02 +0900)
BurageSnap/OptionDialog.Designer.cs
BurageSnap/OptionDialog.cs
BurageSnap/OptionDialog.resx
BurageSnap/Properties/Resources.Designer.cs
BurageSnap/Properties/Resources.ja.resx
BurageSnap/Properties/Resources.resx

index 64501fe..6ab7dac 100644 (file)
@@ -45,6 +45,7 @@ namespace BurageSnap
         /// </summary>
         private void InitializeComponent()
         {
+            this.components = new System.ComponentModel.Container();
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OptionDialog));
             this.label3 = new System.Windows.Forms.Label();
             this.textBoxFolder = new System.Windows.Forms.TextBox();
@@ -58,6 +59,8 @@ namespace BurageSnap
             this.checkBoxTopMost = new System.Windows.Forms.CheckBox();
             this.folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
             this.comboBoxWindowTitle = new System.Windows.Forms.ComboBox();
+            this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
+            ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
             this.SuspendLayout();
             // 
             // label3
@@ -84,6 +87,7 @@ namespace BurageSnap
             // 
             resources.ApplyResources(this.textBoxInterval, "textBoxInterval");
             this.textBoxInterval.Name = "textBoxInterval";
+            this.textBoxInterval.Validating += new System.ComponentModel.CancelEventHandler(this.textBoxInterval_Validating);
             // 
             // label1
             // 
@@ -124,6 +128,10 @@ namespace BurageSnap
             resources.ApplyResources(this.comboBoxWindowTitle, "comboBoxWindowTitle");
             this.comboBoxWindowTitle.Name = "comboBoxWindowTitle";
             // 
+            // errorProvider
+            // 
+            this.errorProvider.ContainerControl = this;
+            // 
             // OptionDialog
             // 
             this.AcceptButton = this.buttonOk;
@@ -146,6 +154,7 @@ namespace BurageSnap
             this.Name = "OptionDialog";
             this.ShowIcon = false;
             this.Load += new System.EventHandler(this.OptionDialog_Load);
+            ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
             this.ResumeLayout(false);
             this.PerformLayout();
 
@@ -165,5 +174,6 @@ namespace BurageSnap
         private System.Windows.Forms.CheckBox checkBoxTopMost;
         private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog;
         private System.Windows.Forms.ComboBox comboBoxWindowTitle;
+        private System.Windows.Forms.ErrorProvider errorProvider;
     }
 }
\ No newline at end of file
index ac11e54..4a95a27 100644 (file)
 // along with this program; if not, see <http://www.gnu.org/licenses/>.
 
 using System;
+using System.ComponentModel;
 using System.Linq;
 using System.Windows.Forms;
+using BurageSnap.Properties;
 
 namespace BurageSnap
 {
@@ -67,5 +69,17 @@ namespace BurageSnap
             textBoxFolder.Text = folderBrowserDialog.SelectedPath;
             textBoxFolder.Select(textBoxFolder.TextLength, 0);
         }
+
+        private void textBoxInterval_Validating(object sender, CancelEventArgs e)
+        {
+            int interval;
+            if (int.TryParse(textBoxInterval.Text, out interval) && 0 < interval && interval < 1000 * 1000)
+            {
+                errorProvider.SetError(textBoxInterval, "");
+                return;
+            }
+            e.Cancel = true;
+            errorProvider.SetError(textBoxInterval, Resources.OptionDialog_textBoxInterval_Validating_Interval);
+        }
     }
 }
\ No newline at end of file
index 1526cb3..449acc3 100644 (file)
   <data name="&gt;&gt;comboBoxWindowTitle.ZOrder" xml:space="preserve">
     <value>0</value>
   </data>
-  <metadata name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>ja</value>
+  <metadata name="errorProvider.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>190, 22</value>
   </metadata>
   <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   <data name="&gt;&gt;folderBrowserDialog.Type" xml:space="preserve">
     <value>System.Windows.Forms.FolderBrowserDialog, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
+  <data name="&gt;&gt;errorProvider.Name" xml:space="preserve">
+    <value>errorProvider</value>
+  </data>
+  <data name="&gt;&gt;errorProvider.Type" xml:space="preserve">
+    <value>System.Windows.Forms.ErrorProvider, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
   <data name="&gt;&gt;$this.Name" xml:space="preserve">
     <value>OptionDialog</value>
   </data>
index 68fc622..2cc3751 100644 (file)
@@ -116,5 +116,14 @@ namespace BurageSnap.Properties {
                 return ResourceManager.GetString("FormMain_checkBoxContinuous_CheckedChanged_Capture", resourceCulture);
             }
         }
+        
+        /// <summary>
+        ///   Interval must be in the range of 1 ms to 1000 sec. に類似しているローカライズされた文字列を検索します。
+        /// </summary>
+        internal static string OptionDialog_textBoxInterval_Validating_Interval {
+            get {
+                return ResourceManager.GetString("OptionDialog_textBoxInterval_Validating_Interval", resourceCulture);
+            }
+        }
     }
 }
index 18a988b..3557d97 100644 (file)
   <data name="FormMain_checkBoxContinuous_CheckedChanged_Capture" xml:space="preserve">
     <value>キャプチャ</value>
   </data>
+  <data name="OptionDialog_textBoxInterval_Validating_Interval" xml:space="preserve">
+    <value>間隔は1msから1000秒の間で指定してください。</value>
+  </data>
 </root>
\ No newline at end of file
index cb75c92..7ec9a84 100644 (file)
   <data name="FormMain_checkBoxContinuous_CheckedChanged_Capture" xml:space="preserve">
     <value>Capture</value>
   </data>
+  <data name="OptionDialog_textBoxInterval_Validating_Interval" xml:space="preserve">
+    <value>Interval must be in the range of 1 ms to 1000 sec.</value>
+  </data>
 </root>
\ No newline at end of file