Beispiel #1
0
    public async void Test()
    {
        var bandManager = new BandManager();

        bandManager.ReadingChanged += BandManager_ReadingChanged;
        var whatever = await bandManager.ToggleAccelerometer();
    }
Beispiel #2
0
        private async void MetroWindow_Loaded(object sender, RoutedEventArgs e)
        {
            if (!Settings.Current.AgreedToFirstRunWarning)
            {
                if (!await AgreeToFirstRunWarning())
                {
                    Telemetry.TrackEvent(TelemetryCategory.General, Telemetry.TelemetryEvent.DeclinedFirstRunWarning);
                    Application.Current.Shutdown();
                }
            }

            if (!Settings.Current.AgreedToTelemetry)
            {
                if (!await AgreeToTelemetry())
                {
                    Telemetry.TrackEvent(TelemetryCategory.General, Telemetry.TelemetryEvent.DeclinedTelemetry);
                    Application.Current.Shutdown();
                }
            }

            // Begin Band detection - this will continue for the lifetime of the process
            BandManager.Start();

            if (About.Current.WasUpdated)
            {
                Telemetry.TrackEvent(TelemetryCategory.General, Telemetry.TelemetryEvent.AppUpgraded);
                PageContent.Content = new AboutPage(true);
            }
            else
            {
                ButtonMyBand_Click(null, null);
            }
        }
Beispiel #3
0
        private async void MetroWindow_Loaded(object sender, RoutedEventArgs e)
        {
            if (!Settings.Current.AgreedToFirstRunWarning)
            {
                if (!await AgreeToFirstRunWarning())
                {
                    Telemetry.Client.TrackEvent(Telemetry.Events.DeclinedFirstRunWarning);
                    Application.Current.Shutdown();
                }
            }

            if (!Settings.Current.AgreedToTelemetry)
            {
                if (!await AgreeToTelemetry())
                {
                    Telemetry.Client.TrackEvent(Telemetry.Events.DeclinedTelemetry);
                    Application.Current.Shutdown();
                }
            }

            // Begin Band detection - this will continue for the lifetime of the process
            BandManager.Start();

            ButtonMyBand_Click(null, null);
        }
Beispiel #4
0
        public MyBandPage()
        {
            InitializeComponent();

            _band = BandManager.Instance;

            DataContext = _band;
        }
Beispiel #5
0
        public MainWindow()
        {
            InitializeComponent();

            Telemetry.TrackEvent(TelemetryCategory.General, Telemetry.TelemetryEvent.AppLaunch, Settings.Current.Device);

            // Create just creates the singleton - call Start() to actually get things rolling
            BandManager.Create();
        }
Beispiel #6
0
        public MainWindow()
        {
            InitializeComponent();

            Telemetry.Client.TrackEvent(Telemetry.Events.AppLaunch);

            // Create just creates the singleton - call Start() to actually get things rolling
            BandManager.Create();
        }
Beispiel #7
0
 private void ComboBox2_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (firstTimeCombo2)
     {
         firstTimeCombo2 = false;
     }
     else
     {
         ComboBoxItem typeItem   = (ComboBoxItem)ComboBox2.SelectedItem;
         string       valueCombo = typeItem.Content.ToString();
         classValue = Convert.ToInt32(valueCombo);
         BandManager.GetInstance(interv, classValue);
     }
 }
        public ActivityLogPage()
        {
            InitializeComponent();

            // set the default exporter
            // TODO: Restore last used
            Exporter = Exporters.First();

            LoadExportSettings();

            _band = BandManager.Instance;

            this.DataContext = BandCloudManager.Instance;
        }
Beispiel #9
0
        public MainWindow()
        {
            InitializeComponent();

            Telemetry.TrackEvent(TelemetryCategory.General, Telemetry.TelemetryEvent.AppLaunch, Settings.Current.Device);

            string message = null;

            if (!BandManager.CanRun(ref message))
            {
                MessageBox.Show(message, "unBand Startup Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);

                Application.Current.Shutdown();

                return;
            }

            // Create just creates the singleton - call Start() to actually get things rolling
            BandManager.Create();
        }
Beispiel #10
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "Player")
        {
            // Change stat values
            StatsManager.PickupUpdateStats(instrument);

            // Change player stats
            PlayerController.StatChange();

            // Switch instrument sound
            BandManager.InstrumentSwitch(instrument.audioName, instrument.type);

            // Switch puase instrument icon
            PauseManager.SpriteSwitch(this.gameObject, instrument.type);

            // Update pause menu stat bars
            PauseManager.UpdateStatBars();
        }
    }
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            if (!visited)
            {
                try
                {
                    BeginLoadingIcon();

                    bandInstance = new BandManager();
                    await bandInstance.BandInit();

                    measurements = new Measurements();

                    //initiate connection with server set listeners:
                    try
                    {
                        await Notifications.initHubConnection();
                    }
                    catch (Exception)
                    {
                        EndLoadingIcon();
                        DialogBox.ShowOk("Error", "Communication error with Azure server, attempting to reconnect.");
                        this.Frame.Navigate(typeof(PatientMainPage), null);
                    }
                    visited = true;
                    //start periodic timer
                    //StartTimer();
                    EndLoadingIcon();
                }
                catch (Exception)
                {
                    EndLoadingIcon();
                    DialogBox.ShowOk("Error", "Communication error with Azure server, attempting to reconnect.");
                    this.Frame.Navigate(typeof(PatientMainPage), null);
                }
            }
        }
Beispiel #12
0
        private async void OnLoaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            //AddingTyle();
            ComboBoxItem typeItem   = (ComboBoxItem)ComboBox1.SelectedItem;
            string       valueCombo = typeItem.Content.ToString();

            ComboBoxItem typeItem2   = (ComboBoxItem)ComboBox2.SelectedItem;
            string       valueCombo2 = typeItem2.Content.ToString();

            interv     = Convert.ToInt32(valueCombo);
            classValue = Convert.ToInt32(valueCombo2);

            StartLogs();


            BandManager.GetInstance(interv, classValue).Initialize();
            BandManager.Done += (source, args) =>
            {
                Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
                {
                    switch (args.EventInfo.channelName)
                    {
                    case "Accelerometer":
                        AcceDisplay.Text = "Accelerometer: " + args.EventInfo.sensorMessage;
                        break;

                    case "HeartRate":
                        HeartRateDisplay.Text = "HeartRate: " + args.EventInfo.sensorMessage;
                        await c.saveStringToLocalFile("BandHRLogs.txt", "TimeStamp: " + args.EventInfo.timeStamp + " HeartRate: " + args.EventInfo.sensorMessage);
                        break;

                    case "SkinTemperature":
                        SkinTemperatureDisplay.Text = "Skin Temperature: " + args.EventInfo.sensorMessage;
                        await c.saveStringToLocalFile("BandSkinTempLogs.txt", "TimeStamp: " + args.EventInfo.timeStamp + " Skin Temperature: " + args.EventInfo.sensorMessage);
                        break;

                    case "Contact":
                        ContactBandDisplay.Text = args.EventInfo.sensorMessage;
                        await c.saveStringToLocalFile("BandContactLogs.txt", "TimeStamp: " + args.EventInfo.timeStamp + " " + args.EventInfo.sensorMessage);
                        break;

                    case "Pedometer":
                        PedometerDisplay.Text = "Pedometer: " + args.EventInfo.sensorMessage;
                        await c.saveStringToLocalFile("BandPedometerLogs.txt", "TimeStamp: " + args.EventInfo.timeStamp + " Pedometer: " + args.EventInfo.sensorMessage);
                        break;

                    case "UVIndex":
                        UVDisplay.Text = "UV: " + args.EventInfo.sensorMessage;
                        await c.saveStringToLocalFile("BandUVLogs.txt", "TimeStamp: " + args.EventInfo.timeStamp + " UV: " + args.EventInfo.sensorMessage);
                        break;

                    case "Calories":
                        CaloriesDisplay.Text = "Calories: " + args.EventInfo.sensorMessage;
                        await c.saveStringToLocalFile("BandCaloriesLogs.txt", "TimeStamp: " + args.EventInfo.timeStamp + " Calories: " + args.EventInfo.sensorMessage);
                        break;

                    case "Gsr":
                        GSRDisplay.Text = "Gsr: " + args.EventInfo.sensorMessage;
                        await c.saveStringToLocalFile("BandGsrLogs.txt", "TimeStamp: " + args.EventInfo.timeStamp + " Gsr: " + args.EventInfo.sensorMessage);
                        break;

                    case "AmbientLight":
                        AmbientLightDisplay.Text = "AmbientLight: " + args.EventInfo.sensorMessage;
                        await c.saveStringToLocalFile("BandAmbientLightLogs.txt", "TimeStamp: " + args.EventInfo.timeStamp + " AmbientLight: " + args.EventInfo.sensorMessage);
                        break;

                    case "Altimeter":
                        AltimeterDisplay.Text = "Altimeter: " + args.EventInfo.sensorMessage;
                        await c.saveStringToLocalFile("BandAltimeterLogs.txt", "TimeStamp: " + args.EventInfo.timeStamp + " Altimeter: " + args.EventInfo.sensorMessage);
                        break;

                    case "Barometer":
                        BarometerDisplay.Text = args.EventInfo.sensorMessage;
                        await c.saveStringToLocalFile("BandBarometerLogs.txt", "TimeStamp: " + args.EventInfo.timeStamp + " " + args.EventInfo.sensorMessage);
                        break;

                    case "RRInterval":
                        RrIntervalDisplay.Text = "RRInterval: " + args.EventInfo.sensorMessage;
                        await c.saveStringToLocalFile("BandRRIntervalLogs.txt", "TimeStamp: " + args.EventInfo.timeStamp + " RRInterval: " + args.EventInfo.sensorMessage);
                        break;

                    default:
                        Debug.WriteLine("Default case - Error on reading sensors info");
                        break;
                    }
                }).AsTask();
            };



            //bandHelper = new BandReativeExtensionsWrapper();

            //var bands = await BandClientManager.Instance.GetBandsAsync();
            //if (bands.Length < 1)
            //{
            //    var t = new MessageDialog("Can't find the Band", "Failed to Connect").ShowAsync();
            //    return;
            //}

            //await bandHelper.Connect();
            //ManageBand(bandHelper);
        }