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(); }
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(); }
private void JumpToEnd() { if (Context.Viewer.SelectedTile == null) { return; } PrintViewImageBox imageBox = Context.Viewer.SelectedTile.ParentImageBox as PrintViewImageBox; if (imageBox.DisplaySet == null) { return; } CaptureBeginState(imageBox); imageBox.TopLeftPresentationImageIndex = imageBox.TotleImageCount - imageBox.Tiles.Count; if (CaptureEndState()) { imageBox.Draw(); } }
internal void Draw() { _imageBox.Draw(); }