Exemple #1
0
        public void Dispose()
        {
            if (_disposed)
            {
                return;
            }

            _disposed = true;
            _debugTimer.Stop();
            _durationTimer.Stop();

            if (_manager != null)
            {
                _manager.StateUpdated            -= OnStateUpdated;
                _manager.SignalBarsUpdated       -= OnSignalBarsUpdated;
                _manager.RemoteMediaStateUpdated -= OnRemoteMediaStateUpdated;

                _manager.SetIncomingVideoOutput(null);
                _manager = null;
            }

            var capturer = _service.Capturer;

            if (capturer != null)
            {
                capturer.SetOutput(null);
            }
        }
Exemple #2
0
        public void Connect(VoipManager controller)
        {
            //_controller = controller;

            controller.SetIncomingVideoOutput(BackgroundPanel);

            // Let's avoid duplicated events
            controller.StateUpdated            -= OnStateUpdated;
            controller.SignalBarsUpdated       -= OnSignalBarsUpdated;
            controller.RemoteMediaStateUpdated -= OnRemoteMediaStateUpdated;

            controller.StateUpdated            += OnStateUpdated;
            controller.SignalBarsUpdated       += OnSignalBarsUpdated;
            controller.RemoteMediaStateUpdated += OnRemoteMediaStateUpdated;

            //controller.SetMuteMicrophone(_isMuted);

            //OnStateUpdated(controller, controller.GetConnectionState());
            //OnSignalBarsUpdated(controller, controller.GetSignalBarsCount());
        }
Exemple #3
0
        private void OnStateUpdated(VoipManager sender, VoipState newState)
        {
            this.BeginOnUIThread(() =>
            {
                switch (newState)
                {
                case VoipState.WaitInit:
                case VoipState.WaitInitAck:
                    _state             = newState;
                    StateLabel.Content = Strings.Resources.VoipConnecting;
                    break;

                case VoipState.Established:
                    _state             = newState;
                    StateLabel.Content = "00:00";

                    SignalBarsLabel.Visibility = Visibility.Visible;
                    StartUpdatingCallDuration();

                    sender.SetIncomingVideoOutput(BackgroundPanel);
                    break;

                case VoipState.Failed:
                    //switch (sender.GetLastError())
                    //{
                    //    case libtgvoip.Error.Incompatible:
                    //    case libtgvoip.Error.Timeout:
                    //    case libtgvoip.Error.Unknown:
                    //        _state = newState;
                    //        StateLabel.Content = Strings.Resources.VoipFailed;
                    //        break;
                    //}
                    break;
                }
            });
        }
Exemple #4
0
        public void Connect(VoipManager controller)
        {
            if (_disposed)
            {
                return;
            }

            if (_manager != null)
            {
                // Let's avoid duplicated events
                _manager.StateUpdated            -= OnStateUpdated;
                _manager.SignalBarsUpdated       -= OnSignalBarsUpdated;
                _manager.RemoteMediaStateUpdated -= OnRemoteMediaStateUpdated;

                if (_manager != controller)
                {
                    _manager.SetIncomingVideoOutput(BackgroundPanel);
                }
            }

            if (_manager != controller)
            {
                controller.SetIncomingVideoOutput(BackgroundPanel);
            }

            controller.StateUpdated            += OnStateUpdated;
            controller.SignalBarsUpdated       += OnSignalBarsUpdated;
            controller.RemoteMediaStateUpdated += OnRemoteMediaStateUpdated;

            _manager = controller;

            //controller.SetMuteMicrophone(_isMuted);

            //OnStateUpdated(controller, controller.GetConnectionState());
            //OnSignalBarsUpdated(controller, controller.GetSignalBarsCount());
        }