예제 #1
0
        private async void Button_Click_1(object sender, RoutedEventArgs e)
        {
            ShokpodSettings settings = await ShokpodSettings.getSettings();

            this.ApiLocation.Text   = settings.ShokpodApiLocation;
            this.ThresholdG.Text    = "" + settings.ServerImpactThreshhold;
            this.DisplayG.IsChecked = settings.DisplayAcceleration;
        }
예제 #2
0
        private async void Flyout_Closed(object sender, object e)
        {
            ShokpodSettings settings = await ShokpodSettings.getSettings();

            settings.ShokpodApiLocation     = this.ApiLocation.Text;
            settings.ServerImpactThreshhold = Convert.ToDouble(this.ThresholdG.Text);
            settings.DisplayAcceleration    = Convert.ToBoolean(this.DisplayG.IsChecked);
            ShokpodSettings.saveToFile(settings);
        }
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            SelectedSensorTag = e.Parameter as SensorTag;

            SensorList.ItemsSource = tiles;

            SelectedSensorTag.MovementDataChanged += OnMovementMeasurementValueChanged;

            ConnectionResult result = await SelectedSensorTag.Connect();

            if ((result.Result == null) && (result.Exception == null) && (result.Success == false))
            {
                MessageDialog dialog = new MessageDialog("No permission to access device", "Connection error");
                await dialog.ShowAsync();

                //device = null;
                return;
            }
            if (result.Result.Status == GattCommunicationStatus.Success)
            {
            }
            if (result.Result.Status == GattCommunicationStatus.ProtocolError)
            {
                Debug($"Connection protocol error: {result.Result.ProtocolError.Value.ToString()}. Connection failures");
            }
            else if (result.Result.Status == GattCommunicationStatus.Unreachable)
            {
                Debug($"Connection protocol error: Device unreachable");
            }
            else if (result.Exception != null)
            {
                string msg           = String.Format("Message:\n{0}\n\nInnerException:\n{1}\n\nStack:\n{2}", result.Exception.Message, result.Exception.InnerException, result.Exception.StackTrace);
                var    messageDialog = new MessageDialog(msg, "Exception");
                await messageDialog.ShowAsync();
            }

            InidicateConnectionStatus(result);

            this.displayAcceleration = ShokpodSettings.getSettings().Result.DisplayAcceleration;
            base.OnNavigatedTo(e);
        }