private void TurboHost_Load(object sender, EventArgs e) { tAutoTyperDictionary = new Dictionary<int, string>(); tFileIO = new FileIO(); tParser = new IniParser(tFileIO.GetSettingsFilePath()); tService = new SpreadsheetsService("TurboHost"); tTextReplacementDictionary = new Dictionary<string, string>(); tCurrentDate = GetFormattedDate(); tDirectory = tFileIO.FolderPath; tBetX = 150; tBetY = 150; SavedData = CheckSettingsFile(); if (SavedData == false) { this.Hide(); tLogin = new LoginSetup(); tLogin.FormClosed += new FormClosedEventHandler(tLogin_FormClosed); tLogin.TopMost = true; tLogin.ShowDialog(); } else { Listener = new KeyboardHookListener(new GlobalHooker()); Listener.Enabled = true; try { HookManager.KeyPress += HookManager_KeyPress; } catch { Console.WriteLine("error"); } FinishLoading(); } }
void tLogin_FormClosed(object sender, FormClosedEventArgs e) { tParser = new IniParser(tFileIO.GetSettingsFilePath()); tParser.AddSetting("UserSettings", "GmailAddress", tLogin.tGmailAddress); tParser.AddSetting("UserSettings", "GmailPassword", tLogin.tGmailPassword); tParser.AddSetting("UserSettings", "FacebookId", tLogin.tFacebookId); tParser.AddSetting("UserSettings", "FacebookPin", tLogin.tFacebookPIN); tParser.AddSetting("UserSettings", "SpreadsheetName", tLogin.tSpreadsheetName); tParser.SaveSettings(); HookManager.KeyPress += new KeyPressEventHandler(HookManager_KeyPress); tUserName = tLogin.tGmailAddress; tPassword = tLogin.tGmailPassword; tFacebookId = tLogin.tFacebookId; tFacebookPin = tLogin.tFacebookPIN; tSheetName = tLogin.tSpreadsheetName; LoadComboBoxValues(comboBox1); LoadComboBoxValues(comboBox2); LoadComboBoxValues(comboBox3); try { tService.setUserCredentials(tUserName, tPassword); tDicingSpreadsheet = GetDicingSheet(); tWorksheetEntry = GetWorksheet(tDicingSpreadsheet); tWorksheetFeed = GetWorksheetFeed(tWorksheetEntry); } catch { MessageBox.Show("There was an error logging you into Google or loading your spreadsheets. Check the info.", "Google Error", MessageBoxButtons.OK); } tTextReplacementDictionary.Add("{player1}", ""); tTextReplacementDictionary.Add("{player2}", ""); tTextReplacementDictionary.Add("{bet}", ""); tTextReplacementDictionary.Add("{pot}", ""); this.Show(); }