private RadDiagramShape AddActiveIndicator(RadDiagramShape player, TableRingItem tableItem) { RadDiagramShape indicator = new RadDiagramShape() { DataContext = tableItem, Height = ACTIVE_INDICATOR_HEIGHT, Width = ACTIVE_INDICATOR_WIDTH, StrokeThickness = 0, BorderThickness = new Thickness(0), IsResizingEnabled = false, IsRotationEnabled = false, IsDraggingEnabled = false, IsManipulationEnabled = false, IsManipulationAdornerVisible = false, IsHitTestVisible = true, FontSize = 13, X = player.X + activeIndicatorRelativePosition.X, Y = player.Y + activeIndicatorRelativePosition.Y }; BindingOperations.ClearBinding(indicator, RadDiagramShape.BackgroundProperty); Binding backgroundBinding = new Binding() { Path = new PropertyPath(ReflectionHelper.GetPath <TableRingItem>(o => o.IsChecked)), Mode = BindingMode.TwoWay, Converter = new FilterTableRingBooleanToBrushConverter() }; indicator.SetBinding(RadDiagramShape.BackgroundProperty, backgroundBinding); return(indicator); }
private RadDiagramShape CreateCardLabel(RadDiagram diagram, ReplayerCardViewModel card) { var label = new RadDiagramShape() { Height = CARD_HEIGHT, Width = CARD_WIDTH, MaxHeight = CARD_HEIGHT, MaxWidth = CARD_WIDTH, StrokeThickness = 0, BorderThickness = new Thickness(0), IsEnabled = false, IsHitTestVisible = false, DataContext = card }; try { BindingOperations.ClearBinding(label, UIElement.VisibilityProperty); BindingOperations.ClearBinding(label, Control.BackgroundProperty); Binding cardBinding = new Binding(nameof(ReplayerCardViewModel.CardId)) { Source = card, Mode = BindingMode.TwoWay, Converter = new IntToCardConverter(), ConverterParameter = label }; label.SetBinding(Control.BackgroundProperty, cardBinding); } catch (Exception ex) { LogProvider.Log.Error(ex); } return(label); }
private RadDiagramShape CreatePlayerLabel(ReplayerPlayerViewModel p) { var label = new RadDiagramShape() { DataContext = p, Tag = p, Height = PLAYER_HEIGHT, Width = PLAYER_WIDTH, StrokeThickness = 0, BorderThickness = new Thickness(0), IsEnabled = false, IsHitTestVisible = false, FontSize = 13 }; BindingOperations.ClearBinding(label, Control.BackgroundProperty); Binding myBinding = new Binding(nameof(ReplayerPlayerViewModel.IsFinished)) { Source = p, Mode = BindingMode.TwoWay, Converter = new ReplayerBrushPlayerConverter() }; label.SetBinding(Control.BackgroundProperty, myBinding); return(label); }
internal void UpdateChips(decimal amount) { ChipsShape.Content = null; ConvertToChips(amount); if (!Chips.Any()) { return; } StackPanel sp = new StackPanel(); sp.HorizontalAlignment = HorizontalAlignment.Left; sp.VerticalAlignment = VerticalAlignment.Bottom; foreach (var chip in Chips) { for (int j = 0; j < chip.Count; j++) { var chipShape = new RadDiagramShape() { Height = 25, Width = 25, StrokeThickness = 0, BorderThickness = new Thickness(0), Tag = "ChipsInfo", Visibility = Visibility.Visible, DataContext = chip, Margin = new Thickness(0, -22, 0, 0), ZIndex = sp.Children.Count }; Binding chipBinding = new Binding(ReflectionHelper.GetPath <ChipModel>(o => o.ChipColor)) { Source = chip, Mode = BindingMode.OneTime, Converter = new ColorToChipsConverter(), ConverterParameter = chipShape }; chipShape.SetBinding(Control.BackgroundProperty, chipBinding); sp.Children.Insert(0, chipShape); } } ChipsShape.Height = sp.Height; ChipsShape.Content = sp; }
private RadDiagramShape AddActiveIndicator(RadDiagramShape player, SettingsSiteViewModel viewModel, int seat) { RadDiagramShape indicator = new RadDiagramShape() { Height = ACTIVE_INDICATOR_HEIGHT, Width = ACTIVE_INDICATOR_WIDTH, StrokeThickness = 0, BorderThickness = new Thickness(0), IsResizingEnabled = false, IsRotationEnabled = false, IsDraggingEnabled = false, IsManipulationEnabled = false, IsManipulationAdornerVisible = false, IsHitTestVisible = true, FontSize = 13, X = player.X + activeIndicatorRelativePosition.X, Y = player.Y + activeIndicatorRelativePosition.Y, DataContext = viewModel.SelectedSiteViewModel, Tag = seat, Cursor = Cursors.Hand }; BindingOperations.ClearBinding(indicator, RadDiagramShape.BackgroundProperty); MultiBinding backgroundBinding = new MultiBinding(); backgroundBinding.Converter = new MultiBooleanAndToBrushConverter(); Binding seatBinding = new Binding() { Path = new PropertyPath(ReflectionHelper.GetPath <SiteViewModel>(o => o.SelectedSeatModel.PreferredSeat)), Mode = BindingMode.TwoWay, Converter = new ParameterToBoolConverter(), ConverterParameter = seat }; Binding enabledBinding = new Binding() { Path = new PropertyPath(ReflectionHelper.GetPath <SiteViewModel>(o => o.SelectedSeatModel.IsPreferredSeatEnabled)) }; backgroundBinding.Bindings.Add(seatBinding); backgroundBinding.Bindings.Add(enabledBinding); indicator.SetBinding(RadDiagramShape.BackgroundProperty, backgroundBinding); return(indicator); }
private RadDiagramShape CreateDealerLabel(RadDiagram diagram, ReplayerPlayerViewModel player) { var button = new RadDiagramShape() { Background = new ImageBrush(new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(diagram), DealerImage))), Height = BUTTON_HEIGHT, Width = BUTTON_WIDTH, StrokeThickness = 0, IsEnabled = false, }; Binding myBinding = new Binding(nameof(ReplayerPlayerViewModel.IsDealer)) { Source = player, Mode = BindingMode.TwoWay, Converter = new BoolToVisibilityConverter() }; button.SetBinding(UIElement.VisibilityProperty, myBinding); return(button); }