Exemplo n.º 1
0
        void HandlePauseTimerCommand(object unused)
        {
            if (!IsTimerRunning)
            {
                return;
            }

            ProgressBar.CancelWidthToAnimation();             //abort animation
        }
Exemplo n.º 2
0
        void TimerView_SizeChanged(object sender, EventArgs e)
        {
            if (Width == 0 || Height == 0)
            {
                return;
            }

            if (TrackBar == null || ProgressBar == null)
            {
                return;
            }

            if (Children.Count == 0)
            {
                //ensure track-bar gets full width and height as parent
                AddTrackBar();

                //ensure progress-bar gets full height, but width can be changed
                AddProgressBar();

                //if timer-label available, ensure it gets full width and height
                if (TimerLabel != null)
                {
                    AddTimerLabel();
                    TimerLabel.SetBinding(BindingContextProperty, new Binding(nameof(RemainingTime), source: this));
                }

                if (AutoStart)
                {
                    StartTimerCommand.Execute(Time);
                }
            }
            else
            {
                if (IsTimerRunning)
                {
                    //if timer runnnig already - restart animation
                    ProgressBar.CancelWidthToAnimation();
                    StartTimerCommand.Execute(null);                     //Use remaining time
                }
                else
                {
                    SetProgressBarWidth();
                }
            }
        }
Exemplo n.º 3
0
 void ResetTimer()
 {
     ProgressBar.CancelWidthToAnimation();
     RemainingTime = default(TimeSpan); //reset timer
     SetProgressBarWidth();             //reset width
 }