Esempio n. 1
0
        public MainViewModel()
        {
            _serializationService = new CobsSerializationService();
            _serializationService.RegisterType <MessageHandShakeRequest>(0);
            _serializationService.RegisterType <MessageAcknowledgment>(1);
            _serializationService.RegisterType <MessageAddItem>(2);
            _serializationService.RegisterType <MessageRemoveItem>(3);
            _serializationService.RegisterType <MessageUpdateVolume>(4);
            _serializationService.RegisterType <MessageSetDefaultEndpoint>(5);
            _serializationService.RegisterType <MessageSettings>(6);
            _serializationService.RegisterType <MessageHeartbeat>(7);

            _settingsViewModel = new SettingsViewModel();
            _settingsViewModel.PropertyChanged += OnSettingsChanged;

            _audioSessionService = new AudioSessionService();
            _audioSessionService.DefaultDeviceChanged += OnDefaultDeviceChanged;
            _audioSessionService.DeviceCreated        += OnDeviceCreated;
            _audioSessionService.DeviceRemoved        += OnDeviceRemoved;
            _audioSessionService.DeviceVolumeChanged  += OnDeviceVolumeChanged;
            _audioSessionService.SessionCreated       += OnAudioSessionCreated;
            _audioSessionService.SessionRemoved       += OnAudioSessionRemoved;
            _audioSessionService.SessionVolumeChanged += OnAudioSessionVolumeChanged;

            _communicationService = new CommunicationService(_serializationService);
            _communicationService.MessageReceived  += OnMessageReceived;
            _communicationService.Error            += OnCommunicationError;
            _communicationService.DeviceDiscovered += OnDeviceDiscovered;
        }
Esempio n. 2
0
        public MainViewModel()
        {
            _serializationService = new CobsSerializationService();
            _serializationService.RegisterType <MessageHandShakeRequest>(0);
            _serializationService.RegisterType <MessageHandShakeResponse>(1);
            _serializationService.RegisterType <MessageAddSession>(2);
            _serializationService.RegisterType <MessageRemoveSession>(3);
            _serializationService.RegisterType <MessageUpdateVolumeSession>(4);
            _serializationService.RegisterType <MessageSettings>(5);

            _audioSessionService = new AudioSessionService();
            _audioSessionService.SessionCreated       += OnAudioSessionCreated;
            _audioSessionService.SessionRemoved       += OnAudioSessionRemoved;
            _audioSessionService.SessionVolumeChanged += OnAudioSessionVolumeChanged;

            _discoveryService = new DiscoveryService(_serializationService);
            _discoveryService.DeviceDiscovered += OnDeviceDiscovered;

            _communicationService = new CommunicationService(_serializationService);
            _communicationService.MessageReceived += OnMessageReceived;
            _communicationService.Error           += OnCommunicationError;

            _settingsViewModel = new SettingsViewModel();
            _settingsViewModel.PropertyChanged += OnSettingsChanged;
        }