private void ReadPreferences() { _username = AppSettings.serviceUsername; _password = AppSettings.servicePassword; _tempoTracker = new TempoTrackerApi.TempoTracker(_username, _password, Properties.Settings.Default.CustomApiUrl); if (string.IsNullOrEmpty(_username) || string.IsNullOrEmpty(_password) || string.IsNullOrEmpty(Properties.Settings.Default.CustomApiUrl)) { var optionsForm = new OptionsForm(); if (optionsForm.ShowDialog(this) != DialogResult.OK) { MessageBox.Show("Please configure API information.", Resources.Language.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); } ReadPreferences(); } // Reload preferences to ensure they're running latest settings ShowInTaskbar = AppSettings.perfShowInTaskbar; tempoTrackerNotifyIcon.Visible = AppSettings.notifyShow; // If idle timeout is set, jump out, otherwise disable the idle timer if (AppSettings.perfIdleTimeout) return; idleTimer.Enabled = false; idleTimer.Stop(); }
private void optionsButton_Click(object sender, EventArgs e) { var optionsForm = new OptionsForm(); if (optionsForm.ShowDialog(this) == DialogResult.OK) { ReadPreferences(); } }