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;
        }
Example #2
0
        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();
        }
Example #3
0
        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);
            }
        }
Example #4
0
 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);
 }
Example #5
0
        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);
        }
Example #6
0
        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();
            }
        }
Example #7
0
 private void On_timebox_started(object sender, EventArgs e)
 {
     SetControlPropertyThreadSafe(txtTaskStatus, "Text", "Running");
     SetMenuStatusStarted();
     var settings = new Settings();
     if (settings.PreferencesPlayTick)
     {
         _player.PlayLooping();
     }
 }
 public UserPreferencesController(UserPreferencesView userPreferences)
 {
     _settings = new Settings();
 }
 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());
 }