コード例 #1
0
        private void UserPreferences_Load(object sender, EventArgs e)
        {
            var settings = new Settings();
            numericSessionLength.Value = settings.SessionLength;
            numericBreakLength.Value = settings.BreakLength;
            checkSessionAlarm.Checked = settings.PlaySessionAlarm;
            checkClockTick.Checked = settings.PreferencesPlayTick;

            _controller.EnableSave += CanSave;
        }
コード例 #2
0
ファイル: IntelliForm.cs プロジェクト: garfieldmoore/Timebox
        protected void IntelliForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            var settings = new Settings();

            try
            {
                settings[_localWinTop] = Top;
                settings[_localWinLeft] = Left;
            }
            catch (Exception exception)
            {
                Trace.WriteLine(exception);
            }
            settings.Save();
        }
コード例 #3
0
ファイル: IntelliForm.cs プロジェクト: garfieldmoore/Timebox
        private void IntelliWindows_Load(object sender, EventArgs e)
        {
            _localWinTop = string.Format("{0}_{1}", WindowTop, this.Name);
            _localWinLeft = string.Format("{0}_{1}", Windowleft, this.Name);
            var settings = new Settings();

            try
            {
               Top = Convert.ToInt32(settings[_localWinTop]);
               Left = Convert.ToInt32(settings[_localWinLeft]);
            }
            catch (Exception exception)
            {
                Trace.WriteLine(exception);
            }
        }
コード例 #4
0
ファイル: TimeBoxView.cs プロジェクト: garfieldmoore/Timebox
 private void Form1_Load(object sender, EventArgs e)
 {
     Text = Application.ProductName;
     Icon = GetEmbeddedResource("Pomodoro.Images.Pomodoro32x32.ico");
     txtCurrentTask.Text = string.Empty;
     txtTaskStatus.Text = string.Empty;
     SetMenuStatusCanStart();
     var settings = new Settings();
     var soundfile = settings.PreferencesSoundTickFile;
     _player = new SoundPlayer(soundfile);
 }
コード例 #5
0
ファイル: TimeBoxView.cs プロジェクト: garfieldmoore/Timebox
        private void StartTask(string taskName)
        {
            var settings = new Settings();
            int sessionLength;

            if (_state == TimeBoxState.Task)
                sessionLength = settings.SessionLength;
            else
            {
                sessionLength = settings.BreakLength;
            }

            _controller.Start(taskName, new TimeSpan(0, 0, sessionLength, 0));
            SetControlPropertyThreadSafe(txtCurrentTask, "Text", taskName);
        }
コード例 #6
0
ファイル: TimeBoxView.cs プロジェクト: garfieldmoore/Timebox
        private void On_timeout_expiry(object sender, EventArgs e)
        {
            var settings = new Settings();
            if (null != _player)
            {
                _player.Stop();
            }

            if (settings.PlaySessionAlarm)
            {
                string soundLocation = settings.SessionsAlarmFile;
                _sessionAlarm = new SoundPlayer(soundLocation);
                _sessionAlarm.Play();
            }

            SetControlPropertyThreadSafe(txtTaskStatus, "Text", "break");
            this.BeginInvoke(new MethodInvoker(SetMenuStatusBreak));
            Thread.Sleep(2000);

            if (_sessionAlarm != null)
                _sessionAlarm.Stop();

            if (_state == TimeBoxState.Task)
            {
                _state = TimeBoxState.Break;
                StartTask("Taking a break");
            }
            else
            {
                MethodInvoker m = SetMenuStatusCanStart;
                m.Invoke();
            }
        }
コード例 #7
0
ファイル: TimeBoxView.cs プロジェクト: garfieldmoore/Timebox
 private void On_timebox_started(object sender, EventArgs e)
 {
     SetControlPropertyThreadSafe(txtTaskStatus, "Text", "Running");
     SetMenuStatusStarted();
     var settings = new Settings();
     if (settings.PreferencesPlayTick)
     {
         _player.PlayLooping();
     }
 }
コード例 #8
0
 public UserPreferencesController(UserPreferencesView userPreferences)
 {
     _settings = new Settings();
 }
コード例 #9
0
 public void Start(string name, TimeSpan timeout)
 {
     var task = new Task(name);
     _timeBox = new TimeBox(task, timeout);
     _timeBox.TimeoutExpired += On_task_timeout;
     _timeBox.TickUpdated += On_tick_updated;
     var settings = new Settings();
     _timeBox.Start();
     if (null != TimeBoxStarted)
         TimeBoxStarted(this, new EventArgs());
 }