Ejemplo n.º 1
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();
            }
        }
Ejemplo n.º 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;
            }
        }
Ejemplo n.º 3
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;
     }
 }
Ejemplo n.º 4
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;
        }
Ejemplo n.º 5
0
 //анимация крестика
 private void popupExit_MouseEnter(object sender, MouseEventArgs e)
 {
     line1.Stroke = SpecialColor.white();
     line2.Stroke = SpecialColor.white();
 }