public MainWindowViewModel(AccountManager accountManager, GameSessionMap gameSessionMap, Configurator configurator) { if (accountManager == null) { throw new ArgumentException("Null Null GameSessionMap in MainWindowViewModel()", "accountManager"); } if (gameSessionMap == null) { throw new ArgumentException("Null GameSessionMap in MainWindowViewModel()", "gameSessionMap"); } if (configurator == null) { throw new ArgumentException("Null Configurator in MainWindowViewModel()", "configurator"); } _accountManager = accountManager; _gameSessionMap = gameSessionMap; _configurator = configurator; _accountManager.UserAccounts.CollectionChanged += UserAccountsCollectionChanged; NewProfileCommand = new DelegateCommand(CreateNewProfile); NextProfileCommand = new DelegateCommand(GoToNextProfile); PrevProfileCommand = new DelegateCommand(GoToPrevProfile); DeleteProfileCommand = new DelegateCommand(DeleteProfile); EditCharactersCommand = new DelegateCommand(EditCharacters); LoadStatusSymbols(); }
internal MainWindow(MainWindowViewModel mainWindowViewModel, GameSessionMap gameSessionMap, GameMonitor gameMonitor) { if (mainWindowViewModel == null) { throw new Exception("Null MainWindowViewModel in MainWindow()"); } if (gameSessionMap == null) { throw new Exception("Null GameSessionMap in MainWindow()"); } if (gameMonitor == null) { throw new Exception("Null GameMonitor in MainWindow()"); } _viewModel = mainWindowViewModel; _viewModel.CloseAction = new Action(() => this.Close()); _gameSessionMap = gameSessionMap; _gameMonitor = gameMonitor; _launchWorker = new LaunchWorker(_worker, _gameSessionMap); _launchWorker.ReportAccountStatusEvent += (accountStatus, item) => UpdateAccountStatus(accountStatus, item); _launchWorker.ProgressChangedEvent += _worker_ProgressChanged; _launchWorker.WorkerCompletedEvent += _worker_RunWorkerCompleted; _uicontext = SynchronizationContext.Current; _viewModel.OpeningSimpleLauncherEvent += () => this.Hide(); _viewModel.LaunchingSimpleGameEvent += (li) => this.LaunchSimpleClient(li); _autoLaunchOnStart = Properties.Settings.Default.AutoLaunchOnStart; if (Properties.Settings.Default.AutoRelaunch) { CheckForProgramUpdate(); } InitializeComponent(); DataContext = _viewModel; mainWindowViewModel.PropertyChanged += MainWindowViewModel_PropertyChanged; EnsureDataFoldersExist(); PopulateServerList(); LoadUserAccounts(initialLoad: true); LoadImages(); ChangeBackgroundImageRandomly(); SubscribeToGameMonitorEvents(); _timer = new System.Timers.Timer(5000); // every five seconds _timer.Elapsed += _timer_Elapsed; StartStopTimerIfAutoChecked(); if (_autoLaunchOnStart) { LaunchGame(); } ThwargLauncher.AppSettings.WpfWindowPlacementSetting.Persist(this); }
public GameMonitor(GameSessionMap map, Configurator configurator) { if (map == null) { throw new Exception("Null GameSessionMap in GameMonitor()"); } if (configurator == null) { throw new Exception("Null Configurator in GameMonitor()"); } _map = map; _configurator = configurator; }
public CommandManager(GameMonitor gameMonitor, GameSessionMap gameSessionMap) { if (gameMonitor == null) { throw new Exception("Null GameMonitor in CommandManager()"); } if (gameSessionMap == null) { throw new Exception("Null GameSessionMap in CommandManager()"); } _gameMonitor = gameMonitor; _gameSessionMap = gameSessionMap; StartHandling(); }
internal MainWindow(MainWindowViewModel mainWindowViewModel, GameSessionMap gameSessionMap, GameMonitor gameMonitor) { if (mainWindowViewModel == null) { throw new Exception("Null MainWindowViewModel in MainWindow()"); } if (gameSessionMap == null) { throw new Exception("Null GameSessionMap in MainWindow()"); } if (gameMonitor == null) { throw new Exception("Null GameMonitor in MainWindow()"); } _viewModel = mainWindowViewModel; _viewModel.CloseAction = new Action(() => this.Close()); _gameSessionMap = gameSessionMap; _gameMonitor = gameMonitor; _uicontext = SynchronizationContext.Current; _viewModel.OpeningSimpleLauncherEvent += () => this.Hide(); _viewModel.LaunchingSimpleGameEvent += (li) => this.LaunchSimpleClient(li); CheckForProgramUpdate(); InitializeComponent(); DataContext = _viewModel; mainWindowViewModel.PropertyChanged += MainWindowViewModel_PropertyChanged; MigrateSettingsIfNeeded(); EnsureDataFoldersExist(); PopulateServerList(); LoadUserAccounts(initialLoad: true); LoadImages(); ChangeBackgroundImageRandomly(); WireUpBackgroundWorker(); if (Properties.Settings.Default.ACLocation != "") { txtLauncherLocation.Text = Properties.Settings.Default.ACLocation; } ThwargLauncher.AppSettings.WpfWindowPlacementSetting.Persist(this); }
internal MainWindow(MainWindowViewModel mainWindowViewModel, GameSessionMap gameSessionMap, GameMonitor gameMonitor) { if (mainWindowViewModel == null) { throw new Exception("Null MainWindowViewModel in MainWindow()"); } if (gameSessionMap == null) { throw new Exception("Null GameSessionMap in MainWindow()"); } if (gameMonitor == null) { throw new Exception("Null GameMonitor in MainWindow()"); } _viewModel = mainWindowViewModel; _viewModel.CloseAction = new Action(() => this.Close()); _gameSessionMap = gameSessionMap; _gameMonitor = gameMonitor; _uicontext = SynchronizationContext.Current; _viewModel.OpeningSimpleLauncherEvent += () => this.Hide(); _viewModel.LaunchingSimpleGameEvent += (li) => this.LaunchSimpleClient(li); CheckForProgramUpdate(); InitializeComponent(); DataContext = _viewModel; mainWindowViewModel.PropertyChanged += MainWindowViewModel_PropertyChanged; MigrateSettingsIfNeeded(); EnsureDataFoldersExist(); PopulateServerList(); LoadUserAccounts(initialLoad: true); LoadImages(); ChangeBackgroundImageRandomly(); WireUpBackgroundWorker(); SubscribeToGameMonitorEvents(); _timer = new System.Timers.Timer(5000); // every five seconds _timer.Elapsed += _timer_Elapsed; _timer.Enabled = ConfigSettings.GetConfigBool("AutoRelaunch", false); ThwargLauncher.AppSettings.WpfWindowPlacementSetting.Persist(this); }
private void BeginMonitoringGame() { _configurator = new Configurator(); RecordGameDll(); _gameSessionMap = new GameSessionMap(); _gameMonitor = new GameMonitor(_gameSessionMap, _configurator); _accountManager = new AccountManager(_gameMonitor); _mainViewModel = new MainWindowViewModel(_accountManager, _gameSessionMap, _configurator); _mainViewModel.RequestShowMainWindowEvent += () => _mainWindow.Show(); _commandManager = new CommandManager(_gameMonitor, _gameSessionMap); bool testCommandTokenParser = true; if (testCommandTokenParser) { _commandManager.TestParse(); } _uiGameMonitorBridge = new UiGameMonitorBridge(_gameMonitor, _mainViewModel); _uiGameMonitorBridge.Start(); _gameMonitor.Start(); }
private void BeginMonitoringGame() { // Logger is a static object, so it already exists string logfilepath = GetLauncherLogPath(); _logWriter = new LogWriter(logfilepath); _configurator = new Configurator(); RecordGameDll(); _gameSessionMap = new GameSessionMap(); _gameMonitor = new GameMonitor(_gameSessionMap, _configurator); _accountManager = new AccountManager(_gameMonitor); _mainViewModel = new MainWindowViewModel(_accountManager, _gameSessionMap, _configurator); _mainViewModel.RequestShowMainWindowEvent += () => _mainWindow.Show(); _commandManager = new CommandManager(_gameMonitor, _gameSessionMap); bool testCommandTokenParser = true; if (testCommandTokenParser) { _commandManager.TestParse(); } _uiGameMonitorBridge = new UiGameMonitorBridge(_gameMonitor, _mainViewModel); _uiGameMonitorBridge.Start(); _gameMonitor.Start(); }
private void RemoveDeadSessionByPid(int processId) { string pidkey = GameSessionMap.GetProcessIdKey(processId); RemoveSessionByPidKey(pidkey); }
public LaunchWorker(BackgroundWorker worker, GameSessionMap gameSessionMap) { _worker = worker; _gameSessionMap = gameSessionMap; Initialize(); }