/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { string fileName = ""; string target = ""; int port = 49152; ParseStd std = ParseStd.SFXSCPI; Console.WriteLine("starting\n"); ScpiCon scpiCon = new ScpiCon(); if (ParseCommandLine(args, ref fileName, ref target, ref port, ref std) == true) { try { Console.WriteLine("Loading Scpi File " + fileName); TextParser parser = new TextParser(fileName, std); Console.WriteLine("Executing Scpi commands"); ScpiTest scpiTest = new ScpiTest(parser, scpiCon, target, port); scpiTest.Run(); Console.WriteLine("Exciting ScpiCon"); } catch (Exception e) { scpiCon.ShowError(e.Message); } } else { scpiCon.ShowError("Invalid command line parameter or option"); string str = "scpicon /f [filename] /t [target machine] "; str += "/p [port, default=49152] /s [0-SCPI, 1-SFXSCPI]"; Console.WriteLine(str); } }
/// <summary> /// launches a thred that runs scpitest. scpitest needs to be tun in a /// seperate thread to enable pause and breakpoint features /// </summary> private void ScpiRunner() { //Always get the curtabpage and work on it instead of directly //working on tabControl.SelectedTab. This helps if the selected //tab chnages evne before the function gets completed //TabPage curTabPage = tabControl.SelectedTab; //ScpiListView curScpilistView = (ScpiListView)curTabPage.Controls[0]; ScpiListView curScpilistView = (ScpiListView)this.Invoke(new GetCurrentListviewDelegate(this.GetCurrentListview), null); TabData tabData = (TabData)this.Invoke(new GetCurTabDataDelegate(this.GetCurTabData), null); try { //AutoResetEvent syncEvent = new AutoResetEvent(false); TextParser parser = new TextParser(curScpilistView, ParseStd.TEK); ScpiTest scpiTest = new ScpiTest(parser, curScpilistView, tabData.machineName, tabData.port); //tabData.syncEvent = syncEvent; scpiTest.Run(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }