Exemplo n.º 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);
 }
Exemplo n.º 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();
                }
            }
        }
Exemplo n.º 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);
 }
Exemplo n.º 4
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);
            }
        }