66 lines
1.8 KiB
C#
66 lines
1.8 KiB
C#
using System;
|
|
using Tizen.Applications;
|
|
using Tizen.System;
|
|
using Tizen.Wearable.CircularUI.Forms.Renderer.Watchface;
|
|
|
|
namespace TizenWatchfaceApp1
|
|
{
|
|
class Program : FormsWatchface
|
|
{
|
|
protected WatchFaceApplication mainApplication = null;
|
|
|
|
protected override void OnCreate()
|
|
{
|
|
base.OnCreate();
|
|
|
|
mainApplication = new WatchFaceApplication();
|
|
mainApplication.ViewModel.Battery = Battery.Percent;
|
|
mainApplication.ViewModel.Time = DateTime.Now;
|
|
|
|
Battery.ChargingStateChanged += battery_ChargingStateChanged;
|
|
|
|
LoadWatchface(mainApplication);
|
|
}
|
|
|
|
protected override void OnTick(TimeEventArgs time)
|
|
{
|
|
base.OnTick(time);
|
|
|
|
if (mainApplication != null)
|
|
{
|
|
mainApplication.ViewModel.Time = new DateTime(time.Time.Year, time.Time.Month, time.Time.Day, time.Time.Hour24, time.Time.Minute, time.Time.Second, time.Time.Millisecond);
|
|
}
|
|
}
|
|
|
|
protected void battery_ChargingStateChanged(object sender, BatteryChargingStateChangedEventArgs e)
|
|
{
|
|
if (mainApplication != null)
|
|
{
|
|
mainApplication.ViewModel.Battery = Battery.Percent;
|
|
}
|
|
}
|
|
|
|
|
|
//protected override void OnAmbientChanged(AmbientEventArgs mode)
|
|
//{
|
|
// base.OnAmbientChanged(mode);
|
|
//}
|
|
|
|
//protected override void OnAmbientTick(TimeEventArgs time)
|
|
//{
|
|
// base.OnAmbientTick(time);
|
|
//}
|
|
|
|
static void Main(string[] args)
|
|
{
|
|
var app = new Program();
|
|
|
|
global::Xamarin.Forms.Platform.Tizen.Forms.Init(app);
|
|
global::Tizen.Wearable.CircularUI.Forms.Renderer.FormsCircularUI.Init();
|
|
|
|
app.Run(args);
|
|
}
|
|
|
|
}
|
|
}
|