private void ExportInvite() { if (IsWorking) { return; } if (Invite != null) { return; } IsWorking = true; MTProtoService.ExportInviteAsync(_newChannel.ToInputChannel(), result => Execute.BeginOnUIThread(() => { IsWorking = false; Invite = result; var inviteExported = Invite as TLChatInviteExported; if (inviteExported != null) { if (!TLString.IsNullOrEmpty(inviteExported.Link)) { InviteLink = inviteExported.Link.ToString(); } } }), error => Execute.BeginOnUIThread(() => { IsWorking = false; Execute.ShowDebugMessage("channels.exportInvite error " + error); })); }
public object Convert(object item, Type targetType, object parameter, CultureInfo culture) { if (!(item is TLObject)) { return(null); } var serviceText = item as TLServiceText; if (serviceText != null) { return(TextTemplate); } var userBase = item as TLUserBase; if (userBase != null && userBase.IsContact) { return(ContactTemplate); } var username = userBase as IUserName; if (username != null && !TLString.IsNullOrEmpty(username.UserName)) { return(UserUsernameTemplate); } return(UserStatusTemplate); }
public void CheckAndUpdateTransportInfoAsync(TLInt dcId, TLString host, TLInt port, Action callback, Action <TLRPCError> faultCallback = null) { LogPublicConfig(string.Format("CheckTransport dc_id={0} host={1} port={2}", dcId, host, port)); if (dcId == null) { return; } if (TLString.IsNullOrEmpty(host)) { return; } if (port == null) { return; } var dcOption = TLUtils.GetDCOption(_config, dcId); var transport = GetSpecialTransport(host.ToString(), port.Value, Type, new TransportSettings { DcId = dcId.Value, Secret = TLUtils.ParseSecret(dcOption), AuthKey = dcOption != null ? dcOption.AuthKey : null, Salt = dcOption != null ? dcOption.Salt : TLLong.Random(), SessionId = TLLong.Random(), MessageIdDict = new Dictionary <long, long>(), SequenceNumber = 0, ClientTicksDelta = dcOption != null ? dcOption.ClientTicksDelta : 0, PacketReceivedHandler = OnPacketReceivedByTransport }); CheckAndUpdateTransportInfoInternalAsync(dcOption as TLDCOption78, transport, callback, faultCallback); }
private void StartTimer() { if (!TLString.IsNullOrEmpty(_password.EmailUnconfirmedPattern)) { _checkPasswordSettingsTimer.Start(); } }
public EmailViewModel(ICacheService cacheService, ICommonErrorHandler errorHandler, IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator) : base(cacheService, errorHandler, stateService, navigationService, mtProtoService, eventAggregator) { _passwordBase = stateService.Password; stateService.Password = null; _authorizationForm = stateService.AuthorizationForm; stateService.AuthorizationForm = null; _secureValues = stateService.SecureValues; stateService.SecureValues = null; _secureType = stateService.SecureType; stateService.SecureType = null; _secureRequiredType = stateService.SecureRequiredType; stateService.SecureRequiredType = null; var password = _passwordBase as TLPassword81; if (password != null) { var passwordSettings = password.Settings as TLPasswordSettings83; if (passwordSettings != null) { CurrentEmail = TLString.IsNullOrEmpty(passwordSettings.Email)? string.Empty : passwordSettings.Email.ToString(); } } _emailValue = _secureRequiredType != null ? _secureRequiredType.DataValue : null; }
public bool ChooseDialog(TLDialogBase dialog) { if (dialog == null) { return(false); } if (ForwardedMessages != null) { var channel = dialog.With as TLChannel; if (channel != null && !channel.Creator && !channel.IsEditor) { MessageBox.Show(AppResources.PostToChannelError, AppResources.Error, MessageBoxButton.OK); return(false); } } var result = MessageBoxResult.OK; if (LogFileName != null) { result = MessageBox.Show(AppResources.ForwardMessagesToThisChat, AppResources.Confirm, MessageBoxButton.OKCancel); } if (_bot != null) { var chat = dialog.With as TLChat; var userName = _bot as IUserName; if (chat == null) { return(false); } var botName = userName != null ? userName.UserName : _bot.FirstName; botName = TLString.IsNullOrEmpty(botName) ? _bot.LastName : botName; var chatName = chat.FullName; result = MessageBox.Show(string.Format(AppResources.AddUserToTheGroup, botName, chatName), AppResources.Confirm, MessageBoxButton.OKCancel); } if (result == MessageBoxResult.OK) { StateService.SharedContact = SharedContact; StateService.LogFileName = LogFileName; StateService.ForwardMessages = ForwardedMessages; StateService.With = dialog.With; StateService.RemoveBackEntries = true; StateService.AnimateTitle = true; StateService.AccessToken = _accessToken; StateService.Bot = _bot; StateService.WebLink = _webLink; StateService.Url = _url; StateService.UrlText = _text; NavigationService.UriFor <DialogDetailsViewModel>().Navigate(); return(true); } return(false); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var userBase = value as TLUserBase; if (userBase != null) { if (userBase.Index == 333000) { return(SupportTemplate); } if (userBase.IsSelf) { return(UserSelfTemplate); } } var user = value as TLUser; if (user != null && user.IsBot) { var botInfo = user.BotInfo as TLBotInfo; if (botInfo != null && !TLString.IsNullOrEmpty(botInfo.Description)) { return(BotTemplate); } return(new DataTemplate()); } return(UserTemplate); }
private void OnCheckPasswordSettings(object sender, System.EventArgs e) { Execute.ShowDebugMessage("account.getPasswordSettings"); MTProtoService.GetPasswordAsync( result => BeginOnUIThread(() => { var password = result as TLPassword; if (password != null && password.HasRecovery.Value) { var currentPassword = _password as TLPassword; if (currentPassword != null) { password.CurrentPasswordHash = currentPassword.CurrentPasswordHash; } _password = password; RecoveryEmailUnconfirmedVisibility = !TLString.IsNullOrEmpty(_password.EmailUnconfirmedPattern) || (_password is TLPassword && ((TLPassword)_password).HasRecovery.Value) ? Visibility.Visible : Visibility.Collapsed; NotifyOfPropertyChange(() => RecoveryEmailLabel); NotifyOfPropertyChange(() => CompletePasswordLabel); NotifyOfPropertyChange(() => ChangePasswordVisibility); NotifyOfPropertyChange(() => CompletePasswordVisibility); StopTimer(); } }), error => { Execute.ShowDebugMessage("account.getPasswordSettings error " + error); }); }
public PasswordViewModel(ICacheService cacheService, ICommonErrorHandler errorHandler, IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator) : base(cacheService, errorHandler, stateService, navigationService, mtProtoService, eventAggregator) { _checkPasswordSettingsTimer.Tick += OnCheckPasswordSettings; _checkPasswordSettingsTimer.Interval = TimeSpan.FromSeconds(5.0); _password = StateService.Password; StateService.Password = null; if (_password != null) { PasswordEnabled = _password.IsAvailable; RecoveryEmailUnconfirmedVisibility = !TLString.IsNullOrEmpty(_password.EmailUnconfirmedPattern) || (_password is TLPassword && ((TLPassword)_password).HasRecovery.Value) ? Visibility.Visible : Visibility.Collapsed; } PropertyChanged += (o, e) => { if (Property.NameEquals(e.PropertyName, () => PasswordEnabled) && !_suppressPasswordEnabled) { if (PasswordEnabled) { ChangePassword(); } else { ClearPassword(); } } }; }
private void OnCheckPasswordSettings(object sender, System.EventArgs e) { Execute.ShowDebugMessage("account.getPasswordSettings"); MTProtoService.GetPasswordAsync( result => BeginOnUIThread(() => { var password84 = result as TLPassword84; if (password84 != null && password84.HasRecovery.Value) { var algo = password84.CurrentAlgo as TLPasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow; if (algo == null) { return; } password84.CurrentPasswordHash = SRP.GetX(new TLString(TempNewPassword), algo); //password.CurrentPasswordHash = Utils.Password.GetHash(password.CurrentSalt, new TLString(TempNewPassword)); _password = password84; RecoveryEmailUnconfirmedVisibility = !TLString.IsNullOrEmpty(_password.EmailUnconfirmedPattern) || (_password is TLPassword && ((TLPassword)_password).HasRecovery.Value) ? Visibility.Visible : Visibility.Collapsed; NotifyOfPropertyChange(() => RecoveryEmailLabel); NotifyOfPropertyChange(() => CompletePasswordLabel); NotifyOfPropertyChange(() => ChangePasswordVisibility); NotifyOfPropertyChange(() => CompletePasswordVisibility); StopTimer(); if (_authorizationForm != null || _secureValues != null) { MTProtoService.GetPasswordSettingsAsync(SRP.GetCheck(password84.CurrentPasswordHash, password84.SRPId, password84.SRPB, algo), result2 => BeginOnUIThread(() => { Passport.EnterPasswordViewModel.NavigateToPassportCommon( result2, password84, new TLString(TempNewPassword), _authorizationForm, _secureValues, MTProtoService, StateService, NavigationService); }), error => BeginOnUIThread(() => { if (error.TypeEquals(ErrorType.PASSWORD_HASH_INVALID)) { StateService.AuthorizationForm = _authorizationForm; StateService.Password = result; NavigationService.UriFor <Passport.EnterPasswordViewModel>().WithParam(x => x.RandomParam, Guid.NewGuid().ToString()).Navigate(); } })); } } }), error => { Execute.ShowDebugMessage("account.getPasswordSettings error " + error); }); }
protected PasswordViewModelBase(ICacheService cacheService, ICommonErrorHandler errorHandler, IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator) : base(cacheService, errorHandler, stateService, navigationService, mtProtoService, eventAggregator) { PasswordBase = StateService.Password as TLPassword; if (PasswordBase != null) { PasswordHint = !TLString.IsNullOrEmpty(PasswordBase.Hint) ? PasswordBase.Hint.ToString() : string.Empty; } }
public WebCardInfoViewModel(ICacheService cacheService, ICommonErrorHandler errorHandler, IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator) : base(cacheService, errorHandler, stateService, navigationService, mtProtoService, eventAggregator) { if (PaymentInfo != null && PaymentInfo.Form != null && !TLString.IsNullOrEmpty(PaymentInfo.Form.Url)) { Url = new Uri(PaymentInfo.Form.Url.ToString(), UriKind.Absolute); } _removeCheckoutView = StateService.RemoveCheckoutAndCardView; StateService.RemoveCheckoutAndCardView = false; }
public void CopyInvite() { var inviteExported = Invite as TLChatInviteExported; if (inviteExported != null) { if (!TLString.IsNullOrEmpty(inviteExported.Link)) { Clipboard.SetText(inviteExported.Link.ToString()); } } }
public void AddContact() { if (CurrentContact == null) { return; } if (!HasPhone) { return; } var userPhone = new TLString(Phone); if (TLString.IsNullOrEmpty(userPhone)) { return; } IsWorking = true; ImportContactAsync(CurrentContact, userPhone, MTProtoService, result => { if (result.Users.Count > 0) { EventAggregator.Publish(new TLUpdateContactLink24 { UserId = result.Users[0].Id, MyLink = new TLContactLink(), ForeignLink = new TLContactLinkUnknown() }); var userBase = result.Users[0]; if (userBase != null && userBase.IsContact) { ContactsHelper.CreateContactAsync(_fileManager, StateService, userBase); } RaiseImportStatusChanged(new ImportEventArgs { Imported = true }); } BeginOnUIThread(() => { IsWorking = false; NotifyOfPropertyChange(() => HasPhone); }); }, error => BeginOnUIThread(() => { IsWorking = false; Execute.ShowDebugMessage("contacts.importContacts error " + error); })); }
private string GetChatSubtitle3() { var channel = CurrentItem as TLChannel; if (channel != null) { if (!TLString.IsNullOrEmpty(channel.About)) { return(channel.About.ToString()); } } return(string.Empty); }
public override void NavigateToNextStep() { var paymentResult = PaymentInfo.Result as TLPaymentResult; if (paymentResult != null) { var backEnrty = NavigationService.BackStack.FirstOrDefault(); while (backEnrty != null && !backEnrty.Source.ToString().Contains("DialogDetailsView.xaml") && !backEnrty.Source.ToString().Contains("ShellView.xaml")) { NavigationService.RemoveBackEntry(); backEnrty = NavigationService.BackStack.FirstOrDefault(); } if (backEnrty != null && backEnrty.Source.ToString().Contains("DialogDetailsView.xaml")) { StateService.ShowScrollDownButton = true; } NavigationService.GoBack(); return; } var paymentVerificationNeeded = PaymentInfo.Result as TLPaymentVerificationNeeded; if (paymentVerificationNeeded != null) { if (!TLString.IsNullOrEmpty(paymentVerificationNeeded.Url)) { var backEnrty = NavigationService.BackStack.FirstOrDefault(); while (backEnrty != null && !backEnrty.Source.ToString().Contains("DialogDetailsView.xaml") && !backEnrty.Source.ToString().Contains("ShellView.xaml")) { NavigationService.RemoveBackEntry(); backEnrty = NavigationService.BackStack.FirstOrDefault(); } if (backEnrty != null && backEnrty.Source.ToString().Contains("DialogDetailsView.xaml")) { StateService.ShowScrollDownButton = true; } StateService.RemoveBackEntry = true; StateService.Url = paymentVerificationNeeded.Url.ToString(); StateService.PaymentInfo = PaymentInfo; NavigationService.UriFor <WebVerificationViewModel>().Navigate(); } return; } }
public void Open(TLUserBase user, TLChatBase chat, Action <AddChatParticipantBoxResult> callback) { var userName = user.FirstName; if (TLString.IsNullOrEmpty(userName)) { userName = user.LastName; } AddUserToTheGroupString = string.Format(AppResources.AddUserToTheGroup, userName, chat.FullName); NotifyOfPropertyChange(() => AddUserToTheGroupString); IsOpen = true; _callback = callback; }
private string GetChatSubtitle3() { var user = CurrentItem as TLUser; if (user != null && user.IsBot) { var botInfo = user.BotInfo as TLBotInfo; if (botInfo != null && !TLString.IsNullOrEmpty(botInfo.Description)) { return(botInfo.Description.ToString()); } } return(string.Empty); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var message = value as TLMessage; if (message == null) { return(Visibility.Collapsed); } if (TLString.IsNullOrEmpty(message.Message)) { return(Visibility.Collapsed); } return(Visibility.Visible); }
public ShippingInfoViewModel(ICacheService cacheService, ICommonErrorHandler errorHandler, IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator) : base(cacheService, errorHandler, stateService, navigationService, mtProtoService, eventAggregator) { if (PaymentInfo != null && PaymentInfo.Form != null) { var savedInfo = PaymentInfo.Form.SavedInfo; if (savedInfo != null) { Name = savedInfo.Name != null?savedInfo.Name.ToString() : null; var phone = TLString.IsNullOrEmpty(savedInfo.Phone) ? string.Empty : savedInfo.Phone.ToString(); if (!string.IsNullOrEmpty(phone)) { var codeCounty = CountryUtils.CountriesSource.FirstOrDefault(x => phone.StartsWith(x.PhoneCode, StringComparison.OrdinalIgnoreCase)); if (codeCounty != null) { PhoneCode = codeCounty.PhoneCode; var index = phone.IndexOf(PhoneCode, StringComparison.OrdinalIgnoreCase); var phoneNumber = (index < 0) ? phone : phone.Remove(index, PhoneCode.Length); PhoneNumber = phoneNumber; } else { PhoneNumber = phone; } } Email = savedInfo.Email != null?savedInfo.Email.ToString() : null; if (savedInfo.ShippingAddress != null) { var country = CountryUtils.CountriesSource.FirstOrDefault(x => string.Equals(savedInfo.ShippingAddress.CountryIso2.ToString(), x.Code, StringComparison.OrdinalIgnoreCase)); StreetLine1 = savedInfo.ShippingAddress.StreetLine1.ToString(); StreetLine2 = savedInfo.ShippingAddress.StreetLine2.ToString(); City = savedInfo.ShippingAddress.City.ToString(); State = savedInfo.ShippingAddress.State.ToString(); _selectedCountry = country; PostCode = savedInfo.ShippingAddress.PostCode.ToString(); } } } SaveShippingInformation = true; }
public WebViewModel(IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService) { _stateService = stateService; _navigationService = navigationService; _mtProtoService = mtProtoService; _sharedContact = stateService.SharedContact as TLUser; stateService.SharedContact = null; var userName = _sharedContact as IUserName; if (userName != null && !TLString.IsNullOrEmpty(userName.UserName)) { Subtitle = "@" + userName.UserName; } _botCallbackAnswer = stateService.BotCallbackAnswer; stateService.BotCallbackAnswer = null; _forwardMessages = stateService.ForwardMessages; stateService.ForwardMessages = null; var botCallbackAnswer54 = _botCallbackAnswer as TLBotCallbackAnswer54; if (botCallbackAnswer54 != null) { Url = new Uri(botCallbackAnswer54.Url.ToString(), UriKind.RelativeOrAbsolute); #if DEBUG Clipboard.SetText(botCallbackAnswer54.Url.ToString()); MessageBox.Show(botCallbackAnswer54.Url.ToString()); #endif } _game = stateService.Game; stateService.Game = null; if (_game != null) { GameTitle = _game.Title.ToString(); } _inputPeer = stateService.InputPeer; stateService.InputPeer = null; _timer = new Timer(OnTimerTick); }
public void AddContact() { if (CurrentContact == null) { return; } if (!HasPhone) { return; } var userPhone = new TLString(Phone); if (TLString.IsNullOrEmpty(userPhone)) { return; } IsWorking = true; ImportContactAsync(CurrentContact, userPhone, MTProtoService, result => { IsWorking = false; if (result.Users.Count > 0) { EventAggregator.Publish(result.Users[0]); RaiseImportStatusChanged(new ImportEventArgs { Imported = true }); var contact = result.Users[0] as TLUserContact; if (contact != null) { EventAggregator.Publish(new AddedToContactsEventArgs { Contact = contact }); ContactsHelper.CreateContactAsync(_fileManager, StateService, contact); } } }, error => { IsWorking = false; Execute.ShowDebugMessage("contacts.importContacts error " + error); }); }
public void Passport() { if (IsWorking) { return; } var passportConfig = StateService.GetPassportConfig(); var passportConfigHash = passportConfig != null ? passportConfig.Hash : new TLInt(0); MTProtoService.GetPassportDataAsync( (result1, result2) => BeginOnUIThread(() => { IsWorking = false; if (result1.HasPassword) { StateService.Password = result1; StateService.SecureValues = result2; NavigationService.UriFor <Passport.EnterPasswordViewModel>().Navigate(); return; } if (!result1.HasPassword) { if (!TLString.IsNullOrEmpty(result1.EmailUnconfirmedPattern)) { StateService.Password = result1; StateService.SecureValues = result2; NavigationService.UriFor <PasswordViewModel>().Navigate(); } else { StateService.Password = result1; StateService.SecureValues = result2; NavigationService.UriFor <PasswordIntroViewModel>().Navigate(); } return; } }), error => BeginOnUIThread(() => { IsWorking = false; Execute.ShowDebugMessage("passport.container error " + error); })); }
public void CopyLink() { if (_sharedContact == null || TLString.IsNullOrEmpty(_sharedContact.UserName)) { return; } var link = string.Format(Constants.UsernameLinkPlaceholder, _sharedContact.UserName); if (_game != null && !TLString.IsNullOrEmpty(_game.ShortName)) { link += "?game=" + _game.ShortName; } Clipboard.SetText(link); MessageBox.Show(AppResources.CopyLinkHint); }
protected override void OnActivate() { StartTimer(); if (StateService.RemoveBackEntry) { StateService.RemoveBackEntry = false; NavigationService.RemoveBackEntry(); } if (StateService.Password == null) { _suppressPasswordEnabled = true; if (_password != null) { PasswordEnabled = _password.IsAvailable; RecoveryEmailUnconfirmedVisibility = !TLString.IsNullOrEmpty(_password.EmailUnconfirmedPattern) || (_password is TLPassword && ((TLPassword)_password).HasRecovery.Value) ? Visibility.Visible : Visibility.Collapsed; NotifyOfPropertyChange(() => RecoveryEmailLabel); NotifyOfPropertyChange(() => CompletePasswordLabel); NotifyOfPropertyChange(() => ChangePasswordVisibility); NotifyOfPropertyChange(() => CompletePasswordVisibility); } _suppressPasswordEnabled = false; } else { _password = StateService.Password; StateService.Password = null; StartTimer(); RecoveryEmailUnconfirmedVisibility = !TLString.IsNullOrEmpty(_password.EmailUnconfirmedPattern) || (_password is TLPassword && ((TLPassword)_password).HasRecovery.Value) ? Visibility.Visible : Visibility.Collapsed; NotifyOfPropertyChange(() => RecoveryEmailLabel); NotifyOfPropertyChange(() => CompletePasswordLabel); NotifyOfPropertyChange(() => ChangePasswordVisibility); NotifyOfPropertyChange(() => CompletePasswordVisibility); } base.OnActivate(); }
private void UsernameHint_OnTap(object sender, GestureEventArgs e) { Caption.Focus(); var frameworkElement = e.OriginalSource as FrameworkElement; if (frameworkElement != null) { var user = frameworkElement.DataContext as IUserName; if (user != null) { var userBase = user as TLUserBase; var index = 0; for (var i = Caption.Text.Length - 1; i >= 0; i--) { if (Caption.Text[i] == '@') { index = i; break; } } if (TLString.IsNullOrEmpty(user.UserName)) { if (userBase != null) { ViewModel.AddMention(userBase); Caption.Text = string.Format("{0}({1})", Caption.Text.Substring(0, index + 1), userBase.FullName); Caption.SelectionStart = Caption.Text.Length - userBase.FullName.Length - 1; Caption.SelectionLength = userBase.FullName.Length; } } else { Caption.Text = string.Format("{0}{1} ", Caption.Text.Substring(0, index + 1), user.UserName); Caption.SelectionStart = Caption.Text.Length; Caption.SelectionLength = 0; } } } }
public object Convert(object item, Type targetType, object parameter, CultureInfo culture) { if (!(item is TLObject)) { return(null); } var serviceText = item as TLServiceText; if (serviceText != null) { return(TextTemplate); } var userBase = item as TLUserBase; if (userBase != null && userBase.IsGlobalResult) { var username = userBase as IUserName; if (username != null && !TLString.IsNullOrEmpty(username.UserName)) { return(UserTemplate); } return(DialogTemplate); } var chatBase = item as TLChatBase; if (chatBase != null && chatBase.IsGlobalResult) { return(UserTemplate); } var dialog = item as TLDialog; if (dialog != null && dialog.TopMessage != null && dialog.Messages == null) { return(MessageTemplate); } return(DialogTemplate); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null) { return(null); } var firstLetter = string.Empty; var message = value as TLMessage; if (message == null) { return(null); } var links = message.Links; if (links != null && links.Count > 0) { firstLetter = GetFirstUrlLetter(links[0]); } else { var mediaWebPage = message.Media as TLMessageMediaWebPage; if (mediaWebPage != null) { var webPage = mediaWebPage.WebPage as TLWebPage; if (webPage != null) { if (!TLString.IsNullOrEmpty(webPage.DisplayUrl)) { firstLetter = GetFirstUrlLetter(webPage.DisplayUrl.ToString()); } } } } return(firstLetter); }
private void ClearHistory_OnLoaded(object sender, RoutedEventArgs e) { var menuItem = sender as MenuItem; if (menuItem == null) { return; } var dialog = menuItem.DataContext as TLDialogBase; if (dialog == null) { return; } var channel = dialog.With as TLChannel; menuItem.Visibility = channel != null && (!channel.IsMegaGroup || !TLString.IsNullOrEmpty(channel.UserName)) ? Visibility.Collapsed : Visibility.Visible; }
private void SendContact(TLUserBase contact) { if (TLString.IsNullOrEmpty(contact.Phone)) { var username = contact as IUserName; if (username != null && !TLString.IsNullOrEmpty(username.UserName)) { string accessToken = null; var bot = contact as TLUser; if (bot != null && bot.IsBot && !string.IsNullOrEmpty(bot.AccessToken)) { accessToken = bot.AccessToken; bot.AccessToken = null; } _text = string.Format(Constants.UsernameLinkPlaceholder, username.UserName); if (!string.IsNullOrEmpty(accessToken)) { _text += "?start=" + accessToken; } Send(); return; } return; } var media = new TLMessageMediaContact82 { UserId = contact.Id, FirstName = contact.FirstName, LastName = contact.LastName, PhoneNumber = contact.Phone, VCard = TLString.Empty }; ContinueSendContact(media); }