コード例 #1
0
        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));
        }
コード例 #2
0
 private void SelectMessageMandler(SelectedMessage msg)
 {
     _isSelected = msg.SelectedObject == gameObject;
     if (!_isSelected)
     {
         _activeManipulationCommand = CommandType.None;
     }
 }
コード例 #3
0
        private void IngredientAmountSelected(SelectedMessage <IngredientAmountWrapper> message)
        {
            if (message.TargetId != RecipeId)
            {
                return;
            }

            Model = message.Model;
        }
コード例 #4
0
        private void IngredientSelected(SelectedMessage <IngredientWrapper> message)
        {
            var ingredientDetail = _ingredientRepository.GetById(message.Id);

            Model = new IngredientAmountDetailModel
            {
                IngredientId          = ingredientDetail.Id,
                IngredientName        = ingredientDetail.Name,
                IngredientDescription = ingredientDetail.Description
            };
        }
コード例 #5
0
        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
            };
        }
コード例 #6
0
        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;
        }
コード例 #7
0
        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;
        }
コード例 #8
0
        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,
コード例 #9
0
        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();
            }
        }
コード例 #10
0
        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);
            }
        }
コード例 #11
0
 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);
         }
     }
 }
コード例 #12
0
        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);
        }
コード例 #13
0
 private void OnRecipeSelected(SelectedMessage <RecipeWrapper> message)
 {
     SelectRecipe(message.Id);
 }
コード例 #14
0
 private void OnIngredientSelected(SelectedMessage <IngredientWrapper> message)
 {
     SelectIngredient(message.Id);
 }
コード例 #15
0
 private void SelectMessageMandler(SelectedMessage msg)
 {
     //?
 }
コード例 #16
0
 private void PersonSelected(SelectedMessage <PersonWrapper> message)
 {
     ActorId = message.Id;
     Load();
 }
コード例 #17
0
 public MessageListViewModel()
 {
     MessageList             = Repository.Get(typeof(MessageList)) as MessageList;
     SelectedMessage         = Repository.Get(typeof(SelectedMessage)) as SelectedMessage;
     SelectedMessage.message = MessageList.First();
 }
コード例 #18
0
        void Someday_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            ClientStats.LogEvent("Someday in message details view");

            SelectedMessage.AddLabel(new Label(LabelType.Someday));
        }
コード例 #19
0
 private void Proxy_MessagedReceived(string message, string senderId)
 {
     SelectedFriend = GetFriend(senderId);
     SelectedMessage.AddMessageContent(message);
 }
コード例 #20
0
 private void FilmSelected(SelectedMessage <FilmWrapper> message)
 {
     FilmId = message.Id;
     Load();
 }
コード例 #21
0
 private void SelectedPhoto(SelectedMessage message)
 {
     Detail = photoRepository.FindById(message.Id);
 }
コード例 #22
0
        void WaitingFor_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            ClientStats.LogEvent("WaitingFor in message details view");

            SelectedMessage.AddLabel(new Label(LabelType.WaitingFor));
        }
コード例 #23
0
 private void OnFilmSelected(SelectedMessage <FilmWrapper> message)
 {
     SelectFilm(message.Id);
 }
コード例 #24
0
        void Todo_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            ClientStats.LogEvent("Todo in message details view");

            SelectedMessage.AddLabel(new Label(LabelType.Todo));
        }
コード例 #25
0
 private void OnPersonSelected(SelectedMessage <PersonWrapper> message)
 {
     SelectPerson(message.Id);
 }
コード例 #26
0
        /// <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);
        }
コード例 #27
0
        void Archive_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            ClientStats.LogEvent("Archive in message details view");

            SelectedMessage.Archive();
        }