public DisplaySettingsToolVM(EditProjectVM parent) { Image = "display_settingsDrawingImage"; Name = "View Properties"; this.parent = parent; PossiblePastePositions = new List <DominoInCanvas>(); ShowImageClick = new RelayCommand(o => { ShowImage(); }); if (parent.CurrentProject != null && parent.CurrentProject.PrimaryImageTreatment != null) { if (parent.CurrentProject.PrimaryImageTreatment.FilteredImage != null) { FilteredImage = parent.CurrentProject.PrimaryImageTreatment.FilteredImage; FilteredMat = parent.CurrentProject.PrimaryImageTreatment.imageFiltered.ToImage <Emgu.CV.Structure.Bgra, byte>(); } else { Core.BlendFileFilter bff = parent.CurrentProject.PrimaryImageTreatment.ImageFilters.OfType <Core.BlendFileFilter>().FirstOrDefault(); if (bff != null) { string relativePath = bff.FilePath; string absolutePath = Core.Workspace.AbsolutePathFromReference(ref relativePath, parent.CurrentProject); if (File.Exists(absolutePath)) { FilteredImage = (System.Drawing.Bitmap)System.Drawing.Image.FromFile(absolutePath); FilteredMat = new Image <Emgu.CV.Structure.Bgra, byte>(absolutePath); } } } } Expandable = parent.CurrentProject is FieldParameters ? Visibility.Visible : Visibility.Collapsed; }
public SelectionToolVM(EditProjectVM parent) { Image = "rect_selectDrawingImage"; Name = "Select"; SelectionTools = new ObservableCollection <SelectionDomain>() { new RectangleSelection(), new CircleSelectionDomain(), new PolygonSelectionDomain(), new FreehandSelectionDomain() }; CurrentSelectionDomain = SelectionTools[0]; UndoSelectionOperation = new RelayCommand((o) => { parent.UndoInternal(true); }); RedoSelectionOperation = new RelayCommand((o) => { parent.RedoInternal(true); }); InvertSelection = new RelayCommand((o) => InvertSelectionOperation()); this.parent = parent; }
public static DominoProviderTabItem ViewModelGenerator(IDominoProvider project, string path) { DominoProviderTabItem Content = null; if (project != null) { if (project.Editing) { Content = new EditProjectVM(project); } else { switch (project) { case FieldParameters fieldNode: Content = new CreateFieldVM(fieldNode, true); break; case StructureParameters structureNode: Content = new CreateRectangularStructureVM(structureNode, true); break; case SpiralParameters spiralNode: Content = new CreateSpiralVM(spiralNode, true); break; case CircleParameters circleNode: Content = new CreateCircleVM(circleNode, true); break; default: break; } } //(Content as DominoProviderTabItem).assemblyname = // OpenProjectSerializer.GetOpenProjects().Where(x => x.id == project.ParentProjectID).First().name; (Content as DominoProviderTabItem).name = System.IO.Path.GetFileNameWithoutExtension(path); } return(Content); }