コード例 #1
0
        public void SetCall(TLTuple <TLPhoneCallState, TLPhoneCallBase, TLUserBase, string> tuple)
        {
            if (_disposed)
            {
                return;
            }

            if (_state != tuple.Item1)
            {
                Debug.WriteLine("[{0:HH:mm:ss.fff}] State changed in app: " + tuple.Item1, DateTime.Now);

                _state             = tuple.Item1;
                StateLabel.Content = StateToLabel(tuple.Item1);

                if (tuple.Item1 == TLPhoneCallState.Established)
                {
                    SignalBarsLabel.Visibility = Visibility.Visible;
                    StartUpdatingCallDuration();

                    if (_emojis != null)
                    {
                        for (int i = 0; i < _emojis.Length; i++)
                        {
                            var imageLarge = FindName($"LargeEmoji{i}") as Image;
                            var source     = Emoji.BuildUri(_emojis[i]);

                            imageLarge.Source = new BitmapImage(new Uri(source));
                        }
                    }
                }
            }

            if (tuple.Item2 is TLPhoneCallRequested call)
            {
            }

            if (tuple.Item3 is TLUser user)
            {
                if (user.HasPhoto && user.Photo is TLUserProfilePhoto)
                {
                    Image.Source         = DefaultPhotoConverter.Convert(user.Photo, true) as ImageSource;
                    GrabPanel.Background = new SolidColorBrush(Colors.Transparent);
                }
                else
                {
                    Image.Source         = null;
                    GrabPanel.Background = BindConvert.Current.Bubble(user.Id);
                }

                FromLabel.Text        = user.FullName;
                DescriptionLabel.Text = string.Format(Strings.Android.CallEmojiKeyTooltip, user.FirstName);
            }

            if (tuple.Item4.Length > 0)
            {
                _emojis = tuple.Item4.Split(' ');
            }
        }
コード例 #2
0
        private Task UpdateStateAsync(TLPhoneCallState state)
        {
            if (_state != state)
            {
                Debug.WriteLine("[{0:HH:mm:ss.fff}] State changed in task: " + state, DateTime.Now);

                _state = state;
                return(UpdateCallAsync());
            }

            return(Task.CompletedTask);
        }
コード例 #3
0
        private string StateToLabel(TLPhoneCallState state)
        {
            switch (state)
            {
            case TLPhoneCallState.WaitingIncoming:
                return(Strings.Android.VoipIncoming);

            case TLPhoneCallState.WaitInit:
            case TLPhoneCallState.WaitInitAck:
                return(Strings.Android.VoipConnecting);

            case TLPhoneCallState.ExchangingKeys:
                return(Strings.Android.VoipExchangingKeys);

            case TLPhoneCallState.Waiting:
                return(Strings.Android.VoipWaiting);

            case TLPhoneCallState.Ringing:
                return(Strings.Android.VoipRinging);

            case TLPhoneCallState.Requesting:
                return(Strings.Android.VoipRequesting);

            case TLPhoneCallState.HangingUp:
                return(Strings.Android.VoipHangingUp);

            case TLPhoneCallState.Ended:
                return(Strings.Android.VoipCallEnded);

            case TLPhoneCallState.Busy:
                return(Strings.Android.VoipBusy);

            case TLPhoneCallState.Failed:
                return(Strings.Android.VoipFailed);

            case TLPhoneCallState.Established:
                return("00:00");
            }

            return(null);
        }
コード例 #4
0
        private string StateToLabel(TLPhoneCallState state)
        {
            switch (state)
            {
            case TLPhoneCallState.WaitingIncoming:
                return("Incoming call");

            case TLPhoneCallState.WaitInit:
            case TLPhoneCallState.WaitInitAck:
                return("Connecting");

            case TLPhoneCallState.ExchangingKeys:
                return("Exchanging encryption keys");

            case TLPhoneCallState.Waiting:
                return("Waiting");

            case TLPhoneCallState.Ringing:
                return("Ringing");

            case TLPhoneCallState.Requesting:
                return("Requesting");

            case TLPhoneCallState.HangingUp:
                return("Hanging up");

            case TLPhoneCallState.Ended:
                return("Call ended");

            case TLPhoneCallState.Busy:
                return("Line busy");

            case TLPhoneCallState.Established:
                return("00:00");

            case TLPhoneCallState.Failed:
                return("Failed to connect");
            }

            return(null);
        }