private void Locator_ServiceStateChanged(object sender, ServiceStateChangedEventArgs e) { LocationEnabled = e.ServiceState == ServiceState.Disabled ? false : true; if (LocationEnabled) { Position = locator.GetLocation(); Console.WriteLine("[Locator_ServiceStateChanged] Location Service is Enabled. Position : " + Position.Latitude + ", " + Position.Longitude); } else { Position = null; Console.WriteLine("[Locator_ServiceStateChanged] Location Service is Disabled."); } _viewModel.UpdateInformation(Position); }
// Raised when the screen of the device is on/off/dim. private void Display_StateChanged(object sender, TSystem.DisplayStateChangedEventArgs e) { Console.WriteLine("[Display_StateChanged] " + e.State); // When device's screen turns on if (e.State == TSystem.DisplayState.Normal) { // Update Time for UI update WatchTime time = GetCurrentTime(); _viewModel.Time = time.UtcTimestamp + TimeSpan.FromMilliseconds(time.Millisecond); // Update Information about Weather & Battery _viewModel.UpdateInformation(); } else if (e.State == TSystem.DisplayState.Off) { // When the screen of the device is off _viewModel.UnregisterEvents(); } }