internal void EnterSubLevel(CubeDesignerItem cdi) { if (!IsTopSubLevel && SelectedTab.Header.ToString() == CubePart.Top.ToString()) { CachedCubeTopCollection = CubeTopCollection; CubeTopCollection = new ObservableCollection <CubeDesignerItem>(); CreateSubCollection(cdi, CubeTopCollection); IsTopSubLevel = true; } else if (!IsBaseSubLevel && SelectedTab.Header.ToString() == CubePart.Base.ToString()) { CachedCubeBaseCollection = CubeBaseCollection; CubeBaseCollection = new ObservableCollection <CubeDesignerItem>(); CreateSubCollection(cdi, CubeBaseCollection); IsBaseSubLevel = true; } }
private void CreateSubCollection(CubeDesignerItem cdi, ObservableCollection <CubeDesignerItem> collection) { int count = 0; for (int y = 0; y < cdi.CubeMetadata.SheetRows; y++) { for (int x = 0; x < cdi.CubeMetadata.SheetColumns; x++) { count++; SelectionMode selection = cdi.CubeMetadata.ActiveFrames.Contains(count) ? SelectionMode.Active : SelectionMode.None; var newCdi = new CubeDesignerItem(this, cdi.ImagePath, cdi.CubeMetadata); newCdi.SourceRect = new Int32Rect(newCdi.ItemWidth * x, newCdi.ItemHeight * y, newCdi.ItemWidth, newCdi.ItemHeight); newCdi.Selection = selection; collection.Add(newCdi); if (count == cdi.CubeMetadata.FrameCount) { break; } } } }
private void SelectBase(CubeDesignerItem cubeDesignerItem) { CurrentCubeBaseMetadata = cubeDesignerItem.CubeMetadata; cubeDesignerItem.Selection = SelectionMode.Selected; }