/// <summary> /// Start the activity /// </summary> /// <param name="obj"></param> private async void StartActivity(object obj) { if (!Purchased) { return; } var localSettings = ApplicationData.Current.LocalSettings; localSettings.Values[Constants.BackgroundPace] = true; _NotRunning = 0; _Timer.Start(); try { PebbleConnector _pc = PebbleConnector.GetInstance(); await _pc.StartBackgroundTask(PebbleConnector.Initiator.Pace); } catch (Exception exc) { ExtendedEventArgs _e = new ExtendedEventArgs(); _e.Error = exc.Message; OnFatalError(_e); } }
private void App_Activated(object sender, string e) { ConfigWebView.Visibility = Visibility.Collapsed; var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; localSettings.Values[Constants.PebbleWebViewClosed] = e; if (_WatchAppConfig != null) { //_WatchFaceConfig.WebViewClosed(e); localSettings.Values[Constants.PebbleWatchItem] = _WatchAppConfig.ID.ToString(); } //Process the pebble webviewclosed in the background PebbleConnector _pc = PebbleConnector.GetInstance(); _pc.StartBackgroundTask(PebbleConnector.Initiator.PebbleWebViewClosed); }
private async void Tennis_OnResume(object sender, EventArgs e) { PebbleConnector _pc = PebbleConnector.GetInstance(); try { var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; localSettings.Values[Constants.BackgroundTennis] = true; await _pc.StartBackgroundTask(PebbleConnector.Initiator.Tennis); } catch (Exception exc) { var messageDialog = new Windows.UI.Popups.MessageDialog(exc.Message, "Error"); // Show the message dialog messageDialog.ShowAsync(); } }
public async void Configure(object obj) { Configuring = true; var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; localSettings.Values[Constants.PebbleWatchItem] = Item.ID.ToString(); localSettings.Values[Constants.PebbleShowConfiguration] = ""; PebbleConnector _pc = PebbleConnector.GetInstance(); await _pc.StartBackgroundTask(PebbleConnector.Initiator.PebbleShowConfiguration); _timer = new DispatcherTimer(); _timer.Interval = TimeSpan.FromMilliseconds(250); _timer.Tick += _timer_Tick; _timer.Start(); _timerCycles = 0; }
private async void ExtendCommandInvokedHandler(IUICommand command) { PebbleConnector _pc = PebbleConnector.GetInstance(); if (command.Label == "Yes") { try { await _pc.StartBackgroundTask(PebbleConnector.Initiator.Tennis); var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; localSettings.Values[Constants.BackgroundTennis] = true; localSettings.Values[Constants.TennisCommand] = "extend"; } catch (Exception exc) { var messageDialog = new Windows.UI.Popups.MessageDialog(exc.Message, "Error"); // Show the message dialog messageDialog.ShowAsync(); } } }
private async void StartButton_Click(object sender, RoutedEventArgs e) { PebbleConnector _pc = PebbleConnector.GetInstance(); //_vmBinder.vmNewMatch = new vmNewMatch(); _vmBinder.Tennis.vmMatch = new vmMatchState(); ApplicationData.Current.LocalSettings.Values.Remove(Constants.TennisState); ApplicationData.Current.LocalSettings.Values.Remove(Constants.TennisCommand); //_vmBinder.vmMatch.Start(_vmBinder.vmNewMatch); ShowPage(ProgressRing); _Timer = new DispatcherTimer(); _Timer.Interval = TimeSpan.FromSeconds(1); _Timer.Tick += _Timer_Tick; _Timer.Start(); try { await _vmBinder.vmNewMatch.Save(); var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; localSettings.Values[Constants.BackgroundTennis] = true; await _pc.StartBackgroundTask(PebbleConnector.Initiator.Tennis); } catch (Exception exc) { var messageDialog = new Windows.UI.Popups.MessageDialog(exc.Message, "Error"); // Show the message dialog messageDialog.ShowAsync(); ShowPage(NewMatchGrid); } }