public ConversationViewModel(IClientChannel clientChannel,
                              IForegroundUpdateService foregroundUpdateService,
                              IVoipChannel voipChannel)
 {
     _clientChannel = clientChannel;
     _voipChannel = voipChannel;
     _foregroundUpdateService = foregroundUpdateService;
     foregroundUpdateService.OnRelayMessagesUpdated += OnRelayMessagesUpdated;
     foregroundUpdateService.OnVoipStateUpdate += OnVoipStateUpdate;
     foregroundUpdateService.OnFrameFormatUpdate += OnFrameFormatUpdate;
     foregroundUpdateService.OnFrameRateUpdate += OnFrameRateUpdate;
     SendInstantMessageCommand = new DelegateCommand(OnSendInstantMessageCommandExecute,
         OnSendInstantMessageCommandCanExecute);
     AudioCallCommand = new DelegateCommand(OnCallCommandExecute, OnCallCommandCanExecute);
     VideoCallCommand = new DelegateCommand(OnVideoCallCommandExecute, OnVideoCallCommandCanExecute);
     HangupCommand = new DelegateCommand(OnHangupCommandExecute, OnHangupCommandCanExecute);
     AnswerCommand = new DelegateCommand(OnAnswerCommandExecute, OnAnswerCommandCanExecute);
     RejectCommand = new DelegateCommand(OnRejectCommandExecute, OnRejectCommandCanExecute);
     CloseConversationCommand = new DelegateCommand(OnCloseConversationCommandExecute, () => _canCloseConversation);
     MuteMicrophoneCommand = new DelegateCommand(MuteMicCommandExecute, MicCommandCanExecute);
     UnMuteMicrophoneCommand = new DelegateCommand(UnMuteCommandExecute, MicCommandCanExecute);
     SwitchVideoCommand = new DelegateCommand(SwitchVideoCommandExecute, SwitchVideoCommandCanExecute);
     LayoutService.Instance.LayoutChanged += LayoutChanged;
     LayoutChanged(LayoutService.Instance.LayoutType);
     SetVideoPresenters();
 }
 public ConversationViewModel(IClientChannel clientChannel,
                              IForegroundUpdateService foregroundUpdateService,
                              IVoipChannel voipChannel)
 {
     _clientChannel           = clientChannel;
     _voipChannel             = voipChannel;
     _foregroundUpdateService = foregroundUpdateService;
     foregroundUpdateService.OnRelayMessagesUpdated += OnRelayMessagesUpdated;
     foregroundUpdateService.OnVoipStateUpdate      += OnVoipStateUpdate;
     foregroundUpdateService.OnFrameFormatUpdate    += OnFrameFormatUpdate;
     foregroundUpdateService.OnFrameRateUpdate      += OnFrameRateUpdate;
     SendInstantMessageCommand = new DelegateCommand(OnSendInstantMessageCommandExecute,
                                                     OnSendInstantMessageCommandCanExecute);
     AudioCallCommand                      = new DelegateCommand(OnCallCommandExecute, OnCallCommandCanExecute);
     VideoCallCommand                      = new DelegateCommand(OnVideoCallCommandExecute, OnVideoCallCommandCanExecute);
     HangupCommand                         = new DelegateCommand(OnHangupCommandExecute, OnHangupCommandCanExecute);
     AnswerCommand                         = new DelegateCommand(OnAnswerCommandExecute, OnAnswerCommandCanExecute);
     RejectCommand                         = new DelegateCommand(OnRejectCommandExecute, OnRejectCommandCanExecute);
     CloseConversationCommand              = new DelegateCommand(OnCloseConversationCommandExecute, () => _canCloseConversation);
     MuteMicrophoneCommand                 = new DelegateCommand(MuteMicCommandExecute, MicCommandCanExecute);
     UnMuteMicrophoneCommand               = new DelegateCommand(UnMuteCommandExecute, MicCommandCanExecute);
     SwitchVideoCommand                    = new DelegateCommand(SwitchVideoCommandExecute, SwitchVideoCommandCanExecute);
     LayoutService.Instance.LayoutChanged += LayoutChanged;
     LayoutChanged(LayoutService.Instance.LayoutType);
     SetVideoPresenters();
 }
        public SettingsViewModel(IUnityContainer container,
                                 CoreDispatcher dispatcher,
                                 IForegroundUpdateService foregroundUpdateService)
        {
            _foregroundUpdateService = foregroundUpdateService;
            _localSettings           = ApplicationData.Current.LocalSettings;
            _dispatcher = dispatcher;

            _mediaSettings = container.Resolve <IMediaSettingsChannel>();
            _callChannel   = container.Resolve <ICallChannel>();
            _ntpService    = container.Resolve <NtpService>();

            _ntpService.OnNtpSyncFailed    += HandleNtpSynFailed;
            _ntpService.OnNtpTimeAvailable += HandleNtpTimeSync;

            CloseCommand           = new DelegateCommand(OnCloseCommandExecute);
            SaveCommand            = new DelegateCommand(OnSaveCommandExecute);
            QuitAppCommand         = new DelegateCommand(OnQuitAppCommandExecute);
            DeleteIceServerCommand = new DelegateCommand <IceServerViewModel>(OnDeleteIceServerCommandExecute);
            AddIceServerCommand    = new DelegateCommand(OnAddIceServerCommandExecute);

            // When AudioRoutingManager API is available, the UI elements related to microphone and speaker selection
            // are hidden from settings view.
            // In this case, the user will have the option to change the devices to be used from the call UI.
            // https://msdn.microsoft.com/en-us/library/windows/apps/windows.phone.media.devices.audioroutingmanager.aspx
            EnableAudioDeviceSelection = !ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract", 1);

            _foregroundUpdateService.OnMediaDevicesChanged += OnMediaDevicesChanged;
        }
        public ContactsViewModel(IForegroundUpdateService foregroundUpdateService,
            Func<ConversationViewModel> contactFactory)
        {
            _contactFactory = contactFactory;
            foregroundUpdateService.OnPeerDataUpdated += OnPeerDataUpdated;
            foregroundUpdateService.GetShownUser += ForegroundUpdateService_GetShownUser;
            OnPeerDataUpdated();

            LayoutService.Instance.LayoutChanged += LayoutChanged;
            ShowSettings = new DelegateCommand(() => OnShowSettings?.Invoke());
        }
Beispiel #5
0
        public ConnectingViewModel(IForegroundUpdateService foregroundUpdateService,
                                   ISocketConnection socketConnection)
        {
            _connection = socketConnection;

            foregroundUpdateService.OnRegistrationStatusUpdated += OnRegistrationStatusUpdated;

            ConnectCommand = new DelegateCommand(OnConnectCommandExecute, OnConnectCommandCanExecute);
            ShowSettings   = new DelegateCommand(() => OnShowSettings?.Invoke());

            Task.Run(UpdateStatusAsync).Wait();
        }
        public ConnectingViewModel(IForegroundUpdateService foregroundUpdateService,
                                   ISocketConnection socketConnection)
        {
            _connection = socketConnection;

            foregroundUpdateService.OnRegistrationStatusUpdated += OnRegistrationStatusUpdated;

            ConnectCommand = new DelegateCommand(OnConnectCommandExecute, OnConnectCommandCanExecute);
            ShowSettings = new DelegateCommand(() => OnShowSettings?.Invoke());

            UpdateStatus();
        }
        public ContactsViewModel(IForegroundUpdateService foregroundUpdateService,
            Func<ConversationViewModel> contactFactory, CoreDispatcher uiDispatcher) :base(uiDispatcher)
        {
            _contactFactory = contactFactory;
            foregroundUpdateService.OnPeerDataUpdated += OnPeerDataUpdated;
            foregroundUpdateService.GetShownUser += ForegroundUpdateService_GetShownUser;
            foregroundUpdateService.OnVoipStateUpdate += OnVoipStateUpdate;
            OnPeerDataUpdated();

            LayoutService.Instance.LayoutChanged += LayoutChanged;
            LayoutChanged(LayoutService.Instance.LayoutType);
            ShowSettings = new DelegateCommand(() => OnShowSettings?.Invoke());
        }
Beispiel #8
0
        public ContactsViewModel(IForegroundUpdateService foregroundUpdateService,
                                 Func <ConversationViewModel> contactFactory, CoreDispatcher uiDispatcher) : base(uiDispatcher)
        {
            _contactFactory = contactFactory;
            foregroundUpdateService.OnPeerDataUpdated += OnPeerDataUpdated;
            foregroundUpdateService.GetShownUser      += ForegroundUpdateService_GetShownUser;
            foregroundUpdateService.OnVoipStateUpdate += OnVoipStateUpdate;
            OnPeerDataUpdated();

            LayoutService.Instance.LayoutChanged += LayoutChanged;
            LayoutChanged(LayoutService.Instance.LayoutType);
            ShowSettings = new DelegateCommand(() => OnShowSettings?.Invoke());
        }
Beispiel #9
0
        public ConversationViewModel(IClientChannel clientChannel,
                                     IForegroundUpdateService foregroundUpdateService,
                                     ICallChannel callChannel, CoreDispatcher uiDispatcher,
                                     IMediaSettingsChannel settingsChannel)
        {
            _clientChannel           = clientChannel;
            _callChannel             = callChannel;
            _settingsChannel         = settingsChannel;
            _uiDispatcher            = uiDispatcher;
            _foregroundUpdateService = foregroundUpdateService;
            foregroundUpdateService.OnRelayMessagesUpdated += OnRelayMessagesUpdated;
            foregroundUpdateService.OnCallStatusUpdate     += OnCallStatusUpdate;
            foregroundUpdateService.OnFrameFormatUpdate    += OnFrameFormatUpdate;
            foregroundUpdateService.OnFrameRateUpdate      += OnFrameRateUpdate;
            SendInstantMessageCommand = new DelegateCommand(OnSendInstantMessageCommandExecute,
                                                            OnSendInstantMessageCommandCanExecute);
            AudioCallCommand         = new DelegateCommand(OnCallCommandExecute, OnCallCommandCanExecute);
            VideoCallCommand         = new DelegateCommand(OnVideoCallCommandExecute, OnVideoCallCommandCanExecute);
            HangupCommand            = new DelegateCommand(OnHangupCommandExecute, OnHangupCommandCanExecute);
            AnswerCommand            = new DelegateCommand(OnAnswerCommandExecute, OnAnswerCommandCanExecute);
            RejectCommand            = new DelegateCommand(OnRejectCommandExecute, OnRejectCommandCanExecute);
            CloseConversationCommand = new DelegateCommand(OnCloseConversationCommandExecute,
                                                           () => _canCloseConversation);
            MuteMicrophoneCommand   = new DelegateCommand(MuteMicCommandExecute, MicCommandCanExecute);
            UnMuteMicrophoneCommand = new DelegateCommand(UnMuteCommandExecute, MicCommandCanExecute);
            SwitchVideoCommand      = new DelegateCommand(SwitchVideoCommandExecute, SwitchVideoCommandCanExecute);

            IsAudioRoutingApiAvailable = ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract", 1);
            if (IsAudioRoutingApiAvailable)
            {
                ActivateSpeakerPhone   = new DelegateCommand(ActivateSpeakerPhoneExecute, ActivateSpeakerPhoneCanExecute);
                DeactivateSpeakerPhone = new DelegateCommand(DeactivateSpeakerPhoneExecute, DeactivateSpeakerPhoneCanExecute);
                AudioRoutingManager.GetDefault().AudioEndpointChanged += AudioEndpointChanged;
            }

            ActivateFrontCamera = new DelegateCommand(ActivateFrontCameraExecute, ActivateFrontCameraCanExecute);
            ActivateBackCamera  = new DelegateCommand(ActivateBackCameraExecute, ActivateBackCameraCanExecute);

            LayoutService.Instance.LayoutChanged += LayoutChanged;
            LayoutChanged(LayoutService.Instance.LayoutType);
            SetVideoPresenters();
        }
 public ConversationViewModel(IClientChannel clientChannel,
                              IForegroundUpdateService foregroundUpdateService,
                              IVoipChannel voipChannel)
 {
     _clientChannel = clientChannel;
     _voipChannel = voipChannel;
     _foregroundUpdateService = foregroundUpdateService;
     foregroundUpdateService.OnRelayMessagesUpdated += OnRelayMessagesUpdated;
     foregroundUpdateService.OnVoipStateUpdate += OnVoipStateUpdate;
     foregroundUpdateService.OnFrameFormatUpdate += OnFrameFormatUpdate;
     SendInstantMessageCommand = new DelegateCommand(OnSendInstantMessageCommandExecute,
         OnSendInstantMessageCommandCanExecute);
     CallCommand = new DelegateCommand(OnCallCommandExecute, OnCallCommandCanExecute);
     VideoCallCommand = new DelegateCommand(OnVideoCallCommandExecute, OnVideoCallCommandCanExecute);
     HangupCommand = new DelegateCommand(OnHangupCommandExecute, OnHangupCommandCanExecute);
     AnswerCommand = new DelegateCommand(OnAnswerCommandExecute, OnAnswerCommandCanExecute);
     RejectCommand = new DelegateCommand(OnRejectCommandExecute, OnRejectCommandCanExecute);
     CloseConversationCommand = new DelegateCommand(OnCloseConversationCommandExecute);
     SwitchMicCommand = new DelegateCommand(SwitchMicCommandExecute, SwitchMicCommandCanExecute);
     SwitchVideoCommand = new DelegateCommand(SwitchVideoCommandExecute, SwitchVideoCommandCanExecute);
 }