コード例 #1
0
        private void connectButton_Click(object sender, EventArgs e)
        {
            if (logbook == null)
            {
                disconnectLogbook = false;
                logbook = new Logbook(logbookPort);

                logbook.CommandResult += new CommandResultEventHandler(logbook_CommandResult);
                logbook.CommandFailed += new CommandFailedEventHandler(logbook_CommandFailed);
                logbook.CommandTimeout += new CommandTimeoutEventHandler(logbook_CommandTimeout);
                logbook.CommandQueueFull += new CommandQueueFullEventHandler(logbook_CommandQueueFull);
                logbook.Disconnected += new EventHandler(logbook_Disconnected);

                log.Append("connectButton_Click", String.Format("Connecting Logbook on {0}", logbookPort));
                try
                {
                    logbook.Activate();
                }
                catch (LogbookConnectionException ex)
                {
                    log.LogException(ex);
                }
            }
            else
            {
                if (!logbook.IsActive)
                {
                    log.Append("connectButton_Click", String.Format("Reactivating Logbook on {0}", logbookPort));
                    logbook.Activate();
                }
            }
        }
コード例 #2
0
 public CommandFailedEventArgs(Logbook.Command command, byte[] data)
 {
     this.command = command;
     this.response = new byte[data.Length];
     Array.Copy(data, response, data.Length);
     this.reason = "";
 }
コード例 #3
0
ファイル: Logbook.cs プロジェクト: MarkPaxton/SensorShare3
        private void LogbookThread()
        {
            logbook = new Logbook(logbookPort);

             logbook.CommandResult += new CommandResultEventHandler(logbook_CommandResult);
             logbook.CommandTimeout += new CommandTimeoutEventHandler(logbook_CommandTimeout);
             logbook.CommandFailed += new CommandFailedEventHandler(logbook_CommandFailed);
             logbook.Disconnected += new EventHandler(logbook_Disconnected);
        }
コード例 #4
0
        public ConnectLogbookForm(Logbook logbook)
        {
            InitializeComponent();
             updateLabel = new LabelTextDelegate(DoUpdateLabel);

             this.logbook = logbook;

             logbook_CommandResultHandler = new CommandResultEventHandler(logbook_CommandResult);
             logbook_CommandFailedHandler = new CommandFailedEventHandler(logbook_CommandFailed);
             logbook_CommandTimeoutHandler = new CommandTimeoutEventHandler(logbook_CommandTimeout);
             logbook_DisconnectedHandler = new EventHandler(logbook_Disconnected);
             activateTimerCallback += new TimerCallback(activateTimerPing);

             logbook.CommandResult += logbook_CommandResultHandler;
             logbook.CommandFailed += logbook_CommandFailedHandler;
             logbook.CommandTimeout += logbook_CommandTimeoutHandler;
             logbook.Disconnected += logbook_DisconnectedHandler;

             if (logbook.IsActive)
             {
            UpdateLabel(statusLabel, "Connected");
             }
        }
コード例 #5
0
 //Constructor.
 public CommandQueueFullEventArgs(Logbook.Command command)
 {
     failedCommand = command;
 }
コード例 #6
0
 public CommandFailedEventArgs(Logbook.Command command)
 {
     this.command = command;
     this.response = new byte[0];
     this.reason = "";
 }
コード例 #7
0
        //Constructor.
        public CommandTimeoutEventArgs(Logbook.Command command, byte[] responseSoFar)
        {
            failedCommand = command;

            failedResponse = new byte[responseSoFar.Length];
            failedResponse = responseSoFar;
        }
コード例 #8
0
 //Constructor.
 public CommandResultEventArgs(byte[] resultGot, Logbook.Command newCommand)
 {
     result = new byte[resultGot.Length];
     result = resultGot;
     command = newCommand;
 }
コード例 #9
0
ファイル: Logbook.cs プロジェクト: MarkPaxton/SensorShare3
        private void logbook_sendCommand(Logbook.Command command)
        {
            try
             {
            if (logbook.IsActive)
            {
               log.Append("logbook_sendCommand", String.Format("Sending {0}", command.name));
               if (logbookConnectionError)
               {
                  log.Append("logbook_sendCommand", "Logbook connection error - reconnecting");
                  logbook.reconnect();
                  logbookConnectionError = false;

               }
               logbook.sendCommand(command);
            }
             }
             catch (Exception ex)
             {
            logbookConnectionError = true;
            log.LogException(ex);
             }
        }
コード例 #10
0
        private void DesktopLogbookTest_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (logbook != null)
            {
                if (logbook.IsActive)
                {
                    log.Append("DesktopLogbookTest_FormClosing", "Deactivating Logbook");
                    logbook.Deactivate();
                    logbook = null;
                }

            }
        }
コード例 #11
0
ファイル: TestForm.cs プロジェクト: MarkPaxton/SensorShare3
 private void LogbookThread()
 {
     logbook = new Logbook(logbookPort);
 }