/// <summary>
        /// Fired when a question is selected from the side menu
        /// </summary>
        /// <param name="SelectedQuestion">The question that has been selected</param>
        private void QuestionListItemSelectedEvent(int SelectedQuestionIndex)
        {
            if (CurrentQuestionEditorViewModel != null && CurrentQuestionEditorViewModel.AnyUnsavedChanges)
            {
                if (AskToSave())
                {
                    if (SubmitQuestion())
                    {
                        QuestionListViewModel.Instance.CanChangeSelection = true;
                        QuestionListViewModel.Instance.SelectLastClickedItem();
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    QuestionListViewModel.Instance.CanChangeSelection = true;
                    QuestionListViewModel.Instance.SelectLastClickedItem();
                }
            }

            var SelectedQuestion = IoCServer.TestEditor.Builder.CurrentQuestions[SelectedQuestionIndex];

            CurrentQuestionEditorViewModel = BaseQuestionEditorViewModel.ToViewModel(SelectedQuestion);
            CurrentQuestionType            = SelectedQuestion.Type;
            ImagesEditorViewModel.Instance.LoadItems(SelectedQuestion.Task.Images);
            QuestionTypeDialogVisible = false;
            IsCancelButtonVisible     = true;
            CanDeleteQuestion         = true;
        }
 /// <summary>
 /// Fired when submit button is clicked
 /// </summary>
 private void Submit()
 {
     if (SubmitQuestion())
     {
         QuestionTypeDialogVisible = true;
         QuestionListViewModel.Instance.UnCheckAll();
         CurrentQuestionEditorViewModel = BaseQuestionEditorViewModel.ToViewModel(null);
     }
 }
        /// <summary>
        /// Select question type from the popup
        /// </summary>
        /// <param name="Type">The type of the question as <see cref="QuestionType"/> enum</param>
        private void SelectQuestionFromTiles(object Type)
        {
            try
            {
                var type = (QuestionType)Type;
                CurrentQuestionType            = type;
                IsCancelButtonVisible          = false;
                CanDeleteQuestion              = false;
                CurrentQuestionEditorViewModel = BaseQuestionEditorViewModel.ToViewModel(null, type);
            }
            catch
            {
                // Developer error
                IoCServer.Logger.Log("No such question. Error code: 1");
                return;
            }

            QuestionTypeDialogVisible = false;
        }
        /// <summary>
        /// Cancels current question edition/creating
        /// </summary>
        private void Cancel()
        {
            if (CurrentQuestionEditorViewModel.AnyUnsavedChanges)
            {
                if (AskToSave())
                {
                    if (!SubmitQuestion())
                    {
                        return;
                    }
                }
                else
                {
                    QuestionListViewModel.Instance.CanChangeSelection = true;
                    QuestionListViewModel.Instance.SelectLastClickedItem();
                }
            }

            ImagesEditorViewModel.Instance.LoadItems(null);
            CurrentQuestionEditorViewModel = BaseQuestionEditorViewModel.ToViewModel(null);
            QuestionListViewModel.Instance.UnCheckAll();
            QuestionTypeDialogVisible = true;
        }