public PropertyTheftWindow(Player victim, Player thief, int actionId) { base.isModal = false; AssetsOfVictim = new ObservableCollection <Card>(); this.victim = victim; this.thief = thief; this.type = (TheftType)actionId; this.showMonopoliesOnly = (TheftType.Dealbreaker == this.type); InitializeComponent(); // Update the label for the victim's assets. this.VictimAssetsLabel.Content = victim.Name + "'s Assets"; // Create a property hierarchy for the victim's properties. This view will be used regardless of the type of theft. propertyViewVictim = new PropertyHierarchyView(victim, showMonopoliesOnly); Grid.SetRow(propertyViewVictim, 1); Grid.SetColumn(propertyViewVictim, 0); WindowGrid.Children.Add(propertyViewVictim); propertyViewVictim.SelectedItemChanged += new RoutedPropertyChangedEventHandler <object>(SelectedItemChanged); // If this is a ForcedDeal, create a tree view of the thief's properties. if (TheftType.ForcedDeal == type) { propertyViewThief = new PropertyHierarchyView(thief, false, true); Grid.SetRow(propertyViewThief, 1); Grid.SetColumn(propertyViewThief, 1); WindowGrid.Children.Add(propertyViewThief); propertyViewThief.SelectedItemChanged += new RoutedPropertyChangedEventHandler <object>(SelectedItemChanged); } // Otherwise, display only the victim's properties. else { // Center the victim's properties in the window. Grid.SetColumnSpan(propertyViewVictim, 2); Grid.SetColumnSpan(VictimAssetsLabel, 2); // Hide the thief assets label. ThiefAssetsLabel.Visibility = System.Windows.Visibility.Hidden; } // Update the window title to reflect the player receiving rent. this.Title = "Stealing Property from " + victim.Name; // Set the data context of the window. this.DataContext = this; }
public PropertyTheftWindow( Player victim, Player thief, int actionId ) { AssetsOfVictim = new ObservableCollection<Card>(); this.victim = victim; this.thief = thief; this.type = (TheftType)actionId; this.showMonopoliesOnly = (TheftType.Dealbreaker == this.type); InitializeComponent(); // Update the label for the victim's assets. this.VictimAssetsLabel.Content = victim.Name + "'s Assets"; // Create a property hierarchy for the victim's properties. This view will be used regardless of the type of theft. propertyViewVictim = new PropertyHierarchyView(victim, showMonopoliesOnly); Grid.SetRow(propertyViewVictim, 1); Grid.SetColumn(propertyViewVictim, 0); WindowGrid.Children.Add(propertyViewVictim); propertyViewVictim.SelectedItemChanged += new RoutedPropertyChangedEventHandler<object>(SelectedItemChanged); // If this is a ForcedDeal, create a tree view of the thief's properties. if (TheftType.ForcedDeal == type) { propertyViewThief = new PropertyHierarchyView(thief, false, true); Grid.SetRow(propertyViewThief, 1); Grid.SetColumn(propertyViewThief, 1); WindowGrid.Children.Add(propertyViewThief); propertyViewThief.SelectedItemChanged += new RoutedPropertyChangedEventHandler<object>(SelectedItemChanged); } // Otherwise, display only the victim's properties. else { // Center the victim's properties in the window. Grid.SetColumnSpan(propertyViewVictim, 2); Grid.SetColumnSpan(VictimAssetsLabel, 2); // Hide the thief assets label. ThiefAssetsLabel.Visibility = System.Windows.Visibility.Hidden; } // Update the window title to reflect the player receiving rent. this.Title = "Stealing Property from " + victim.Name; // Set the data context of the window. this.DataContext = this; }