/// <summary> /// Converts this rectangular array of Tiles into a jagged array, for the purposes /// of Data Contract (DC) serialization. /// </summary> public static TileCollection Jaggedize_DC(this Tile[,] input) { TileCollection output = new TileCollection(); output.AddRange(new TileList[input.GetLength(0)].AsEnumerable()); for (int i = 0; i < input.GetLength(0); i++) { output[i] = new TileList(); output[i].AddRange(new Tile[input.GetLength(1)].AsEnumerable()); for (int j = 0; j < input.GetLength(1); j++) { output[i][j] = input[i, j]; } } return(output); }
public virtual object CreateMemento() { var imageBox = this.ImageViewer.SelectedImageBox as PrintViewImageBox; object displaySetMemento = null; if (imageBox.DisplaySet != null) { displaySetMemento = imageBox.DisplaySet.CreateMemento(); } int IndexOfSelectedTile; if (imageBox.SelectedTile == null) { IndexOfSelectedTile = -1; } else { IndexOfSelectedTile = imageBox.Tiles.IndexOf(imageBox.SelectedTile); } TileCollection tileCollection = new TileCollection(); tileCollection.AddRange(imageBox.Tiles); PrintImageBoxMemento imageBoxMemento = new PrintImageBoxMemento(imageBox.DisplaySet.Clone(), imageBox.DisplaySetLocked, displaySetMemento, tileCollection, imageBox.TopLeftPresentationImageIndex, imageBox.NormalizedRectangle, IndexOfSelectedTile, imageBox.TotleImageCount); return(imageBoxMemento); }