コード例 #1
0
        // ---------- Properties         ---------- \\


        // ---------- Private methods    ---------- \\
        private void ContinuoususbChecker()                                                                                                                  // Method that is run by the thread.
        {
            while (true)                                                                                                                                     // Infinite loop.
            {
                if ((!Hasusb()) && (myIsOnline))                                                                                                             // If you loose connection to the usb, but were originally connected.
                {
                    myIsOnline = false;                                                                                                                      // Sets the boolean value to false.
                    BasicCheckerArgs LostConnectionArgs = new BasicCheckerArgs(string.Format("Lost connection to VID:{0}, PID:{1}.", myVID, myPID));         // Creates a new object that contains what the events GoesOffline should contain of information.
                    GoesOffline(this, LostConnectionArgs);                                                                                                   // Activates the event GoesOffline.
                }
                else if ((Hasusb()) && (!myIsOnline))                                                                                                        // If you regain connection to usb, and were originally disconnected.
                {
                    myIsOnline = true;                                                                                                                       // Sets the boolean value to true.
                    BasicCheckerArgs GotConnectionArgs = new BasicCheckerArgs(string.Format("Reestablished connection to VID:{0}, PID:{1}.", myVID, myPID)); // // Creates a new object that contains what the events GoesOnline should contain of information.
                    GoesOnline(this, GotConnectionArgs);                                                                                                     // Activates the event GoesOnline.
                }
            }
        }
コード例 #2
0
        // ---------- Properties         ---------- \\


        // ---------- Private methods    ---------- \\
        private void ContinuouspowerChecker()                                                               // Method that is beeing runned by the thread.
        {
            while (true)                                                                                    // Infinite loop.
            {
                if ((!Haspower()) && (myIsOnline))                                                          // If you loose connection the powersource, and it was originally connected.
                {
                    myIsOnline = false;                                                                     // Changing the boolen value to false.
                    BasicCheckerArgs LostConnectionArgs = new BasicCheckerArgs("Lost connection.");         // Creates a new object that contains what the event GoesOffline should contain of information.
                    GoesOffline(this, LostConnectionArgs);                                                  // Activates the event GoesOffline.
                }
                else if ((Haspower()) && (!myIsOnline))                                                     // If you get connected to a powersource, and it was originally disconnected.
                {
                    myIsOnline = true;                                                                      // Changing the boolean value to true.
                    BasicCheckerArgs GotConnectionArgs = new BasicCheckerArgs("Reestablished connection."); // // Creates a new object that contains what the event GoesOnline should contain of information.
                    GoesOnline(this, GotConnectionArgs);                                                    // Activates the event GoesOnline.
                }
            }
        }
コード例 #3
0
        // ---------- Properties         ---------- \\	


        // ---------- Private methods    ---------- \\	
        private void ContinuousInternetChecker()                                                            // Method that is run by the new thread.
        {
            while (true)                                                                                    // Eternal loop.
            {
                if ((!HasInternet()) && (myIsOnline))                                                       // If internet is lost, and internet was active before.
                {
                    myIsOnline = false;                                                                     // Set myIsOnline to False.
                    BasicCheckerArgs LostConnectionArgs = new BasicCheckerArgs("Lost connection.");         // Creates a new object of InternetCheckerArgs that contains a message.
                    GoesOffline(this, LostConnectionArgs);                                                  // Activates the event GoesOffline.
                }
                else if ((HasInternet()) && (!myIsOnline))                                                  // If internet is reestablished, and internet was reported as disconnected before.
                {
                    myIsOnline = true;                                                                      // Set myIsOnline to True.
                    BasicCheckerArgs GotConnectionArgs = new BasicCheckerArgs("Reestablished connection."); // Creates a new object of InternetCheckerArgs that contains a message.
                    GoesOnline(this, GotConnectionArgs);                                                    // Activates the event GoesOnline.
                }
                Thread.Sleep(1000);
            }
        }
コード例 #4
0
 private void USBTransmitterCheckerGoesOnline(object sender, BasicCheckerArgs e) // A method which is called at USBTransmitterCheckerGoesOnline event.
 {
     myUSBTransmitterConnected = true;
     UpdateStatusIndicators();
     Program.myEmail.SendMessage("USB temperature transmitter connection is reestablished. Time " + DateTime.Now.ToString(), SYSTEM_STATUS_MESSAGE_SUBJECT);
 }
コード例 #5
0
 private void USBTransmitterCheckerGoesOffline(object sender, BasicCheckerArgs e) // A method which is called at USBTransmitterCheckerGoesOffline event.
 {
     myUSBTransmitterConnected = false;
     UpdateStatusIndicators(); // Updates system status indicators.
     Program.myEmail.SendMessage("USB temperature transmitter is disconnected. Time " + DateTime.Now.ToString(), SYSTEM_STATUS_MESSAGE_SUBJECT);
 }
コード例 #6
0
 private void USBCellPhoneCheckerGoesOnline(object sender, BasicCheckerArgs e) // A method which is called at USBCellPhoneCheckerGoesOnline event.
 {
     myUSBCellPhoneConnected = true;                                           // When cell phones USB connection is reestablished, myUSBGSMConnected is set to true.
     UpdateStatusIndicators();                                                 // Updates system status indicators.
 }
コード例 #7
0
 private void USBGSMCheckerGoesOnline(object sender, BasicCheckerArgs e)                                                                        // A method which is called at USBGSMCheckerGoesOnline event.
 {
     myUSBGSMConnected = true;                                                                                                                  // When GSM Checkers USB connection is reestablished, myUSBGSMConnected is set to true.
     UpdateStatusIndicators();                                                                                                                  // Updates system status indicators.
     Program.myEmail.SendMessage("GSM modem USB connection is reestablished. Time: " + DateTime.Now.ToString(), SYSTEM_STATUS_MESSAGE_SUBJECT); // Send message using global myEmail object.
 }
コード例 #8
0
 private void SignalCheckerGoesOnline(object sender, BasicCheckerArgs e)                                                      // A method which is called at SignalCheckerGoesOnline event.
 {
     myHasSignal = true;                                                                                                      // When signal goes online, myHasSignal is set to true.
     UpdateStatusIndicators();                                                                                                // Updates system status indicators.
     Program.myEmail.SendMessage("GSM signal is recovered. Time: " + DateTime.Now.ToString(), SYSTEM_STATUS_MESSAGE_SUBJECT); // Send message using global myEmail object.
 }
コード例 #9
0
 private void ChargerCheckerGoesOnline(object sender, BasicCheckerArgs e)                                                    // A method which is called at ChargerCheckerGoesOnline event.
 {
     myChargerConnected = true;                                                                                              // When charger is connected, myChargerConnected is set to true.
     UpdateStatusIndicators();                                                                                               // Updates system status indicators.
     Program.myEmail.SendMessage("Charger is reconnected. Time: " + DateTime.Now.ToString(), SYSTEM_STATUS_MESSAGE_SUBJECT); // Send message using global myEmail object.
 }
コード例 #10
0
 private void InternetCheckerGoesOnline(object sender, BasicCheckerArgs e) // A method which is called at InternetCheckerGoesOnline event.
 {
     myInternetConnected = true;                                           // When internet is connected, myInternetConnected is set to true.
     UpdateStatusIndicators();                                             // Updates system status indicators.
 }