private async void _SaveTests_Exec(object parameter)
        {
            var tests = TaskResultCreator.CreateTests(SelectedPattern, Questions);;

            tests.IsTestActive = true;

            var result = (CRUDResult)await MainView.Client.AdminManager.UpdateAsync(tests);

            if (!result.IsSuccess)
            {
                MessageBox.Show(result.Message);

                return;
            }

            PatternVisibility = Visibility.Visible;

            PanelVisibility = Visibility.Collapsed;

            OpenPanelVisibility = Visibility.Collapsed;

            TestVisibility = Visibility.Collapsed;

            TestContentVisibility = Visibility.Collapsed;
        }
Exemplo n.º 2
0
        public async void _Finish_Exec(object parameter)
        {
            var pattern = TaskResultCreator.DiagramCreate(Elements, _ObjectForms, LoadedDiagram);

            pattern.Pattern = LoadedDiagram.Pattern;

            Client.DiagramManager.Difficulty = (Difficulty)CurrentDifficulty;

            var result = (DiagramResult)await Client.DiagramManager.PostAsync(pattern);

            Result = new ResultView(this, result);

            WorkSpaceVisibility = Visibility.Collapsed;

            TestsVisibility = Visibility.Collapsed;

            ResultVisibility = Visibility.Visible;

            Dispose();
        }
        public async void _Finish_Exec(object parameter)
        {
            var pattern = TaskResultCreator.Create(NewPattern, SubjectElements, ReferenceElements);

            pattern.IsTestActive = false;

            var result = new CRUDResult();

            if (Patterns.Select(x => x.Id).ToList().Contains(NewPattern.Id))
            {
                result = (CRUDResult)await MainView.Client.AdminManager.UpdateAsync(pattern);
            }
            else
            {
                result = (CRUDResult)await MainView.Client.AdminManager.PostAsync(pattern);
            }

            if (!result.IsSuccess)
            {
                MessageBox.Show(result.Message);

                return;
            }

            PatternVisibility = Visibility.Visible;

            PanelVisibility = Visibility.Collapsed;

            OpenPanelVisibility = Visibility.Collapsed;

            TestVisibility = Visibility.Collapsed;

            MainView.Patterns = new ObservableCollection <PatternView>
                                    (await MainView.Client.PatternManager.GetAllAsync());

            Patterns = MainView.Patterns;
        }