void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.window = ((Time_Owner.WindowRest)(target));
                return;

            case 2:
                this.imgBackground = ((System.Windows.Controls.Image)(target));
                return;

            case 3:

            #line 23 "..\..\WindowRest.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.BtnClose);

            #line default
            #line hidden
                return;

            case 4:
                this.textTimer = ((System.Windows.Controls.TextBlock)(target));
                return;
            }
            this._contentLoaded = true;
        }
예제 #2
0
        /// <summary>
        /// It's only for the Pomodoro mode
        /// </summary>
        private void ChangeTimerStage()
        {
            switch (timerStage)
            {
            case TimerStage.Work:
                receivedTomato++;
                currentTask.DataTask.Tomatoes++;
                // Adding exp to profile
                Profile.data.AddExperience((int)wholeTimer.TotalMinutes);

                UpdateTotalTime();
                dataChanged = true;

                bool isLongBreak = false;

                // If hasn't passed 4 tomatoes then do a simple break, else do a long break
                if (receivedTomato % 4 != 0)
                {
                    wholeTimer = new TimeSpan(0, GlobalSettings.dataSettings.TimeOfBreak, 0);
                }
                else
                {
                    wholeTimer  = new TimeSpan(0, GlobalSettings.dataSettings.TimeOfLongBreak, 0);
                    isLongBreak = true;
                }

                timerStage = TimerStage.Break;

                currentTask.DataTask.TotalTime =
                    currentTask.DataTask.TotalTime.Add
                        (new TimeSpan(0, GlobalSettings.dataSettings.TimeOfWork, 0));

                UpdateTotalTime();
                TaskbarItemInfo.ProgressState = System.Windows.Shell.TaskbarItemProgressState.Paused;

                Save();

                // If the window of rest is enable than open it
                if (GlobalSettings.dataSettings.EnableWindowBreak)
                {
                    windowRest           = new WindowRest();
                    windowRest.PathImage = !isLongBreak ? GlobalSettings.dataSettings.PathImgBreakTime :
                                           GlobalSettings.dataSettings.PathImgLongBreakTime;

                    windowRest.Show();

                    if (progressBar != null)
                    {
                        progressBar.Activate();
                    }
                }
                break;

            case TimerStage.Break:
                wholeTimer = new TimeSpan(0, GlobalSettings.dataSettings.TimeOfWork, 0);
                timerStage = TimerStage.Work;
                TaskbarItemInfo.ProgressState = System.Windows.Shell.TaskbarItemProgressState.Normal;

                if (windowRest != null)
                {
                    windowRest.Close(); windowRest = null;
                }
                break;
            }
            timerTime = wholeTimer;
            ShowNotifyMessage(timerStage.ToCapsString(), 10);
            UpdateTimerInfo();
        }