public MemoryReader() { state = State.NoSC2; scoreboard = MainWindowViewModel.DisplayWindow.Scoreboard; db = new Database("players.db"); var t = new DispatcherTimer(); t.Interval = TimeSpan.FromMilliseconds(500); t.Tick += new EventHandler(Tick); t.Start(); player1Observer = new PropertyObserver<Model.Player>(scoreboard.Player1); player1Observer.RegisterHandler(n => n.Name, OnNameChanged); player1Observer.RegisterHandler(n => n.Race, OnRaceChanged); player2Observer = new PropertyObserver<Model.Player>(scoreboard.Player2); player2Observer.RegisterHandler(n => n.Name, OnNameChanged); player2Observer.RegisterHandler(n => n.Race, OnRaceChanged); }
/// <summary> Initializes a new instance of the <see cref="ScoreboardControlPanelViewModel"/> class. </summary> /// <param name="scoreboard"> The scoreboard view model. </param> public ScoreboardControlPanelViewModel(ScoreboardControlViewModel scoreboard) { this.scoreboard = scoreboard; }
/// <summary> /// Sets the viewmodel for the window to another instance of ScoreboardControlViewModel /// </summary> /// <param name="vm"> /// The viewModel to apply. /// </param> public void SetViewModel(ScoreboardControlViewModel vm) { this.Scoreboard = vm; }
/// <summary> Sets the viewmodel for the window to another instance of ScoreboardControlViewModel </summary> /// <param name="vm"> The viewModel to apply. </param> public void SetViewModel(ScoreboardControlViewModel vm) { scoreboardControl.DataContext = vm; this.scoreboard = vm; }