public SettingsForm(Settings settings) { this.settings = settings; InitializeComponent(); // Mono for MacOSX and Linux do not implement the notifyIcon // so ignore this feature if we are not running on Windows cbMinimizeToTray.Visible = CrossPlatformHelpers.IsWindowsEnvironment(); tbJiraBaseUrl.Text = this.settings.JiraBaseUrl; tbUsername.Text = settings.Username; tbApiToken.Text = settings.ApiToken; cbAlwaysOnTop.Checked = this.settings.AlwaysOnTop; cbMinimizeToTray.Checked = this.settings.MinimizeToTray; cbAllowMultipleTimers.Checked = this.settings.AllowMultipleTimers; cbIncludeProjectName.Checked = this.settings.IncludeProjectName; cbSaveTimerState.DisplayMember = "Text"; cbSaveTimerState.ValueMember = "Value"; cbSaveTimerState.DataSource = new[] { new { Text = "Reset all timers on exit", Value = SaveTimerSetting.NoSave }, new { Text = "Save current timetracking, pause active timer", Value = SaveTimerSetting.SavePause }, new { Text = "Save current timetracking, active timer continues", Value = SaveTimerSetting.SaveRunActive } }; cbSaveTimerState.SelectedValue = this.settings.SaveTimerState; cbPauseOnSessionLock.DisplayMember = "Text"; cbPauseOnSessionLock.ValueMember = "Value"; cbPauseOnSessionLock.DataSource = new[] { new { Text = "No pause", Value = PauseAndResumeSetting.NoPause }, new { Text = "Pause active timer", Value = PauseAndResumeSetting.Pause }, new { Text = "Pause and resume on unlock", Value = PauseAndResumeSetting.PauseAndResume } }; cbPauseOnSessionLock.SelectedValue = this.settings.PauseOnSessionLock; cbPostWorklogComment.DisplayMember = "Text"; cbPostWorklogComment.ValueMember = "Value"; cbPostWorklogComment.DataSource = new[] { new { Text = "Post only as part of worklog", Value = WorklogCommentSetting.WorklogOnly }, new { Text = "Post only as a comment", Value = WorklogCommentSetting.CommentOnly }, new { Text = "Post as both worklog and comment", Value = WorklogCommentSetting.WorklogAndComment } }; cbPostWorklogComment.SelectedValue = this.settings.PostWorklogComment; tbStartTransitions.Text = this.settings.StartTransitions; cbLoggingEnabbled.Checked = this.settings.LoggingEnabled; cbCheckForUpdate.Checked = settings.CheckForUpdate; }
private void MainForm_Resize(object sender, EventArgs e) { // Mono for MacOSX and Linux do not implement the notifyIcon // so ignore this feature if we are not running on Windows if (!CrossPlatformHelpers.IsWindowsEnvironment()) { return; } if (this.settings.MinimizeToTray && WindowState == FormWindowState.Minimized) { this.notifyIcon.Visible = true; this.Hide(); } else if (WindowState == FormWindowState.Normal) { this.notifyIcon.Visible = false; } }
public SettingsForm(Settings settings) { this.settings = settings; InitializeComponent(); // Mono for MacOSX and Linux do not implement the notifyIcon // so ignore this feature if we are not running on Windows cbMinimizeToTray.Visible = CrossPlatformHelpers.IsWindowsEnvironment(); tbJiraBaseUrl.Text = this.settings.JiraBaseUrl; numIssueCount.Value = this.settings.IssueCount; cbAlwaysOnTop.Checked = this.settings.AlwaysOnTop; cbMinimizeToTray.Checked = this.settings.MinimizeToTray; cbTimerEditable.Checked = this.settings.TimerEditable; cbAllowMultipleTimers.Checked = this.settings.AllowMultipleTimers; cbSaveTimerState.DisplayMember = "Text"; cbSaveTimerState.ValueMember = "Value"; cbSaveTimerState.DataSource = new[] { new { Text = "Reset all timers on exit", Value = SaveTimerSetting.NoSave }, new { Text = "Save current timetracking, pause active timer", Value = SaveTimerSetting.SavePause }, new { Text = "Save current timetracking, active timer continues", Value = SaveTimerSetting.SaveRunActive } }; cbSaveTimerState.SelectedValue = this.settings.SaveTimerState; cbPauseOnSessionLock.DisplayMember = "Text"; cbPauseOnSessionLock.ValueMember = "Value"; cbPauseOnSessionLock.DataSource = new[] { new { Text = "No pause", Value = PauseAndResumeSetting.NoPause }, new { Text = "Pause active timer", Value = PauseAndResumeSetting.Pause }, new { Text = "Pause and resume on unlock", Value = PauseAndResumeSetting.PauseAndResume } }; cbPauseOnSessionLock.SelectedValue = this.settings.PauseOnSessionLock; }