/// <summary> /// Updates this instance. /// </summary> private async Task CheckForUpdate() { var updateManager = IoC.Get <UpdateManager>(); this.NeedUpdate = await updateManager.CheckForUpdate(); if (this.NeedUpdate) { var message = new ManaBulbMessage() { IsUpdate = true, View = new UpdateViewModel(UpdateState.NeedUpdate), Action = () => this.Update(), }; this._eventAggregator.PublishOnUIThread(message); return; } else if (this._showUpdateSuccess) { this._showUpdateSuccess = false; this._eventAggregator.PublishOnUIThread(new ManaBulbMessage() { IsUpdate = true, View = new UpdateViewModel(UpdateState.Success), DisplayTime = TimeSpan.FromSeconds(5) }); } else { using (var patreonService = new PatreonService()) { var isPledging = await patreonService.IsPledging(); if (isPledging) { return; } } using (var service = new CollaborationService()) { var collaboration = await service.GetCollaborationAsync(); if (!collaboration.IsExpired()) { this._eventAggregator.PublishOnUIThread(new ManaBulbMessage() { View = new CollaborationViewModel(collaboration), Action = collaboration.Open, DisplayTime = TimeSpan.FromSeconds(6) }); } } } }
private async void CollaborationView_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { if ((bool)e.NewValue) { using (var service = new CollaborationService()) { var content = await service.GetImageAsync(); var bitMap = new BitmapImage(); bitMap.BeginInit(); bitMap.StreamSource = new MemoryStream(content); bitMap.EndInit(); this.Image.Source = bitMap; } } }
public async Task <IActionResult> Activity(string collabId, int page = 1) { try { await InitClient(); var detail = CollaborationService.GetDetailsAsync(collabId); var ars = CollaborationService.GetActivity(collabId, page); await Task.WhenAll(detail, ars); var cd = new CollaborationDetails { Collab = detail.Result, IsSessionActivityPage = true }; var model = new SessionActivity { Activities = ars.Result, CollaborationDetails = cd }; return(View(model)); } catch (StudioApiException e) { return(HandleError(e)); } }