public async Task OnLoad(object data) { bool loadImage = data as bool? ?? true; foreach (var acc in Accounts) { acc.UseChanged -= Acc_UseChanged; } Accounts = ContextList?.Contexts?.Select(c => new AccountEntry(c, loadImage)).ToList(); if (Accounts == null) { LogTo.Warn("No accounts found"); return; } foreach (var acc in Accounts) { acc.UseChanged += Acc_UseChanged; } var defAccount = Accounts.FirstOrDefault(a => a.IsDefault) ?? Accounts.First(); defAccount.Use = true; if (PreSelectedAccounts.Any()) { foreach (var acc in Accounts) { acc.Use = PreSelectedAccounts.Contains(acc.Context.UserId); } } RaisePropertyChanged(nameof(Accounts)); InitializeText(); ConfirmationSet = false; Medias.Clear(); AttachedMedias.Clear(); KnownUserNames = (await Cache.GetKnownUsers().ConfigureAwait(false)).Select(u => u.UserName).ToList(); RaisePropertyChanged(nameof(KnownUserNames)); KnownHashtags = (await Cache.GetKnownHashtags().ConfigureAwait(false)).ToList(); RaisePropertyChanged(nameof(KnownHashtags)); ScheduleDate = DateTime.Now; ScheduleTime = DateTime.Now; DeletionDate = DateTime.Now; DeletionTime = DateTime.Now; IsTweetScheduled = false; IsDeletionScheduled = false; }
public async Task OnLoad(object data) { foreach (var acc in Accounts) { acc.UseChanged -= Acc_UseChanged; } Accounts = ContextList.Contexts.Select(c => new AccountEntry(c)).ToList(); foreach (var acc in Accounts) { acc.UseChanged += Acc_UseChanged; } var defAccount = Accounts.FirstOrDefault(a => a.IsDefault) ?? Accounts.First(); defAccount.Use = true; if (PreSelectedAccounts.Any()) { foreach (var acc in Accounts) { acc.Use = PreSelectedAccounts.Contains(acc.Context.UserId); } } RaisePropertyChanged(nameof(Accounts)); InitializeText(); ConfirmationSet = false; Medias.Clear(); AttachedMedias.Clear(); KnownUserNames = (await Cache.GetKnownUsers().ConfigureAwait(false)).Select(u => u.UserName).ToList(); RaisePropertyChanged(nameof(KnownUserNames)); KnownHashtags = (await Cache.GetKnownHashtags().ConfigureAwait(false)).ToList(); RaisePropertyChanged(nameof(KnownHashtags)); }