예제 #1
0
 void events_processor(object sender, softEventQueue<SOFTEVENT>.EventType e)
 {
     switch (e.ev) {
         case SOFTEVENT.LOAD:
             this.icsManager = new IcsManager();
             state_ = getawayState.Idle;
             shouldStart_ = false;
             privateManager = new privateNetManager();
             events.put(SOFTEVENT.LOADINIT, 0);
             break;
         case SOFTEVENT.LOADINIT:
             try {
                 privateManager.init();
             } catch {
                 startTimer();
                 break;
             }
             events.put(SOFTEVENT.LOAD_SAVED_STATE, 0);
             NetworkChange.NetworkAddressChanged += new NetworkAddressChangedEventHandler(NetworkChange_NetworkAddressChanged);
             NetworkChange.NetworkAvailabilityChanged += new NetworkAvailabilityChangedEventHandler(NetworkChange_NetworkAvailabilityChanged);
             privateManager.networkAvailable += new EventHandler(privateManager_networkAvailable);
             privateManager.networkUnavailable += new EventHandler(privateManager_networkUnavailable);
             break;
         case SOFTEVENT.LOAD_SAVED_STATE:
             LoadConfig();
             if (shouldStart_)
                 Start();
             break;
         case SOFTEVENT.NETWORKADDRESSCHANGED:
             networkAddressChanged();
             break;
         case SOFTEVENT.STARTINIT:
             privateManager.enable();
             startTimer();
             break;
         case SOFTEVENT.RENEWIP:
             reNewIp();
             startTimer();
             break;
         case SOFTEVENT.UPDATECONNECTIONS:
             icsManager.updateConnections();
             break;
         case SOFTEVENT.RESTARTPRIVATE:
             intStop();
             if (shouldStart_)
                 privateManager.enable();
             break;
         case SOFTEVENT.TESTPRIVATE:
             testPrivateConnected();
             break;
         case SOFTEVENT.FIREROUTESTART:
             watchDog.Change(Timeout.Infinite, Timeout.Infinite);
             if (OnRouterStart != null) OnRouterStart(this, null);
             break;
         case SOFTEVENT.INTSTOP:
             intStop();
             break;
     }
 }
예제 #2
0
        void events_processor(object sender, softEventQueue <SOFTEVENT> .EventType e)
        {
            switch (e.ev)
            {
            case SOFTEVENT.LOAD:
                this.icsManager = new IcsManager();
                state_          = getawayState.Idle;
                shouldStart_    = false;
                privateManager  = new privateNetManager();
                events.put(SOFTEVENT.LOADINIT, 0);
                break;

            case SOFTEVENT.LOADINIT:
                try {
                    privateManager.init();
                } catch {
                    startTimer();
                    break;
                }
                events.put(SOFTEVENT.LOAD_SAVED_STATE, 0);
                NetworkChange.NetworkAddressChanged      += new NetworkAddressChangedEventHandler(NetworkChange_NetworkAddressChanged);
                NetworkChange.NetworkAvailabilityChanged += new NetworkAvailabilityChangedEventHandler(NetworkChange_NetworkAvailabilityChanged);
                privateManager.networkAvailable          += new EventHandler(privateManager_networkAvailable);
                privateManager.networkUnavailable        += new EventHandler(privateManager_networkUnavailable);
                break;

            case SOFTEVENT.LOAD_SAVED_STATE:
                LoadConfig();
                if (shouldStart_)
                {
                    Start();
                }
                break;

            case SOFTEVENT.NETWORKADDRESSCHANGED:
                networkAddressChanged();
                break;

            case SOFTEVENT.STARTINIT:
                privateManager.enable();
                startTimer();
                break;

            case SOFTEVENT.RENEWIP:
                reNewIp();
                startTimer();
                break;

            case SOFTEVENT.UPDATECONNECTIONS:
                icsManager.updateConnections();
                break;

            case SOFTEVENT.RESTARTPRIVATE:
                intStop();
                if (shouldStart_)
                {
                    privateManager.enable();
                }
                break;

            case SOFTEVENT.TESTPRIVATE:
                testPrivateConnected();
                break;

            case SOFTEVENT.FIREROUTESTART:
                watchDog.Change(Timeout.Infinite, Timeout.Infinite);
                if (OnRouterStart != null)
                {
                    OnRouterStart(this, null);
                }
                break;

            case SOFTEVENT.INTSTOP:
                intStop();
                break;
            }
        }