public NetworkServer(ScoreManager scoreManager) { this.scoreManager = scoreManager; communication = new NetworkCommunication(); networkThread = new Thread(communication.Run); communication.MessageReceived += OnMessageReceived; }
public SettingsViewModel(NetworkServer server, ITriggerSystem triggerSystem, TimerService timerService, ScoreManager scoreManager, MainViewModel mainView) { this.timerService = timerService; this.server = server; this.scoreManager = scoreManager; this.mainView = mainView; persistencyManager = new PersistencyManager(); TriggerSystem = triggerSystem; SendMessageCommand = new DelegateCommand(SendMessage); SendHighscoreCommand = new DelegateCommand(SendHighscore); SendOperatorCommand = new DelegateCommand(SendOperator); TestCommand = new DelegateCommand(o => SetTestData()); OpenCommand = new DelegateCommand(o => LoadScore()); SaveCommand = new DelegateCommand(o => SaveScore()); ShowTMWindowCommand = new DelegateCommand(o => ShowTimeMeasurementWindow()); SaveScoreCommand = new DelegateCommand(o => SaveCurrentScore()); DeleteScoreCommand = new DelegateCommand(o => DeleteScore()); DiscardScoreCommand = new DelegateCommand(o => DiscardScore()); ExampleText = "Test"; }
public MainViewModel() { ScoreManager = new ScoreManager(); SelectedScore = -1; CurrentPlayer = "-"; triggerSystem = CameraTriggerService.Instance; triggerSystem.TriggerRaised += TimeTrigger; TimerService = new TimerService(); TimerService.TimeTracked += TimeTracked; server = new NetworkServer(ScoreManager); server.NewPlayerReceived += NewPlayerReceived; server.Start(); OpenSettingsWindowCommand = new DelegateCommand(OpenSettingsWindow); OpenSettingsWindowCommand.Execute(null); // Each 100 milliseconds get player updateCurrentPlayerTimer = new Timer(2000); updateCurrentPlayerTimer.Elapsed += OnUpdateCurrentPlayerTimerElapsed; updateCurrentPlayerTimer.Start(); }
public SettingsWindow(NetworkServer server, ITriggerSystem triggerSystem, TimerService timerService, ScoreManager scoreManager, MainViewModel mainView) { InitializeComponent(); this.DataContext = new SettingsViewModel(server, triggerSystem, timerService, scoreManager, mainView); }