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; } }
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; } } }
//событие на выбор карточки 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; } }