private void loadSettings() { _settings = Configuration.Settings.LoadSavedSettings(); if (Settings == null) { _log.Info("The user has not yet entered their credentials, so they will be prompted"); MainApplicationContext.ShowMessageBox("You need to enter your credentials."); //We need the main form to create the initial options settingsForm.Show(); } }
private void checkVersion() { Webservices.TrayApplication ws; string minVersionString; Version minVersion; ws = new Webservices.TrayApplication(); minVersionString = ws.GetMinimumClientVersion(); minVersion = new Version(minVersionString); if (minVersion.CompareTo(new Version(Application.ProductVersion)) > 0) { MainApplicationContext.ShowMessageBox("The version of the RankTrend.com tray application that you are using is out of date, and must be upgraded, you will now be taken to the upgrade page."); System.Diagnostics.Process.Start("http://www.RankTrend.com/Members/Tray-Application/"); Application.ExitThread(); } }
static void Main() { bool grantedOwnership; using (System.Threading.Mutex mtxSingleInstance = new System.Threading.Mutex(true, "93803d66-bd68-4d22-8e8b-93fb37e0d05d", out grantedOwnership)) { if (grantedOwnership) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainApplicationContext()); } else { MainApplicationContext.ShowMessageBox("Another instance of the RankTrend Tray Application is already running. By default, this application is configured to run on Startup and you should not have to manually launch it."); } } }
private void cmdSave_Click(object sender, EventArgs e) { cmdSave.Enabled = false; if (!saveSettings()) { cmdSave.Enabled = true; return; } else { MainApplicationContext.ShowMessageBox("Your credentials have been successfully saved."); } Hide(); //Re-enabled the "Save" button cmdSave.Enabled = true; OnUserCredentialsSave(new EventArgs()); }
private bool changeCredentials() { Webservices.TrayApplication ws; Guid guid; string guidString; if (txtPassword.Text == BLANK_PASSWORD) { MainApplicationContext.ShowMessageBox("If you change your user name, you need to re-enter your password. Your user name has not been changed."); return(false); } //The username or password has changed, so we need to get a new GUID ws = new Webservices.TrayApplication(); Cursor = Cursors.WaitCursor; try { guidString = ws.Authenticate(txtUsername.Text, txtPassword.Text); } finally { Cursor = Cursors.Default; } if (guidString == null) { MainApplicationContext.ShowMessageBox("The user name and password you entered are not correct."); return(false); } guid = new Guid(guidString); Settings.UserName = txtUsername.Text; Settings.UserGuid = guid; return(true); }