Galil.Galil g = new Galil.Galil(); //Dimension g variable for instantiated object private void Form1_Load(object sender, EventArgs e) { try { g.address = ""; //connect to controller this.Text = g.connection(); //print connection information to form titlebar //UI is supported on DMC40x0, DMC41x3, DMC18x6, DMC18x2, DMC30010 //if controller does not support UI, leave UIi out of the program //download asynchronous message progam g.programDownload("i=0\rMG\"Message\",i;WT100;UIi;i=i+1;JP1"); g.command("XQ"); //start the asynchronous message program g.recordsStart(100); //start records argument is period in ms g.onRecord += new Galil.Events_onRecordEventHandler(g_onRecord); //bing record event g.onMessage += new Galil.Events_onMessageEventHandler(g_onMessage); //bind message event g.onInterrupt += new Galil.Events_onInterruptEventHandler(g_onInterrupt); //bind interrupt event } catch (System.Runtime.InteropServices.COMException ex) //catch any errors { textBox1.AppendText(ex.Message + Environment.NewLine); //append any errors to the textbox text } }
private string ReadCommand(string command) { string ret = string.Empty; if (IsInRead) { return(ret); } IsInRead = true; try { if (gALIL == null) { Connect(); } //ret = gALIL.read(command); ret = gALIL.command(command, "\r", ":", true); } catch (Exception ex) { LogHelper.AppLoger.Error(ex); } finally { IsInRead = false; } return(ret); }
private void Form1_Load(object sender, EventArgs e) { try { g = new Galil.Galil(); //create a new object label1.Text = g.libraryVersion() + Environment.NewLine; //print libarary version g.address = ""; //connect to controller label1.Text += g.connection() + Environment.NewLine; //print connection in label1 label1.Text += "MG TIME " + g.command("MG TIME"); } catch (System.Runtime.InteropServices.COMException ex) { label1.Text += ex.Message; } }