private void Form1_Load(object sender, EventArgs e) { btn_start.Tag = "STOP"; if (!File.Exists("Settings.ini")) { FileStream fs = File.Create("Settings.ini"); fs.Close(); } IniFile iniFile = new IniFile(); iniFile.Load("Settings.ini"); if (iniFile["Setting"]["FieldNo"].ToString() == null || iniFile["Setting"]["Interval"].ToString() == null) { MessageBox.Show("초기 환경설정이 필요합니다. 환경설정으로 이동합니다.", "환경설정 필요", MessageBoxButtons.OK, MessageBoxIcon.Information); if (new SettingForm().ShowDialog() != DialogResult.OK) { this.Close(); return; } } else { GLOBAL.FieldNo = iniFile["Setting"]["FieldNo"].ToString(); int.TryParse(iniFile["Setting"]["Interval"].ToString(), out GLOBAL.Interval); string response = GLOBAL.HttpWebRequest("http://198.13.51.149/gytech/getsensorlist.php"); JObject resobj = JObject.Parse(response); JArray arr_fields = (JArray)resobj["FieldList"]; foreach (JObject field in arr_fields) { if (field["No"].ToString().Equals(GLOBAL.FieldNo.ToString())) { GLOBAL.FieldName = field["FieldName"].ToString(); break; } } } lbl_fieldname.Text = "현장명 : " + GLOBAL.FieldName; lbl_filepath.Text = iniFile["Setting"]["FileName"].ToString(); }
private void SettingForm_Load(object sender, EventArgs e) { string response = GLOBAL.HttpWebRequest("http://198.13.51.149/gytech/getfieldlist.php"); JObject resobj = JObject.Parse(response); JArray arr_fieldlist = (JArray)resobj["FieldList"]; Fields.Clear(); foreach (JObject field in arr_fieldlist) { listBox1.Items.Add(field["FieldName"].ToString()); Fields.Add(field); } UploadIntervals[0] = 300; UploadIntervals[1] = 600; UploadIntervals[2] = 900; UploadIntervals[3] = 1800; UploadIntervals[4] = 3600; UploadIntervals[5] = -1; }