protected void StarCore() { var previousSelection = new List <Message>(SelectedMessages); // Contains instance copies of messages, this will be the old data // before the do is applied. var messagesCopy = SelectedMessages .Select(m => m.DuckCopy <Message>()) .ToList(); #region Do action Action doAction = delegate { foreach (var message in SelectedMessages.ToList()) { if (SelectedMessage.IsStarred) { SelectedMessage.SetUnstarred(); } else { SelectedMessage.SetStarred(); } } viewFilter.UpdateCurrentViewAsync(); flipper.Delay(); }; #endregion #region Undo action Action undoAction = delegate { foreach (var message in previousSelection) { // Get old message from copied data Message message1 = message; var oldMessage = messagesCopy.Single(m => m.MessageId == message1.MessageId); // Reverts the previous action message.IsStarred = oldMessage.IsStarred; message.TargetMessageState = oldMessage.TargetMessageState; AsyncUpdateQueue.Enqueue(message); } // We cannot use the IEditableObject appraoch here because the conversation in question // probably might not be in view anymore. So instead we will refresh the whole view. viewFilter.RebuildCurrentViewAsync(); }; #endregion ClientState.Current.UndoManager.Execute(new HistoryAction(doAction, undoAction)); }
private void SelectMessageMandler(SelectedMessage msg) { _isSelected = msg.SelectedObject == gameObject; if (!_isSelected) { _activeManipulationCommand = CommandType.None; } }
private void IngredientAmountSelected(SelectedMessage <IngredientAmountWrapper> message) { if (message.TargetId != RecipeId) { return; } Model = message.Model; }
private void IngredientSelected(SelectedMessage <IngredientWrapper> message) { var ingredientDetail = _ingredientRepository.GetById(message.Id); Model = new IngredientAmountDetailModel { IngredientId = ingredientDetail.Id, IngredientName = ingredientDetail.Name, IngredientDescription = ingredientDetail.Description }; }
private void IngredientSelected(SelectedMessage <IngredientWrapper> message) { var ingredientDetail = _ingredientRepository.GetById(message.Id); Model = new IngredientAmountDetailModel { IngredientId = ingredientDetail?.Id ?? Guid.Empty, IngredientName = ingredientDetail?.Name ?? string.Empty, IngredientDescription = ingredientDetail?.Description ?? string.Empty }; }
public CanvasViewModel() { BackGround = BitmapUtil.GetImage(@"C:\Users\ud\source\repos\MTGTool\MTGTool\bin\Debug\Image\UI\背景.png"); MessageWindow = BitmapUtil.GetImage(@"C:\Users\ud\source\repos\MTGTool\MTGTool\bin\Debug\Image\UI\メッセージウインドウ.png"); _currentMsg = Repository.Get(typeof(SelectedMessage)) as SelectedMessage; _currentMsg.OnChange.Subscribe(_ => { RaisePropertyChanged(nameof(Name)); RaisePropertyChanged(nameof(Message)); RaisePropertyChanged(nameof(Character)); }); ObjectGroups = Repository.Get(typeof(ObjectGroupList)) as ObjectGroupList; VisibleMessage = Repository.Get(typeof(VisibleMessageWindow)) as VisibleMessageWindow; }
private void OnReviewSelected(SelectedMessage <ReviewDetailWrapper> message) { var reviewDetailViewModel = ReviewDetailViewModels.SingleOrDefault(vm => vm.Model.Id == message.Id); if (reviewDetailViewModel == null) { reviewDetailViewModel = _reviewDetailViewModelFactory.Create(); ReviewDetailViewModels.Add(reviewDetailViewModel); reviewDetailViewModel.Load(message.Id); } SelectedReviewDetailViewModel = reviewDetailViewModel; }
private async Task IngredientSelected(SelectedMessage <IngredientWrapper> message) { if (message.Id is null) { Model = null; } else { var ingredientDetail = await _ingredientFacade.GetAsync(message.Id.Value); Model = new IngredientAmountDetailModel( ingredientDetail?.Id ?? Guid.Empty, ingredientDetail?.Name ?? string.Empty, ingredientDetail?.Description ?? string.Empty,
void Star_Executed(object sender, ExecutedRoutedEventArgs e) { if (SelectedMessage.IsStarred) { ClientStats.LogEvent("Star in message details view"); SelectedMessage.SetUnstarred(); } else { ClientStats.LogEvent("Unstar in message details view"); SelectedMessage.SetStarred(); } }
private async Task DeleteMessageExecute() { if (IsBusy) { return; } string tx = null; try { IsBusy = true; if (FromInbox) { tx = await PhantasmaService.RemoveInboxMessage(SelectedMessage.ID); } else { tx = await PhantasmaService.RemoveOutboxMessage(SelectedMessage.ID); } } catch (Exception ex) { if (ex is RpcClientUnknownException || ex is RpcClientTimeoutException) //todo switch error message { AppSettings.ChangeRpcServer(); } await DialogService.ShowAlertAsync(ex.Message, AppResource.Alert_Error); } finally { IsBusy = false; } if (!string.IsNullOrEmpty(tx)) { await _db.DeleteMessage(SelectedMessage.ToStoreMessage()); await DialogService.ShowAlertAsync("Message will be deleted in the next block", "Success"); //todo move to resources await NavigationService.NavigateBackAsync(); } else { await DialogService.ShowAlertAsync(AppResource.Alert_SomethingWrong, AppResource.Alert_Error); } }
private void SelectedPhoto(SelectedMessage message) { Detail = photoRepository.FindById(message.Id); AddNewObject.photoDetailModel = Detail; ThingsOnPhoto.Clear(); PersonsOnPhoto.Clear(); foreach (var objectOnPhotoModel in Detail.ObjectsOnPhoto) { if (objectOnPhotoModel.Object.GetType() == typeof(ThingEntity)) { ThingsOnPhoto.Add(objectOnPhotoModel); } else { PersonsOnPhoto.Add(objectOnPhotoModel); } } }
public void LoadData(object dataInstance) { var helper = ((OverviewDataHelper)dataInstance); using (mailbox.Messages.ReaderLock) SelectedMessage = mailbox.Messages.FirstOrDefault( c => c.MessageId == helper.MessageId); if (SelectedMessage == null) { throw new ApplicationException( String.Format("Message was not found. MessageId = {0}", ((OverviewDataHelper)dataInstance).MessageId)); } // Mark all messages as read SelectedMessage.MarkRead(); OnPropertyChanged("SelectedMessage"); OnPropertyChanged("Title"); if (SelectedConversation == null || SelectedMessage.Conversation != SelectedConversation) { SelectedConversation = SelectedMessage.Conversation; OnPropertyChanged("SelectedConversation"); Messages.Replace(SelectedConversation.Messages); if (list != null) { list.SelectedItem = SelectedMessage; Dispatcher.BeginInvoke(DispatcherPriority.Input, (Action)(() => list.ScrollIntoView(SelectedMessage))); } } MessageActionsBox.Show(SelectedMessage); ThreadView.Show(SelectedMessage); UserProfileControl.SourceAddress = SelectedMessage.From; FocusHelper.Focus(TabSink); }
private void OnRecipeSelected(SelectedMessage <RecipeWrapper> message) { SelectRecipe(message.Id); }
private void OnIngredientSelected(SelectedMessage <IngredientWrapper> message) { SelectIngredient(message.Id); }
private void SelectMessageMandler(SelectedMessage msg) { //? }
private void PersonSelected(SelectedMessage <PersonWrapper> message) { ActorId = message.Id; Load(); }
public MessageListViewModel() { MessageList = Repository.Get(typeof(MessageList)) as MessageList; SelectedMessage = Repository.Get(typeof(SelectedMessage)) as SelectedMessage; SelectedMessage.message = MessageList.First(); }
void Someday_Executed(object sender, ExecutedRoutedEventArgs e) { ClientStats.LogEvent("Someday in message details view"); SelectedMessage.AddLabel(new Label(LabelType.Someday)); }
private void Proxy_MessagedReceived(string message, string senderId) { SelectedFriend = GetFriend(senderId); SelectedMessage.AddMessageContent(message); }
private void FilmSelected(SelectedMessage <FilmWrapper> message) { FilmId = message.Id; Load(); }
private void SelectedPhoto(SelectedMessage message) { Detail = photoRepository.FindById(message.Id); }
void WaitingFor_Executed(object sender, ExecutedRoutedEventArgs e) { ClientStats.LogEvent("WaitingFor in message details view"); SelectedMessage.AddLabel(new Label(LabelType.WaitingFor)); }
private void OnFilmSelected(SelectedMessage <FilmWrapper> message) { SelectFilm(message.Id); }
void Todo_Executed(object sender, ExecutedRoutedEventArgs e) { ClientStats.LogEvent("Todo in message details view"); SelectedMessage.AddLabel(new Label(LabelType.Todo)); }
private void OnPersonSelected(SelectedMessage <PersonWrapper> message) { SelectPerson(message.Id); }
/// <summary> /// Display the directory for the specified CategoryFolder /// </summary> public override bool ViewFromFolder(FolderBase folder, Address address, FolderOptions options) { if (folder != _currentFolder) { _currentFolder = folder; SortConversations(); } // If an address is specified then it refers to a conversation ID that // needs to be selected. If it is not found, the first message is selected // instead. if (address != null && address.Scheme == "cixmailbox") { int selectedID; Int32.TryParse(address.Data, out selectedID); int selectedIndex; for (selectedIndex = 0; selectedIndex < _conversations.Count; ++selectedIndex) { InboxConversation conversation = _conversations[selectedIndex]; if (conversation.RemoteID == selectedID) { break; } } if (selectedIndex == _conversations.Count) { selectedIndex = 0; } SelectedRow = selectedIndex; if (address.Unread) { SelectedMessage.MarkUnread(); } return(true); } // If options are specified then search for the next unread // in the list otherwise set the initial selection to something // useful. if (options == 0 && SelectedRow == -1) { SetInitialSelection(); } else { int row = inboxConversations.SearchRow; if (row < 0 || options.HasFlag(FolderOptions.Reset)) { row = 0; } else if (_conversations.Count > 0) { InboxConversation conversation = _conversations[row]; if (conversation.UnreadCount > 0) { conversation.MarkRead(); } } if (!FirstUnreadAfterRow(row, options)) { inboxConversations.SearchRow = 0; return(false); } } FoldersTree.SetTopicName(_currentFolder.FullName); ActiveControl = inboxConversations; inboxConversations.Focus(); return(true); }
void Archive_Executed(object sender, ExecutedRoutedEventArgs e) { ClientStats.LogEvent("Archive in message details view"); SelectedMessage.Archive(); }