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 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 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); //} }
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; } }
//смена темы 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); } }
//загрузка карточек блоков 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); } } }
private void popupExit_MouseLeave(object sender, MouseEventArgs e) { line1.Stroke = SpecialColor.mainBlue(); line2.Stroke = SpecialColor.mainBlue(); }