private void PebbleJS_OpenURL(object sender, EventArgs e)
        {
            PebbleKitJS.URLEventArgs _uea = (PebbleKitJS.URLEventArgs)e;
            _WatchAppConfig = _uea.WatchItem;

            ConfigWebView.Navigate(new Uri(_uea.URL));
            ConfigWebView.Visibility = Visibility.Visible;
        }
        private void _timer_Tick(object sender, object e)
        {
            _timerCycles++;

            //Check for result
            var    localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            String URL           = (String)localSettings.Values[Constants.PebbleShowConfiguration];

            if (URL.Length > 0)
            {
                PebbleKitJS.URLEventArgs _uea = new PebbleKitJS.URLEventArgs();
                _uea.URL       = URL;
                _uea.WatchItem = Item;
                if (OnOpenConfiguration != null)
                {
                    OnOpenConfiguration(this, _uea);
                }

                Configuring = false;
                _timer.Stop();
            }

            //Check if error occurred
            if (localSettings.Values.Keys.Contains(Constants.BackgroundCommunicatieError) &&
                (int)localSettings.Values[Constants.BackgroundCommunicatieError] == (int)BCState.ConnectionFailed)
            {
                localSettings.Values[Constants.BackgroundCommunicatieError] = (int)BCState.OK;

                ErrorEventArgs ea = new ErrorEventArgs();
                ea.Error = "Connection failed with Pebble Time.";

                if (OnException != null)
                {
                    OnException(this, ea);
                }

                Configuring = false;
                _timer.Stop();
            }

            //Check for time out
            if (_timerCycles > 40)
            {
                Configuring = false;
                _timer.Stop();

                ErrorEventArgs ea = new ErrorEventArgs();
                ea.Error = "Time out occurred while opening the settings window.";

                if (OnException != null)
                {
                    OnException(this, ea);
                }
            }
        }
Esempio n. 3
0
        private void PebbleKitJS_OpenURL(object sender, EventArgs e)
        {
            PebbleKitJS.URLEventArgs _uea = (PebbleKitJS.URLEventArgs)e;
            String URL = _uea.URL;

            var localSettings = ApplicationData.Current.LocalSettings;

            localSettings.Values[Constants.PebbleShowConfiguration] = URL;

            PebbleKitJS.OpenURL -= PebbleKitJS_OpenURL;
        }