Esempio n. 1
0
 /// <summary>
 /// Saves or updates the the specified question item based on the CurrentUIMode
 /// </summary>
 /// <param name="QuestionItem">The question item.</param>
 /// <returns>Task.</returns>
 async internal Task Save(QuestionItem questionItem)
 {
     if (CurrentUIMode == UIModes.Adding)
     {
         await AddQuestion(questionItem);
     }
     else if (CurrentUIMode == UIModes.Editing)
     {
         await UpdateQuestion(questionItem);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Interface to delete the question.
 /// </summary>
 /// <param name="questionItem">Question item.</param>
 public async void DeleteQuestion(QuestionItem questionItem)
 {
     try
     {
         Task deleteQuestion = theQuestionInfo.DeleteQuestion(questionItem);
         await UIUtilities.ShowIndeterminateProgressIfNecessary(deleteQuestion, string.Format("Deleting task: [{0}] ...", questionItem.QuestionText));
     }
     finally
     {
         NavigationController.PopViewControllerAnimated(true);
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Interface to create the question.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="args">Arguments.</param>
        public void CreateQuestion(object sender, EventArgs args)
        {
            // first, add the question to the underlying data
            var newQuestionItem = new QuestionItem();

            theQuestionInfo.CurrentUIMode = UIModes.Adding;

            // then open the detail view to edit it
            var detail = Storyboard.InstantiateViewController("QuestionDetailViewController") as QuestionDetailViewController;

            detail.SetQuestion(this, newQuestionItem);
            NavigationController.PushViewController(detail, true);
        }
Esempio n. 4
0
        /// <summary>
        /// Interface to save the question.
        /// </summary>
        /// <param name="questionItem">Question item.</param>
        public async void SaveQuestion(QuestionItem questionItem)
        {
            try
            {
                Task saveTask = theQuestionInfo.Save(questionItem);

                if (theQuestionInfo.CurrentUIMode == UIModes.Adding)
                {
                    await UIUtilities.ShowIndeterminateProgressIfNecessary(saveTask, string.Format("Adding task: [{0}] ...", questionItem.QuestionText));
                }
                else
                {
                    await UIUtilities.ShowIndeterminateProgressIfNecessary(saveTask, string.Format("Updating task: [{0}] ...", questionItem.QuestionText));
                }

                await RefreshAsync();
            }
            finally
            {
                NavigationController.PopViewControllerAnimated(true);
            }
        }
 /// <summary>
 /// Sets the question and delegate, used externally.
 /// </summary>
 /// <param name="d">D.</param>
 /// <param name="question">Question.</param>
 public void SetQuestion(MasterViewController d, QuestionItem question)
 {
     Delegate        = d;
     currentQuestion = question;
 }
Esempio n. 6
0
 /// <summary>
 /// Updates the question
 /// </summary>
 /// <returns>Task.</returns>
 async internal Task UpdateQuestion(QuestionItem questionItem)
 {
     await _questionItemTable.UpdateAsync(questionItem);
 }
Esempio n. 7
0
 /// <summary>
 /// Adds the question
 /// </summary>
 /// <returns>Task.</returns>
 async internal Task AddQuestion(QuestionItem questionItem)
 {
     await _questionItemTable.InsertAsync(questionItem);
 }
Esempio n. 8
0
        /// <summary>
        /// Deletes the question then refreshes the question list
        /// </summary>
        async internal Task DeleteQuestion(QuestionItem questionItem)
        {
            await _questionItemTable.DeleteAsync(questionItem);

            await RefreshQuestions();
        }