void closeWindow_Click(object sender, RoutedEventArgs e) { if(editWin!=null) editWin.Close(); editWin = null; if (New_ClassWindow != null) New_ClassWindow.Close(); New_ClassWindow = null; if (deleteWindow != null) deleteWindow = null; ShowClasses();//Refreshes the classes }
//On double click event to add edit the class that was double clicked private void ClassesView_MouseDoubleClick(object sender, MouseButtonEventArgs e) { var item = ((FrameworkElement)e.OriginalSource).DataContext as Track; if (item ==null) { // Opens classes_edit.xaml if (ClassesView.SelectedIndex!=-1) { Classes valueSelected = (Classes)ClassesView.SelectedItems[0]; if (editWin != null) editWin.Close(); editWin = new classes_edit(valueSelected.id.ToString(),SendingFrom);//Sends the ID of the value selected editWin.closeWindow.Click += new RoutedEventHandler(closeWindow_Click); editWin.UpdateList.Click +=new RoutedEventHandler(UpdateList_Click); editWin.Owner = Window.GetWindow(this); editWin.ShowDialog(); } } }