Пример #1
0
        private void OnRenamed(object source, RenamedEventArgs e)
        {
            string oldPath  = e.OldFullPath;
            string newPath  = e.FullPath;
            string filename = Path.GetFileName(oldPath);
            string changed  = e.ChangeType.ToString();
            string ext      = Path.GetExtension(newPath);
            // currTime.LastAccessTIme will have a data type of DateTime
            FileInfo currTime = new FileInfo(oldPath);
            string   message  = "File: " + filename + " Renamed "
                                + Path.GetFileName(newPath) + " Path: " + newPath + " " +
                                e.ChangeType + " Date: " + currTime.LastAccessTime;

            // Allows for the writing of text to a textbox,
            // i.e. safe hadling of CrossThreadException.
            ObjectDelegate del = new ObjectDelegate(UpdateTextBox);

            del.Invoke(message);

            // Adds a row to the table with the info on the renamed file.
            if (filesWatchedTable == null)
            {
                createTable();
            }
            row = filesWatchedTable.NewRow();
            row["file_name"]      = filename;
            row["path_name"]      = newPath;
            row["event_occurred"] = changed;
            row["day_time"]       = currTime.LastAccessTime;
            row["extension"]      = ext;
            filesWatchedTable.Rows.Add(row);
        }
Пример #2
0
        private void RecvPub(IAsyncResult res) // Function used to handle received UDP messages
        {
            IPEndPoint recv = new IPEndPoint(IPAddress.Any, PUBLISH_PORT_NUMBER);

            byte[] message = null;
            string dmessage;

            if (!isClosing)
            {
                message = pub.EndReceive(res, ref recv);
            }

            if (message != null) // If a message was received
            {
                ObjectDelegate del = new ObjectDelegate(HandleUDPDatagram);
                dmessage = Encoding.ASCII.GetString(message);
                del.Invoke(dmessage, recv);
                HandleUDPDatagram(dmessage, recv);
            }

            if (!isClosing)
            {
                pub.BeginReceive(new AsyncCallback(RecvPub), null);
            }
        }
Пример #3
0
 private void onClick(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Q)
     {
         inventoryActive = !inventoryActive;
         if (inventoryActive)
         {
             listBox2.SelectedIndex = 0;
         }
         else
         {
             listBox2.SelectedIndex = -1;
         }
     }
     if (inventoryActive)
     {
         ObjectDelegate del = new ObjectDelegate(inventoryHandler);
         del.Invoke(sender, e);
     }
     else
     {
         listBox2.SelectedIndex = -1; // erase inventory interaction
         ObjectDelegate del = new ObjectDelegate(keyPressHandler);
         del.Invoke(sender, e);
     }
 }
Пример #4
0
        private void OnChanged(object source, FileSystemEventArgs e)
        {
            string pathName = e.FullPath;
            string filename = Path.GetFileName(pathName);
            string changed  = e.ChangeType.ToString();
            string ext      = Path.GetExtension(pathName);
            // currTime.LastAccessTIme will have a data type of DateTime
            FileInfo currTime = new FileInfo(pathName);

            //Builds the message to be displayed in the textbox
            string message = "File: " + filename +
                             " Path: " + pathName + " " + changed + " Date: " + currTime.LastAccessTime;

            // Allows for the writing of text to a textbox,
            // i.e. safe hadling of CrossThreadException.
            ObjectDelegate del = new ObjectDelegate(UpdateTextBox);

            del.Invoke(message);

            // Adds a row to the table with the info on the changes to a file.
            if (filesWatchedTable == null)
            {
                createTable();
            }
            row = filesWatchedTable.NewRow();
            row["file_name"]      = filename;
            row["path_name"]      = pathName;
            row["event_occurred"] = changed;
            row["day_time"]       = currTime.LastAccessTime;
            row["extension"]      = ext;
            filesWatchedTable.Rows.Add(row);
        }
Пример #5
0
        /// <summary>
        /// This event handler is called whenever the 1 second CPU timer elapses. It calls the 
        /// SetText method in a thread safe manner in order to update the CPU usage text box.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        private void OnTimedEvent(object source, System.Timers.ElapsedEventArgs e)
        {
            PerformanceCounter cpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total");
            int cpu = (int)cpuCounter.NextValue();
            System.Threading.Thread.Sleep(1000);
            cpu = (int)cpuCounter.NextValue();
            _cpuUsage = cpu;

            ObjectDelegate cpuTextDel = new ObjectDelegate(SetCPUText);    //enable the manual start button
            cpuTextDel.Invoke(_cpu);
        }
Пример #6
0
        private void button3_Click(object sender, EventArgs ef)
        {
            if (!isValidated)
            {
                MessageBox.Show("Validate First Please");
                return;
            }
            if (channelList.CheckedItems.Count < 1)
            {
                MessageBox.Show("No Channels Selected");
                return;
            }
            if (outputFolderOpener.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            string         p   = outputFolderOpener.SelectedPath; //System.IO.Path.GetDirectoryName(sdCard1.FileName);
            ObjectDelegate del = new ObjectDelegate(writeLog);

            del.Invoke(DateTime.Now + " Saving to " + p);

            /*
             * Thread DoItThread = new Thread(() =>
             * {
             *  DoIt(p,del);
             * });
             */
            bw.WorkerReportsProgress = true;
            //bw.
            //bw.RunWorkerCompleted += Bw_RunWorkerCompleted; //DoIt_Done();

            if (!bwInit)
            {
                bw.RunWorkerCompleted += Bw_RunWorkerCompleted;
                bw.ProgressChanged    += Bw_Update1;
                bw.DoWork             += (obj, e) => DoIt(obj, e, p, del);
                bwInit = true;
            }
            //bw.ProgressChanged += Bw_Update1;
            //object d = new{ p, del };
            //DoItThread.
            button1.Enabled = false;
            button2.Enabled = false;
            button3.Enabled = false;
            button4.Enabled = false;
            button5.Enabled = false;
            if (pf.IsDisposed)
            {
                pf = new progressForm();
            }
            pf.Show();
            bw.RunWorkerAsync();
            //DoItThread.Start();
        }
Пример #7
0
        private void HandleClientComm(object client)
        {
            TcpClient     tcpClient    = (TcpClient)client;
            NetworkStream clientStream = tcpClient.GetStream();

            byte[] message = new byte[4096];
            int    bytesRead;

            while (true)
            {
                bytesRead = 0;
                try
                {
                    //blocks until a client sends a message
                    bytesRead = clientStream.Read(message, 0, 4096);
                }
                catch
                {
                    //a socket error has occured
                    break;
                }
                if (bytesRead == 0)
                {
                    //the client has disconnected from the server
                    break;
                }
                //message has successfully been received
                String text = getData(clientStream);
                del.Invoke(text); //Used for Cross Threading & sending text to server output
                //if filter(text)
                sendMessage(tcpClient);
                //System.Diagnostics.Debug.WriteLine(text); //Spit it out in the console
            }

            tcpClient.Close();
        }
Пример #8
0
        private void WorkThread(object obj)
        {
            ObjectDelegate del = (ObjectDelegate)obj;

            while (true)
            {
                if (!s.Connected)
                {
                    continue;
                }

                byte[] b = new byte[100];
                int    k = s.Receive(b);

                String rcv = "";
                for (int i = 0; i < k; i++)
                {
                    rcv += Convert.ToChar(b[i]);
                }

                del.Invoke(rcv);
            }
        }
Пример #9
0
        private void WorkThread(object obj)
        {
            ObjectDelegate del = (ObjectDelegate)obj;

            while (true)
            {
                if (stm == null)
                {
                    continue;
                }

                byte[] bb = new byte[100];
                int    k  = stm.Read(bb, 0, 100);

                String rcv = "";
                for (int i = 0; i < k; i++)
                {
                    rcv += Convert.ToChar(bb[i]);
                }

                del.Invoke(rcv);
            }
        }
Пример #10
0
        /*        private void DoIt_Updated(int file,float percent)
         *      {
         *         // progressForm.
         *          //throw new NotImplementedException();
         *      }
         */
        void DoIt(object sender, DoWorkEventArgs e, string p, object obj)
        {
            ObjectDelegate del = (ObjectDelegate)obj;


            // riff + totallen-8 + wav + 4 * totalframes
            //totallen x-38
            //uint dataLen = totalFrames * 4;
            uint dataLen  = totalFrames * 3; //test 24 bit mode
            uint totalLen = dataLen + 38;

            bufferFact = (int)bufferSeconds.Value * (int)bitRate1;
            bufferIter = (int)bitRate1;

            //0x80, 0xBB, 0x00, 0x00
            //byte[] wav2 = new byte[] { 0x00, 0xDC, 0x05, 0x00, 0x04, 0x00, 0x20, 0x00, 0x64, 0x61, 0x74, 0x61 };

            BinaryWriter[] bwa = new BinaryWriter[32];

            foreach (int cl in channelList.CheckedIndices)
            {
                bwa[cl] = new BinaryWriter(File.OpenWrite(p + "\\" + channelList.Items[cl] + ".wav"));
            }

            foreach (BinaryWriter b in bwa)
            {
                if (b == null)
                {
                    continue;
                }
                Write_Wav_Header(b, bitRate1, totalLen, dataLen);
            }

            inBuf = new List <byte[]>();
            for (int x = 0; x < bufferFact; x++)
            {
                inBuf.Add(new byte[] { });
            }
            int tick = 0;

            bw.ReportProgress(0, new Bwu(2, "", tick++, fileList.Items.Count));
            foreach (string f in fileList.Items)
            {
                bw.ReportProgress(0, new Bwu(2, f, -1, -1));
                //StreamReader sr = new StreamReader(f);
                BinaryReader br = new BinaryReader(File.OpenRead(f));
                br.ReadBytes(32760);
                string head = br.ReadChars(4).ToString();
                uint   i    = br.ReadUInt32(); //read the datasize chunk
                i = i / ((uint)channels1 * 4); // 4 32bit samples per channel
                del.Invoke(DateTime.Now + " Processing->" + f);
                byte[] dataBuf = new byte[channels1 * 4];
                byte[] intBuf  = new byte[bufferFact * 3]; // test 24 bit

                for (int r = 0; r < i; r += bufferFact)
                {
                    bw.ReportProgress(0, new Bwu(1, r + " of " + i, r, (int)i));
                    if ((i - r) < bufferFact)
                    {
                        for (int x = 0; x < (i - r); x++)
                        {
                            inBuf[x] = br.ReadBytes(channels1 * 4);
                        }
                        foreach (int cl in channelList.CheckedIndices)
                        {
                            for (int xy = 0; xy < (i - r); xy++)
                            {
                                inBuf[xy].CopyTo(dataBuf, 0);
                                intBuf[xy * 3]     = dataBuf[1 + cl * 4];
                                intBuf[xy * 3 + 1] = dataBuf[2 + cl * 4];
                                intBuf[xy * 3 + 2] = dataBuf[3 + cl * 4];
                            }
                            bwa[cl].Write(intBuf, 0, ((int)i - r) * 3);
                        }
                    }
                    else
                    {
                        for (int x = 0; x < bufferFact; x++)
                        {
                            inBuf[x] = br.ReadBytes(channels1 * 4);
                        }
                        foreach (int cl in channelList.CheckedIndices)
                        {
                            for (int xy = 0; xy < bufferFact; xy++)
                            {
                                inBuf[xy].CopyTo(dataBuf, 0);
                                intBuf[xy * 3]     = dataBuf[1 + cl * 4];
                                intBuf[xy * 3 + 1] = dataBuf[2 + cl * 4];
                                intBuf[xy * 3 + 2] = dataBuf[3 + cl * 4];
                            }
                            bwa[cl].Write(intBuf);
                        }
                    }
                    bw.ReportProgress(0, new Bwu(1, r + " of " + i, r, -1));
                }

                bw.ReportProgress(0, new Bwu(1, i + " of " + i, (int)i, -1));
                bw.ReportProgress(0, new Bwu(2, tick + " of " + fileList.Items.Count, tick++, -1));
                del.Invoke(DateTime.Now + " Complete->" + f);
            }

            foreach (int cl in channelList.CheckedIndices)
            {
                bwa[cl].Close();
                try
                {
                    bwa[cl].Dispose();
                }
                catch (Exception E)
                {
                    MessageBox.Show(E.Message);
                }
            }

            del.Invoke(DateTime.Now + " Splitting Complete!");
            Thread.Sleep(1000);
        }
Пример #11
0
    /* Obsolete? */
    private void onInventoryClick(object sender, KeyEventArgs e)
    {
        ObjectDelegate del = new ObjectDelegate(keyPressHandler);

        del.Invoke(sender, e);
    }
Пример #12
0
 private void OnDrop(GameObject go)
 {
     onDrop?.Invoke(gameObject, go);
 }
Пример #13
0
 internal override object Invoke(ObjectDelegate pfn)
 {
     return(pfn.Invoke());
 }
Пример #14
0
        private void WaitingBluetooth()
        {
            try {
                connectDatabase();
                string          stm = "SELECT * FROM folderlock.folder";
                MySqlCommand    cmd = new MySqlCommand(stm, conn);
                MySqlDataReader rdr = null;
                rdr = cmd.ExecuteReader();
                for (i_strArray = 0; rdr.Read(); i_strArray++)
                {
                    strArray[i_strArray] = new string[4];
                    for (int j = 0; j <= 3; j++)
                    {
                        strArray[i_strArray][j] = rdr.GetString(j);
                    }
                }
                bc = new BluetoothClient();
                BluetoothDeviceInfo[] array = bc.DiscoverDevicesInRange();
                getMacDevice();
                bool flag = false;
                BluetoothDeviceInfo         bd;
                ChangeScanDeviceBtnDelegate changeScanbtn  = new ChangeScanDeviceBtnDelegate(ChangeEnabledScanDeviceBtn);
                UpdateDataGridViewDelegate  updateDataGrid = new UpdateDataGridViewDelegate(UpdateDataGridView);
chay:
                foreach (BluetoothDeviceInfo bdi in array)
                {
                    try
                    {
                        if (bdi.DeviceAddress.ToString().Equals(deviceMac))
                        {
                            bd = bdi;
                            if (bc.Connected == false)
                            {
                                bc.Connect(new BluetoothEndPoint(bd.DeviceAddress, InTheHand.Net.Bluetooth.BluetoothService.Handsfree)); //.BluetoothService.SerialPort
                                bd.SetServiceState(InTheHand.Net.Bluetooth.BluetoothService.Handsfree, true);                            //.BluetoothService.SerialPort
                            }
                            bd.Refresh();
                            if (bd.Connected)
                            {
                                flag         = true;
                                flag_connect = true;
                                di           = new ShowDialogDelegate(ShowDialog);
                                di.Invoke(true);
                                ObjectDelegate del = new ObjectDelegate(UpdateForm);
                                del.Invoke(bd.DeviceName.ToString(), bd.ClassOfDevice.MajorDevice.ToString(), bd.Authenticated.ToString());
                                ChangeSizeMainFormDelegate csd = new ChangeSizeMainFormDelegate(ChangeSizeForm);
                                csd.Invoke(463, 383);
                                string bd_DeviceMac = bd.DeviceAddress.ToString();
                                if (connectDatabase())
                                {
                                    try
                                    {
                                        bool   flagunlock = true;
                                        string patherr    = "";
                                        int    i          = 0;
                                        while (i < i_strArray)
                                        {
                                            if (strArray[i][2].Equals("True") && strArray[i][3].Equals("True")) //strArray[i][2]: Thuộc tính Auto Lock, strArray[i][3]: Thuộc tính Locked
                                            {
                                                if (!unlockFolder(strArray[i][0], strArray[i][1]))
                                                {
                                                    flagunlock = false;
                                                    patherr   += strArray[i][1] + "\n";
                                                }
                                            }
                                            i++;
                                        }
                                        if (!flagunlock)
                                        {
                                            MessageBox.Show("Không thể mở khóa thành công các thư mục sau: \n" + patherr, "Không thành công", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                        }
                                        updateDataGrid();
                                        SHChangeNotify(0x8000000, 0x1000, IntPtr.Zero, IntPtr.Zero); //refresh Desktop and Windows Explorer
                                    }
                                    catch (Exception ex)
                                    {
                                        MessageBox.Show("Không thể kết nối với Database4", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                    }
                                    changeScanbtn.Invoke(true, "Stop...");
                                    while (true)
                                    {
                                        //if (flag_connect == true) //flag_connect: kiểm tra nếu là true thì refesh, false thì không refresh
                                        bd.Refresh();
                                        bool bd_Connected = bd.Connected;

                                        if (flag_connect == true && bd_Connected == false) //flag_connect:
                                        {
                                            //không tìm thấy thiết bị, khóa tất cả các thư mục
                                            //update Form status-name-type
                                            //del.Invoke(bd.DeviceName.ToString(), bd.ClassOfDevice.MajorDevice.ToString(), bd.Authenticated.ToString());
                                            del.Invoke("None", "None", "False");

                                            di = new ShowDialogDelegate(ShowDialog);
                                            di.Invoke(false);
                                            try
                                            {
                                                csd = new ChangeSizeMainFormDelegate(ChangeSizeForm);
                                                csd.Invoke(232, 187);
                                                UpdateDatabase();
                                                bool   flag_success = true;
                                                string pathError    = "";
                                                int    i            = 0;
                                                while (i < i_strArray)
                                                {
                                                    if (strArray[i][2].Equals("True") && strArray[i][3].Equals("False"))//True
                                                    {
                                                        if (!lockFolder(strArray[i][0], strArray[i][1]))
                                                        {
                                                            flag_success = false;
                                                            pathError   += strArray[i][1] + "\n";
                                                        }
                                                    }
                                                    i++;
                                                }
                                                if (!flag_success)
                                                {
                                                    MessageBox.Show("Không thể khóa thành công tất cả các thư mục sau:\n" + pathError, "Không thành công", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                                }
                                                updateDataGrid();
                                                SHChangeNotify(0x8000000, 0x1000, IntPtr.Zero, IntPtr.Zero); //refresh Desktop and Windows Explorer
                                                flag_connect = false;
                                            }
                                            catch (Exception ex)
                                            {
                                                MessageBox.Show("Không thể kết nối với Database3", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                            }
                                        }
                                        if (flag_connect == false && bd_Connected == true && bd_DeviceMac.Equals(deviceMac))
                                        {
                                            //tìm thấy thiết bị, mở khóa tất cả các thư mục
                                            //update Form status-name-type
                                            del.Invoke(bd.DeviceName.ToString(), bd.ClassOfDevice.MajorDevice.ToString(), bd.Authenticated.ToString());
                                            di = new ShowDialogDelegate(ShowDialog);
                                            di.Invoke(true);
                                            try
                                            {
                                                csd = new ChangeSizeMainFormDelegate(ChangeSizeForm);
                                                csd.Invoke(463, 383);

                                                UpdateDatabase();
                                                bool   flag_success = true;
                                                string pathError    = "";
                                                int    i            = 0;
                                                while (i < i_strArray)
                                                {
                                                    if (strArray[i][2].Equals("True") && strArray[i][3].Equals("True"))
                                                    {
                                                        if (!unlockFolder(strArray[i][0], strArray[i][1]))
                                                        {
                                                            flag_success = false;
                                                            pathError   += strArray[i][1] + "\n";
                                                        }
                                                    }
                                                    i++;
                                                }
                                                if (!flag_success)
                                                {
                                                    MessageBox.Show("Không thể khóa thành công tất cả các thư mục sau:\n" + pathError, "Không thành công", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                                }
                                                updateDataGrid();
                                                SHChangeNotify(0x8000000, 0x1000, IntPtr.Zero, IntPtr.Zero); //Refresh Desktop and Windows Explorer
                                                flag_connect = true;
                                            }
                                            catch (Exception ex)
                                            {
                                                MessageBox.Show("Không thể kết nối với Database2", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                            }
                                        }

                                        if (flag_connect == false && bd_Connected == false)
                                        {
                                            bc    = null;
                                            bc    = new BluetoothClient();
                                            array = bc.DiscoverDevicesInRange();
                                            foreach (BluetoothDeviceInfo bd_t in array)
                                            {
                                                if (bd_t.DeviceAddress.ToString().Equals(deviceMac))
                                                {
                                                    bd = bd_t;
                                                    bc.Connect(new BluetoothEndPoint(bd.DeviceAddress, InTheHand.Net.Bluetooth.BluetoothService.Handsfree)); //.BluetoothService.SerialPort
                                                    bd.SetServiceState(InTheHand.Net.Bluetooth.BluetoothService.Handsfree, true);                            //.BluetoothService.SerialPort
                                                }
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    MessageBox.Show("Không thể kết nối với Database1", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                            }
                            else
                            {
                                MessageBox.Show("Thiết bị chưa được kết nối", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                bc   = null;
                                flag = false;
                            }
                            flag = true;
                            break;
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
                if (!flag)
                {
                    //MessageBox.Show("Không tìm thấy đúng thiết bị cần kết nối", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    //changeScanbtn(true, "Scan Device...");
                    //StopThreadDelegate sthread = new StopThreadDelegate(stopThread);
                    //sthread.Invoke();
                    //return;
                    goto chay;
                }
                //else {
                changeScanbtn.Invoke(true, "stop");
                StopThreadDelegate stpth = new StopThreadDelegate(stopThread);
                stpth.Invoke();
                //}
            }
            catch (Exception ex)
            {
                int i = 0;
                while (i < i_strArray)
                {
                    if (strArray[i][2].Equals("True") && strArray[i][3].Equals("False"))//True
                    {
                        lockFolder(strArray[i][0], strArray[i][1]);
                    }
                    i++;
                }
            }
        }
Пример #15
0
        private void agilent_work(object obj)
        {
            System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US");
            try
            {
                SerialPort agilent  = Serial_port_agilent.Instance;
                SerialPort keithley = Serial_port_keithley.Instance;
                //if (false == Serial_port_agilent.try_to_open_com_port()) return;
                if (false == Serial_port_keithley.try_to_open_com_port())
                {
                    return;
                }
                ObjectDelegate del = (ObjectDelegate)obj;
                foreach (DataGridViewRow row in this.data_grid_view_agilent.Rows)
                {
                    if (!check_if_row_is_empty(row))
                    {
                        //try
                        {
                            NumberStyles style = NumberStyles.Number;

                            voltage_params param = new voltage_params();
                            param.isSweepModeUsed = true;
                            param.start_voltage   = Double.Parse(row.Cells[1].Value.ToString(), style);
                            param.stop_voltage    = Double.Parse(row.Cells[2].Value.ToString(), style);
                            param.step_voltage    = Double.Parse(row.Cells[3].Value.ToString(), style);

                            Keithley_command command_keithley = new Keithley_command(param, "0", row.Cells[4].Value.ToString(),
                                                                                     row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString());

                            stop_keithley();

                            List <String> command_list = command_keithley.get_command_string();
                            foreach (String command in command_list)
                            {
                                keithley.WriteLine(command);
                            }

                            String response = param.start_voltage.ToString() + ", " +
                                              param.stop_voltage.ToString() + ", " + param.step_voltage.ToString() + ", ";

                            var    regex_pairs = new Regex(@"[+-][0-9].[0-9]*E[+-][0-9]*");
                            String fromBuffer  = keithley.ReadLine();

                            MatchCollection MatchList = regex_pairs.Matches(fromBuffer);
                            while (MatchList.Count == 0)
                            {
                                fromBuffer = keithley.ReadLine();
                                MatchList  = regex_pairs.Matches(fromBuffer);
                            }
                            response += fromBuffer;

                            del.Invoke(response);
                        }
                    }
                }
            }
            catch (ThreadAbortException abortException)
            {
                logger.Info("Measurement stopped: " + (string)abortException.ExceptionState);
            }
            catch (Exception ex)
            {
                logger.Error("Agilent error: " + ex.ToString());
            }
        }