private async Task InitData() { if (ServiceContext.Instance.CurrentUser == null || ServiceContext.Instance.CurrentProject == null) { return; } if (IsBusy || initilized) { return; } IsBusy = true; HasError = false; Error = null; var result = await eventService.FetchLatestEvent(); if (result.HasError) { HasError = true; Error = result.Error; IsBusy = false; return; } var latestMeetings = result.Model.Where((meeting) => { var span = DateTime.Now - meeting.MeetingCreatedAt; return(span.Days <= 5); }); foreach (var item in latestMeetings) { LatestMeetings.Add(item); } var result1 = await eventService.GetRelationalCount(); if (result1.HasError) { HasError = true; Error = result1.Error; IsBusy = false; return; } RelationalCount = result1.Model; initilized = true; IsBusy = false; }
public async Task UpdateMessageAndRelationalCount() { if (IsBusy) { return; } IsBusy = true; HasError = false; Error = null; LatestMeetings.Clear(); var result = await eventService.FetchLatestEvent(); if (result.HasError) { HasError = true; Error = result.Error; IsBusy = false; return; } var latestMeetings = result.Model.Where((meeting) => { var span = DateTime.Now - meeting.MeetingCreatedAt; return(span.Days <= 5); }); foreach (var item in latestMeetings) { LatestMeetings.Add(item); } var result1 = await eventService.GetRelationalCount(); if (result1.HasError) { HasError = true; Error = result1.Error; IsBusy = false; return; } RelationalCount = result1.Model; IsBusy = false; }