Skip to content

Instantly share code, notes, and snippets.

@SamedBll
Created September 19, 2017 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SamedBll/bcdca05be069a57496b8332241673507 to your computer and use it in GitHub Desktop.
Save SamedBll/bcdca05be069a57496b8332241673507 to your computer and use it in GitHub Desktop.
B(C) - 24
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using Xamarin.Forms;
namespace Clock
{
public class FitClock : ContentPage
{
public FitClock()
{
Label clocklabel = new Label
{
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
};
Content = clocklabel;
SizeChanged += (object sender, EventArgs args) =>
{
if (this.Width > 0)
{
clocklabel.FontSize = this.Width / 6;
}
};
Device.StartTimer(TimeSpan.FromSeconds(1), () =>
{
clocklabel.Text = DateTime.Now.ToString("h:mm:ss tt");
return true;
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment