private void OnUndoRedoManagerChanged_AlternateContentCommand(UndoRedoManagerEventArgs eventt, bool done, AlternateContentCommand command, bool isTransactionEndEvent, bool isNoTransactionOrTrailingEdge)
 {
     if (command.TreeNode != null)
     {
         InvalidateDescriptions(false, command.TreeNode);
     }
 }
Esempio n. 2
0
 private void OnUndoRedoManagerChanged_TreeNodeChangeTextCommand(UndoRedoManagerEventArgs eventt, bool done, TreeNodeChangeTextCommand command, bool isTransactionEndEvent, bool isNoTransactionOrTrailingEdge)
 {
     if (!isTransactionEndEvent)
     {
         InvalidateHeadings(command.TreeNode);
     }
 }
Esempio n. 3
0
        private void OnUndoRedoManagerChanged_TreeNodeSetIsMarkedCommand(UndoRedoManagerEventArgs eventt, bool done, TreeNodeSetIsMarkedCommand command, bool isTransactionEndEvent, bool isNoTransactionOrTrailingEdge)
        {
            if (command.TreeNode.IsMarked)
            {
                MarkersNavigator.AddMarkedTreeNode(command.TreeNode);
            }
            else
            {
                MarkersNavigator.RemoveMarkedTreeNode(command.TreeNode);
            }

            RaisePropertyChanged(() => HasNotMarkers);
        }
        private void OnUndoRedoManagerChanged_TextNodeStructureEditCommand(UndoRedoManagerEventArgs eventt, bool done, TextNodeStructureEditCommand command, bool isTransactionEndEvent, bool isNoTransactionOrTrailingEdge)
        {
            DebugFix.Assert(command is TreeNodeInsertCommand || command is TreeNodeRemoveCommand);

            //TreeNode node = (command is TreeNodeInsertCommand) ? ((TreeNodeInsertCommand)command).TreeNode : ((TreeNodeRemoveCommand)command).TreeNode;
            TreeNode node = command.TreeNode;

            bool forceInvalidate = (command is TreeNodeInsertCommand && !done) || (command is TreeNodeRemoveCommand && done);

            InvalidatePages(forceInvalidate, node);

            bool done_ = (command is TreeNodeInsertCommand) ? !done : done;

            checkTreeNodeFragmentRemoval(done_, node);
        }
Esempio n. 5
0
        public void OnUndoRedoManagerChanged(UndoRedoManagerEventArgs eventt, bool done, Command command, bool isTransactionEndEvent, bool isNoTransactionOrTrailingEdge)
        {
            if (!TheDispatcher.CheckAccess())
            {
#if DEBUG
                Debugger.Break();
#endif

#if NET40x
                TheDispatcher.Invoke(DispatcherPriority.Normal,
                                     (Action <UndoRedoManagerEventArgs, bool, Command, bool, bool>)OnUndoRedoManagerChanged,
                                     eventt, done, command, isTransactionEndEvent, isNoTransactionOrTrailingEdge);
#else
                TheDispatcher.Invoke(DispatcherPriority.Normal,
                                     (Action)(() => OnUndoRedoManagerChanged(eventt, done, command, isTransactionEndEvent, isNoTransactionOrTrailingEdge))
                                     );
#endif
                return;
            }

            if (isTransactionEndEvent)
            {
                return;
            }

            if (command is CompositeCommand)
            {
#if DEBUG
                Debugger.Break();
#endif
            }
            else if (command is TreeNodeSetIsMarkedCommand)
            {
                OnUndoRedoManagerChanged_TreeNodeSetIsMarkedCommand(eventt, done, (TreeNodeSetIsMarkedCommand)command, isTransactionEndEvent, isNoTransactionOrTrailingEdge);
            }
            else if (command is TreeNodeChangeTextCommand)
            {
                OnUndoRedoManagerChanged_TreeNodeChangeTextCommand(eventt, done, (TreeNodeChangeTextCommand)command, isTransactionEndEvent, isNoTransactionOrTrailingEdge);
            }
            else if (command is TextNodeStructureEditCommand)
            {
                OnUndoRedoManagerChanged_TextNodeStructureEditCommand(eventt, done, (TextNodeStructureEditCommand)command, isTransactionEndEvent, isNoTransactionOrTrailingEdge);
            }

            RaisePropertyChanged(() => SelectedTreeNode);
        }
        public void OnUndoRedoManagerChanged(UndoRedoManagerEventArgs eventt, bool done, Command command, bool isTransactionEndEvent, bool isNoTransactionOrTrailingEdge)
        {
            if (!Dispatcher.CheckAccess())
            {
#if DEBUG
                Debugger.Break();
#endif

#if NET40x
                Dispatcher.Invoke(DispatcherPriority.Normal,
                                  (Action <UndoRedoManagerEventArgs, bool, Command, bool, bool>)OnUndoRedoManagerChanged,
                                  eventt, done, command, isTransactionEndEvent, isNoTransactionOrTrailingEdge);
#else
                Dispatcher.Invoke(DispatcherPriority.Normal,
                                  (Action)(() => OnUndoRedoManagerChanged(eventt, done, command, isTransactionEndEvent, isNoTransactionOrTrailingEdge))
                                  );
#endif
                return;
            }

            //if (isTransactionEndEvent)
            //{
            //    return;
            //}

            if (command is CompositeCommand)
            {
#if DEBUG
                Debugger.Break();
#endif
            }

            if (isNoTransactionOrTrailingEdge)
            {
                //bool keyboardFocusWithin = this.IsKeyboardFocusWithin;

                Tuple <TreeNode, TreeNode> newTreeNodeSelection = m_UrakawaSession.GetTreeNodeSelection();
                refreshData(newTreeNodeSelection);

                //if (keyboardFocusWithin)
                //{
                //    CommandFocus.Execute();
                //}
            }
        }
Esempio n. 7
0
        private void OnUndoRedoManagerChanged_TextNodeStructureEditCommand(UndoRedoManagerEventArgs eventt, bool done, TextNodeStructureEditCommand command, bool isTransactionEndEvent, bool isNoTransactionOrTrailingEdge)
        {
            DebugFix.Assert(command is TreeNodeInsertCommand || command is TreeNodeRemoveCommand);

            //TreeNode node = (command is TreeNodeInsertCommand) ? ((TreeNodeInsertCommand)command).TreeNode : ((TreeNodeRemoveCommand)command).TreeNode;
            //TreeNode node = command.TreeNode;
            //bool forceInvalidate = (command is TreeNodeInsertCommand && !done) || (command is TreeNodeRemoveCommand && done);
            //bool done_ = (command is TreeNodeInsertCommand) ? !done : done;

            if (isNoTransactionOrTrailingEdge)
            {
                View.UnloadProject();
                HeadingsNavigator = null;

                HeadingsNavigator = new HeadingsNavigator(m_session.DocumentProject, this);
                View.LoadProject();
            }
        }
Esempio n. 8
0
        public void OnUndoRedoManagerChanged(UndoRedoManagerEventArgs eventt, bool done, Command command, bool isTransactionEndEvent, bool isNoTransactionOrTrailingEdge)
        {
            if (!Dispatcher.CurrentDispatcher.CheckAccess())
            {
#if DEBUG
                Debugger.Break();
#endif

#if NET40x
                Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal,
                                                    (Action <UndoRedoManagerEventArgs, bool, Command, bool, bool>)OnUndoRedoManagerChanged,
                                                    eventt, done, command, isTransactionEndEvent, isNoTransactionOrTrailingEdge);
#else
                Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal,
                                                    (Action)(() => OnUndoRedoManagerChanged(eventt, done, command, isTransactionEndEvent, isNoTransactionOrTrailingEdge))
                                                    );
#endif
                return;
            }

            //if (isTransactionEndEvent)
            //{
            //    return;
            //}

            if (command is CompositeCommand)
            {
#if DEBUG
                Debugger.Break();
#endif
            }
            else if (command is MetadataCommand)
            {
                if (isNoTransactionOrTrailingEdge)
                {
                    Validate();
                }
            }
        }
Esempio n. 9
0
        public void OnUndoRedoManagerChanged(UndoRedoManagerEventArgs eventt, bool done, Command command, bool isTransactionEndEvent, bool isNoTransactionOrTrailingEdge)
        {
            if (!TheDispatcher.CheckAccess())
            {
#if DEBUG
                Debugger.Break();
#endif

#if NET40x
                TheDispatcher.Invoke(DispatcherPriority.Normal,
                                     (Action <UndoRedoManagerEventArgs, bool, Command, bool, bool>)OnUndoRedoManagerChanged,
                                     eventt, done, command, isTransactionEndEvent, isNoTransactionOrTrailingEdge);
#else
                TheDispatcher.Invoke(DispatcherPriority.Normal,
                                     (Action)(() => OnUndoRedoManagerChanged(eventt, done, command, isTransactionEndEvent, isNoTransactionOrTrailingEdge))
                                     );
#endif
                return;
            }

            if (isTransactionEndEvent)
            {
                return;
            }

            if (command is CompositeCommand)
            {
#if DEBUG
                Debugger.Break();
#endif
            }

            //if (!command.IsTransaction()
            //    || done && command.IsTransactionLast()
            //    || !done && command.IsTransactionFirst()
            //    )
            //{
            //}
        }
            public void OnUndoRedoManagerChanged(object sender, UndoRedoManagerEventArgs eventt)
            {
                if (!(eventt is DoneEventArgs ||
                      eventt is UnDoneEventArgs ||
                      eventt is ReDoneEventArgs ||
                      eventt is TransactionEndedEventArgs ||
                      eventt is TransactionCancelledEventArgs
                      ))
                {
#if DEBUG
                    Debugger.Break();
#endif
                    return;
                }

                Command command = eventt.Command;

                if (m_UndoRedoManager.IsTransactionActive)
                {
                    DebugFix.Assert(eventt is DoneEventArgs || eventt is TransactionEndedEventArgs); // latter => nested transaction!
                }

                bool done = eventt is DoneEventArgs || eventt is ReDoneEventArgs || eventt is TransactionEndedEventArgs;
                DebugFix.Assert(done == !(eventt is UnDoneEventArgs || eventt is TransactionCancelledEventArgs));

                bool isTransactionEndEvent = eventt is TransactionEndedEventArgs;

                if (isTransactionEndEvent)
                {
                    DebugFix.Assert(command is CompositeCommand);
                    if (command.IsInTransaction())
                    {
                        return; // avoid duplicates, only last fully flattened composite command: full transaction
                    }
                }

                OnUndoRedoManagerChanged_CompositeCommandDispatch(eventt, done, command, isTransactionEndEvent);
            }
            private void OnUndoRedoManagerChanged_CompositeCommandDispatch(UndoRedoManagerEventArgs eventt, bool done, Command command, bool isTransactionEndEvent)
            {
                if (command is CompositeCommand)
                {
                    CompositeCommand      compo      = (CompositeCommand)command;
                    IEnumerable <Command> enumerable = done
                        ? compo.ChildCommands.ContentsAs_Enumerable
                        : compo.ChildCommands.ContentsAs_YieldEnumerableReversed;
                    foreach (Command childCommand in enumerable)
                    {
                        OnUndoRedoManagerChanged_CompositeCommandDispatch(eventt, done, childCommand, isTransactionEndEvent);
                    }
                }
                else
                {
                    if (isTransactionEndEvent)
                    {
#if DEBUG
                        DebugFix.Assert(command.IsInTransaction());
#endif
                    }

                    bool isNoTransactionOrTrailingEdge =
                        !command.IsInTransaction() // DONE, UNDONE, REDONE
                        ||
                        !(eventt is DoneEventArgs) // excludes live command executions that occur during active transaction
                        &&
                        (
                            done && command.IsTransactionEnd()
                            ||
                            !done && command.IsTransactionBegin()
                        )
                    ;

                    m_Host.OnUndoRedoManagerChanged(eventt, done, command, isTransactionEndEvent, isNoTransactionOrTrailingEdge);
                }
            }
Esempio n. 12
0
        public void OnUndoRedoManagerChanged(UndoRedoManagerEventArgs eventt, bool done, Command command, bool isTransactionEndEvent, bool isNoTransactionOrTrailingEdge)
        {
            if (!TheDispatcher.CheckAccess())
            {
#if DEBUG
                Debugger.Break();
#endif

#if NET40x
                TheDispatcher.Invoke(DispatcherPriority.Normal,
                                     (Action <UndoRedoManagerEventArgs, bool, Command, bool, bool>)OnUndoRedoManagerChanged,
                                     eventt, done, command, isTransactionEndEvent, isNoTransactionOrTrailingEdge);
#else
                TheDispatcher.Invoke(DispatcherPriority.Normal,
                                     (Action)(() => OnUndoRedoManagerChanged(eventt, done, command, isTransactionEndEvent, isNoTransactionOrTrailingEdge))
                                     );
#endif
                return;
            }

            if (m_TTSGen)
            {
                return;
            }

            //if (isTransactionEndEvent)
            //{
            //    return;
            //}

            if (isNoTransactionOrTrailingEdge)
            {
                if (EventAggregator != null)
                {
                    EventAggregator.GetEvent <StatusBarMessageUpdateEvent>().Publish(Tobi_Plugin_AudioPane_Lang.Ready);
                }
            }

            if (command is CompositeCommand)
            {
#if DEBUG
                Debugger.Break();
#endif
            }
            else if (command is TreeNodeChangeTextCommand)
            {
                if (!isTransactionEndEvent)
                {
                    var cmd = (TreeNodeChangeTextCommand)command;

                    Tuple <TreeNode, TreeNode> selection = m_UrakawaSession.GetTreeNodeSelection();
                    if (selection.Item1 != null)
                    {
                        if (cmd.TreeNode == selection.Item1 ||
                            (cmd.TreeNode.IsDescendantOf(selection.Item1)))
                        {
                            if (State.Audio.HasContent && State.Audio.PlayStreamMarkers != null)
                            {
                                if (true
                                    //State.Audio.PlayStreamMarkers.Count <= Settings.Default.AudioWaveForm_TextCacheRenderThreshold
                                    )
                                {
                                    if (View != null)
                                    {
                                        View.InvalidateWaveFormOverlay();
                                    }
                                }
                                else
                                {
                                    CommandRefresh.Execute();
                                }
                            }
                        }
                    }
                }

                return;
            }

            if (!(command is TextNodeStructureEditCommand) && !(command is AudioEditCommand))
            {
                return;
            }

            if (!isTransactionEndEvent)
            {
                if (View != null)
                {
                    View.CancelWaveFormLoad(false);
                }
                InterruptAudioPlayerRecorder();

                if (View != null)
                {
                    View.CancelWaveFormLoad(true);
                }
                CommandPause.Execute();


                updateTotalDuration(command, done);
            }

            if (command is TextNodeStructureEditCommand)
            {
                if (isNoTransactionOrTrailingEdge)
                {
                    // TODO: this is currently brute-force => refresh waveform correctly, depending on modified tree fragment (remove / insert)

                    if (View != null)
                    {
                        View.ResetAll();
                    }

                    if (AudioPlaybackStreamKeepAlive)
                    {
                        ensurePlaybackStreamIsDead();
                    }

                    State.ResetAll();

                    m_LastSetPlayBytePosition = -1;

                    m_StateToRestore = null;

                    //if (View != null)
                    //{
                    //    View.InvalidateWaveFormOverlay();
                    //}

                    //CommandRefresh.Execute();

                    var sel = m_UrakawaSession.GetTreeNodeSelection();
                    //m_UrakawaSession.PerformTreeNodeSelection(sel.Item1, sel.Item2)
                    var selOld = new Tuple <TreeNode, TreeNode>(null, null);
                    OnTreeNodeSelectionChanged(new Tuple <Tuple <TreeNode, TreeNode>, Tuple <TreeNode, TreeNode> >(selOld, sel));
                }

                return;
            }
            else if (command is AudioEditCommand)
            {
                if (!isTransactionEndEvent ||
                    isNoTransactionOrTrailingEdge && command.IsInTransaction() && command.TopTransactionId() == AudioPaneViewModel.COMMAND_TRANSATION_ID__AUDIO_TTS)
                {
                    OnUndoRedoManagerChanged_AudioEditCommand(eventt, done, (AudioEditCommand)command, isTransactionEndEvent, isNoTransactionOrTrailingEdge);
                }

                if (isNoTransactionOrTrailingEdge)
                {
                    if (m_OnUndoRedoManagerChanged_targetNode1 != null && m_OnUndoRedoManagerChanged_byteStart >= 0 && (!m_OnUndoRedoManagerChanged_done || m_OnUndoRedoManagerChanged_byteDur > 0))
                    {
                        bool deselectAndPosEnd = Settings.Default.Audio_DisableAfterRecordSelection &&
                                                 m_DeferredRecordingDataItems != null && // hack to detect actual recording operation, rather than REDO
                                                 m_OnUndoRedoManagerChanged_done && m_OnUndoRedoManagerChanged_wasInitByAdd;
                        UndoRedoManagerChanged_RestoreAudioTreeNodeSelectionState(m_OnUndoRedoManagerChanged_targetNode1, m_OnUndoRedoManagerChanged_targetNode2, m_OnUndoRedoManagerChanged_byteStart, m_OnUndoRedoManagerChanged_byteDur, m_OnUndoRedoManagerChanged_done, deselectAndPosEnd);

                        if (command.IsInTransaction() && command.TopTransactionId() == AudioPaneViewModel.COMMAND_TRANSATION_ID__AUDIO_SPLIT_SHIFT)
                        {
                            CommandClearSelection.Execute();
                        }

                        m_OnUndoRedoManagerChanged_targetNode1     = null;
                        m_OnUndoRedoManagerChanged_targetNode2     = null;
                        m_OnUndoRedoManagerChanged_byteStart       = -1;
                        m_OnUndoRedoManagerChanged_byteDur         = 0;
                        m_OnUndoRedoManagerChanged_done            = false;
                        m_OnUndoRedoManagerChanged_wasInitByRemove = false;
                        m_OnUndoRedoManagerChanged_wasInitByAdd    = false;
                    }
                    else
                    {
#if DEBUG
                        Debugger.Break();
#endif
                    }
                }

                return;
            }


#if DEBUG
            Debugger.Break();
#endif

            if (View != null)
            {
                View.ResetAll();
            }

            m_LastSetPlayBytePosition = 0;

            m_StateToRestore = null;

            if (AudioPlaybackStreamKeepAlive)
            {
                ensurePlaybackStreamIsDead();
            }

            CommandRefresh.Execute();
        }
Esempio n. 13
0
        private void OnUndoRedoManagerChanged_AudioEditCommand(UndoRedoManagerEventArgs eventt, bool done, AudioEditCommand cmd, bool isTransactionEndEvent, bool isNoTransactionOrTrailingEdge)
        {
#if DEBUG
            DebugFix.Assert(!isTransactionEndEvent ||
                            isNoTransactionOrTrailingEdge && cmd.IsInTransaction() && cmd.TopTransactionId() == AudioPaneViewModel.COMMAND_TRANSATION_ID__AUDIO_TTS);
#endif

            if (cmd is ManagedAudioMediaInsertDataCommand)
            {
                var command = (ManagedAudioMediaInsertDataCommand)cmd;

                if (!done)
                {
                    DebugFix.Assert(!m_OnUndoRedoManagerChanged_wasInitByRemove);
                }

                if (!done || // reverse => force scan backwards to beginning
                    m_OnUndoRedoManagerChanged_targetNode1 == null || // not reverse, first-time init
                    m_OnUndoRedoManagerChanged_wasInitByRemove    // not reverse, not first-time init, but deletion occured before addition (e.g. select waveform audio + paste over it)
                    )
                {
                    m_OnUndoRedoManagerChanged_wasInitByRemove = false;
                    m_OnUndoRedoManagerChanged_wasInitByAdd    = true;

                    m_OnUndoRedoManagerChanged_targetNode1 = command.CurrentTreeNode;
                    m_OnUndoRedoManagerChanged_targetNode2 = command.CurrentTreeNode == command.TreeNode ? null : command.TreeNode;

                    m_OnUndoRedoManagerChanged_byteStart = command.BytePositionInsert;

                    if (done || m_OnUndoRedoManagerChanged_targetNode1 == null)
                    {
                        m_OnUndoRedoManagerChanged_byteDur = 0;
                    }

                    m_OnUndoRedoManagerChanged_done = done;
                }

                m_OnUndoRedoManagerChanged_byteDur += command.ManagedAudioMediaSource.AudioMediaData.PCMFormat.Data.ConvertTimeToBytes(
                    command.ManagedAudioMediaSource.Duration.AsLocalUnits);
            }
            else if (cmd is TreeNodeSetManagedAudioMediaCommand)
            {
                var command = (TreeNodeSetManagedAudioMediaCommand)cmd;

                if (!done)
                {
                    DebugFix.Assert(!m_OnUndoRedoManagerChanged_wasInitByRemove);
                }

                if (!done || // reverse => force scan backwards to beginning
                    m_OnUndoRedoManagerChanged_targetNode1 == null || // not reverse, first-time init
                    m_OnUndoRedoManagerChanged_wasInitByRemove    // not reverse, not first-time init, but deletion occured before addition (e.g. select waveform audio + paste over it)
                    )
                {
                    m_OnUndoRedoManagerChanged_wasInitByRemove = false;
                    m_OnUndoRedoManagerChanged_wasInitByAdd    = true;

                    m_OnUndoRedoManagerChanged_targetNode1 = command.CurrentTreeNode;
                    m_OnUndoRedoManagerChanged_targetNode2 = command.CurrentTreeNode == command.TreeNode ? null : command.TreeNode;

                    m_OnUndoRedoManagerChanged_byteStart = 0;

                    if (done || m_OnUndoRedoManagerChanged_targetNode1 == null)
                    {
                        m_OnUndoRedoManagerChanged_byteDur = 0;
                    }

                    m_OnUndoRedoManagerChanged_done = done;
                }

                m_OnUndoRedoManagerChanged_byteDur += command.ManagedAudioMedia.AudioMediaData.PCMFormat.Data.ConvertTimeToBytes(
                    command.ManagedAudioMedia.Duration.AsLocalUnits);
            }
            else if (cmd is TreeNodeAudioStreamDeleteCommand)
            {
                var command = (TreeNodeAudioStreamDeleteCommand)cmd;

                if (done)
                {
                    DebugFix.Assert(!m_OnUndoRedoManagerChanged_wasInitByAdd);
                }

                if (!done || // reverse => force scan backwards to beginning
                    m_OnUndoRedoManagerChanged_targetNode1 == null    // not reverse, first-time init
                    )
                {
                    if (done || m_OnUndoRedoManagerChanged_targetNode1 == null || m_OnUndoRedoManagerChanged_wasInitByAdd)
                    {
                        m_OnUndoRedoManagerChanged_byteDur = 0;
                    }

                    m_OnUndoRedoManagerChanged_wasInitByAdd    = false;
                    m_OnUndoRedoManagerChanged_wasInitByRemove = true;

                    m_OnUndoRedoManagerChanged_targetNode1 = command.CurrentTreeNode;
                    m_OnUndoRedoManagerChanged_targetNode2 = command.CurrentTreeNode == command.TreeNode
                        ? null
                        : command.TreeNode;

                    m_OnUndoRedoManagerChanged_byteStart = 0;

                    m_OnUndoRedoManagerChanged_done = !done;
                }

                long bytesBegin = 0;
                long bytesEnd   = 0;

                if (command.SelectionData.m_LocalStreamLeftMark > 0)
                {
                    bytesBegin = command.SelectionData.m_LocalStreamLeftMark;
                }

                if (command.SelectionData.m_LocalStreamRightMark <= 0)
                {
                    bytesEnd = command.OriginalManagedAudioMedia.AudioMediaData.PCMFormat.Data.ConvertTimeToBytes(command.OriginalManagedAudioMedia.AudioMediaData.AudioDuration.AsLocalUnits);
                }
                else
                {
                    bytesEnd = command.SelectionData.m_LocalStreamRightMark;
                }

                m_OnUndoRedoManagerChanged_byteStart += bytesBegin;
                m_OnUndoRedoManagerChanged_byteDur   += (bytesEnd - bytesBegin);
            }
        }
        public void OnUndoRedoManagerChanged(UndoRedoManagerEventArgs eventt, bool done, Command command, bool isTransactionEndEvent, bool isNoTransactionOrTrailingEdge)
        {
//            if (!Dispatcher.CheckAccess())
//            {
//#if DEBUG
//                Debugger.Break();
//#endif

//#if NET40x
//                TheDispatcher.Invoke(DispatcherPriority.Normal,
//                    (Action<UndoRedoManagerEventArgs, bool, Command, bool, bool>)OnUndoRedoManagerChanged,
//                    eventt, done, command, isTransactionEndEvent, isNoTransactionOrTrailingEdge);
//#else
//            TheDispatcher.Invoke(DispatcherPriority.Normal,
//                (Action)(() => OnUndoRedoManagerChanged(eventt, done, command, isTransactionEndEvent, isNoTransactionOrTrailingEdge))
//                );
//#endif
//                return;
//            }

            if (command is CompositeCommand)
            {
#if DEBUG
                Debugger.Break();
#endif
            }

            //if (!command.IsTransaction()
            //    || done && command.IsTransactionLast()
            //    || !done && command.IsTransactionFirst()
            //    )
            //{
            //}

            TreeNode node        = null;
            bool     forceRemove = false;

            if (command is AudioEditCommand)
            {
                var cmd = (AudioEditCommand)command;

                node = cmd.TreeNode;
            }
            else if (command is TreeNodeChangeTextCommand)
            {
                var cmd = (TreeNodeChangeTextCommand)command;
                node = cmd.TreeNode;
            }
            else if (command is TextNodeStructureEditCommand)
            {
                var cmd = (TextNodeStructureEditCommand)command;
                node = cmd.TreeNode;

                forceRemove = (command is TreeNodeInsertCommand && !done) || (command is TreeNodeRemoveCommand && done);
            }

            if (node != null)
            {
                updateTreeNodeAudioStatus(forceRemove, node);
            }
        }
 private void OnUndoRedoManagerChanged_TreeNodeChangeTextCommand(UndoRedoManagerEventArgs eventt, bool done, TreeNodeChangeTextCommand command, bool isTransactionEndEvent, bool isNoTransactionOrTrailingEdge)
 {
     InvalidateDescriptions(false, command.TreeNode);
 }