//Monitors CSGO, if CSGO finishes we want to update the Matchlist private void MonitorCSGO() { bool wasRunning = false; while (true) { if (Process.GetProcessesByName("csgo").Length != 0) { wasRunning = true; VibranceAndAudioUserControlInstance.CSGOIsRunning(); } if (Process.GetProcessesByName("csgo").Length == 0 && wasRunning) { wasRunning = false; VibranceAndAudioUserControlInstance.CSGOWasRunning(); long tempAccountId = BoilerHandler.StartAndGetAccountId(); if (tempAccountId != 0 && tempAccountId != _accountId) { _accountId = tempAccountId; Properties.Settings.Default.LastAccountId = tempAccountId; } UpdateMatchlist(); } Thread.Sleep(5000); } }
public App() { FrameworkElement.LanguageProperty.OverrideMetadata( typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))); //Retrieve AccountId //Case1: CSharpBoiler was started while Steam is running if (Process.GetProcessesByName("Steam").Length != 0) { long tempAccountId = BoilerHandler.StartAndGetAccountId(); if (tempAccountId != 0) { CSharpBoiler.Properties.Settings.Default.LastAccountId = tempAccountId; } } //Case2: CSharpboiler was started with Windows or while Steam wasn't running, BUT the accountid from the last Session is available //If Case 1 or 2 apply, start MainWindow if (CSharpBoiler.Properties.Settings.Default.LastAccountId != 0) { var mainWindow = new MainWindow(CSharpBoiler.Properties.Settings.Default.LastAccountId); //Note: ShowDialog is Blocking mainWindow.ShowDialog(); } else { //Neither Case 1 nor 2 were reached, meaning the App is openend for the first time AND Steam isn't running. //Informing the user that Steam is Required MessageBox.Show( "It appears that you run CSharpBoiler for the first time." + "\n\r Steam is required to be running at the first start of CSharpBoiler." + "\n\r\n\r The matchlist is updated:" + "\n\r - when starting CSharpBoiler while Steam is running " + "\n\r - when closing CSGO." + "\n\r\n\r - Closing CSharpBoiler. -" ); } //If we received no accountId or MainWindow.ShowDialog was terminated we end the App Environment.Exit(0); }