コード例 #1
0
        public bool Open()
        {
            try
            {
                application = new AgilentPNA835x.Application(); //is this object obtained by running the PNAproxy script?
                online      = true;
            }
            catch (Exception e)
            {
                StringBuilder sb = new StringBuilder(e.Message);
                if (e.Data != null)
                {
                    sb.Append("  Extra details:");
                    foreach (DictionaryEntry de in e.Data)
                    {
                        sb.AppendFormat("    Key: {0}, Value: {1}" +
                                        de.Key, de.Value);
                    }
                }
                MessageBox.Show(sb.ToString(), "PNA Exception on Connect");

                return(false);
            }

            online = true;
            return(true);
        }
コード例 #2
0
 public void Close()
 {
     if (online)
     {
         this.application.Quit();
         this.application = null;
         online           = false;
     }
 }
コード例 #3
0
 public PNA(string hostname)
 {
     this.hostname = hostname;
     try
     {
         Type t = Type.GetTypeFromProgID("AgilentPNA835x.Application", hostname, true);
         this.app = (AgilentPNA835x.Application)Activator.CreateInstance(t);
         this.app.Reset();
     }
     catch (Exception e)
     {
         Console.WriteLine("An error occured: {0}", e.Message);
     }
 }