Exemplo n.º 1
0
 //Force scope mode event from debug Window
 private void ForceScope(object sender, EventArgs e)
 {
     DisableControls();
     scope = (DSO.JyeScope)sender; //event fired from serial config window
     try
     {
         if (scope.Connect())
         {
             lblScopeType.Text = scope.ScopeName;
             PopulateConfig();
             DisplayCurrentParameters();
             SetCurrentWindowSize(10);
             scope.StartCapture();
             EnableControls();
             scope.NewDataInBuffer += Scope_NewDataInBuffer;
             scope.Info            += Scope_Info;
         }
         else
         {
             MessageBox.Show("Cannot establish connection with scope.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); ScopeDispose();
         }
     }catch (Exception ex)
     {
         ErrorHandler("Cannot establish connection with scope.", ex);
     }
 }
Exemplo n.º 2
0
 //tMenuItems
 private void connectToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (port != null)
     {
         try
         {
             DSO.Utilities.SerialPortAdapter adapter = new DSO.Utilities.SerialPortAdapter(port);
             scope = DSO.Initialization.GetScope(adapter);
             if (scope.Connect())
             {
                 lblScopeType.Text = scope.ScopeName;
                 PopulateConfig();
                 DisplayCurrentParameters();
                 SetCurrentWindowSize(10);
                 scope.StartCapture();
                 EnableControls();
                 scope.NewDataInBuffer += Scope_NewDataInBuffer;
                 scope.Info            += Scope_Info;
                 DisplayInfo("Scope connected. Scope type: " + scope.ScopeName);
             }
             else
             {
                 MessageBox.Show("Cannot establish connection with scope.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); ScopeDispose();
             }
         }
         catch (DSO.Exceptions.ScopeNotSupportedException ex)
         {
             ErrorHandler("Cannot establish connection with scope.", ex);
         }
         catch (DSO.Exceptions.ScopeNotRecognizedException ex)
         {
             ErrorHandler("Cannot establish connection with scope.", ex);
         }
         catch (DSO.Exceptions.ScopeNotDetectedException ex)
         {
             ErrorHandler("Cannot establish connection with scope.", ex);
         }
         catch (System.IO.IOException ex)
         {
             ErrorHandler("Cannot establish connection with scope.", ex);
         }
         catch (System.NullReferenceException ex)
         {
             ErrorHandler("Cannot establish connection with scope.", ex);
         }
     }
     else
     {
         DisableControls();
         if (scope != null)
         {
             scope.Dispose();
         }
         MessageBox.Show("Please set serial communication properly", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); ScopeDispose();
     }
 }