public async Task RemoveMessageGroup(MessageGroupItem messageGroupItem) { try { var result = await _messageManager.DeleteMessageThread(messageGroupItem.MessageGroup.MessageGroupId, Locator.ViewModels.MainPageVm.CurrentUser.Username, Locator.ViewModels.MainPageVm.CurrentTokens, Locator.ViewModels.MainPageVm.CurrentUser.Region); await AccountAuthHelpers.UpdateTokens(Locator.ViewModels.MainPageVm.CurrentUser, result); var resultCheck = await ResultChecker.CheckSuccess(result); if (!resultCheck) { return; } if (SelectedMessageGroup != null && SelectedMessageGroup.MessageGroupId == messageGroupItem.MessageGroup.MessageGroupId) { GroupMemberSeperatedList = string.Empty; SelectedMessageGroup = null; MessageCollection.Clear(); IsSelected = false; } MessageGroupCollection.Remove(messageGroupItem); } catch (Exception ex) { // TODO: Proper Error handling if deleting fails :\ } }
public async Task DownloadImageAsync(MessageGroupItem item) { IsLoading = true; var saved = true; try { var imageBytes = await _messageManager.GetMessageContent(SelectedMessageGroup.MessageGroupId, item.Message.SentMessageId, Locator.ViewModels.MainPageVm.CurrentTokens, Locator.ViewModels.MainPageVm.CurrentUser.Region, Locator.ViewModels.MainPageVm.CurrentUser.Language); await FileAccessCommands.SaveStreamToCameraRoll(imageBytes, item.Message.SentMessageId + ".png"); } catch (Exception ex) { //Insights.Report(ex); saved = false; } var loader = new ResourceLoader(); if (!saved) { await ResultChecker.SendMessageDialogAsync(loader.GetString("ErrorSaveImage/Text"), false); } else { await ResultChecker.SendMessageDialogAsync(loader.GetString("ImageSaved/Text"), true); } IsLoading = false; }
public async Task LoadMessageImage(MessageGroupItem item) { IsLoading = true; var imageBytes = await _messageManager.GetMessageContent(SelectedMessageGroup.MessageGroupId, item.Message.SentMessageId, Locator.ViewModels.MainPageVm.CurrentTokens, Locator.ViewModels.MainPageVm.CurrentUser.Region, Locator.ViewModels.MainPageVm.CurrentUser.Language); item.Image = await DecodeImage(imageBytes); IsLoading = false; }
private async void MessageGroup_OnClick(object sender, ItemClickEventArgs e) { var clickedItem = (MessageGroupItem)e.ClickedItem; _lastSelectedItem = clickedItem; await Locator.ViewModels.MessagesVm.GetMessages(clickedItem.MessageGroup); if (AdaptiveStates.CurrentState == NarrowState) { // Use "drill in" transition for navigating from master list to detail view App.RootFrame.Navigate(typeof(MessageDetailPage), null, new DrillInNavigationTransitionInfo()); } else { // Play a refresh animation when the user switches detail items. //EnableContentTransitions(); } }
private void MessagesVmOnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs) { switch (propertyChangedEventArgs.PropertyName) { case "IsNewMessage": if (Locator.ViewModels.MessagesVm.IsNewMessage) { _lastSelectedItem = null; MessageList.SelectedItem = null; Locator.ViewModels.MessagesVm.MessageCollection.Clear(); if (AdaptiveStates.CurrentState == NarrowState) { // Use "drill in" transition for navigating from master list to detail view App.RootFrame.Navigate(typeof(MessageDetailPage), null, new DrillInNavigationTransitionInfo()); } } break; } }
public async Task LoadMessageImage(MessageGroupItem item) { IsLoading = true; await Shell.Instance.ViewModel.UpdateTokens(); var imageBytes = await _messageManager.GetMessageContent(SelectedMessageGroup.MessageGroupId, item.Message.SentMessageId, Shell.Instance.ViewModel.CurrentTokens, Shell.Instance.ViewModel.CurrentUser.Region, Shell.Instance.ViewModel.CurrentUser.Language); item.Image = await DecodeImage(imageBytes); IsLoading = false; }