protected override void OnPreviewMouseMove(MouseEventArgs e) { base.OnPreviewMouseMove(e); if (e.LeftButton == MouseButtonState.Pressed && _moveEntityType && TypesSelected.Any()) { var moveEntityTypeNewPosition = e.GetPosition(this); var translationVectorX = moveEntityTypeNewPosition.X - _moveEntityTypeStartPoint.X; if (translationVectorX < 0) { var minX = TypesSelected.Min(ts => Canvas.GetLeft(ts)); if (minX < -translationVectorX) { translationVectorX = -minX; } } var translationVectorY = moveEntityTypeNewPosition.Y - _moveEntityTypeStartPoint.Y; if (translationVectorY < 0) { var minY = TypesSelected.Min(ts => Canvas.GetTop(ts)); if (minY < -translationVectorY) { translationVectorY = -minY; } } foreach (var entityTypeControl in TypesSelected) { Canvas.SetLeft(entityTypeControl, Canvas.GetLeft(entityTypeControl) + translationVectorX); Canvas.SetTop(entityTypeControl, Canvas.GetTop(entityTypeControl) + translationVectorY); entityTypeControl.OnMove(); } _moveEntityTypeStartPoint = moveEntityTypeNewPosition; Resize(); } }
private bool CheckType(ICardAllDbInfo cai) { if (ExcludeSpecialCards) { if (MultiPartCardManager.Instance.IsSpecial(cai)) { return(false); } } if (TypesSelected.Count == 0) { return(true); } CardType type = MultiPartCardManager.Instance.GetCardType(cai); CardType wantedType = TypesSelected.Aggregate(CardType.Token, (current, newtype) => current | newtype); if (TypeAggregation == MultiSelectedAggregation.And) { return(Matcher <CardType> .IncludeValue(type, wantedType)); } //TypeAggregation == MultiSelectedAggregation.Or return(Matcher <CardType> .HasValue(type, wantedType)); }
public void UnselectAllTypes() { foreach (var selectedType in TypesSelected.ToList()) { selectedType.IsSelected = false; } }
internal void UnselectOtherTypes(TypeBaseDesigner typeDesigner) { if (!KeyboardUtil.CtrlDown) { foreach (var selectedType in TypesSelected.Where(ts => ts != typeDesigner).ToList()) { selectedType.IsSelected = false; } } }
private bool CheckType(CardCollectionInputGraphicViewModel vm) { if (TypesSelected.Count == 0) { return(true); } CardType type = vm.GetCardType(); CardType wantedType = TypesSelected.Aggregate(CardType.Token, (current, newType) => current | newType); return(Matcher <CardType> .HasValue(type, wantedType)); }
private void DeleteSelectedTypesFromDesigner(bool deleteType) { foreach (var designerType in TypesSelected.ToList()) { foreach (var relationContener in designerType.RelationsContener.ToList()) { Children.Remove(relationContener); relationContener.OnRemove(); } Children.Remove(designerType); DesignerView.RemoveTypeDesigner(designerType); if (deleteType) { designerType.UIType.View.DeleteType(designerType.UIType); } } }
private void ReInit() { //Default values Name = null; ExcludeFunEditions = true; ExcludeOnlineOnlyEditions = true; ExcludeSpecialCards = true; CountIncludeFoil = false; CountIsNameBased = false; CountComparatorSelected = CountComparator[(int)ComparisonType.GreaterOrEquals]; CountSelected = 1; AllLanguages = false; PerimeterScope = PerimeterScope.All; ColorAggregation = MultiSelectedAggregation.Or; TypeAggregation = MultiSelectedAggregation.Or; SubTypeAggregation = MultiSelectedAggregation.Or; EditionsSelected.Clear(); CollectionsSelected.Clear(); ColorsSelected.Clear(); TypesSelected.Clear(); SubTypesSelected.Clear(); }
private void InitContextMenuCommandBindings() { Loaded += delegate { ContextMenu.ContextMenu contextMenu; StackPanel stackPanel; TextBox textBox; if ((contextMenu = ContextMenu) != null && (stackPanel = contextMenu.Items.OfType <StackPanel>().FirstOrDefault(sp => sp.Name == ZOOM_STACKPANEL)) != null && (textBox = stackPanel.Children.OfType <TextBox>().FirstOrDefault(etb => etb.Name == ZOOM_TEXTBOX)) != null) { textBox.SetBinding(TextBox.TextProperty, new Binding { Source = this, Path = new PropertyPath("Zoom") }); } }; CommandBindings.AddRange( new[] { new CommandBinding(AddEntityTypeCommand, delegate { var csdlView = EDMView.CSDL; var addEntityTypeWindow = new AddEntityTypeWindow(csdlView) { Owner = Container.Window }; switch (addEntityTypeWindow.ShowDialog()) { case true: UITypeToAdd = csdlView.AddEntityType(addEntityTypeWindow.EntityTypeName, addEntityTypeWindow.BaseEntityType); break; } } ), new CommandBinding(AddComplexTypeCommand, delegate { var addComplexTypeWindow = new AddComplexTypeWindow { Owner = Container.Window }; switch (addComplexTypeWindow.ShowDialog()) { case true: UITypeToAdd = EDMView.CSDL.AddComplexType(addComplexTypeWindow.ComplexTypeName); break; } } ), new CommandBinding(AddAssociationCommand, AddAssociationExecuted(this, () => EDMView.CSDL, () => DesignerView, null, null) ), new CommandBinding(RemoveFromDesignerCommand, delegate { RemoveFromDesigner(); }, (sender, e) => e.CanExecute = TypesSelected.Any() ), new CommandBinding(SelectAllCommand, delegate { foreach (var types in TypesVisibles) { types.IsSelected = true; } }, (sender, e) => e.CanExecute = TypesVisibles.Any() ) } ); }