Created
September 19, 2017 16:20
-
-
Save SamedBll/bcdca05be069a57496b8332241673507 to your computer and use it in GitHub Desktop.
B(C) - 24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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