private async Task AddStatuses(IEnumerable <StatusViewModel> statuses, bool append = true) { var statusViewModels = statuses as StatusViewModel[] ?? statuses.ToArray(); if (statusViewModels.Any()) { SinceId = Math.Max(SinceId, statusViewModels.Max(s => s.Id)); MaxId = Math.Min(MaxId, statusViewModels.Min(s => s.Id)); foreach (var s in statusViewModels) { await UpdateCache(s.Model); if (append) { await Dispatcher.RunAsync(() => StatusCollection.Add(s)); } else { await Dispatcher.RunAsync(() => StatusCollection.Insert(0, s)); } } RaiseNewStatus(statusViewModels.Last()); } }
public void AddConnection(string connectionId) { connectionIds.Add(connectionId); var name = userService.Name(connectionId); statuses.Add(new Status($"{name} has joined the room")); }
protected CollectionBase GenerateStatusCollectionFromReader(IDataReader returnData) { StatusCollection stsCollection = new StatusCollection(); while (returnData.Read()) { Status newStatus = new Status((int)returnData["StatusId"], (int)returnData["ProjectId"], (string)returnData["StatusName"], (string)returnData["StatusImageUrl"]); stsCollection.Add(newStatus); } return(stsCollection); }
public StatusCollection GetStatus() { StatusCollection status = new StatusCollection(); using (StatusDataAdapter adapter = new StatusDataAdapter()) { IDataReader dr = adapter.GetStatus(); while (dr.Read()) { status.Add(PopulateReader(dr)); } dr.Dispose(); adapter.Dispose(); return status; } }
private async Task AddStatus(StatusViewModel status, bool append = true) { SinceId = Math.Min(SinceId, status.Id); MaxId = Math.Min(MaxId, status.Id); await Dispatcher.RunAsync(() => { if (append) { StatusCollection.Add(status); } else { StatusCollection.Insert(0, status); } }); RaiseNewStatus(status); await UpdateCache(status.Model); }
public async Task GetStatus(string tobeParsedString) { try { IsLoading = true; IsError = false; var ResultList = await StatusParser.Parse(tobeParsedString); foreach (var s in ResultList) { StatusCollection.Add(s); } if (StatusCollection.Count == 0) { IsError = true; } } catch { IsError = true; } IsLoading = false; }