Exemplo n.º 1
0
        /// <summary>
        /// Event Handler for Netowrk manager event
        /// </summary>
        /// <param name="o"></param>
        /// <param name="args"></param>
        private void OnNetworkManagerEvent(object o, EventArgs args)
        {
            try {
                State new_state = nm_manager.State;
                if (new_state != last_state && (new_state == State.Connected || new_state == State.Disconnected))
                {
                    last_state = new_state;

                    NetworkStateChangedHandler handler = StateChanged;
                    if (handler != null)
                    {
                        NetworkStateChangedArgs state_changed_args = new NetworkStateChangedArgs();
                        state_changed_args.Connected = Connected;
                        handler(this, state_changed_args);
                    }

                    Device active_device = nm_manager.ActiveDevice;

                    if (Connected && active_device != null)
                    {
//                      Console.WriteLine("Network Connection Established: {0} ({1})",
//                                        active_device.Name, active_device.IP4Address);
//                        LogCore.Instance.PushDebug("Network Connection Established", String.Format("{0} ({1})",
//                            active_device.Name, active_device.IP4Address));
                    }
                    else if (Connected)
                    {
//                      Console.WriteLine("Network Connection Established: Active Device Unknown");
//                        LogCore.Instance.PushDebug("Network Connection Established", "Active Device Unknown");
                    }
                    else
                    {
//                      Console.WriteLine("Network Connection Unavailable: Disconnected");
//                        LogCore.Instance.PushDebug("Network Connection Unavailable", "Disconnected");
                    }
                }
            } catch (Exception) {
            }
        }
Exemplo n.º 2
0
 private void OnNetworkManagerEvent(object o, EventArgs args)
 {
     try {
         State new_state = nm_manager.State;
         if(new_state != last_state && (new_state == State.Connected || new_state == State.Disconnected)) {
             last_state = new_state;
             NetworkStateChangedHandler handler = StateChanged;
             if(handler != null) {
                 NetworkStateChangedArgs state_changed_args = new NetworkStateChangedArgs();
                 state_changed_args.Connected = Connected;
                 handler(this, state_changed_args);
             }
             Device active_device = nm_manager.ActiveDevice;
             if(Connected && active_device != null) {
             } else if(Connected) {
             } else {
             }
         }
     } catch(Exception) {
     }
 }
Exemplo n.º 3
0
 private void OnNetworkManagerEvent(object o, EventArgs args)
 {
     try {
         State new_state = nm_manager.State;
         if(new_state != last_state && (new_state == State.Connected || new_state == State.Disconnected)) {
             last_state = new_state;
             NetworkStateChangedHandler handler = StateChanged;
             if(handler != null) {
                 NetworkStateChangedArgs state_changed_args = new NetworkStateChangedArgs();
                 state_changed_args.Connected = Connected;
                 handler(this, state_changed_args);
             }
             Device active_device = nm_manager.ActiveDevice;
             if(Connected && active_device != null) {
              Console.WriteLine("Network Connection Established: {0} ({1})",
                    active_device.Name, active_device.IP4Address);
             } else if(Connected) {
              Console.WriteLine("Network Connection Established: Active Device Unknown");
             } else {
              Console.WriteLine("Network Connection Unavailable: Disconnected");
             }
         }
     } catch(Exception) {
     }
 }