/// <summary>
        /// 
        /// </summary>
        /// <param name="activeTask"></param>
        public MeasureActivityPage(aladdinService.Task activeTask)
        {
            this.ViewModel = new MeasureActivityViewModel(activeTask);
            this.DataContext = this.ViewModel;

            InitializeComponent();
        }
 public ContentPageViewModel(aladdinService.MediaContent content)
 {
     this.Url = content.url;
     this.Text = content.text;
     this.Title = content.title;
     this.Category = content.category;
 }
        public ContentPage(aladdinService.MediaContent content)
        {
            this.ViewModel = new ContentPageViewModel(content);
            this.Category =
            this.Url = this.ViewModel.Url;
            this.Text = this.ViewModel.Text;
            this.Title = this.ViewModel.Title;
            this.Category = this.ViewModel.Category;
            this.DataContext = this.ViewModel;
            InitializeComponent();

            if (string.IsNullOrEmpty(this.Url))
            {
                //this.WebPageExpander.IsExpanded = false;
                this.WebPageExpander.Visibility = Visibility.Hidden;
                this.WebPageExpander.Height = 0;
                //this.WebPageStack.Visibility = Visibility.Hidden;
                //this.WebPageStack.Height = 0;
            }
            if (string.IsNullOrEmpty(this.Text))
            {
                //this.TextExpander.IsExpanded = false;
                this.WebBrowser.MinHeight = 450;
                this.TextExpander.Visibility = Visibility.Hidden;
                this.TextExpander.Height = 0;
                //this.TextStack.Visibility = Visibility.Hidden;
                //this.TextStack.Height = 0;
            }
        }
        static List<QuestionnaireQuestion> GetQuestions(aladdinService.QuestionnaireQuestion[] questions)
        {
            List<QuestionnaireQuestion> qs = new List<QuestionnaireQuestion>();

            if (questions != null)
            {
                foreach (var qqFS in questions.OrderBy(q => q.position))
                {
                    QuestionnaireQuestionAnswerType answerType = (QuestionnaireQuestionAnswerType)Enum.Parse(typeof(QuestionnaireQuestionAnswerType), qqFS.type);
                    QuestionnaireQuestion qq = new QuestionnaireQuestion(qqFS.id, qqFS.title, answerType);
                    List<QuestionnaireQuestionAnswer> answers = new List<QuestionnaireQuestionAnswer>();

                    List<aladdinService.QuestionnaireQuestionAnswer> answersFS = new List<aladdinService.QuestionnaireQuestionAnswer>();
                    answersFS = qqFS.answers.OrderBy(a => a.position).ToList();

                    foreach (var aFS in answersFS)
                    {
                        var a = new QuestionnaireQuestionAnswer();
                        a.Answer = aFS.description;
                        a.Value = aFS.value.ToString();
                        a.GlobalID = System.Convert.ToString(qqFS.GlobalID);
                        answers.Add(a);
                    }
                    qq.GlobalID = System.Convert.ToString(qqFS.GlobalID);
                    qq.Answers = answers.ToArray();
                    qq.Condition = qqFS.condition.ToString();
                    qq.Questions = GetQuestions(qqFS.questions);
                    qq.FixChildrenParentID();
                    qs.Add(qq);
                }
            }

            return qs;
        }
 public static Questionnaire Convert(aladdinService.Questionnaire qFS)
 {
     Questionnaire q = new Questionnaire();
     q.Version = qFS.versionSpecified ? qFS.version.ToString() : "";
     List<QuestionnaireQuestion> qs = GetQuestions(qFS.question);
     q.Questions = qs.ToArray();
     return q;
 }
        public WizardPage(aladdinService.Task activeTask)
        {
            this.ViewModel = new WizardPageViewModel(activeTask);
            this.DataContext = this.ViewModel;

            InitializeComponent();
            //if (MainWindow.Questionnaire != null)
            //    this.ChooseOneAnswerFromManyControl.FillAnswers(MainWindow.Questionnaire.Questions[4].Questions[0]);
        }
        public MeasureBloodPressurePage(aladdinService.Task activeTask)
        {
            this.ViewModel = new MeasureBloodPressureViewModel(activeTask);
            this.DataContext = this.ViewModel;

            InitializeComponent();

            this.lbl1.Content = "systolic:  " + Config.PROPERTIES_DICTIONARY[Config.PROPERTY_BLOOD_SISTOLIC_MIN] + " - " +
                    Config.PROPERTIES_DICTIONARY[Config.PROPERTY_BLOOD_SISTOLIC_MAX] + " (mmHg)";
            this.lbl2.Content = "diastolic: " + Config.PROPERTIES_DICTIONARY[Config.PROPERTY_BLOOD_DIASTOLIC_MIN] + " - " +
                    Config.PROPERTIES_DICTIONARY[Config.PROPERTY_BLOOD_DIASTOLIC_MAX] + " (mmHg)";
        }
 public ExternalServicePageViewModel(aladdinService.Task activeTask)
 {
     this.ActiveTask = activeTask;
     if (this.ActiveTask != null && this.ActiveTask.URL != null)
     {
         this.Url = this.ActiveTask.URL;
         this.Text = this.ActiveTask.Text;
         using (aladdinService.StorageComponentImplService sc = new aladdinService.StorageComponentImplService())
         {
             aladdinService.OperationResult taskChangeStatus = sc.ChangeTaskStatus(Convert.ToInt32(this.ActiveTask.ID), (int)Config.TaskStatusEnum.Completed, App.CurrentUserID);
         }
     }
 }
        public ExercisePage(aladdinService.Task activeTask)
        {
            this.ViewModel = new ExercisePageViewModel(activeTask);
            this.Url = this.ViewModel.Url;
            this.Text = this.ViewModel.Text;
            this.DataContext = this.ViewModel;
            InitializeComponent();

            if (string.IsNullOrEmpty(this.Url))
                this.WebPageExpander.IsExpanded = false;
            if (string.IsNullOrEmpty(this.Text))
                this.TextExpander.IsExpanded = false;
        }
 public WizardPageViewModel(aladdinService.Task activeTask)
 {
     this.ActiveTask = activeTask;
     if (this.ActiveTask != null)
     {
         aladdinService.Questionnaire qFS = this.ActiveTask.Questionnaire;
         this.Questionnaire = Questionnaire.FromFile(@"DailyQuestionnaire.xml");  //Utils.Convert(qFS);// Questionnaire.FromFile(@"DailyQuestionnaire.xml");
         this.QuestionnaireAnswers = new QuestionnaireAnswers();
         this.QuestionnaireWizard = new QuestionnaireWizard(this.Questionnaire, this.QuestionnaireAnswers);
         this.QuestionnaireWizard.ActivePageChanged += new ClientApplication.QuestionnaireWizard.ActivePageChangedEventHandler(QuestionnaireWizard_ActivePageChanged);
         this.QuestionSummaryVisibility = Visibility.Visible;
         this.UpdateQuestionInfo();
     }
 }
 public MessagePage(aladdinService.Task activeTask)
 {
     this.MessageText = activeTask.Text;
     this.DataContext = this;
     InitializeComponent();
 }
        internal void MoveToPage(string to, aladdinService.Task activeTask)
        {
            object page = null;
            this.ActiveTask = activeTask;

            if (!string.IsNullOrEmpty(to))
            {
                switch (to)
                {
                    case "education":
                        page = this.MediaContentSectionPage;
                        (page as MediaContentSectionPage).Category = "education";
                        break;
                    case "games":
                        page = this.MediaContentSectionPage;
                        (page as MediaContentSectionPage).Category = "games";
                        break;
                    case "entertainment":
                        page = this.MediaContentSectionPage;
                        (page as MediaContentSectionPage).Category = "entertainment";
                        break;
                    case "LoginPage":
                        if (App.IsUserAuthenticated)
                            App.IsUserAuthenticated = false;
                        page = this.LoginPage;
                        break;
                    case "MyTasksPage":
                        page = this.MyTasksPage;
                        break;
                    case "OptionsPage":
                        page = this.OptionsPage;
                        break;
                    case "WizardPage":
                        page = this.WizardPage;
                        break;
                    case "StartPage":
                        page = this.StartPage;
                        break;
                    case "MeasureWeightPage":
                        page = this.MeasureWeightPage;
                        break;
                    case "MeasureBloodPressurePage":
                        page = this.MeasureBloodPressurePage;
                        break;
                    case "MeasureActivityPage":
                        page = this.MeasureActivityPage;
                        break;
                    case "MediaContentPage":
                        page = this.MediaContentPage;
                        break;
                    case "DisclaimerPage":
                        {
                            if (App.HasDisclaimer)
                                page = this.DisclaimerPage;
                            else
                                page = this.MediaContentPage;
                        }
                        break;
                    case "ContactUsPage":
                        page = this.ContactUsPage;
                        break;
                    case "PlayGame":
                        page = this.ExternalServicePage;
                        break;
                    case "SocialNetwork":
                        page = this.ExternalServicePage;
                        (page as ExternalServicePage).Url = App.ForumPage;
                        break;
                    case "MessagePage":
                        page = this.MessagePage;
                        break;
                    case "Exercise":
                        page = this.ExercisePage;
                        break;
                    default:
                        break;
                }
            }

            if (page != null)
                this.ActivePage = page;
        }
 internal void MoveToContentPage(aladdinService.MediaContent content)
 {
     ContentPage page = new ContentPage(content);
     this.ActivePage  = page;
 }
 public ExternalServicePage(aladdinService.Task activeTask)
 {
     this.ViewModel = new ExternalServicePageViewModel(activeTask);
     this.Url = this.ViewModel.Url;
     InitializeComponent();
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="activeTask"></param>
 public MeasureBloodPressureViewModel(aladdinService.Task activeTask)
 {
     this.ActiveTask = activeTask;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="activeTask"></param>
 public MeasureWeightViewModel(aladdinService.Task activeTask)
 {
     this.ActiveTask = activeTask;
 }