Пример #1
0
        private void ColorSelect_Impl(int selectedColor)
        {
            if (SelectedItem is not null)
            {
                bool anyChanged       = false;
                bool fileWasDirty     = FileDirty;
                var  editedShowlights = SelectedItems.Cast <ShowLightViewModel>().ToArray();
                var  oldShowlights    = new List <(ShowLightViewModel, int)>();

                foreach (var sl in editedShowlights)
                {
                    if (sl.Note == selectedColor)
                    {
                        continue;
                    }

                    anyChanged = true;

                    oldShowlights.Add((sl, sl.Note));

                    sl.Note = (byte)selectedColor;
                }

                if (!anyChanged)
                {
                    return;
                }

                var undo = new UndoEdit(oldShowlights, selectedColor);

                scrollIntoView.OnNext(editedShowlights[0]);

                UndoManager.AddUndo(undo, fileWasDirty);
            }
        }
Пример #2
0
        private void Move_Impl()
        {
            if (SelectedItem is not null)
            {
                int timeSec = (int)(MoveToTime * 1000f);
                if (SelectedItem.Time == timeSec)
                {
                    return;
                }

                UndoManager.AddUndo(new UndoMove(SelectedItem, SelectedItem.Time, timeSec), FileDirty);

                SelectedItem.Time = timeSec;

                scrollIntoView.OnNext(SelectedItem);
            }
        }
Пример #3
0
 private void AddUndo()
 {
     _undo.AddUndo(Document);
 }