예제 #1
0
        void ExtendedMessageListener_RegistrationChanged(object sender, RegistrationEventArgs e)
        {
            switch (e.DeviceName)
            {
            case Environment.Devices.NETDUINO_3_WIFI:
                netduinoConnection.ChangeState(e.RegistrationEvent == RegistrationEventArgs.RegistrationEvents.Registered);
                SendToRegisteredDevices(InstantiateServerStateDataMessage(ServerStates.STATE_CONNECTION_NETDUINO_3_WIFI, netduinoConnection.State.ToString()));
                break;

            case Environment.Devices.RASPBERRY_PI_B:
                pibrellaConnection.ChangeState(e.RegistrationEvent == RegistrationEventArgs.RegistrationEvents.Registered);
                SendToRegisteredDevices(InstantiateServerStateDataMessage(ServerStates.STATE_CONNECTION_RASPBERRY_B, pibrellaConnection.State.ToString()));
                break;

            case Environment.Devices.WINDOWS_PHONE:
                windowsPhoneConnection.ChangeState(e.RegistrationEvent == RegistrationEventArgs.RegistrationEvents.Registered);
                SendToRegisteredDevices(InstantiateServerStateDataMessage(ServerStates.STATE_CONNECTION_WINDOWS_PHONE, windowsPhoneConnection.State.ToString()));
                break;

            case Environment.Devices.WINDOWS_SURFACE:
                surfaceConnection.ChangeState(e.RegistrationEvent == RegistrationEventArgs.RegistrationEvents.Registered);
                SendToRegisteredDevices(InstantiateServerStateDataMessage(ServerStates.STATE_CONNECTION_WINDOWS_SURFACE, surfaceConnection.State.ToString()));
                break;
            }
        }
        void ExtendedMessageListener_RegistrationChanged(object sender, RegistrationEventArgs e)
        {
            switch (e.DeviceName)
            {
            case Devices.PHOTON_A:
                photonAConnection.ChangeState(e.RegistrationEvent == RegistrationEventArgs.RegistrationEvents.Registered);
                SendToRegisteredDevices(InstantiateServerStateDataMessage(ServerStates.STATE_CONNECTION_PHOTON_A, photonAConnection.State.ToString()));
                break;

            case Devices.PHOTON_B:
                photonBConnection.ChangeState(e.RegistrationEvent == RegistrationEventArgs.RegistrationEvents.Registered);
                SendToRegisteredDevices(InstantiateServerStateDataMessage(ServerStates.STATE_CONNECTION_PHOTON_B, photonBConnection.State.ToString()));
                break;

            case Devices.PHOTON_C:
                photonCConnection.ChangeState(e.RegistrationEvent == RegistrationEventArgs.RegistrationEvents.Registered);
                SendToRegisteredDevices(InstantiateServerStateDataMessage(ServerStates.STATE_CONNECTION_PHOTON_C, photonCConnection.State.ToString()));
                break;

            case Devices.RASPBERRY_PI_B:
                pibrellaConnection.ChangeState(e.RegistrationEvent == RegistrationEventArgs.RegistrationEvents.Registered);
                SendToRegisteredDevices(InstantiateServerStateDataMessage(ServerStates.STATE_CONNECTION_RASPBERRY_B, pibrellaConnection.State.ToString()));
                break;

            case Devices.WINDOWS_PHONE:
                windowsPhoneConnection.ChangeState(e.RegistrationEvent == RegistrationEventArgs.RegistrationEvents.Registered);
                SendToRegisteredDevices(InstantiateServerStateDataMessage(ServerStates.STATE_CONNECTION_WINDOWS_PHONE, windowsPhoneConnection.State.ToString()));
                break;

            case Devices.WINDOWS_SURFACE:
                surfaceConnection.ChangeState(e.RegistrationEvent == RegistrationEventArgs.RegistrationEvents.Registered);
                SendToRegisteredDevices(InstantiateServerStateDataMessage(ServerStates.STATE_CONNECTION_WINDOWS_SURFACE, surfaceConnection.State.ToString()));
                break;

            case Devices.ANDROID_PHONE:
                androidConnection.ChangeState(e.RegistrationEvent == RegistrationEventArgs.RegistrationEvents.Registered);
                SendToRegisteredDevices(InstantiateServerStateDataMessage(ServerStates.STATE_CONNECTION_ANDROID_PHONE, androidConnection.State.ToString()));
                break;
            }
        }