SetState() 공개 메소드

public SetState ( TimerState state ) : void
state TimerState
리턴 void
예제 #1
0
        private void tbTime_TextChanged(object sender, EventArgs e)
        {
            // Ignore if programatically changing value (from timer)
            if (ignoreTextChange)
            {
                return;
            }

            TimeSpan time = JiraHelpers.JiraTimeToTimeSpan(tbTime.Text);

            if (time.TotalMilliseconds == 0)
            {
                return;
            }

            TimerState state = WatchTimer.GetState();

            state.TotalTime = time;
            state.StartTime = DateTime.Now;
            WatchTimer.SetState(state);
        }
예제 #2
0
        public MainForm()
        {
            settings = Settings.Instance;
            if (!settings.Load())
            {
                MessageBox.Show(string.Format("An error occurred while loading settings for Jira StopWatch. Your configuration file has most likely become corrupted.{0}{0}And older configuration file has been loaded instead, so please verify your settings.", Environment.NewLine), "Jira StopWatch");
            }

            Logger.Instance.LogfilePath = Path.Combine(Application.UserAppDataPath, "jirastopwatch.log");
            Logger.Instance.Enabled     = settings.LoggingEnabled;

            restRequestFactory    = new RestRequestFactory();
            jiraApiRequestFactory = new JiraApiRequestFactory(restRequestFactory);

            restClientFactory         = new RestClientFactory();
            restClientFactory.BaseUrl = this.settings.JiraBaseUrl;

            jiraApiRequester = new JiraApiRequester(restClientFactory, jiraApiRequestFactory);

            jiraClient = new JiraClient(jiraApiRequestFactory, jiraApiRequester);

            InitializeComponent();

            pMain.HorizontalScroll.Maximum = 0;
            pMain.AutoScroll             = false;
            pMain.VerticalScroll.Visible = false;
            pMain.AutoScroll             = true;

            Text = string.Format("{0} {1}", Application.ProductName, Application.ProductVersion);

            cbFilters.DropDownStyle = ComboBoxStyle.DropDownList;
            cbFilters.DisplayMember = "Name";

            ticker = new Timer();
            // First run should be almost immediately after start
            ticker.Interval = firstDelay;
            ticker.Tick    += ticker_Tick;

            idleTicker          = new Timer();
            idleTicker.Interval = idleCheckInterval;
            idleTicker.Tick    += idle_Tick;

            runningTicker          = new Timer();
            runningTicker.Interval = runningCheckInterval;
            runningTicker.Tick    += running_Tick;

            backupTicker          = new Timer();
            backupTicker.Interval = backupCheckInterval;
            backupTicker.Tick    += backup_Tick;

            backupTimer = new WatchTimer();

            // load backup timer state
            TimerState backupTimerState = new TimerState
            {
                TotalTime = settings.BackupTimer
            };

            backupTimer.SetState(backupTimerState);

            UpdateBackupTime();
        }