private void buttonSave_Click(object sender, EventArgs e)
        {
            ulong port = 0;
            if (!ulong.TryParse(textBoxProxyPort.Text, out port))
            {
                port = 0;
            }

            Toggl.Settings settings = new Toggl.Settings();

            settings.UseProxy = checkBoxUseProxy.Checked;
            settings.ProxyPort = port;
            settings.ProxyHost = textBoxProxyHost.Text;
            settings.ProxyUsername = textBoxProxyUsername.Text;
            settings.ProxyPassword = textBoxProxyPassword.Text;

            settings.UseIdleDetection = checkBoxIdleDetection.Checked;
            settings.OnTop = checkBoxOnTop.Checked;
            settings.Reminder = checkBoxRemindToTrackTime.Checked;

            settings.MenubarTimer = true;
            settings.DockIcon = true;

            settings.RecordTimeline = checkBoxRecordTimeline.Checked;

            if (!Toggl.SetSettings(settings))
            {
                return;
            }

            Close();
        }
        private void buttonSave_Click(object sender, EventArgs e)
        {
            ulong port = 0;
            if (!ulong.TryParse(textBoxProxyPort.Text, out port))
            {
            port = 0;
            }

            ulong idleMinutes = 0;
            ulong.TryParse(textBoxIdleMinutes.Text, out idleMinutes);

            ulong reminderMinutes = 0;
            ulong.TryParse(textBoxReminderMinutes.Text, out reminderMinutes);

            Toggl.Settings settings = new Toggl.Settings();

            settings.AutodetectProxy = checkBoxUseSystemProxySettings.Checked;

            settings.UseProxy = checkBoxUseProxy.Checked;
            settings.ProxyPort = port;
            settings.ProxyHost = textBoxProxyHost.Text;
            settings.ProxyUsername = textBoxProxyUsername.Text;
            settings.ProxyPassword = textBoxProxyPassword.Text;

            settings.OnTop = checkBoxOnTop.Checked;

            settings.Reminder = checkBoxRemindToTrackTime.Checked;
            settings.ReminderMinutes = reminderMinutes;

            settings.UseIdleDetection = checkBoxIdleDetection.Checked;
            settings.IdleMinutes = idleMinutes;

            settings.MenubarTimer = true;
            settings.DockIcon = true;

            settings.RecordTimeline = checkBoxRecordTimeline.Checked;

            // Save shortcut keys

            if (btnRecordShowHideShortcut.Tag != null)
            {
            Utils.SetShortcutForShow((KeyEventArgs)btnRecordShowHideShortcut.Tag);
            }
            if (btnClearShowHideShortcut.Tag != null)
            {
            Utils.SetShortcutForShow(null);
            }

            if (btnRecordStartStopShortcut.Tag != null)
            {
            Utils.SetShortcutForStart((KeyEventArgs)btnRecordStartStopShortcut.Tag);
            }
            if (btnClearStartStopTimer.Tag != null)
            {
            Utils.SetShortcutForStart(null);
            }

            if (!Toggl.SetSettings(settings))
            {
            return;
            }

            Close();
        }