FrameTimerX 1.0.1

FrameTimerX is a cross-platform Timer that runs inside a Xamarin Forms Frame.

Install-Package FrameTimerX -Version 1.0.1
dotnet add package FrameTimerX --version 1.0.1
<PackageReference Include="FrameTimerX" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FrameTimerX --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

FrameTimerX v1.0.1

Author: Marcos Lapa dos Santos

A cross-platform Timer that runs inside a Xamarin.Forms.Frame

Features:

  • AutoStart Timer
  • CountDown/CountUp
  • TimerTypes: "hh:mm:ss" | "mm:ss" | IntergerCounter
  • Visual Warning (Frame BackgroundColor Changing)
  • Negative Numbers (Auto Stop on zero by default)

Configuration:

  1. Add the component to your xaml page:
    <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"             
             ...             
             xmlns:frt="clr-namespace:FrameTimerX;assembly=FrameTimerX"             
             ...             
             x:Class="YourProject.MainPage">
  1. Creating a simple FrameTimerX (Default Type = "hh:mm:ss"; AutoStart = true)
    <frt:FrameTimer IsAutoStarted="True" />

Examples

  1. Configuring the FrameTimerX for a Integer CountDown, TickVelocity = 500 miliseconds
    <frt:FrameTimer BackgroundColor="LightBlue" 
          StartingCounter="50" TickVelocity="500"            
          IsCountDown="True" IsAutoStarted="True"
          TimerType="IntegerCounter" />
  1. Starting manually a FrameTimerX in a button click
  • On Xaml file:
        <frt:FrameTimer x:Name="frtManual" BackgroundColor="LightGreen" 
                        StartingMinute="1" StartingSecond="0" IsCountDown="True" TimerType="MinuteSecond" 
                        HorizontalOptions="Center" VerticalOptions="Center" />
        <Button Text="Start" Clicked="Button_Clicked"/>
  • On .cs file:
    private void Button_Clicked(object sender, EventArgs e){
      frtManual.Start();
    }
    
  1. Creating a FrameTimerX with alternate background color on Warning
        <frt:FrameTimer AllowNegativeValues="True" BackgroundColor="LightCoral" WarningColor="Orange"                       
                        StartingCounter="30" TickVelocity="500" EnableWarning="True" ClockFontNegaviteTextColor="DarkBlue"
                        IsCountDown="True" IsAutoStarted="True" TimerType="IntegerCounter" 
                        StartWarningCount="10" HorizontalOptions="Center" VerticalOptions="Center" />

Handling Events

FrameTimerX has the Started, Stopped, Resumed and WarningStarted events to handle. We can use the CodeBehind or MVVM (Command) aproach.

CodeBehind sample

Handling the Stopped event

XAML File

        <frt:FrameTimer StartingCounter="0" TickVelocity="500" Stopped="FrtTimer_Stopped"
                        IsAutoStarted="True" TimerType="IntegerCounter" />

CS File

        private void FrtTimer_Stopped(object sender, FrameTimerEventArgs args)
        {
            Debug.WriteLine("=======================================================");
            Debug.WriteLine("========== Simple Stopped Event raised!!!!! ===========");
            Debug.WriteLine($"  ==> Counter:{args.Counter}");
            Debug.WriteLine($"  ==> Hour:{args.Hour}");
            Debug.WriteLine($"  ==> Minute:{args.Minute}");
            Debug.WriteLine($"  ==> Second:{args.Second}");
            Debug.WriteLine("=======================================================");
        }

MVVM (Bindable Command) sample

Handling the WarningStarted event

XAML File (Remember to link your ViewModel to the Page Context before...)

        <frt:FrameTimer StartingCounter="90" TickVelocity="1000" TimerType="IntegerCounter"
                        EnableWarning="True" StartWarningTime="30"
                        WarningColor="Orange" IsCountDown="True" 
                        OnStartWarning="{Binding StartWarningCommmand} />

CS File => ViewModel

        // Constructor
        public MyViewModel(){
            StartWarningCommmand = new Command(StartWarning);
        }
        
        public Command StartWarningCommmand { get; }

        public void StartWarning()
        {
            Debug.WriteLine("########### Warning Started! ###########");
        }

Known Issues

  • FIXED on v1.0.1: Don't try to start a FrameTimerX on your page's constructor or OnAppearing event, use the AutoStart property instead.
  • We can't put any componente inside the FrameTimer, because it'll became a simple Frame.
    For example, if we do something like this:
        <frt:FrameTimer IsAutoStarted="True" BorderColor="Black">
           <StackLayout>
               <Label Text="Test"></Label>
           </StackLayout>
       </frt:FrameTimer>

We'll get a simple Frame with a Label "Test" inside a StackLayout...

FrameTimerX v1.0.1

Author: Marcos Lapa dos Santos

A cross-platform Timer that runs inside a Xamarin.Forms.Frame

Features:

  • AutoStart Timer
  • CountDown/CountUp
  • TimerTypes: "hh:mm:ss" | "mm:ss" | IntergerCounter
  • Visual Warning (Frame BackgroundColor Changing)
  • Negative Numbers (Auto Stop on zero by default)

Configuration:

  1. Add the component to your xaml page:
    <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"             
             ...             
             xmlns:frt="clr-namespace:FrameTimerX;assembly=FrameTimerX"             
             ...             
             x:Class="YourProject.MainPage">
  1. Creating a simple FrameTimerX (Default Type = "hh:mm:ss"; AutoStart = true)
    <frt:FrameTimer IsAutoStarted="True" />

Examples

  1. Configuring the FrameTimerX for a Integer CountDown, TickVelocity = 500 miliseconds
    <frt:FrameTimer BackgroundColor="LightBlue" 
          StartingCounter="50" TickVelocity="500"            
          IsCountDown="True" IsAutoStarted="True"
          TimerType="IntegerCounter" />
  1. Starting manually a FrameTimerX in a button click
  • On Xaml file:
        <frt:FrameTimer x:Name="frtManual" BackgroundColor="LightGreen" 
                        StartingMinute="1" StartingSecond="0" IsCountDown="True" TimerType="MinuteSecond" 
                        HorizontalOptions="Center" VerticalOptions="Center" />
        <Button Text="Start" Clicked="Button_Clicked"/>
  • On .cs file:
    private void Button_Clicked(object sender, EventArgs e){
      frtManual.Start();
    }
    
  1. Creating a FrameTimerX with alternate background color on Warning
        <frt:FrameTimer AllowNegativeValues="True" BackgroundColor="LightCoral" WarningColor="Orange"                       
                        StartingCounter="30" TickVelocity="500" EnableWarning="True" ClockFontNegaviteTextColor="DarkBlue"
                        IsCountDown="True" IsAutoStarted="True" TimerType="IntegerCounter" 
                        StartWarningCount="10" HorizontalOptions="Center" VerticalOptions="Center" />

Handling Events

FrameTimerX has the Started, Stopped, Resumed and WarningStarted events to handle. We can use the CodeBehind or MVVM (Command) aproach.

CodeBehind sample

Handling the Stopped event

XAML File

        <frt:FrameTimer StartingCounter="0" TickVelocity="500" Stopped="FrtTimer_Stopped"
                        IsAutoStarted="True" TimerType="IntegerCounter" />

CS File

        private void FrtTimer_Stopped(object sender, FrameTimerEventArgs args)
        {
            Debug.WriteLine("=======================================================");
            Debug.WriteLine("========== Simple Stopped Event raised!!!!! ===========");
            Debug.WriteLine($"  ==> Counter:{args.Counter}");
            Debug.WriteLine($"  ==> Hour:{args.Hour}");
            Debug.WriteLine($"  ==> Minute:{args.Minute}");
            Debug.WriteLine($"  ==> Second:{args.Second}");
            Debug.WriteLine("=======================================================");
        }

MVVM (Bindable Command) sample

Handling the WarningStarted event

XAML File (Remember to link your ViewModel to the Page Context before...)

        <frt:FrameTimer StartingCounter="90" TickVelocity="1000" TimerType="IntegerCounter"
                        EnableWarning="True" StartWarningTime="30"
                        WarningColor="Orange" IsCountDown="True" 
                        OnStartWarning="{Binding StartWarningCommmand} />

CS File => ViewModel

        // Constructor
        public MyViewModel(){
            StartWarningCommmand = new Command(StartWarning);
        }
        
        public Command StartWarningCommmand { get; }

        public void StartWarning()
        {
            Debug.WriteLine("########### Warning Started! ###########");
        }

Known Issues

  • FIXED on v1.0.1: Don't try to start a FrameTimerX on your page's constructor or OnAppearing event, use the AutoStart property instead.
  • We can't put any componente inside the FrameTimer, because it'll became a simple Frame.
    For example, if we do something like this:
        <frt:FrameTimer IsAutoStarted="True" BorderColor="Black">
           <StackLayout>
               <Label Text="Test"></Label>
           </StackLayout>
       </frt:FrameTimer>

We'll get a simple Frame with a Label "Test" inside a StackLayout...

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.1 70 11/22/2019
1.0.0 78 10/30/2019