protected override void OnActivate() { base.OnActivate(); MTProtoService.GetBlockedAsync(new TLInt(0), new TLInt(int.MaxValue), result => { var contacts = result as TLContactsBlocked; if (contacts != null) { var count = contacts.Blocked.Count; UpdateBlockedUsersString(count); } }, error => Execute.ShowDebugMessage("contacts.getBlocked error " + error)); MTProtoService.GetAccountTTLAsync( result => { var days = result.Days.Value; UpdateAccountTTLString(days); }, error => Execute.ShowDebugMessage("account.getAccountTTL error " + error)); MTProtoService.GetPrivacyAsync(new TLInputPrivacyKeyStatusTimestamp(), result => { UpdateLastSeenString(result); }, error => Execute.ShowDebugMessage("account.getPrivacy error " + error)); }
protected override void OnInitialize() { Status = AppResources.Loading; MTProtoService.GetBlockedAsync(new TLInt(0), new TLInt(int.MaxValue), result => { var contacts = result as TLContactsBlocked; if (contacts != null) { foreach (var user in contacts.Users) { var cachedUser = CacheService.GetUser(new TLInt(user.Index)); if (cachedUser != null) { LazyItems.Add(cachedUser); } else { LazyItems.Add(user); } } Status = Items.Count > 0 || LazyItems.Count > 0? string.Empty : string.Format("{0}", AppResources.NoUsersHere); BeginOnUIThread(PopulateItems); } }, error => BeginOnUIThread(() => Status = string.Empty)); base.OnInitialize(); }
protected override void OnActivate() { base.OnActivate(); MTProtoService.GetBlockedAsync(new TLInt(0), new TLInt(int.MaxValue), result => { var contacts = result as TLContactsBlocked; if (contacts != null) { var count = contacts.Blocked.Count; UpdateBlockedUsersString(count); } }, error => Execute.ShowDebugMessage("contacts.getBlocked error " + error)); MTProtoService.GetAccountTTLAsync( result => { var days = result.Days.Value; UpdateAccountTTLString(days); }, error => Execute.ShowDebugMessage("account.getAccountTTL error " + error)); MTProtoService.GetPrivacyAsync(new TLInputPrivacyKeyStatusTimestamp(), result => { LastSeenSubtitle = GetPrivacyString(result, out _lastSeenPrivacyRules); }, error => Execute.ShowDebugMessage("account.getPrivacy error " + error)); MTProtoService.GetPrivacyAsync(new TLInputPrivacyKeyPhoneCall(), result => { PhoneCallsSubtitle = GetPrivacyString(result, out _phoneCallsPrivacyRules); }, error => Execute.ShowDebugMessage("account.getPrivacy error " + error)); MTProtoService.GetPrivacyAsync(new TLInputPrivacyKeyChatInvite(), result => { GroupsSubtitle = GetPrivacyString(result, out _chatInvitePrivacyRules); }, error => Execute.ShowDebugMessage("account.getPrivacy error " + error)); Execute.BeginOnThreadPool(() => { var isSecretChatEnabled = TLUtils.OpenObjectFromMTProtoFile <TLBool>(SecretChatsViewModel.LinkPreviewsSyncRoot, Constants.WebPagePreviewsFileName); if (isSecretChatEnabled == null || !isSecretChatEnabled.Value) { _secretChatsEnabled = true; IsSecretChatsEnabled = true; } else { _secretChatsEnabled = false; } }); }