private void GenerateProject() { FormDevice formDevice1 = null; FormDevice formDevice2 = null; ScriptGenerate.TpLocatorEstrategy locatorEstrategy = ScriptGenerate.TpLocatorEstrategy.IndividualExpression; if (rbCombinedExpInOrder.Checked) { locatorEstrategy = ScriptGenerate.TpLocatorEstrategy.CombinedExpressionsInOrder; } else if (rbCombinedExpMultiLocator.Checked) { locatorEstrategy = ScriptGenerate.TpLocatorEstrategy.CombinedExpressionsMultiLocator; } if (cbCRef1.SelectedIndex > -1) { formDevice1 = FormMain.FormDevices[_cbCRef1Index[cbCRef1.SelectedIndex]]; } if (cbCRef2.SelectedIndex > -1) { formDevice2 = FormMain.FormDevices[_cbCRef2Index[cbCRef2.SelectedIndex]]; } if (formDevice1 == null || formDevice2 == null) { MessageBox.Show("Select two devices."); return; } string msg = ""; if (!MyNode.CheckDeviceConfigCompatibility(formDevice1.DeviceConfig, formDevice2.DeviceConfig, out msg)) { MessageBox.Show(msg); return; } try { this.Cursor = Cursors.WaitCursor; string dirProject = Support.ScriptGenerate.GenerateVisualStudioProjectTest(formDevice1.DeviceConfig, formDevice2.DeviceConfig, locatorEstrategy, (XPathSelector.XPathType)cbIndividualExp.SelectedItem); System.Diagnostics.Process.Start(dirProject); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { this.Cursor = Cursors.Default; } }
private void newDeviceToolStripMenuItem_Click(object sender, EventArgs e) { FormDevice f = new FormDevice(); f.Text = "Device " + (FormDevices.Count + 1); FormDevices.Add(f); f.MdiParent = this; f.Show(); }
private void btnCompare_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; FormDevice formDevice1 = null; FormDevice formDevice2 = null; if (cbCRef1.SelectedIndex > -1) { formDevice1 = FormMain.FormDevices[_cbCRef1Index[cbCRef1.SelectedIndex]]; } if (cbCRef2.SelectedIndex > -1) { formDevice2 = FormMain.FormDevices[_cbCRef2Index[cbCRef2.SelectedIndex]]; } if (formDevice1 == null || formDevice2 == null) { MessageBox.Show("Select two devices."); } else { string msg = ""; Support.MyNode.CompareStates(formDevice1.DeviceConfig, formDevice2.DeviceConfig, ckTextSimilarity.Checked, ckScreenshotSimilarity.Checked, ckOCRSimilarity.Checked, out msg); if (msg != "") { MessageBox.Show(msg); } else { tbOutput.Text = Support.MyNode.CompareStatesGenerateOutPut(formDevice1.DeviceConfig, formDevice2.DeviceConfig, ckTextSimilarity.Checked, ckScreenshotSimilarity.Checked, ckOCRSimilarity.Checked); MessageBox.Show("Finish."); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { this.Cursor = Cursors.Default; } }