protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); var button = FindViewById<Button>(Resource.Id.MyButton); _settingsWorker = new SettingsWorker(); //_settingsWorker.GetSettings(); DateTime date = DateTime.Today; bool isSunrise = false; bool isSunset = false; DateTime sunrise = DateTime.Now; DateTime sunset = DateTime.Now; InitializeLocationManager(); button.Click += (sender, args) => { if (_currentLocation == null) { button.Text = "no location data"; return; } SunTimes.Instance.CalculateSunRiseSetTimes(_currentLocation.Latitude, _currentLocation.Longitude, date, ref sunrise, ref sunset, ref isSunrise, ref isSunset); button.Text = string.Format("Sunrise " + sunrise.ToString("HH:mm")); }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); var button = FindViewById<Button>(Resource.Id.button1); // TODO #region Getting settings _settingsWorker = new SettingsWorker(); AppSettings = new SettingsDTO(); _settingsWorker.GetSettings(AppSettings); #endregion InitializeLocationManager(); DateTime date = DateTime.Today; bool isSunrise = false; bool isSunset = false; DateTime sunrise = DateTime.Now; DateTime sunset = DateTime.Now; button.Text = AppSettings.WakeUpSound; button.Click += (sender, args) => { /*if (_currentLocation == null) { button.Text = "no location data"; return; }*/ AppSettings.WakeUpSound = "123" + DateTime.Now.ToString(); _settingsWorker.PushSettings(AppSettings); /*SunTimes.Instance.CalculateSunRiseSetTimes(_currentLocation.Latitude, _currentLocation.Longitude, date, ref sunrise, ref sunset, ref isSunrise, ref isSunset); button.Text = string.Format("Sunrise " + sunrise.ToString("HH:mm"));*/ }; }