private void btnCheck_Click(object sender, EventArgs e) { if (textTestTime.Text.Length == 0 || textUserName.Text.Length == 0 || textUserYearOld.Text.Length == 0) { MessageBox.Show("欄位都為必填!"); return; } string order_id = DateTime.Now.ToString("yyyyMMddHHmmss"); ConfigManager config_manager = new ConfigManager(order_id, outputPath, int.Parse(textTestTime.Text), bluetoothDeviceManager, true, true, textUserName.Text, textUserYearOld.Text); MessageBox.Show("準備好了?確定後開始測試"); ArrayList formList = new ArrayList(); formList.Add(this); Memory m = new Memory(config_manager, formList); m.Location = new Point(0, this.devIndex * 256); this.Close(); }
//private ChartDraw chartDraw = null; public Memory(ConfigManager manager, ArrayList root_f) { InitializeComponent(); this.configManager = manager; // this.TopMost = true; this.rootFrom = root_f; if (!manager.getIsTest()) { string memory = ChromeUtils.memoryURL + configManager.getOrderID(); ChromeUtils.openChrome(memory); } BluetoothDeviceManager deviceManager = manager.getDeviceManager(); FloderUtils folder = new FloderUtils(manager.getPath()); folder.createRoot(); this.runPath = folder.createDeviceFolder(deviceManager.getDeviceAddress(), manager.getOrderID()); this.brainReceiver = new BrainReceiver(deviceManager.getCOM(), brainReiverCallback, sectionReciver, abrainCallback); //this.chartDraw = new ChartDraw(runPath); //chartDraw.Show(); //chartDraw.Location = new Point(0,120); labelDeviceName.Text = deviceManager.getDeviceName() + "(" + deviceManager.getCOM() + ")"; labelMac.Text = deviceManager.getDeviceAddress(); serviceTime = -1; brainReciverRun(); }
public DoTest(ConfigManager manager) { InitializeComponent(); this.configManager = manager; this.TopMost = true; }
public void clientSave(ConfigManager manager) { string path = runPath + Client; if (!File.Exists(path)) { StreamWriter sw = new StreamWriter(path); string orderID = manager.getOrderID(); sw.WriteLine(orderID); string name = manager.getName(); sw.WriteLine(name); string year = manager.getYear(); sw.WriteLine(year); string runTime = manager.getRunTime() + ""; sw.WriteLine(runTime); BluetoothDeviceManager blueManager = manager.getDeviceManager(); string addr = blueManager.getDeviceAddress(); sw.WriteLine(addr); sw.Close(); } }
private void btnCheck_Click(object sender, EventArgs e) { if (outputText.Text.Length == 0) { FolderBrowserDialog path = new FolderBrowserDialog(); path.ShowDialog(); outputText.Text = path.SelectedPath; } if (outputText.Text.Length == 0) { MessageBox.Show("尚未選擇輸出路徑!"); return; } if (textTestTime.Text.Length == 0 || textUserName.Text.Length == 0 || textUserYearOld.Text.Length == 0 || textWordNum.Text.Length == 0) { MessageBox.Show("欄位都為必填!"); return; } ArrayList list = bluetooth_list.getResult(); if (list.Count == 0) { MessageBox.Show("尚未選擇Device!"); return; } ChromeUtils.closeChrome(); Boolean isclient = checkBoxClient.Checked; if (isclient) { BluetoothDeviceManager manager = (BluetoothDeviceManager)list[0]; string order_id = DateTime.Now.ToString("yyyyMMddHHmmss"); ConfigManager config_manager = new ConfigManager(order_id, outputText.Text, int.Parse(textTestTime.Text), manager, true, isclient, textUserName.Text, textUserYearOld.Text); MessageBox.Show("準備好了?確定後開始測試"); ArrayList formList = new ArrayList(); formList.Add(this); formList.Add(bluetooth_list); new Memory(config_manager,formList); } else { BluetoothDeviceManager manager = (BluetoothDeviceManager)list[0]; HttpWorker httpWorker = new HttpWorker(HttpWorker.orderCreate, httpResponse); JSONObject form = new JSONObject(); form.setString("deviceAddress", manager.getDeviceAddress()); form.setString("userName", textUserName.Text); form.setString("userYearOld", textUserYearOld.Text); form.setString("wordNum", textWordNum.Text); form.setString("testTime", textTestTime.Text); httpWorker.setData(form); httpWorker.httpWorker(); WaitDialog.show(); } }
private void httpResponse(JSONObject response) { WaitDialog.close(); int error_code = response.getInt("error_code"); if (error_code == 0) { Boolean isTest = radioTest.Checked; Boolean isclient = checkBoxClient.Checked; ArrayList list = bluetooth_list.getResult(); BluetoothDeviceManager manager = (BluetoothDeviceManager)list[0]; string order_id = response.getString("orderID"); ConfigManager config_manager = new ConfigManager(order_id, outputText.Text, int.Parse(textTestTime.Text), manager, isTest, isclient, textUserName.Text, textUserYearOld.Text); if (!config_manager.getIsTest()) { ShowExDialog.show("第一步、選擇單字", Properties.Resources.choose); string chooseUrl = ChromeUtils.chooseURL + order_id; ChromeUtils.openChrome(chooseUrl); Choose choose = new Choose(config_manager); choose.Show(); choose.Location = new Point(0, 0); this.WindowState = FormWindowState.Minimized; } else { MessageBox.Show("準備好了?確定後開始測試"); ArrayList formList = new ArrayList(); formList.Add(this); formList.Add(bluetooth_list); new Memory(config_manager, formList); } } else { string message = response.getString("message"); MessageBox.Show(message); } }