Exemplo n.º 1
0
        /// <summary>
        /// Merge the vote supporters from one vote into several other votes.
        /// </summary>
        /// <param name="fromVote">The originating vote.</param>
        /// <param name="toVotes">The destination votes.</param>
        /// <returns>Returns true if successfully completed.</returns>
        public bool Split(VoteLineBlock fromVote, List <VoteLineBlock> toVotes)
        {
            UndoBuffer.Push(new UndoAction(UndoActionType.Split, VoteStorage));
            UserMerges.AddMergeRecord(fromVote, toVotes, UndoActionType.Split, Quest !.PartitionMode);

            bool merged = SplitImplWrapper(fromVote, toVotes);

            if (merged)
            {
                OnPropertyChanged("Votes");
                OnPropertyChanged("Voters");
                OnPropertyChanged(nameof(HasUndoActions));
            }
            else
            {
                UndoBuffer.Pop();
            }

            return(merged);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Replace the task on the provided vote with the requested task.
        /// </summary>
        /// <param name="vote">The vote to update the task on.</param>
        /// <param name="task">The new task label.</param>
        /// <returns>Returns true if the task was updated.</returns>
        public bool ReplaceTask(VoteLineBlock vote, string task)
        {
            if (StringComparer.OrdinalIgnoreCase.Equals(vote.Task, task))
            {
                return(false);
            }

            UndoBuffer.Push(new UndoAction(UndoActionType.ReplaceTask, VoteStorage, vote));
            VoteLineBlock originalVote = vote.Clone();

            if (ReplaceTaskImplWrapper(vote, task))
            {
                UserMerges.AddMergeRecord(originalVote, vote, UndoActionType.ReplaceTask, Quest !.PartitionMode);

                OnPropertyChanged("Votes");
                OnPropertyChanged(nameof(HasUndoActions));
                return(true);
            }

            UndoBuffer.Pop();
            return(false);
        }