public GoldFieldViewModel(GoldFieldView view) { this.view = view; EventGenerator(); view.DataContext = GameViewModel.Instance; foreach (RessourceProducer item in GameViewModel.Instance.MainCastle.GoldProducers) { GoldProducerViewModel controller = new GoldProducerViewModel(item); if (item.IsVisible) { if (item.IsActive == true) { controller.SetActiveView(); this.view.AllGoldProducersSP.Children.Add(controller.View); } else { this.view.AllGoldProducersSP.Children.Add(controller.View); } } else { controller.View.Visibility = System.Windows.Visibility.Collapsed; this.view.AllGoldProducersSP.Children.Add(controller.View); } } }
public GoldFieldViewModel() { this.view = new GoldFieldView(); EventGenerator(); view.DataContext = GameViewModel.Instance; }
private void GoldFieldButton_Click(object sender, System.Windows.RoutedEventArgs e) { GoldFieldView newGoldFieldView = new GoldFieldView(); Switcher.Switch(newGoldFieldView); }