void updateRendering() { AttributeTransformationViewModel model = DataContext as AttributeTransformationViewModel; if (model.IsShadow) { mainGrid.Background = Application.Current.Resources.MergedDictionaries[0]["lightBrush"] as SolidColorBrush; border.BorderThickness = new Thickness(4); } else { mainGrid.Background = Application.Current.Resources.MergedDictionaries[0]["lightBrush"] as SolidColorBrush; border.BorderThickness = model.BorderThicknes; } if (model.TextAngle == 0) { txtBlock.MaxWidth = model.Size.X; } else { txtBlock.MaxWidth = model.Size.Y; } toggleHighlighted(model.IsHighlighted); }
public void AttributeTransformationViewModelDropped(AttributeTransformationViewModel sender, AttributeTransformationViewModelEventArgs e, bool overElement) { AttributeTransformationViewModelEventHandler inputModelEventHandler = _renderer as AttributeTransformationViewModelEventHandler; if (inputModelEventHandler != null) { inputModelEventHandler.AttributeTransformationViewModelDropped(sender, e, overElement); } }
public void AttributeTransformationViewModelMoved(AttributeTransformationViewModel sender, AttributeTransformationViewModelEventArgs e, bool overElement) { var model = (AttributeTransformationMenuItemViewModel)((MenuItemViewModel)DataContext).MenuItemComponentViewModel; if (model.CanDrop) { if (overElement && !_isHighlighted) { toggleHighlighted(true); _isHighlighted = true; } else if (!overElement && _isHighlighted) { toggleHighlighted(false); _isHighlighted = false; } } }
public void AttributeTransformationViewModelDropped(AttributeTransformationViewModel sender, AttributeTransformationViewModelEventArgs e, bool overElement) { var model = (AttributeTransformationMenuItemViewModel)((MenuItemViewModel)DataContext).MenuItemComponentViewModel; if (model.CanDrop) { if (_isHighlighted) { toggleHighlighted(false); _isHighlighted = false; } if (overElement) { if (model != null && model.DroppedTriggered != null) { model.DroppedTriggered(new AttributeTransformationModel(e.AttributeTransformationModel.AttributeModel)); } } } }
private TileMenuItemViewModel recursiveCreateTileMenu(object inputModel, TileMenuItemViewModel parent) { TileMenuItemViewModel currentTileMenuItemViewModel = null; if (inputModel is AttributeGroupModel) { var inputGroupModel = inputModel as AttributeGroupModel; currentTileMenuItemViewModel = new TileMenuItemViewModel(parent); var inputGroupViewModel = new InputGroupViewModel(null, inputGroupModel); currentTileMenuItemViewModel.TileMenuContentViewModel = new InputGroupViewTileMenuContentViewModel { Name = inputGroupModel.RawName, InputGroupViewModel = inputGroupViewModel }; currentTileMenuItemViewModel.ChildrenNrColumns = (int)Math.Ceiling(inputGroupModel.InputModels.Count() / 10.0); currentTileMenuItemViewModel.ChildrenNrRows = (int)Math.Min(10.0, inputGroupModel.InputModels.Count()); currentTileMenuItemViewModel.Alignment = Alignment.Center; currentTileMenuItemViewModel.AttachPosition = AttachPosition.Right; var count = 0; foreach (var childInputModel in inputGroupModel.InputModels /*.OrderBy(am => am.RawName)*/) { var childTileMenu = recursiveCreateTileMenu(childInputModel, currentTileMenuItemViewModel); childTileMenu.Row = count; // TileMenuItemViewModel.Children.Count; childTileMenu.Column = currentTileMenuItemViewModel.ChildrenNrColumns - 1 - (int)Math.Floor((currentTileMenuItemViewModel.Children.Count - 1) / 10.0); childTileMenu.RowSpan = 1; childTileMenu.ColumnSpan = 1; //currentTileMenuItemViewModel.Children.Add(childTileMenu); count++; if (count == 10.0) { count = 0; } } } else if (inputModel is AttributeFieldModel) { currentTileMenuItemViewModel = new TileMenuItemViewModel(parent); var attributeTransformationViewModel = new AttributeTransformationViewModel(null, new AttributeTransformationModel(inputModel as AttributeFieldModel)); currentTileMenuItemViewModel.TileMenuContentViewModel = new InputFieldViewTileMenuContentViewModel { Name = (inputModel as AttributeFieldModel).RawName, AttributeTransformationViewModel = attributeTransformationViewModel }; } else if (inputModel is OperationTypeGroupModel) { var taskGroupModel = inputModel as OperationTypeGroupModel; currentTileMenuItemViewModel = new TileMenuItemViewModel(parent); currentTileMenuItemViewModel.TileMenuContentViewModel = new OperationTypeGroupTileMenuContentViewModel { Name = taskGroupModel.Name, OperationTypeGroupModel = taskGroupModel }; currentTileMenuItemViewModel.ChildrenNrColumns = (int)Math.Ceiling(taskGroupModel.OperationTypeModels.Count() / 10.0); currentTileMenuItemViewModel.ChildrenNrRows = (int)Math.Min(10.0, taskGroupModel.OperationTypeModels.Count()); currentTileMenuItemViewModel.Alignment = Alignment.Center; currentTileMenuItemViewModel.AttachPosition = AttachPosition.Right; var count = 0; foreach (var childInputModel in taskGroupModel.OperationTypeModels /*.OrderBy(am => am.RawName)*/) { var childTileMenu = recursiveCreateTileMenu(childInputModel, currentTileMenuItemViewModel); childTileMenu.Row = count; // TileMenuItemViewModel.Children.Count; childTileMenu.Column = currentTileMenuItemViewModel.ChildrenNrColumns - 1 - (int)Math.Floor((currentTileMenuItemViewModel.Children.Count - 1) / 10.0); childTileMenu.RowSpan = 1; childTileMenu.ColumnSpan = 1; //currentTileMenuItemViewModel.Children.Add(childTileMenu); count++; if (count == 10.0) { count = 0; } } } else if (inputModel is OperationTypeModel) { currentTileMenuItemViewModel = new TileMenuItemViewModel(parent); currentTileMenuItemViewModel.TileMenuContentViewModel = new OperationTypeTileMenuContentViewModel { Name = (inputModel as OperationTypeModel).Name, OperationTypeModel = inputModel as OperationTypeModel }; } parent.Children.Add(currentTileMenuItemViewModel); currentTileMenuItemViewModel.Alignment = Alignment.Center; currentTileMenuItemViewModel.AttachPosition = AttachPosition.Right; return(currentTileMenuItemViewModel); }