//private void Btn_Close(object sender, RoutedEventArgs e) //{ // Close(); //} //bool isMaxWindow = false; //private void Btn_Max(object sender, RoutedEventArgs e) //{ // if (isMaxWindow) // { // WindowState = WindowState.Normal; // isMaxWindow = false; // } // else // { // WindowState = WindowState.Maximized; // isMaxWindow = true; // } //} //public static bool dataRefresh; //public bool DataRefresh //{ // get { return dataRefresh; } // set // { // //如果变量改变则调用事件触发函数 // if (value != dataRefresh) // { // WhenDataRefreshChange(); // } // dataRefresh = value; // } //} ////定义委托 //public delegate void DataRefreshChanged(object sender, RoutedEventArgs e); ////与委托相关联的事件 //public event DataRefreshChanged OnDataRefreshChanged; //private void WhenDataRefreshChange() //{ // if (OnDataRefreshChanged != null) // { // OnDataRefreshChanged(this, null); // } //} //private void Refresh_Click(object sender, RoutedEventArgs e) //{ // MyRefresh(); //} //public void MyRefresh() //{ // UserQuestionAdmin userQuestionAdmin = new UserQuestionAdmin(); // questionAdmin.Content = userQuestionAdmin; // //questionAdmin.DataContext = userQuestionAdmin; //} private void RibbonWindow_MouseDown(object sender, MouseButtonEventArgs e) { if (GlobalParams.DataRefresh) { UserQuestionAdmin userQuestionAdmin = new UserQuestionAdmin(); questionAdmin.Content = userQuestionAdmin; GlobalParams.DataRefresh = false; } }
private void ShowShare_Click(object sender, RoutedEventArgs e) { GlobalParams.isShare = (bool)showShare.IsChecked; if (GlobalParams.isShare) { GlobalParams.SqlShowShare = " UNION SELECT * FROM question WHERE share=0 and " + GlobalParams.Condition; UserQuestionAdmin userQuestionAdmin = new UserQuestionAdmin(); questionAdmin.Content = userQuestionAdmin; } else { GlobalParams.SqlShowShare = ""; UserQuestionAdmin userQuestionAdmin = new UserQuestionAdmin(); questionAdmin.Content = userQuestionAdmin; } }
void StartLoatWindow() { account.Content = GlobalParams.MyAccount; UserQuestionEntry userQuestionEntry = new UserQuestionEntry(); questionEntry.Content = userQuestionEntry; UserQuestionAdmin userQuestionAdmin = new UserQuestionAdmin(); questionAdmin.Content = userQuestionAdmin; UserCreateExam userCreateExam = new UserCreateExam(); questionExam.Content = userCreateExam; UserAlterPassword userAlterPassword = new UserAlterPassword(); questionAlter.Content = userAlterPassword; }
//判断选择的TabControl private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e) { switch (this.tabControl.SelectedIndex) { case 0: { if (GlobalParams.TypeRefresh) { SelectSubject(); GlobalParams.TypeRefresh = false; } if (GlobalParams.DataRefresh) { UserQuestionAdmin userQuestionAdmin = new UserQuestionAdmin(); questionAdmin.Content = userQuestionAdmin; GlobalParams.DataRefresh = false; } showShare.Visibility = Visibility.Visible; //Refresh.Visibility = Visibility.Visible; labNtype.Visibility = Visibility.Visible; Ntype.Visibility = Visibility.Visible; break; } case 1: { showShare.Visibility = Visibility.Collapsed; //Refresh.Visibility = Visibility.Collapsed; labNtype.Visibility = Visibility.Collapsed; Ntype.Visibility = Visibility.Collapsed; if (StartClick1 == 0) { UserQuestionEntry userQuestionEntry = new UserQuestionEntry(); questionEntry.Content = userQuestionEntry; } StartClick1++; break; } case 2: { showShare.Visibility = Visibility.Collapsed; //Refresh.Visibility = Visibility.Collapsed; labNtype.Visibility = Visibility.Collapsed; Ntype.Visibility = Visibility.Collapsed; if (StartClick2 == 0) { UserCreateExam userCreateExam = new UserCreateExam(); questionExam.Content = userCreateExam; } StartClick2++; break; } case 3: { showShare.Visibility = Visibility.Collapsed; //Refresh.Visibility = Visibility.Collapsed; labNtype.Visibility = Visibility.Collapsed; Ntype.Visibility = Visibility.Collapsed; break; } //case 4: // { // labNtype.Visibility = Visibility.Collapsed; // Ntype.Visibility = Visibility.Collapsed; // break; // } //case 5: // { // labNtype.Visibility = Visibility.Collapsed; // Ntype.Visibility = Visibility.Collapsed; // break; // } default: break; } }
private void Ntype_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (start > 0) { string selectSubject = ""; try { selectSubject = Ntype.SelectedValue.ToString().Replace("System.Windows.Controls.ComboBoxItem: ", ""); GlobalParams.ThisSelectSubject = selectSubject; } catch (System.NullReferenceException) { } if (selectSubject != "全部类型") { if (selectSubject == "python" || selectSubject == "Python") { GlobalParams.ThisPage = 1; GlobalParams.startIndex = 0; //Tj.Condition = null; GlobalParams.Condition = "subject='python' or subject='Python'"; if (showShare.IsChecked == true) { GlobalParams.SqlShowShare = " UNION SELECT * FROM question WHERE share=0 and " + GlobalParams.Condition; } else { GlobalParams.SqlShowShare = ""; } //sqlStr = "select * from question where subject='python' or subject='Python' limit 0,25"; UserQuestionAdmin userQuestionAdmin = new UserQuestionAdmin(); questionAdmin.Content = userQuestionAdmin; } else if (selectSubject == "java" || selectSubject == "Java") { GlobalParams.ThisPage = 1; GlobalParams.startIndex = 0; GlobalParams.Condition = "subject='java' or subject='Java'"; if (showShare.IsChecked == true) { GlobalParams.SqlShowShare = " UNION SELECT * FROM question WHERE share=0 and " + GlobalParams.Condition; } else { GlobalParams.SqlShowShare = ""; } //sqlStr = "select * from question where subject='java' or subject='Java' limit 0,25"; UserQuestionAdmin userQuestionAdmin = new UserQuestionAdmin(); questionAdmin.Content = userQuestionAdmin; } else if (selectSubject == "C#" || selectSubject == "c#") { GlobalParams.ThisPage = 1; GlobalParams.startIndex = 0; GlobalParams.Condition = "subject='c#' or subject='C#'"; if (showShare.IsChecked == true) { GlobalParams.SqlShowShare = " UNION SELECT * FROM question WHERE share=0 and " + GlobalParams.Condition; } else { GlobalParams.SqlShowShare = ""; } //sqlStr = "select * from question where subject='java' or subject='Java' limit 0,25"; UserQuestionAdmin userQuestionAdmin = new UserQuestionAdmin(); questionAdmin.Content = userQuestionAdmin; } else { GlobalParams.ThisPage = 1; GlobalParams.startIndex = 0; GlobalParams.Condition = "subject='" + selectSubject + "'"; if (showShare.IsChecked == true) { GlobalParams.SqlShowShare = " UNION SELECT * FROM question WHERE share=0 and " + GlobalParams.Condition; } else { GlobalParams.SqlShowShare = ""; } //sqlStr = "select * from question where subject='" + selectSubject + "' limit 0,25"; UserQuestionAdmin userQuestionAdmin = new UserQuestionAdmin(); questionAdmin.Content = userQuestionAdmin; //MessageBox.Show(sqlStr); } } else { GlobalParams.ThisPage = 1; GlobalParams.startIndex = 0; GlobalParams.Condition = "true"; if (showShare.IsChecked == true) { GlobalParams.SqlShowShare = " UNION SELECT * FROM question WHERE share=0 and " + GlobalParams.Condition; } else { GlobalParams.SqlShowShare = ""; } //sqlStr = "select * from question"; UserQuestionAdmin userQuestionAdmin = new UserQuestionAdmin(); questionAdmin.Content = userQuestionAdmin; } } start++; }