Ejemplo n.º 1
0
        private void CloneTheme_Executed(object arg)
        {
            var newTheme          = Model.Clone() as Theme;
            var newThemeViewModel = new ThemeViewModel(newTheme);

            OwnerRound.Themes.Add(newThemeViewModel);
            OwnerRound.OwnerPackage.Document.Navigate.Execute(newThemeViewModel);
        }
Ejemplo n.º 2
0
        private void AddTheme_Executed(object arg)
        {
            try
            {
                var document = OwnerPackage.Document;

                var theme = new Theme {
                    Name = ""
                };
                var themeViewModel = new ThemeViewModel(theme);

                document.BeginChange();

                try
                {
                    Themes.Add(themeViewModel);
                    if (AppSettings.Default.CreateQuestionsWithTheme)
                    {
                        for (int i = 0; i < 5; i++)
                        {
                            var question = QDocument.CreateQuestion((i + 1) * AppSettings.Default.QuestionBase);
                            themeViewModel.Questions.Add(new QuestionViewModel(question));
                        }
                    }
                }
                finally
                {
                    document.CommitChange();
                }

                QDocument.ActivatedObject = themeViewModel;
                document.Navigate.Execute(themeViewModel);
            }
            catch (Exception exc)
            {
                PlatformSpecific.PlatformManager.Instance.Inform(exc.Message, true);
            }
        }