internal static void AssignDisplaySetToImageBox(IImageBox imageBox, IDisplaySet displaySet)
			{
                MemorableUndoableCommand memorableCommand = new MemorableUndoableCommand(imageBox);
                memorableCommand.BeginState = imageBox.CreateMemento();

                // always create a 'fresh copy' to show in the image box.  We never want to show
                // the 'originals' (e.g. the ones in IImageSet.DisplaySets) because we want them 
                // to remain clean and unaltered - consider them to be templates for what actually
                // gets shown.
                imageBox.DisplaySet = displaySet.CreateFreshCopy();

                imageBox.Draw();
                //this.ImageViewer.SelectedImageBox[0, 0].Select();

                memorableCommand.EndState = imageBox.CreateMemento();

                DrawableUndoableCommand historyCommand = new DrawableUndoableCommand(imageBox);
                historyCommand.Enqueue(memorableCommand);
                imageBox.ImageViewer.CommandHistory.AddCommand(historyCommand);
            }
            internal static void AssignDisplaySetToImageBox(IImageBox imageBox, IDisplaySet displaySet)
            {
                MemorableUndoableCommand memorableCommand = new MemorableUndoableCommand(imageBox);

                memorableCommand.BeginState = imageBox.CreateMemento();

                // always create a 'fresh copy' to show in the image box.  We never want to show
                // the 'originals' (e.g. the ones in IImageSet.DisplaySets) because we want them
                // to remain clean and unaltered - consider them to be templates for what actually
                // gets shown.
                imageBox.DisplaySet = displaySet.CreateFreshCopy();

                imageBox.Draw();
                //this.ImageViewer.SelectedImageBox[0, 0].Select();

                memorableCommand.EndState = imageBox.CreateMemento();

                DrawableUndoableCommand historyCommand = new DrawableUndoableCommand(imageBox);

                historyCommand.Enqueue(memorableCommand);
                imageBox.ImageViewer.CommandHistory.AddCommand(historyCommand);
            }
Exemplo n.º 3
0
        protected override void OnDragDrop(DragEventArgs drgevent)
        {
            _tile.Select();

            MemorableUndoableCommand memorableCommand = new MemorableUndoableCommand(_tile.ParentImageBox);

            memorableCommand.BeginState = _tile.ParentImageBox.CreateMemento();

            IDisplaySet displaySet = (IDisplaySet)drgevent.Data.GetData(typeof(DisplaySet));

            _tile.ParentImageBox.DisplaySet = displaySet.CreateFreshCopy();
            _tile.ParentImageBox.Draw();

            memorableCommand.EndState = _tile.ParentImageBox.CreateMemento();

            DrawableUndoableCommand historyCommand = new DrawableUndoableCommand(_tile.ParentImageBox);

            historyCommand.Enqueue(memorableCommand);
            _tile.ImageViewer.CommandHistory.AddCommand(historyCommand);

            base.OnDragDrop(drgevent);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Helper method for setting the display set of this image box.
        /// </summary>
        /// <param name="displaySet">The display set to show in this image box, or NULL to clear it.</param>
        /// <param name="createFreshCopy">Value indicating whether or not <see cref="IDisplaySet.CreateFreshCopy"/> should be called on the display set.</param>
        /// <param name="addToCommandHistory">Value indicating whether or not the viewer command history should be updated.</param>
        /// <param name="selectDefaultTile">Value indicating whether or not <see cref="IImageBox.SelectDefaultTile"/> should be called after updating the display set.</param>
        public void SetDisplaySet(IDisplaySet displaySet, bool createFreshCopy = false, bool addToCommandHistory = true, bool selectDefaultTile = true)
        {
            var memorableCommand = addToCommandHistory ? new MemorableUndoableCommand(this)
            {
                BeginState = CreateMemento()
            } : null;

            DisplaySet = displaySet != null && createFreshCopy?displaySet.CreateFreshCopy() : displaySet;

            Draw();
            if (selectDefaultTile)
            {
                SelectDefaultTile();
            }

            if (addToCommandHistory)
            {
                memorableCommand.EndState = CreateMemento();

                var historyCommand = new DrawableUndoableCommand(this);
                historyCommand.Enqueue(memorableCommand);
                ImageViewer.CommandHistory.AddCommand(historyCommand);
            }
        }