示例#1
0
        private void MainForm_Shown(object sender, EventArgs e)
        {
            if (this.settings.FirstRun)
            {
                this.settings.FirstRun = false;

                EditSettings();
                JiraLogin();
            }
            else
            {
                if (IsJiraEnabled)
                    AuthenticateJira(this.settings.Username, this.settings.Password);
            }

            InitializeIssueControls();

            // Add issuekeys from settings to issueControl controls
            int i = 0;
            foreach (var issueControl in this.issueControls)
            {
                if (i < settings.PersistedIssues.Count)
                {
                    var persistedIssue = settings.PersistedIssues[i];
                    issueControl.IssueKey = persistedIssue.Key;

                    if (this.settings.SaveTimerState != SaveTimerSetting.NoSave)
                    {
                        TimerState timerState = new TimerState
                        {
                            Running = this.settings.SaveTimerState == SaveTimerSetting.SavePause ? false : persistedIssue.TimerRunning,
                            StartTime = persistedIssue.StartTime,
                            TotalTime = persistedIssue.TotalTime
                        };
                        issueControl.WatchTimer.SetState(timerState);
                        issueControl.Comment = persistedIssue.Comment;
                    }
                }
                i++;
            }

            ticker.Start();
        }
示例#2
0
 public void SetState(TimerState state)
 {
     this.Running = state.Running;
     this.totalTime = state.TotalTime;
     this.startTime = state.StartTime;
 }
示例#3
0
 public void SetState(TimerState state)
 {
     this.Running   = state.Running;
     this.totalTime = state.TotalTime;
     this.startTime = state.StartTime;
 }
示例#4
0
        private void MainForm_Shown(object sender, EventArgs e)
        {
            if (this.settings.FirstRun)
            {
                this.settings.FirstRun = false;

                EditSettings();
                JiraLogin();
            }
            else
            {
                if (IsJiraEnabled)
                    AuthenticateJira(this.settings.Username, this.settings.Password);
            }

            InitializeIssueControls();

            // Add issuekeys from settings to issueControl controls
            int i = 0;
            foreach (var issueControl in this.issueControls)
            {
                if (i < this.issues.Count)
                {
                    string[] issueState = this.issues[i].Split(';');
                    issueControl.IssueKey = issueState[0];

                    if (this.settings.SaveTimerState != SaveTimerSetting.NoSave)
                    {
                        TimerState timerState = new TimerState
                        {
                            Running = this.settings.SaveTimerState == SaveTimerSetting.SavePause ? false : bool.Parse(issueState[1]),
                            StartTime = DateTime.Parse(issueState[2]),
                            TotalTime = TimeSpan.Parse(issueState[3])
                        };
                        issueControl.WatchTimer.SetState(timerState);
                    }
                }
                i++;
            }

            ticker.Start();
        }
示例#5
0
        private void MainForm_Shown(object sender, EventArgs e)
        {
            if (this.settings.FirstRun)
            {
                this.settings.FirstRun = false;
                EditSettings();
            }
            else
            {
                if (IsJiraEnabled)
                {
                    AuthenticateJira(this.settings.Username, this.settings.PrivateApiToken);
                }
            }

            while (this.tabControl.TabCount <= this.settings.IssueCounts.Count())
            {
                int    lastIndex = this.tabControl.TabCount - 1;
                string tabName   = this.settings.TabNames.ContainsKey(lastIndex) ? this.settings.TabNames[lastIndex] : "New tab";

                this.tabControl.TabPages.Insert(lastIndex, tabName);
                this.tabControl.TabPages[lastIndex].BackColor   = Theme.WindowBackground;
                this.tabControl.TabPages[lastIndex].BorderStyle = BorderStyle.None;
                Panel panel = this.GetPanel(lastIndex);
                this.tabControl.TabPages[lastIndex].Controls.Add(panel);
            }

            for (int tab = 0; tab < this.settings.IssueCounts.Count; tab++)
            {
                this.tabControl.SelectedIndex    = tab;
                this.tabControl.SelectedTab.Text = this.settings.TabNames.ContainsKey(tab) ? this.settings.TabNames[tab] : "New tab";
                InitializeIssueControls();

                // Add issuekeys from settings to issueControl controls
                int i = 0;
                foreach (var issueControl in this.issueControls)
                {
                    if (settings.PersistedIssues.ContainsKey(tab) && i < settings.PersistedIssues[tab].Count)
                    {
                        var persistedIssue = settings.PersistedIssues[tab][i];
                        issueControl.IssueKey = persistedIssue.Key;

                        if (this.settings.SaveTimerState != SaveTimerSetting.NoSave)
                        {
                            TimerState timerState = new TimerState
                            {
                                Running          = this.settings.SaveTimerState == SaveTimerSetting.SavePause ? false : persistedIssue.TimerRunning,
                                SessionStartTime = persistedIssue.SessionStartTime,
                                InitialStartTime = persistedIssue.InitialStartTime,
                                TotalTime        = persistedIssue.TotalTime
                            };
                            issueControl.WatchTimer.SetState(timerState);
                            issueControl.Comment = persistedIssue.Comment;
                            issueControl.EstimateUpdateMethod = persistedIssue.EstimateUpdateMethod;
                            issueControl.EstimateUpdateValue  = persistedIssue.EstimateUpdateValue;
                        }
                    }
                    i++;
                }
            }
            this.tabControl.SelectedIndex = 0;
            TotalTimeLogged = settings.TotalTimeLogged;

            UpdateTotalTimeLogged(new TimeSpan());

            ticker.Start();
        }