예제 #1
0
 void CalculateEmotionValue()
 {
     // Get the last emotional state info and try to plot a graph
     HealthVaultMethods.GetThings(EmotionalStateModel.TypeId, null,
                                  baseTime.Subtract(new TimeSpan(28, 0, 0, 0)),
                                  baseTime,
                                  GetThingsCompleted);
 }
예제 #2
0
        void AuthenticationCompleted(object sender, HealthVaultResponseEventArgs e)
        {
            SetProgressBarVisibility(false);

            if (e != null && e.ErrorText != null)
            {
                SetErrorMesasge(e.ErrorText);
                return;
            }

            if (App.HealthVaultService.CurrentRecord == null)
            {
                App.HealthVaultService.CurrentRecord = App.HealthVaultService.Records[0];
            }

            App.HealthVaultService.SaveSettings(App.SettingsFilename);
            if (App.HealthVaultService.CurrentRecord != null)
            {
                SetRecordName(App.HealthVaultService.CurrentRecord.RecordName);
                // We are only interested in the last item
                HealthVaultMethods.GetThings(EmotionalStateModel.TypeId, 1, null, null, GetThingsCompleted);
                SetProgressBarVisibility(true);
            }

            // Check to see if we should upload all the reading from Trial
            if (TrialModeStorageProvider.Instance.TrialStage == TrialState.UpgradeData)
            {
                if (TrialModeStorageProvider.Instance.TrialMode.emotionalStates.Count > 0)
                {
                    Dispatcher.BeginInvoke(() =>
                    {
                        MessageBoxResult result = MessageBox.Show(string.Format("You have {0} emotional state item(s).",
                                                                                TrialModeStorageProvider.Instance.TrialMode.emotionalStates.Count),
                                                                  "Upload local items to HealthVault", MessageBoxButton.OKCancel);
                        if (result == MessageBoxResult.Cancel)
                        {
                            CancelUpgrade();
                        }
                        if (result == MessageBoxResult.OK)
                        {
                            if (TrialModeStorageProvider.Instance.TrialMode.emotionalStates.Count > 0)
                            {
                                HealthVaultMethods.PutThings(TrialModeStorageProvider.Instance.TrialMode.emotionalStates,
                                                             PutThingsDoUpgradeCompleted);
                                SetProgressBarVisibility(true);
                            }
                        }
                    });
                }
                else
                {
                    EnjoyHealthVault();
                }
            }
        }
예제 #3
0
 void RefreshGraph()
 {
     this.EmotionList.Clear();
     this.GraphLabel.Text = string.Format("Readings for last 7 Days from {0}",
                                          BaseTimeForGraph.ToString("MMM dd, yyyy"));
     // Get the last emotional state info and try to plot a graph
     HealthVaultMethods.GetThings(EmotionalStateModel.TypeId, null,
                                  BaseTimeForGraph.Subtract(new TimeSpan(7, 0, 0, 0)),
                                  BaseTimeForGraph,
                                  GetThingsCompleted);
 }
예제 #4
0
        // Save the reading to HealthVault
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            EmotionalStateModel model = new EmotionalStateModel();

            model.Mood      = (Mood)c_MoodSlider.Value;
            model.Stress    = (Stress)c_StressSlider.Value;
            model.Wellbeing = (Wellbeing)c_WellbeingSlider.Value;
            model.When      = DateTime.Now;
            HealthVaultMethods.PutThings(model, PutThingsCompleted);
            SetProgressBarVisibility(true);
        }
예제 #5
0
        // Save the readings to HealthVault
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            EmotionalStateModel model = new EmotionalStateModel();

            model.Mood      = (Mood)(moodSliderSelector.DataSource.SelectedItem as ValueData).ID;
            model.Stress    = (Stress)(stressSliderSelector.DataSource.SelectedItem as ValueData).ID;
            model.Wellbeing = (Wellbeing)(wellbeingSliderSelector.DataSource.SelectedItem as ValueData).ID;
            model.Note      = Txt_Note.Text;
            model.When      = DateTime.Now;
            if (!App.IsTrial)
            {
                HealthVaultMethods.PutThings(model, PutThingsCompleted);
                SetProgressBarVisibility(true);
            }
            else
            {
                SetProgressBarVisibility(true);
                TrialModeStorageProvider.Instance.TrialMode.emotionalStates.Add(model);
                TrialModeStorageProvider.Instance.Save();
                SetProgressBarVisibility(false);
                SetUserToast("Mood successfully saved on the device!");
            }
        }
예제 #6
0
        void AuthenticationCompleted(object sender, HealthVaultResponseEventArgs e)
        {
            SetProgressBarVisibility(false);

            if (e != null && e.ErrorText != null)
            {
                SetRecordName(e.ErrorText);
                return;
            }

            if (App.HealthVaultService.CurrentRecord == null)
            {
                App.HealthVaultService.CurrentRecord = App.HealthVaultService.Records[0];
            }

            App.HealthVaultService.SaveSettings(SettingsFilename);
            if (App.HealthVaultService.CurrentRecord != null)
            {
                SetRecordName(App.HealthVaultService.CurrentRecord.RecordName);
                // We are only interested in the last item
                HealthVaultMethods.GetThings(EmotionalStateModel.TypeId, 1, null, null, GetThingsCompleted);
                SetProgressBarVisibility(true);
            }
        }