Пример #1
0
        //загрузка всех карточек(изначально варианты загружаются для первого полежения)
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            loadPositionСardMass = questions.getLoadsImgPath(choiceBlock.theme, choiceBlock.blockID);
            //variantCardMass = questions.getVariantsImgPath(choiceBlock.theme, choiceBlock.blockID, 1);

            int num = 1;

            foreach (List <string> card in loadPositionСardMass)
            {
                Button button = new Button();
                button.Style   = this.Resources["buttonCard"] as Style;
                button.Content = choiceBlock.ToRoman(num);
                num++;
                button.Tag        = System.IO.Path.GetFullPath(card[1]);
                button.Width      = (loadPosition.ActualHeight) / 5 * 8;
                button.Height     = (loadPosition.ActualHeight);
                button.Foreground = SpecialColor.mainBlue();
                button.Click     += card_Click;
                loadPosition.Children.Add(button);
            }

            //num = 1;
            //foreach (string card in variantCardMass) {
            //    Button button = new Button();
            //    button.Style = this.Resources["buttonCard"] as Style;
            //    button.Content = choiceBlock.ToRoman(num);
            //    num++;
            //    button.Tag = System.IO.Path.GetFullPath(card);
            //    button.Width = (variant.ActualHeight) / 5 * 8;
            //    button.Height = (variant.ActualHeight);
            //    button.Foreground = SpecialColor.mainBlue();
            //    button.Click += card_Click2;
            //    variant.Children.Add(button);
            //}
        }
Пример #2
0
        private void card_Click2(object sender, RoutedEventArgs e)
        {
            if ((sender as Button) != variantСurrentButton)
            {
                if (variantСurrentButton != null)
                {
                    variantСurrentButton.Background = SpecialColor.mainBack();
                    variantСurrentButton.Foreground = SpecialColor.mainBlue();
                }
                (sender as Button).Background = SpecialColor.mainBlue();
                (sender as Button).Foreground = SpecialColor.white();
                variantСurrentButton          = (sender as Button);

                int id = 0;
                foreach (Button button in variant.Children)
                {
                    if (variantСurrentButton == button)
                    {
                        variantID = Int32.Parse(variantCardMass[id][0]);
                        break;
                    }
                    id++;
                }
            }
            else
            {
                (sender as Button).Background = SpecialColor.mainBack();
                (sender as Button).Foreground = SpecialColor.mainBlue();
                variantСurrentButton          = null;
            }
        }
Пример #3
0
        private void card_Click(object sender, RoutedEventArgs e)
        {
            if ((sender as Button) != loadPositioСurrentButton)
            {
                if (loadPositioСurrentButton != null)
                {
                    loadPositioСurrentButton.Background = SpecialColor.mainBack();
                    loadPositioСurrentButton.Foreground = SpecialColor.mainBlue();
                }
                (sender as Button).Background = SpecialColor.mainBlue();
                (sender as Button).Foreground = SpecialColor.white();
                loadPositioСurrentButton      = (sender as Button);


                int id = 0;
                foreach (Button button in loadPosition.Children)
                {
                    if (loadPositioСurrentButton == button)
                    {
                        variantCardMass = questions.getVariantsImgPath(choiceBlock.theme, choiceBlock.blockID, Int32.Parse(loadPositionСardMass[id][0]));
                        loadID          = Int32.Parse(loadPositionСardMass[id][0]);
                        break;
                    }
                    id++;
                }
                //изменение вариантов
                //variantCardMass = questions.getVariantsImgPath(choiceBlock.theme, choiceBlock.blockID, ID);
                variantСurrentButton = null;
                variant.Children.Clear();
                int num = 1;
                foreach (List <string> card in variantCardMass)
                {
                    Button button = new Button();
                    button.Style   = this.Resources["buttonCard"] as Style;
                    button.Content = choiceBlock.ToRoman(num);
                    num++;
                    button.Tag        = System.IO.Path.GetFullPath(card[1]);
                    button.Width      = (variant.ActualHeight) / 5 * 8;
                    button.Height     = (variant.ActualHeight);
                    button.Foreground = SpecialColor.mainBlue();
                    button.Click     += card_Click2;
                    variant.Children.Add(button);
                }
            }
            else
            {
                (sender as Button).Background = SpecialColor.mainBack();
                (sender as Button).Foreground = SpecialColor.mainBlue();
                loadPositioСurrentButton      = null;


                if (variantСurrentButton != null)
                {
                    variantСurrentButton.Background = SpecialColor.mainBack();
                    variantСurrentButton.Foreground = SpecialColor.mainBlue();
                }
                variantСurrentButton = null;
                variant.Children.Clear();
            }
        }
        private async void mainLayoutStart_Click(object sender, RoutedEventArgs e)
        {
            if (isCurrentData)
            {
                if (WpfApp1.View.choiceBlock.currentButton != null)
                {
                    WpfApp1.View.choiceBlock.currentButton.Foreground = SpecialColor.mainBlue();
                    WpfApp1.View.choiceBlock.currentButton.Background = SpecialColor.mainBack();
                    WpfApp1.View.choiceBlock.currentButton            = null;
                }
                lastName_data          = lastName.Text;
                firstName_data         = firstName.Text;
                secondName_data        = secondName.Text;
                group_data             = group.Text;
                contentControl.Content = cBlock;
            }
            else
            {
                if (!DataPopup.IsOpen)
                {
                    DataPopupText.Content    = "ВВЕДИТЕ ДАННЫЕ";
                    DataPopupText.Background = SpecialColor.red();
                    DataPopup.IsOpen         = true;
                    await Task.Delay(2000);

                    DataPopup.IsOpen = false;
                }
            }
        }
Пример #5
0
 //поиск людей
 private void searchDataTypeCB_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     searchData.Clear();
     searchData.Text           = "Введите ключевое слово";
     searchData.Foreground     = SpecialColor.placeholder();
     resultsPeople.ItemsSource = null;
     resultsPeople.ItemsSource = loadResultsPeople;
 }
Пример #6
0
 /// <summary>
 /// Prints some colored text in the chat (yellow, green, special).
 /// You can choose the special color in this Version (A fake teammessage is send to the client and afterwards
 /// the information is restored).
 /// </summary>
 /// <param name="player">
 /// A player <see cref="Player"/>
 /// </param>
 /// <param name="specialColor">
 /// The SpecialColor you want to send <see cref="SpecialColor"/>
 /// </param>
 /// <param name="text">
 /// The text you want to send, you can use C#-style arguments like {0} <see cref="System.String"/>
 /// </param>
 /// <param name="paramlist">
 /// The additional parameterlist. <see cref="System.Object[]"/>
 /// </param>
 public static void ClientColorPrint(this Player player, SpecialColor specialColor, string text, params object[] paramlist)
 {
     // TODO: for some reason this doesn't work, thought the messages come in a proper way
     string team = player.GetTeamString();
     player.SendTeamInfoMessage(CounterStrike.GetTeamString(specialColor));
     player.ClientColorPrint(text, paramlist);
     player.SendTeamInfoMessage(team);
 }
Пример #7
0
        /// <summary>
        /// Prints some colored text in the chat (yellow, green, special).
        /// You can choose the special color in this Version (A fake teammessage is send to the client and afterwards
        /// the information is restored).
        /// </summary>
        /// <param name="player">
        /// A player <see cref="Player"/>
        /// </param>
        /// <param name="specialColor">
        /// The SpecialColor you want to send <see cref="SpecialColor"/>
        /// </param>
        /// <param name="text">
        /// The text you want to send, you can use C#-style arguments like {0} <see cref="System.String"/>
        /// </param>
        /// <param name="paramlist">
        /// The additional parameterlist. <see cref="System.Object[]"/>
        /// </param>
        public static void ClientColorPrint(this Player player, SpecialColor specialColor, string text, params object[] paramlist)
        {
            // TODO: for some reason this doesn't work, thought the messages come in a proper way
            string team = player.GetTeamString();

            player.SendTeamInfoMessage(CounterStrike.GetTeamString(specialColor));
            player.ClientColorPrint(text, paramlist);
            player.SendTeamInfoMessage(team);
        }
Пример #8
0
 public static int GetTeamID(SpecialColor color)
 {
     switch (color) {
     case SpecialColor.Red:
         return 1;
     case SpecialColor.Blue:
         return 2;
     case SpecialColor.White:
     default:
         return 3;
     }
 }
Пример #9
0
 public AddTextMode(Controller controller, UndoMgr undoMgr, SelectionMgr selectionMgr, EventDB eventDB, string text, string fontName, bool fontBold, bool fontItalic, SpecialColor fontColor, float fontHeight)
 {
     this.controller   = controller;
     this.undoMgr      = undoMgr;
     this.selectionMgr = selectionMgr;
     this.eventDB      = eventDB;
     this.text         = text;
     this.fontName     = fontName;
     this.fontBold     = fontBold;
     this.fontItalic   = fontItalic;
     this.fontColor    = fontColor;
     this.fontHeight   = fontHeight;
     this.displayText  = CourseFormatter.ExpandText(eventDB, selectionMgr.ActiveCourseView, text);
 }
Пример #10
0
        public static int GetTeamID(SpecialColor color)
        {
            switch (color)
            {
            case SpecialColor.Red:
                return(1);

            case SpecialColor.Blue:
                return(2);

            case SpecialColor.White:
            default:
                return(3);
            }
        }
Пример #11
0
        private void CustomizeColor(CmykColor color)
        {
            ColorChooserDialog colorChooserDialog = new ColorChooserDialog();

            colorChooserDialog.Color = color;

            if (colorChooserDialog.ShowDialog() == DialogResult.OK)
            {
                Color = new SpecialColor(colorChooserDialog.Color);
            }

            colorChooserDialog.Dispose();
            comboBox.Invalidate();

            SendChangeNotification();
        }
Пример #12
0
        //ПРОВЕРКА ВВЕДЕННОСТИ ДАННЫХ
        private async void saveData_Click(object sender, RoutedEventArgs e)
        {
            if (saveDataFlag == true)
            {
                saveDataFlag = false;

                isCurrentData = false;
                if (lastName.Text != "" && lastName.Text != "Фамилия" &&
                    firstName.Text != "" && firstName.Text != "Имя" &&
                    secondName.Text != "" && secondName.Text != "Отчество" &&
                    group.Text != "" && group.Text != "Группа")
                {
                    Regex regFIO   = new Regex("^([А-Я]|[A-Z])([а-я]|[a-z])+$");
                    Regex regGroup = new Regex("^[А-ЯA-Z 0-9\\-]*$");//"^([А-Я]|[A-Z]){2,}(\\-| )?\\d{1,2}\\-\\d{2}$"
                    if (regFIO.IsMatch(lastName.Text) &&
                        regFIO.IsMatch(firstName.Text) &&
                        regFIO.IsMatch(secondName.Text) &&
                        regGroup.IsMatch(group.Text))
                    {
                        curRec.Content = lastName.Text + " " + firstName.Text + " " + secondName.Text + " " + group.Text;
                        isCurrentData  = true;
                    }
                }

                if (isCurrentData == true)
                {
                    DataPopupText.Content = "ДАННЫЕ СОХРАНЕНЫ";
                }
                else
                {
                    DataPopupText.Content = "ДАННЫЕ НЕ СОХРАНЕННЫ";
                    curRec.Content        = "*Учетная запись";
                }
                DataPopupText.Background = isCurrentData == true?SpecialColor.green() : SpecialColor.red();

                DataPopup.IsOpen = true;
                await Task.Delay(2000);

                DataPopup.IsOpen = false;

                saveDataFlag = true;
            }
        }
Пример #13
0
        public SpecialColor GetAttributeColor(string name, SpecialColor defValue)
        {
            string value = Reader.GetAttribute(name);

            if (value == null || value == string.Empty)
            {
                return(defValue);
            }
            else
            {
                try {
                    return(SpecialColor.Parse(value));
                }
                catch (FormatException) {
                    BadXml("Bad format for color attribute '{0}'", name);
                    return(defValue);
                }
            }
        }
Пример #14
0
 //событие на выбор карточки
 private void card_Click(object sender, RoutedEventArgs e)
 {
     if ((sender as Button) != currentButton)
     {
         if (currentButton != null)
         {
             currentButton.Background = SpecialColor.mainBack();
             currentButton.Foreground = SpecialColor.mainBlue();
         }
         (sender as Button).Background = SpecialColor.mainBlue();
         (sender as Button).Foreground = SpecialColor.white();
         currentButton = (sender as Button);
     }
     else
     {
         (sender as Button).Background = SpecialColor.mainBack();
         (sender as Button).Foreground = SpecialColor.mainBlue();
         currentButton = null;
     }
 }
Пример #15
0
        //смена темы
        private void loadDataThemesCB_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            currentButton = null;
            choiceContent.Children.Clear();
            cardMass = questions.getBlocksImgPath(loadDataThemesCB.Text);
            int num = 1;

            foreach (List <string> card in cardMass)
            {
                Button button = new Button();
                button.Style   = this.Resources["buttonCard"] as Style;
                button.Content = choiceBlock.ToRoman(num);
                num++;
                button.Tag        = Path.GetFullPath(card[1]);
                button.Width      = (choiceContent.ActualWidth - 61) / 4;
                button.Height     = ((choiceContent.ActualWidth - 45) / 4) / 8 * 5;
                button.Foreground = SpecialColor.mainBlue();
                button.Click     += card_Click;
                choiceContent.Children.Add(button);
            }
        }
Пример #16
0
        //загрузка карточек блоков
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            //currentButton = null;
            //choiceContent.Children.Clear();

            //if (choiceContent.Children.Count == 0) {
            //    foreach (Card card in cardMass) {
            //        Button button = new Button();
            //        button.Style = this.Resources["buttonCard"] as Style;
            //        button.Content = card.title;
            //        button.Tag = card.path;
            //        button.Width = (choiceContent.ActualWidth - 61) / 4;
            //        button.Height = ((choiceContent.ActualWidth - 45) / 4) / 8 * 5;
            //        button.Foreground = SpecialColor.mainBlue();
            //        button.Click += card_Click;
            //        choiceContent.Children.Add(button);
            //    }
            //}

            //плучение блока соответствующего теме
            cardMass = questions.getBlocksImgPath(loadDataThemesCB.Text);

            if (choiceContent.Children.Count == 0)
            {
                int num = 1;
                foreach (List <string> card in cardMass)
                {
                    Button button = new Button();
                    button.Style   = this.Resources["buttonCard"] as Style;
                    button.Content = choiceBlock.ToRoman(num);
                    num++;
                    button.Tag        = Path.GetFullPath(card[1]);
                    button.Width      = (choiceContent.ActualWidth - 61) / 4;
                    button.Height     = ((choiceContent.ActualWidth - 45) / 4) / 8 * 5;
                    button.Foreground = SpecialColor.mainBlue();
                    button.Click     += card_Click;
                    choiceContent.Children.Add(button);
                }
            }
        }
Пример #17
0
 private void searchData_TextChanged(object sender, TextChangedEventArgs e)
 {
     newSearchMass.Clear();
     if (searchData.Text != "" && searchData.Text != "Введите ключевое слово")
     {
         if (searchDataTypeCB.Text == "всем полям")
         {
             foreach (Person person in loadResultsPeople)
             {
                 if (person.lastName.ToLower().Contains(searchData.Text.ToLower()) || person.firstName.ToLower().Contains(searchData.Text.ToLower()) || person.secondName.ToLower().Contains(searchData.Text.ToLower()) || person.group.ToLower().Contains(searchData.Text.ToLower()))
                 {
                     newSearchMass.Add(person);
                 }
             }
         }
         else if (searchDataTypeCB.Text == "фамилии")
         {
             foreach (Person person in loadResultsPeople)
             {
                 if (person.lastName.ToLower().Contains(searchData.Text.ToLower()))
                 {
                     newSearchMass.Add(person);
                 }
             }
         }
         else if (searchDataTypeCB.Text == "имени")
         {
             foreach (Person person in loadResultsPeople)
             {
                 if (person.firstName.ToLower().Contains(searchData.Text.ToLower()))
                 {
                     newSearchMass.Add(person);
                 }
             }
         }
         else if (searchDataTypeCB.Text == "отчеству")
         {
             foreach (Person person in loadResultsPeople)
             {
                 if (person.secondName.ToLower().Contains(searchData.Text.ToLower()))
                 {
                     newSearchMass.Add(person);
                 }
             }
         }
         else
         {
             foreach (Person person in loadResultsPeople)
             {
                 if (person.group.ToLower().Contains(searchData.Text.ToLower()))
                 {
                     newSearchMass.Add(person);
                 }
             }
         }
         resultsPeople.ItemsSource = null;
         resultsPeople.ItemsSource = newSearchMass;
     }
     else
     {
         if (searchData.Text != "Введите ключевое слово" || searchData.Foreground == SpecialColor.placeholder())
         {
             resultsPeople.ItemsSource = null;
             resultsPeople.ItemsSource = loadResultsPeople;
         }
     }
     //if (resultsPeople.Items.Count!=0)
     //    loadDataTypeCB_SelectionChanged(null, null);
 }
Пример #18
0
 public static string GetTeamString(SpecialColor color)
 {
     return GetTeamString(GetTeamID(color));
 }
Пример #19
0
 public static Team GetTeamEnum(SpecialColor color)
 {
     return (Team)GetTeamID(color);
 }
Пример #20
0
 private void popupExit_MouseLeave(object sender, MouseEventArgs e)
 {
     line1.Stroke = SpecialColor.mainBlue();
     line2.Stroke = SpecialColor.mainBlue();
 }
Пример #21
0
        //адаптиваня ширина заголовка
        private void adaptiveTitle(Label testTitle, string title)
        {
            double fz = testTitle.FontSize;

            testTitle.Content = title;
            FormattedText ft = new FormattedText(title, CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface("Arial"), fz, SpecialColor.white());

            while ((ft.Width * 96 / 72) >= (SystemParameters.PrimaryScreenWidth - 900))
            {
                if (fz == 10)
                {
                    break;
                }
                fz -= 0.1;
                ft.SetFontSize(fz);
            }
            testTitle.FontSize = fz;
            testTitle.Content  = ft.Text;
        }
Пример #22
0
        //подтверждение ответа
        private async void confirmAnswer_Click(object sender, RoutedEventArgs e)
        {
            if (test1)
            {
                return;
            }

            test1 = true;

            TestControl test_one = new TestControl();

            // Создаем словарь исходных данных
            if (checkAnswer.Variables == null)
            {
                checkAnswer.Variables = questions.getQuestionParams(choiceBlock.theme, choiceBlock.blockID, choiceNextPage.loadID, choiceNextPage.variantID);
            }

            // Создаем счетчик попыток для каждой неизвестной переменной, которую необходимо найти.
            if (numTry == null)
            {
                numTry = new List <int>();
                foreach (var item in questions.getQuestionFinds(choiceBlock.theme, choiceBlock.blockID, choiceNextPage.loadID, choiceNextPage.variantID, stageNum))
                {
                    numTry.Add(0);
                }
            }

            if (mainPict == null)
            {
                mainPict = new List <string>();
                foreach (var i in questions.getQuestionFinds(choiceBlock.theme, choiceBlock.blockID, choiceNextPage.loadID, choiceNextPage.variantID, 2))
                {
                    mainPict.Add(questions.getVariantsImgPath(choiceBlock.theme, choiceBlock.blockID, choiceNextPage.loadID)[choiceNextPage.loadID][1].ToString());
                }
            }

            // Создаем список неизвестных переменных
            if (questionFindList == null)
            {
                questionFindList = questions.getQuestionFinds(choiceBlock.theme, choiceBlock.blockID, choiceNextPage.loadID, choiceNextPage.variantID, stageNum);
            }

            if (questionFormulasDict == null)
            {
                questionFormulasDict = questions.getQuestionFormuls(choiceBlock.theme, choiceBlock.blockID, choiceNextPage.loadID, choiceNextPage.variantID, stageNum);
            }

            if (graphicHintList == null)
            {
                graphicHintList = questions.getTipsPath(choiceBlock.theme, choiceBlock.blockID, choiceNextPage.loadID, choiceNextPage.variantID);
            }


            // Рассчитывем введенную формулу
            checkAnswer.Formula = answer.Text;
            string formualaInput = checkAnswer.Check();


            if (questionFormulasDict.Count > 0)
            {
                // Строка правильной формулы
                checkAnswer.Formula = questionFormulasDict[test_one.SelectedIndex()]["0"];

                string formulaCorrectExport = checkAnswer.Formula;
                string formulaCorrect       = checkAnswer.Check();


                // Проверяем на ошибку "NullOrEmpty Error!" - если была передана пустая строка
                if (formualaInput == "NullOrEmpty Error!")
                {
                    AnswerPopupContent.Background = SpecialColor.orange();
                    AnswerPopupContent.Content    = "ОШИБКА";
                    test_one.AnswerTipsClear();
                    test_one.AnswerTip($"Ошибка! Введена пустая строка", "orange");
                }


                // Проверяем на ошибку "Syntax Error!" - если была выявлена синтаксическая ошибка
                else if (formualaInput == "Syntax Error!")
                {
                    AnswerPopupContent.Background = SpecialColor.orange();
                    AnswerPopupContent.Content    = "ОШИБКА";
                    test_one.AnswerTipsClear();
                    test_one.AnswerTip($"Была выявлена синтаксическая ошибка!", "orange");
                }


                // Проверяем на ошибку "Bracket Error!" - если была выявлена ошибка правильности написания скобок
                else if (formualaInput == "Bracket Error!")
                {
                    AnswerPopupContent.Background = SpecialColor.orange();
                    AnswerPopupContent.Content    = "ОШИБКА";
                    test_one.AnswerTipsClear();
                    test_one.AnswerTip($"Ошибка! Неправильно расставлены скобки!", "orange");
                }


                // Проверяем на ошибку "UnknownData Error!" - если были переданы неизвестные данные
                else if (formualaInput == "UnknownData Error!")
                {
                    AnswerPopupContent.Background = SpecialColor.orange();
                    AnswerPopupContent.Content    = "ОШИБКА";
                    test_one.AnswerTipsClear();
                    test_one.AnswerTip($"Ошибка! Введены неизвестные данные!", "orange");
                }

                // Если ошибок нет, то проводим рассчет введенной формулы и сравниваем её с правильной формулой
                // Если ответ совпал, то выводим информацию о "правильности" ответа и засчитываем правильный ответ.
                else if (Convert.ToDouble(formulaCorrect) == Convert.ToDouble(formualaInput))
                {
                    AnswerPopupContent.Background = SpecialColor.green();
                    AnswerPopupContent.Content    = "ПРАВИЛЬНО";

                    // +1 к счетчику правильных ответов
                    correctAnswersCount++;

                    // За правильный ответ дается 5 баллов
                    test_one.Score(5);

                    // На вопрос был дан ответ, следовательно попытки больше не нужны
                    numTry[test_one.SelectedIndex()] = 3;

                    test_one.AnswerTipsClear();
                    test_one.AnswerTip($"Правильно! Ответ: {formulaCorrectExport}", "green");
                }
                else
                {
                    AnswerPopupContent.Background = SpecialColor.red();
                    AnswerPopupContent.Content    = "НЕПРАВИЛЬНО";

                    // За не правильный ответ балл на 1
                    test_one.Score(-1);

                    // +1 к кол-ву попыток
                    numTry[test_one.SelectedIndex()]++;

                    // Очищаем другие уведомления
                    test_one.AnswerTipsClear();

                    if (stageNum == 2)
                    {
                        if (numTry[test_one.SelectedIndex()] == graphicHintNum)
                        {
                            mainPict[test_one.SelectedIndex()] = graphicHintList[test_one.SelectedIndex()];
                            test_one.GraphContent(System.IO.Path.GetFullPath(mainPict[test_one.SelectedIndex()]));
                        }
                    }

                    if (numTry[test_one.SelectedIndex()] < 3)
                    {
                        test_one.AnswerTip($"Дан неправильный ответ. У вас осталось еще {3 - numTry[test_one.SelectedIndex()]} попытки(-а)", "red");
                    }
                    else
                    {
                        test_one.AnswerTip($"Попыток больше нет!", "red");
                        test_one.AnswerTip($"Правильная формула: {formulaCorrectExport}", "red");
                        foreach (var item in questionFormulasDict[test_one.SelectedIndex()])
                        {
                            if (checkAnswer.Variables.ContainsKey(item.Key))
                            {
                                test_one.AnswerTip($"Правильная формула: {item.Value}", "red");
                            }
                        }
                    }
                }

                if (numTry[test_one.SelectedIndex()] >= 3)
                {
                    // Если эта переменная еще не найдена, то добавляем ее в словарь переменных
                    checkAnswer.Variables.Add(questionFindList[test_one.SelectedIndex()].ToLower(), Convert.ToDouble(formulaCorrect));

                    // Обновляем в графическом интерфейсе граф "задача"
                    test_one.QuestionVal(test_one.SelectedValue(), formulaCorrect);

                    // Удаляем найденную переменную из списка неизвестных переменных и выпадающего списка
                    questionFindList.Remove(test_one.SelectedValue());

                    // Удаляем счетчик кол-ва попыток ответа для найденой переменной
                    numTry.RemoveAt(test_one.SelectedIndex());

                    // Удаляем формулу для найденной переменной
                    questionFormulasDict.RemoveAt(test_one.SelectedIndex());

                    if (stageNum == 2)
                    {
                        graphicHintList.RemoveAt(test_one.SelectedIndex());
                        mainPict.RemoveAt(test_one.SelectedIndex());
                    }

                    // Очищаем вводное поле
                    answer.Clear();

                    // Обновляем выпадающий список
                    test_one.QuestionValsСВ(questionFindList);
                }

                AnswerPopup.IsOpen = true;
                await Task.Delay(1000);

                AnswerPopup.IsOpen = false;


                // Если закончился 1-ый этап ответов на вопрос, то переходим к следующему, иначе завершаем тест
                try {
                    if (questionFindList.Count <= 0)
                    {
                        stageNum += 1;

                        if (stageNum >= maxStageNum + 1)
                        {
                            test1 = true;
                            _timer.Stop();
                            test_one.AnswerTip($"Тестирование завершено! Пожалуйста, нажмите на кнопку 'Завершить тестирование'!", "orange");
                        }

                        else
                        {
                            // Обновляем исходные данные
                            string testtext = "";
                            int    proba    = 0;
                            bool   proba1   = false;
                            foreach (var massiv in checkAnswer.Variables)
                            {
                                if (massiv.Key != "Hb" && massiv.Key != "Va" && massiv.Key != "Vb")
                                {
                                    if (massiv.Key == "h" || massiv.Key == "d")
                                    {
                                        testtext += $"{massiv.Key} = {massiv.Value} м; ";
                                    }
                                    else
                                    {
                                        testtext += $"{massiv.Key} = {massiv.Value} кН; ";
                                    }
                                    proba++;
                                    if (proba >= 3)
                                    {
                                        testtext += "\n";
                                        proba     = 0;
                                    }
                                }
                                else
                                {
                                    if (proba1 == false)
                                    {
                                        testtext += "\nЗначения опор Кн:\n";
                                        proba     = 0;
                                        proba1    = true;
                                    }

                                    proba++;

                                    testtext += $"{massiv.Key} = {massiv.Value}; ";

                                    if (proba >= 3)
                                    {
                                        testtext += "\n";
                                        proba     = 0;
                                    }
                                }
                            }
                            test_one.DataExtraInfo(testtext);

                            test_one.DataMainInfo(questions.getQuestionText(choiceBlock.theme, choiceBlock.blockID, choiceNextPage.loadID, choiceNextPage.variantID, stageNum));
                            test_one.QuestionVals(questions.getQuestionFinds(choiceBlock.theme, choiceBlock.blockID, choiceNextPage.loadID, choiceNextPage.variantID, stageNum));

                            numTry               = null;
                            questionFindList     = null;
                            questionFormulasDict = null;

                            questionFindList = questions.getQuestionFinds(choiceBlock.theme, choiceBlock.blockID, choiceNextPage.loadID, choiceNextPage.variantID, stageNum);

                            if (graphicHintNum == 0)
                            {
                                int numvalue = 0;
                                foreach (var value in graphicHintList)
                                {
                                    mainPict[numvalue] = value;
                                    numvalue++;
                                }
                                //mainPict = graphicHintList;
                                test_one.GraphContent(System.IO.Path.GetFullPath(mainPict[0]));
                            }

                            if (stageNum == 2)
                            {
                                test_one.VisualTip(System.IO.Path.GetFullPath("Img/block1/przn.png"));
                            }

                            test1 = false;
                        }
                    }
                    else
                    {
                        test1 = false;
                    }
                }
                finally
                {
                    // Создаем список неизвестных переменных
                    if (questionFindList == null)
                    {
                        questionFindList = questions.getQuestionFinds(choiceBlock.theme, choiceBlock.blockID, choiceNextPage.loadID, choiceNextPage.variantID, stageNum);
                    }

                    if (questionFormulasDict == null)
                    {
                        questionFormulasDict = questions.getQuestionFormuls(choiceBlock.theme, choiceBlock.blockID, choiceNextPage.loadID, choiceNextPage.variantID, stageNum);
                    }
                }
            }
        }
Пример #23
0
 //анимация крестика
 private void popupExit_MouseEnter(object sender, MouseEventArgs e)
 {
     line1.Stroke = SpecialColor.white();
     line2.Stroke = SpecialColor.white();
 }
Пример #24
0
        async void _init()
        {
            await Task.Delay(300);

            _colorService.Channel = 1;

            Channels = new List <Channel>();

            for (var c = 1; c <= 9; c++)
            {
                Channels.Add(new Channel()
                {
                    ChannelNumber = c.ToString(),
                    ToggleChannel = _toggled,
                    IsToggled     = c == 1
                });
            }

            var colours = new List <Color>()
            {
                Colors.Black,
                Colors.Red,
                Colors.Green,
                Colors.Blue,
                // Colors.Pink,
                Colors.White,
                Colors.DeepSkyBlue,
                // Colors.ForestGreen,
                //   Colors.MediumPurple,
                Colors.Orange,
                Colors.LightPink,
                Colors.Aqua,
                Colors.Lime,
                //    Colors.Teal,
                Colors.MediumVioletRed,
            };

            var width = Window.Current.Bounds.Width / colours.Count;

            var colTemp = new List <SolidColorPanelViewModel>();

            var i = new List <byte>()
            {
                1,
                16,
                32,
                48,
                //   64,
                80,
                112,
                //  128,
                // 144,
                160,
                176,
                192,
                208,
                //  224,
                240,
            };

            for (var iColor = 0; iColor < colours.Count; iColor++)
            {
                var specialColor = new SpecialColor(colours[iColor], i[iColor]);

                Debug.WriteLine($"Color: {specialColor.Color}, code: {specialColor.SpecialCode} ");

                var vm = CreateContentModel <SolidColorPanelViewModel>(_ =>
                {
                    _.Colour = specialColor;
                    _.Width  = width;
                });

                colTemp.Add(vm);
            }

            Colours = colTemp;
        }
 public SpecialColorSelectedMessage(SpecialColor color)
 {
     Color = color;
 }
Пример #26
0
        private void pictureBoxPreview_Paint(object sender, PaintEventArgs e)
        {
            // Get the graphics, size to 10 mm high.
            float    scale = 10.0F / pictureBoxPreview.ClientSize.Height;
            Graphics g     = e.Graphics;

            g.ScaleTransform(1 / scale, 1 / scale);
            g.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;

            // Get sizes and colors and so forth.
            float controlLineWidth        = NormalCourseAppearance.lineThickness * appearance.lineWidth;
            float controlCircleDiameter   = appearance.ControlCircleOutsideDiameter;        // outside diameter
            float controlDotDiameter      = appearance.centerDotDiameter;
            float controlCircleDrawRadius = (controlCircleDiameter - controlLineWidth) / 2; // radius to pen center

            SpecialColor lineSpecialColor = this.Color;
            Color        lineColor;

            if (lineSpecialColor.Kind == SpecialColor.ColorKind.Black)
            {
                lineColor = System.Drawing.Color.Black;
            }
            else if (lineSpecialColor.Kind == SpecialColor.ColorKind.Purple)
            {
                lineColor = purpleColor;
            }
            else
            {
                lineColor = SwopColorConverter.CmykToRgbColor(lineSpecialColor.CustomColor);
            }

            using (Brush purpleBrush = new SolidBrush(purpleColor))
                using (Pen purplePen = new Pen(purpleColor, controlLineWidth))
                    using (Pen linePen = new Pen(lineColor, this.LineWidth))
                    {
                        // Create the pen to be correct for the style and so forth.
                        LineKind lineKind = this.LineKind;
                        linePen.StartCap = linePen.EndCap = System.Drawing.Drawing2D.LineCap.Flat;
                        if (lineKind == PurplePen.LineKind.Double)
                        {
                            linePen.Width = this.LineWidth * 2 + this.GapSize;
                            float widthFract = this.LineWidth / linePen.Width;
                            float gapFract   = this.GapSize / linePen.Width;
                            linePen.CompoundArray = new float[4] {
                                0, widthFract, widthFract + gapFract, 1
                            };
                        }
                        else if (lineKind == PurplePen.LineKind.Dashed && this.DashSize > 0 && this.GapSize > 0)
                        {
                            linePen.DashCap     = System.Drawing.Drawing2D.DashCap.Flat;
                            linePen.DashOffset  = 0;
                            linePen.DashPattern = new float[2] {
                                this.DashSize / this.LineWidth, this.GapSize / this.LineWidth
                            };
                        }

                        // Draw control circle
                        PointF centerCircle = new PointF(5, 5);
                        g.DrawEllipse(purplePen, RectangleF.FromLTRB(centerCircle.X - controlCircleDrawRadius, centerCircle.Y - controlCircleDrawRadius, centerCircle.X + controlCircleDrawRadius, centerCircle.Y + controlCircleDrawRadius));

                        // Draw center dot.
                        if (controlDotDiameter > 0.0F)
                        {
                            g.FillEllipse(purpleBrush, RectangleF.FromLTRB(centerCircle.X - controlDotDiameter / 2, centerCircle.Y - controlDotDiameter / 2, centerCircle.X + controlDotDiameter / 2, centerCircle.Y + controlDotDiameter / 2));
                        }

                        // Draw legs
                        double angle = (Math.PI * 1.4);
                        g.DrawLine(purplePen, (float)(centerCircle.X + Math.Cos(angle) * 15), (float)(centerCircle.Y + Math.Sin(angle) * 15),
                                   (float)(centerCircle.X + Math.Cos(angle) * controlCircleDrawRadius), (float)(centerCircle.Y + Math.Sin(angle) * controlCircleDrawRadius));
                        angle = (Math.PI * 0.8);
                        g.DrawLine(purplePen, (float)(centerCircle.X + Math.Cos(angle) * 15), (float)(centerCircle.Y + Math.Sin(angle) * 15),
                                   (float)(centerCircle.X + Math.Cos(angle) * controlCircleDrawRadius), (float)(centerCircle.Y + Math.Sin(angle) * controlCircleDrawRadius));

                        // Draw line
                        PointF lineStart = new PointF(12, -5), lineCorner = new PointF(12, 5), lineEnd = new PointF(100, 5);
                        using (GraphicsPath path = new GraphicsPath()) {
                            if (!this.showRadius)
                            {
                                // Line, not rectangle. Just show line.
                                path.AddLine(lineCorner, lineEnd);
                            }
                            else if (this.CornerRadius > 0)
                            {
                                const float kappa = 0.5522847498F; // constant used to create near-circle with a bezier.

                                PointF roundStart = new PointF(lineCorner.X, lineCorner.Y - CornerRadius);
                                PointF roundEnd   = new PointF(lineCorner.X + CornerRadius, lineCorner.Y);
                                PointF control1   = new PointF(lineCorner.X, lineCorner.Y - (1 - kappa) * CornerRadius);
                                PointF control2   = new PointF(lineCorner.X + (1 - kappa) * CornerRadius, lineCorner.Y);
                                path.AddLine(lineStart, roundStart);
                                path.AddBezier(roundStart, control1, control2, roundEnd);
                                path.AddLine(roundEnd, lineEnd);
                            }
                            else
                            {
                                // No corner radius.
                                path.AddLine(lineStart, lineCorner);
                                path.AddLine(lineCorner, lineEnd);
                            }
                            try {
                                g.DrawPath(linePen, path);
                            }
                            catch (Exception) {
                                // Do nothing. Very occasionally, GDI+ given an overflow exception or ExternalException or OutOfMemory exception.
                                // Just ignore it; there's nothing else to do. See bug #1997301.
                            }
                        }
                    }
        }
Пример #27
0
 public static string GetTeamString(SpecialColor color)
 {
     return(GetTeamString(GetTeamID(color)));
 }
Пример #28
0
 public ColorAndText(string text, CmykColor color)
 {
     this.Text         = text;
     this.SpecialColor = new SpecialColor(color);
     this.Color        = color;
 }
Пример #29
0
 public ColorAndText(string text, SpecialColor specialColor, CmykColor color)
 {
     this.Text         = text;
     this.SpecialColor = specialColor;
     this.Color        = color;
 }
Пример #30
0
 public static Team GetTeamEnum(SpecialColor color)
 {
     return((Team)GetTeamID(color));
 }