public TimerHandler(StopWatch stopWatchP, TimerPageStopWatch timerPageStopWatchP, Bitmap.BitmapCountDown bitmapCountDownP)
        {
            totalTime  = stopWatchP;
            phaseTime  = timerPageStopWatchP;
            bitmapTime = bitmapCountDownP;

            totalTimeThread  = new Thread(totalTime.Start);
            bitmapTimeThread = new Thread(bitmapTime.Start);
            phaseTimeThread  = new Thread(phaseTime.Start);
        }
Beispiel #2
0
        private void StartButtonClicked(object sender, EventArgs args)
        {
            // Remove previous content
            mainG.Children.Remove(startbutton);

            // Add new content
            // List: Get Ready, Start, Rep Break, Set Break or Final Break

            Grid getReadyG = new Grid
            {
                Padding         = new Thickness(0),
                Margin          = new Thickness(0),
                BackgroundColor = mainColor,
                RowDefinitions  =
                {
                    // 5 Rows
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    }
                },
                RowSpacing    = 0,
                ColumnSpacing = 0,
            };

            // Total time calculations
            int getReadyAndStart = StaticFiles.TimerPageUISettings.reps * StaticFiles.TimerPageUISettings.sets * (StaticFiles.TimerPageUISettings.getReadyTime + StaticFiles.TimerPageUISettings.startTime);
            int breakReps        = StaticFiles.TimerPageUISettings.reps * (StaticFiles.TimerPageUISettings.reps - 1);
            int breakSets        = StaticFiles.TimerPageUISettings.sets - 1;
            int totalTime        = getReadyAndStart + (breakReps * StaticFiles.TimerPageUISettings.repsRestTime) + (breakSets * StaticFiles.TimerPageUISettings.setsRestTime);

            getReadyG.Children.Add(getReadyL, 0, 0);
            getReadyG.Children.Add(timerL, 0, 1);
            Grid.SetColumnSpan(getReadyL, 2);
            Grid.SetColumnSpan(timerL, 2);

            bitmapView = new Bitmap.BitmapCountDown();
            getReadyG.Children.Add(bitmapView, 0, 2);
            Grid.SetColumnSpan(bitmapView, 2);

            //Add buttons for Stop / Reset
            getReadyG.Children.Add(stopButton, 0, 3);
            getReadyG.Children.Add(resetButton, 1, 3);

            mainG.Children.Add(getReadyG, 0, 4);
            Grid.SetColumnSpan(getReadyG, 4);

            totalTimeTimer = new StopWatch(timerNumL, StopWatch.CountDirection.COUNTDOWN, totalTime);
            countDownTimer = new TimerPageStopWatch(timerL, getReadyL);
            timerHandler   = new Timer.TimerHandler(totalTimeTimer, countDownTimer, bitmapView);
            timerHandler.Start();
        }