public virtual void disposeVISASession()
 {
     try
     {
         if (deviceSession != null)
         {
             deviceSession.Dispose();
             sessionCommType = commType.none;
             sessionInitialised = false;
             VISAResourceName = "";
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine(e.Message);
     }
 }
 /// <summary>
 /// Initialize the VISA communication
 /// </summary>
 /// <param name="resourceName">VISA resource name</param>
 public virtual void initVISASession(string resourceName,bool developmentMode=false)
 {
     if (developmentMode == false)
     {
         try
         {
             VISAResourceName = resourceName;
             deviceSession = (MessageBasedSession)ResourceManager.GetLocalManager().Open(resourceName);
             sessionCommType = commType.VISA;
             sessionInitialised = true;
         }
         catch (InvalidCastException)
         {
             Debug.WriteLine("Resource selected must be a message-based session");
             sessionInitialised = false;
             sessionCommType = commType.none;
         }
         catch (Exception exp)
         {
             Debug.WriteLine(exp.Message);
             System.Windows.Forms.MessageBox.Show(VISAResourceName + " initialization fails");
             System.Windows.Forms.MessageBox.Show(exp.Message);
             sessionInitialised = false;
             sessionCommType = commType.none;
         }
         finally
         {
             //Cursor.Current = Cursors.Default;
         }
     }
     else
     {
         sessionInitialised = false;
         sessionCommType = commType.none;
     }
 }
 public virtual void disableVISASession()
 {
     sessionInitialised = false;
     sessionCommType = commType.none;
 }