/// <summary> /// Initializes a new instance of the <see cref="MultiPlayerViewModel"/> class. /// </summary> /// <param name="model">The model.</param> public MultiPlayerViewModel(IMultiPlayerModel model) { this.model = model; model.PropertyChanged += delegate(Object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "PlayerPos") { PlayerPos = model.PlayerPos; } else if (e.PropertyName == "OpponentPos") { OpponentPos = model.OpponentPos; } else if (e.PropertyName == "YouWon") { YouWon = model.YouWon; } else if (e.PropertyName == "OpponentWon") { OpponentWon = model.OpponentWon; } else if (e.PropertyName == "ExitGame") { ExitGame = model.ExitGame; } else if (e.PropertyName == "LostConnection") { LostConnection = model.LostConnection; } }; }
/// <summary> /// Initializes a new instance of the <see cref="MultiPlayerViewModel"/> class. /// </summary> /// <param name="model">The model.</param> public MultiPlayerViewModel(IMultiPlayerModel model) { this.model = model; this.playerVM = new MultiPlayerPlayerViewModel(this.model); this.opponentVM = new MultiPlayerOpponentViewModel(this.model); this.model.PropertyChanged += Model_PropertyChanged; }
public MultiPlayer() { this.model = new ApplicationMultiPlayerModel(); this.InitializeComponent(); this.vm = new MultiPlayerViewModel(this.model); this.DataContext = this.vm; this.surpriseClose = true; }
public MultiPlayerViewModel(IMultiPlayerModel model) { this.model = model; model.PropertyChanged += delegate(Object sender, PropertyChangedEventArgs e) { NotifyPropertyChanged("VM_" + e.PropertyName); }; }
// public SoundPlayer player; /// <summary> /// Initializes a new instance of the <see cref="MultiPlayerWindow"/> class. /// </summary> /// <param name="model">The model.</param> public MultiPlayerWindow(IMultiPlayerModel model) { this.model = model; this.InitializeComponent(); this.vm = new MultiPlayerWindowViewModel(model); this.DataContext = this.vm; this.vm.ClosingHappend += this.CloseGame; }
public MultiPlayerViewModel() { this.model = new ApplicationMultiPlyaerModel(); // this.model = model; model.PropertyChanged += delegate(Object sender, PropertyChangedEventArgs e) { NotifyPropertyChanged(e.PropertyName); }; model.ListCommand(); }
/// <summary> /// Initializes a new instance of the <see cref="MultiPlayer"/> class. /// </summary> /// <param name="model">The model.</param> public MultiPlayer(IMultiPlayerModel model) { InitializeComponent(); vm = new MultiPlayerViewModel(model); DataContext = vm; SetBinding(YouWonProperty, new Binding("YouWon")); SetBinding(OpponentWonProperty, new Binding("OpponentWon")); SetBinding(ExitGameProperty, new Binding("ExitGame")); SetBinding(LostConnectionProperty, new Binding("LostConnection")); }
/// <summary> /// Initializes a new instance of the <see cref="MultiPlayerDetailsViewModel"/> class. /// </summary> /// <param name="model">The model.</param> public MultiPlayerDetailsViewModel(IMultiPlayerModel model) { this.model = model; model.PropertyChanged += delegate(Object sender, PropertyChangedEventArgs e){ if (e.PropertyName == "Maze") { MultiPlayer mp = new MultiPlayer(model); mp.Show(); NotifyPropertyChanged("VM_" + e.PropertyName); } }; }
/// <summary> /// Initializes a new instance of the <see cref="MultiPlayer"/> class. /// </summary> /// <param name="model">The model.</param> /// <param name="main">The main.</param> public MultiPlayer(IMultiPlayerModel model, Window main) { InitializeComponent(); this.player = new MusicPlayer("multiplayer.mp3"); this.player.Play(); this.mainWindow = main; this.model = model; this.vm = new MultiPlayerViewModel(this.model); this.DataContext = this.vm; this.mazeCtrlPlayer.DataContext = this.vm.Player; this.mazeCtrlOpponent.DataContext = this.vm.Opponent; }
/// <summary> /// Initializes a new instance of the <see cref="MultiPlayerWindowViewModel"/> class. /// </summary> /// <param name="model">The model.</param> public MultiPlayerWindowViewModel(IMultiPlayerModel model) { this.model = model; model.PropertyChanged += delegate(Object sender, PropertyChangedEventArgs e) { if (e.PropertyName.Equals("CloseReason")) { this.ClosingHappend?.Invoke(this.VmCloseReason); } else { this.NotifyPropertyChanged("Vm" + e.PropertyName); } }; }
/// <summary> /// Initializes a new instance of the <see cref="MultiPlayerPlayerViewModel"/> class. /// </summary> /// <param name="model">The model.</param> public MultiPlayerPlayerViewModel(IMultiPlayerModel model) { this.model = model; this.model.PropertyChanged += Model_PropertyChanged; }