private void DrawCell(BlueprintView pView, CellViewModel pCell) { if (!pView.Dispatcher.CheckAccess()) { pView.Dispatcher.BeginInvoke(new DrawCellDelegate(DrawCell), new object[] { pView, pCell }); } else { mBlueprintViewModel.Cells.Add(pCell); } }
public BlueprintCreator(BlueprintView pView) { mBlueprintView = pView; }
public void SetupBlueprint(BlueprintView view) { Log.Write(LogLevel.Info, "Rozpoczęto proces tworzenia planu budynku"); var mBlueprintCreator = new BlueprintCreatorWindow(); mBlueprintCreator.ShowDialog(); if (!((BlueprintCreatorViewModel)mBlueprintCreator.DataContext).IsBlueprintCreated) { return; } IsBlueprintCreated = false; if (mBlueprint.IsGeometryMode) { view.DataContext = new BlueprintViewModel { CellAreaHeight = mBlueprint.CellAreaHeight, CellAreaWidth = mBlueprint.CellAreaWidth, BackgroundPane = new SolidColorBrush(Colors.LightSlateGray) }; var creator = new BlueprintCreator(view); creator.DrawCells(); } else { Brush brush = new SolidColorBrush(Colors.LightSlateGray); if (((BlueprintCreatorViewModel) mBlueprintCreator.DataContext).Bitmap != null) { brush = new ImageBrush(((BlueprintCreatorViewModel)mBlueprintCreator.DataContext).Bitmap.ToBitmapImage()); } view.DataContext = new BlueprintViewModel { CellAreaHeight = mBlueprint.CellAreaHeight, CellAreaWidth = mBlueprint.CellAreaWidth, BackgroundPane = brush }; } IsBlueprintCreated = true; }