private void DeleteCurrentPage(object sender, EventArgs args)
        {
            if (this.Context.Viewer == null || this.Context.Viewer.SelectedImageBox == null || this.Context.Viewer.SelectedImageBox.DisplaySet == null)
            {
                return;
            }
            PrintViewImageBox imageBox = this.ImageViewer.SelectedImageBox as PrintViewImageBox;
            var memorableCommand       = new MemorableUndoableCommand(imageBox)
            {
                BeginState = CreateMemento()
            };
            var printImageViewer = Context.Viewer as PrintImageViewerComponent;

            foreach (PrintViewTile tile in imageBox.Tiles)
            {
                if (tile.PresentationImage == null)
                {
                    int number1 = imageBox.TotleImageCount - imageBox.DisplaySet.PresentationImages.Count;
                    if (number1 > 0)
                    {
                        imageBox.TotleImageCount = imageBox.TotleImageCount - 1;
                    }
                    tile.Deselect();
                    continue;
                }

                if (imageBox.DisplaySet.PresentationImages.Contains(tile.PresentationImage))
                {
                    if (printImageViewer.SelectPresentationImages.Contains(tile.PresentationImage as PresentationImage))
                    {
                        var pi = tile.PresentationImage as PresentationImage;
                        pi.Selected = false;
                        printImageViewer.SelectPresentationImages.Remove(pi);
                    }
                    imageBox.DisplaySet.PresentationImages.Remove(tile.PresentationImage);
                    //tile.PresentationImage.Dispose();
                    tile.PresentationImage = null;
                    tile.Deselect();
                }
            }

            imageBox.TopLeftPresentationImageIndex = imageBox.TopLeftPresentationImageIndex - imageBox.Tiles.Count;
            imageBox.Draw();
            imageBox.SelectDefaultTile();
            memorableCommand.EndState = CreateMemento();
            var historyCommand = new DrawableUndoableCommand(imageBox)
            {
                Name = SR.CommandPrintPreviewDeleteImage
            };

            historyCommand.Enqueue(memorableCommand);
            this.Context.Viewer.CommandHistory.AddCommand(historyCommand);
            PropertyChanged();
        }
Esempio n. 2
0
        private void ImageScrollerMouseDown(object sender, EventArgs e)
        {
            if (_imageBox != null)
            {
                if (_imageBox.Tiles.Count > 0)
                {
                    if (!_imageBox.Selected)
                    {
                        _imageBox.SelectDefaultTile();
                    }

                    PrintTileControl tileControl = GetTileControl(_imageBox.SelectedTile);
                    if (tileControl != null)
                    {
                        tileControl.Focus();
                    }

                    BeginCaptureUndo();
                }
            }
        }
        private void CreateEmptyPage(object sender, EventArgs args)
        {
            if (Context.Viewer.SelectedImageBox == null)
            {
                return;
            }

            PrintViewImageBox imageBox = Context.Viewer.SelectedImageBox as PrintViewImageBox;

            imageBox.TotleImageCount += imageBox.Tiles.Count;
            imageBox.TopLeftPresentationImageIndex = imageBox.TotleImageCount - imageBox.Tiles.Count;
            imageBox.Draw();
            imageBox.SelectDefaultTile();
        }