private static void EntityPanel_Click(object sender, RoutedEventArgs e) { if (KeySet.Pressing == false) { KeySet.studentList.Clear(); Button button = ((Button)sender); Frame frame = ((MainWindow)Application.Current.MainWindow).ConFrame; Business.Concrete.StudentManager studentManager = new Business.Concrete.StudentManager(); Student student = studentManager.Get(Convert.ToInt32(button.Tag)); frame.Navigate(new Pages.DetailStudent(student)); } }
private static void Btn_Click(object sender, RoutedEventArgs e) { Button button = sender as Button; button.Focusable = false; Business.Concrete.StudentManager studentManager = new Business.Concrete.StudentManager(); Student student = studentManager.Get(Convert.ToInt32(button.Tag)); bool varmi = false; foreach (var item in KeySet.studentList) { if (item.Identity == Convert.ToInt32(button.Tag)) { varmi = true; } } BrushConverter bc = new BrushConverter(); if (varmi == false) { button.Background = (Brush)bc.ConvertFrom("black"); KeySet.studentList.Add(student); } else if (varmi == true) { button.Background = (Brush)bc.ConvertFrom("white"); try { foreach (var item in KeySet.studentList) { if (item.Identity == Convert.ToInt32(button.Tag)) { KeySet.studentList.Remove(item); } } } catch (Exception) { } } }