Exemplo n.º 1
0
 private void ListView_ItemClick(object sender, ItemClickEventArgs e)
 {
     if (e.ClickedItem is TLChannelParticipantAdmin participant && participant.User != null)
     {
         ViewModel.NavigationService.Navigate(typeof(ChannelAdminRightsPage), TLTuple.Create(ViewModel.Item.ToPeer(), participant));
     }
 }
Exemplo n.º 2
0
        private void ParticipantRestrictExecute(TLChannelParticipantBase participant)
        {
            if (_item == null)
            {
                return;
            }

            NavigationService.Navigate(typeof(ChannelBannedRightsPage), TLTuple.Create(_item.ToPeer(), participant));
        }
Exemplo n.º 3
0
        private async Task UpdateCallAsync()
        {
            if (_connection != null)
            {
                VoIPCallTask.Log("Mediator initialized", "Informing foreground about current call");

                var data = TLTuple.Create((int)_state, _phoneCall, _user, _emojis != null ? string.Join(" ", _emojis) : string.Empty);
                await _connection.SendMessageAsync(new ValueSet { { "caption", "voip.callInfo" }, { "request", TLSerializationService.Current.Serialize(data) } });
            }
        }
Exemplo n.º 4
0
        public async void OnSignalBarsChanged(int count)
        {
            if (_connection != null)
            {
                VoIPCallTask.Log("Mediator initialized", "Informing foreground about signal bars");

                var data = TLTuple.Create(count);
                await _connection.SendMessageAsync(new ValueSet { { "caption", "voip.signalBars" }, { "request", TLSerializationService.Current.Serialize(data) } });
            }
        }
Exemplo n.º 5
0
        //public RelayCommand<TLKeyboardButtonBase> KeyboardButtonCommand => new RelayCommand<TLKeyboardButtonBase>(KeyboardButtonExecute);
        public async void KeyboardButtonExecute(TLKeyboardButtonBase button, TLMessage message)
        {
            if (button is TLKeyboardButtonBuy buyButton)
            {
                if (message.Media is TLMessageMediaInvoice invoiceMedia && invoiceMedia.HasReceiptMsgId)
                {
                    var response = await ProtoService.GetPaymentReceiptAsync(invoiceMedia.ReceiptMsgId.Value);

                    if (response.IsSucceeded)
                    {
                        NavigationService.Navigate(typeof(PaymentReceiptPage), TLTuple.Create(message, response.Result));
                    }
                }
                else
                {
                    var response = await ProtoService.GetPaymentFormAsync(message.Id);

                    if (response.IsSucceeded)
                    {
                        if (response.Result.Invoice.IsEmailRequested || response.Result.Invoice.IsNameRequested || response.Result.Invoice.IsPhoneRequested || response.Result.Invoice.IsShippingAddressRequested)
                        {
                            NavigationService.NavigateToPaymentFormStep1(message, response.Result);
                        }
                        else if (response.Result.HasSavedCredentials)
                        {
                            if (ApplicationSettings.Current.TmpPassword != null)
                            {
                                if (ApplicationSettings.Current.TmpPassword.ValidUntil < TLUtils.Now + 60)
                                {
                                    ApplicationSettings.Current.TmpPassword = null;
                                }
                            }

                            if (ApplicationSettings.Current.TmpPassword != null)
                            {
                                NavigationService.NavigateToPaymentFormStep5(message, response.Result, null, null, null, null, null, true);
                            }
                            else
                            {
                                NavigationService.NavigateToPaymentFormStep4(message, response.Result, null, null, null);
                            }
                        }
                        else
                        {
                            NavigationService.NavigateToPaymentFormStep3(message, response.Result, null, null, null);
                        }
                    }
                }
            }
Exemplo n.º 6
0
        private void ParticipantEditExecute(TLChannelParticipantBase participant)
        {
            if (_item == null)
            {
                return;
            }

            if (participant is TLChannelParticipantAdmin)
            {
                NavigationService.Navigate(typeof(ChannelAdminRightsPage), TLTuple.Create(_item.ToPeer(), participant));
            }
            else if (participant is TLChannelParticipantBanned)
            {
                NavigationService.Navigate(typeof(ChannelBannedRightsPage), TLTuple.Create(_item.ToPeer(), participant));
            }
        }
Exemplo n.º 7
0
 public static void NavigateToPaymentFormStep5(this INavigationService service, MessageViewModel message, PaymentForm paymentForm, TLPaymentRequestedInfo info, TLPaymentsValidatedRequestedInfo validatedInfo, TLShippingOption shipping, string title, string credentials, bool save)
 {
     service.Navigate(typeof(PaymentFormStep5Page), TLTuple.Create(message, paymentForm, info, validatedInfo, shipping, title ?? string.Empty, credentials ?? string.Empty, save));
 }
Exemplo n.º 8
0
 public static void NavigateToPaymentFormStep4(this INavigationService service, MessageViewModel message, PaymentForm paymentForm, TLPaymentRequestedInfo info, TLPaymentsValidatedRequestedInfo validatedInfo, TLShippingOption shipping)
 {
     service.Navigate(typeof(PaymentFormStep4Page), TLTuple.Create(message, paymentForm, info, validatedInfo, shipping));
 }
Exemplo n.º 9
0
 public static void NavigateToPaymentFormStep1(this INavigationService service, MessageViewModel message, PaymentForm paymentForm)
 {
     service.Navigate(typeof(PaymentFormStep1Page), TLTuple.Create(message, paymentForm));
 }
Exemplo n.º 10
0
 private async void Hangup_Click(object sender, RoutedEventArgs e)
 {
     var duration = _state == TLPhoneCallState.Established ? DateTime.Now - _started : TimeSpan.Zero;
     await VoIPConnection.Current.SendRequestAsync("phone.discardCall", TLTuple.Create(duration.TotalSeconds));
 }