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); }
public void ConfigureTable(RadDiagram diagram, SettingsSiteViewModel viewModel, EnumTableType tableType) { diagram.Clear(); var table = new RadDiagramShape() { Background = new ImageBrush(new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(diagram), GetBackgroundImage(tableType)))), StrokeThickness = 0, IsEnabled = false, Height = TABLE_HEIGHT, Width = TABLE_WIDTH, X = tablePosition.X, Y = tablePosition.Y, }; diagram.AddShape(table); CreatePlayerLabels(diagram, viewModel, (int)tableType); }
private void SwitchView(object obj) { if (obj != null) { var viewModel = ViewModelCollection.FirstOrDefault(x => x == obj); if (viewModel != null) { SettingsSiteViewModel vm = viewModel as SettingsSiteViewModel; if (vm != null && _preferredSeatingFlag) { vm.SelectedSiteType = EnumPokerSites.Ignition; _preferredSeatingFlag = false; SelectedViewModel = vm; } else { SelectedViewModel = viewModel; } } } }
private void CreatePlayerLabels(RadDiagram diagram, SettingsSiteViewModel viewModel, int seats) { var positions = PredefinedPlayerPositions[seats]; for (int i = 0; i < seats; i++) { RadDiagramShape player = new RadDiagramShape() { Background = new ImageBrush(new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(diagram), BackgroundPlayerImage))), Height = PLAYER_HEIGHT, Width = PLAYER_WIDTH, StrokeThickness = 0, BorderThickness = new Thickness(0), IsResizingEnabled = false, IsRotationEnabled = false, IsDraggingEnabled = false, IsManipulationEnabled = false, IsManipulationAdornerVisible = false, IsHitTestVisible = true, FontSize = 13, DataContext = viewModel.SelectedSiteViewModel, Tag = i + 1, Cursor = Cursors.Hand }; player.X = positions[i, 0]; player.Y = positions[i, 1]; var indicator = AddActiveIndicator(player, viewModel, i + 1); player.MouseLeftButtonUp += PlayerControl_MouseLeftButtonUp; indicator.MouseLeftButtonUp += PlayerControl_MouseLeftButtonUp; diagram.AddShape(player); diagram.AddShape(indicator); } }