Commit 32251bedc142ec89942baf5923c55e73a697682a

Authored by r-ujihara
1 parent fbff54ee

行政区コード入力方式変更

@@ -38,6 +38,7 @@ @@ -38,6 +38,7 @@
38 this.button2 = new System.Windows.Forms.Button(); 38 this.button2 = new System.Windows.Forms.Button();
39 this.label4 = new System.Windows.Forms.Label(); 39 this.label4 = new System.Windows.Forms.Label();
40 this.comboBox4 = new System.Windows.Forms.ComboBox(); 40 this.comboBox4 = new System.Windows.Forms.ComboBox();
  41 + this.textBox1 = new System.Windows.Forms.TextBox();
41 this.SuspendLayout(); 42 this.SuspendLayout();
42 // 43 //
43 // comboBox1 44 // comboBox1
@@ -93,7 +94,7 @@ @@ -93,7 +94,7 @@
93 // 94 //
94 // button1 95 // button1
95 // 96 //
96 - this.button1.Location = new System.Drawing.Point(15, 191); 97 + this.button1.Location = new System.Drawing.Point(12, 212);
97 this.button1.Name = "button1"; 98 this.button1.Name = "button1";
98 this.button1.Size = new System.Drawing.Size(105, 58); 99 this.button1.Size = new System.Drawing.Size(105, 58);
99 this.button1.TabIndex = 6; 100 this.button1.TabIndex = 6;
@@ -103,7 +104,7 @@ @@ -103,7 +104,7 @@
103 // 104 //
104 // button2 105 // button2
105 // 106 //
106 - this.button2.Location = new System.Drawing.Point(167, 191); 107 + this.button2.Location = new System.Drawing.Point(167, 212);
107 this.button2.Name = "button2"; 108 this.button2.Name = "button2";
108 this.button2.Size = new System.Drawing.Size(105, 58); 109 this.button2.Size = new System.Drawing.Size(105, 58);
109 this.button2.TabIndex = 7; 110 this.button2.TabIndex = 7;
@@ -123,16 +124,26 @@ @@ -123,16 +124,26 @@
123 // comboBox4 124 // comboBox4
124 // 125 //
125 this.comboBox4.FormattingEnabled = true; 126 this.comboBox4.FormattingEnabled = true;
126 - this.comboBox4.Location = new System.Drawing.Point(96, 132); 127 + this.comboBox4.Location = new System.Drawing.Point(96, 157);
127 this.comboBox4.Name = "comboBox4"; 128 this.comboBox4.Name = "comboBox4";
128 this.comboBox4.Size = new System.Drawing.Size(176, 20); 129 this.comboBox4.Size = new System.Drawing.Size(176, 20);
129 this.comboBox4.TabIndex = 9; 130 this.comboBox4.TabIndex = 9;
130 // 131 //
  132 + // textBox1
  133 + //
  134 + this.textBox1.Location = new System.Drawing.Point(96, 132);
  135 + this.textBox1.MaxLength = 5;
  136 + this.textBox1.Name = "textBox1";
  137 + this.textBox1.Size = new System.Drawing.Size(100, 19);
  138 + this.textBox1.TabIndex = 10;
  139 + this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
  140 + //
131 // Form1 141 // Form1
132 // 142 //
133 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 143 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
134 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 144 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
135 - this.ClientSize = new System.Drawing.Size(284, 261); 145 + this.ClientSize = new System.Drawing.Size(284, 282);
  146 + this.Controls.Add(this.textBox1);
136 this.Controls.Add(this.comboBox4); 147 this.Controls.Add(this.comboBox4);
137 this.Controls.Add(this.label4); 148 this.Controls.Add(this.label4);
138 this.Controls.Add(this.button2); 149 this.Controls.Add(this.button2);
@@ -162,6 +173,7 @@ @@ -162,6 +173,7 @@
162 private System.Windows.Forms.Button button2; 173 private System.Windows.Forms.Button button2;
163 private System.Windows.Forms.Label label4; 174 private System.Windows.Forms.Label label4;
164 private System.Windows.Forms.ComboBox comboBox4; 175 private System.Windows.Forms.ComboBox comboBox4;
  176 + private System.Windows.Forms.TextBox textBox1;
165 } 177 }
166 } 178 }
167 179
@@ -16,6 +16,7 @@ namespace MedicalCheckInputTool @@ -16,6 +16,7 @@ namespace MedicalCheckInputTool
16 public partial class Form1 : Form 16 public partial class Form1 : Form
17 { 17 {
18 private healthAreaSet haSet = null; 18 private healthAreaSet haSet = null;
  19 + private adminNameSet anSet = null;
19 20
20 public Form1() 21 public Form1()
21 { 22 {
@@ -67,6 +68,7 @@ namespace MedicalCheckInputTool @@ -67,6 +68,7 @@ namespace MedicalCheckInputTool
67 68
68 readFile(); 69 readFile();
69 70
  71 +
70 } 72 }
71 73
72 private void button1_Click(object sender, EventArgs e) 74 private void button1_Click(object sender, EventArgs e)
@@ -129,19 +131,14 @@ namespace MedicalCheckInputTool @@ -129,19 +131,14 @@ namespace MedicalCheckInputTool
129 var settings = new DataContractJsonSerializerSettings(); 131 var settings = new DataContractJsonSerializerSettings();
130 settings.UseSimpleDictionaryFormat = true; 132 settings.UseSimpleDictionaryFormat = true;
131 var serializer = new DataContractJsonSerializer(typeof(adminNameSet), settings); 133 var serializer = new DataContractJsonSerializer(typeof(adminNameSet), settings);
132 - adminNameSet data = null;  
133 using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(text))) 134 using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(text)))
134 { 135 {
135 - data = (adminNameSet)serializer.ReadObject(ms); 136 + anSet = (adminNameSet)serializer.ReadObject(ms);
136 } 137 }
137 138
138 comboBox4.Items.Add(""); 139 comboBox4.Items.Add("");
139 - foreach (var p in data.adminName)  
140 - {  
141 - comboBox4.Items.Add(p.Key + ":" + p.Value);  
142 - }  
143 -  
144 comboBox4.DropDownStyle = ComboBoxStyle.DropDownList; 140 comboBox4.DropDownStyle = ComboBoxStyle.DropDownList;
  141 + comboBox4.SelectedIndex = 0; // 先頭の項目を選択
145 142
146 //保健区読み込み 143 //保健区読み込み
147 string text2 = File.ReadAllText(@"healthArea.json", Encoding.GetEncoding("shift_jis")); 144 string text2 = File.ReadAllText(@"healthArea.json", Encoding.GetEncoding("shift_jis"));
@@ -175,5 +172,31 @@ namespace MedicalCheckInputTool @@ -175,5 +172,31 @@ namespace MedicalCheckInputTool
175 frm.Dispose(); 172 frm.Dispose();
176 173
177 } 174 }
  175 +
  176 + private void textBox1_TextChanged(object sender, EventArgs e)
  177 + {
  178 + comboBox4.Items.Clear();
  179 +
  180 + if (textBox1.Text.Length == 4 || textBox1.Text.Length == 5)
  181 + {
  182 + string key = textBox1.Text.PadLeft(6, '0');
  183 +
  184 + if (anSet.adminName.ContainsKey(key))
  185 + {
  186 + string value = anSet.adminName[key];
  187 + comboBox4.Items.Add(key + ":" + value);
  188 + }
  189 + else
  190 + {
  191 + comboBox4.Items.Add("");
  192 + }
  193 + }
  194 + else
  195 + {
  196 + comboBox4.Items.Add("");
  197 + }
  198 + comboBox4.SelectedIndex = 0; // 先頭の項目を選択
  199 +
  200 + }
178 } 201 }
179 } 202 }
Please register or login to post a comment