private void menuClassNoItem_click(Object sender, EventArgs e) { MenuItem mi = (MenuItem)sender; bool flag = true; for (int i = MdiChildren.Length - 1; i > -1; i--) { if (this.MdiChildren[i].Text.Equals(mi.Text)) { if(this.MdiChildren[i] is FormClassNoTimeTable) { FormClassNoTimeTable aTT = (FormClassNoTimeTable)this.MdiChildren[i]; aTT.RefreshContent(); this.MdiChildren[i].WindowState = FormWindowState.Maximized; flag = false; } } } if (flag) { int akey = int.Parse(mi.Text.Split('.')[0]) ; FormClassNoTimeTable aTT = new FormClassNoTimeTable(mi.Text, new C_ClassNoTimeTable_for_Class(akey), new C_FormClassNoTimeTableDoubleClick_Class(akey),this); aTT.MdiParent = this; aTT.RefreshContent(); aTT.Show(); } }
private void txtInput_KeyPress(object sender,System.Windows.Forms.KeyPressEventArgs e) { if (e.KeyChar == 'D' || e.KeyChar == 'd') { TextBox tb = (TextBox)sender; int[] tempint = Basic_HTB_Info.TextBoxName2WeekLesson(tb); int weekno = tempint[0]; int lessno = tempint[1]; if (contr.GetGridCellSUID(weekno, lessno) > 0) { ; if (MessageBox.Show("delete " + contr.GetGridCellSUID(weekno, lessno).ToString() + contr.GridCellItemString(contr.GetGridCellSUID(weekno, lessno)), "", MessageBoxButtons.YesNo) == DialogResult.Yes) { if (Basic_HTB_Info.GetInstance().RemoveSubjectFromTimeTable(contr.GetGridCellSUID(weekno, lessno))) { RefreshContent(); MessageBox.Show("Deleted Success!"); } } } } else if (e.KeyChar == 'T' || e.KeyChar == 't') { TextBox tb = (TextBox)sender; int[] tempint = Basic_HTB_Info.TextBoxName2WeekLesson(tb); int weekno = tempint[0]; int lessno = tempint[1]; if (contr.GetGridCellSUID(weekno, lessno) > 0) { Basic_HTB_Info htb = Basic_HTB_Info.GetInstance(); int a_suid = contr.GetGridCellSUID(weekno, lessno); int akey =htb.unitkeyToTeachernos(a_suid)[0]; FormClassNoTimeTable aTT = new FormClassNoTimeTable(akey+"."+htb.htbIDTeacher[akey].ToString(), new C_ClassNoTimeTable_for_Teacher(akey), new C_FormClassNoTimeTableDoubleClick_Teacher(akey),mdi_p); aTT.MdiParent = mdi_p; aTT.RefreshContent(); aTT.Show(); } } else if (e.KeyChar == 'C' || e.KeyChar == 'c') { TextBox tb = (TextBox)sender; int[] tempint = Basic_HTB_Info.TextBoxName2WeekLesson(tb); int weekno = tempint[0]; int lessno = tempint[1]; if (contr.GetGridCellSUID(weekno, lessno) > 0) { Basic_HTB_Info htb = Basic_HTB_Info.GetInstance(); int a_suid = contr.GetGridCellSUID(weekno, lessno); int akey = htb.unitkeyToClassnos(a_suid)[0]; FormClassNoTimeTable aTT = new FormClassNoTimeTable(akey + "." + htb.htbIDClass[akey].ToString(), new C_ClassNoTimeTable_for_Class(akey), new C_FormClassNoTimeTableDoubleClick_Class(akey), mdi_p); aTT.MdiParent = mdi_p; aTT.RefreshContent(); aTT.Show(); } } else if (e.KeyChar == 'V' || e.KeyChar == 'v') { TextBox tb = (TextBox)sender; int[] tempint = Basic_HTB_Info.TextBoxName2WeekLesson(tb); int weekno = tempint[0]; int lessno = tempint[1]; Basic_HTB_Info htb = Basic_HTB_Info.GetInstance(); int a_suid = contr.GetGridCellSUID(weekno, lessno); contr.View_Color_DVG_For_ExchangeCell(this.tableLayoutPanel1, a_suid, weekno, lessno); } /* else if ((!Char.IsControl(e.KeyChar)) && ((e.KeyChar < '0') || (e.KeyChar > '9'))) { // MessageBox.Show("1"); e.Handled = true; } else { // MessageBox.Show("2"); */ }
private void menuAllClassNoItem_Click(Object sender, EventArgs e) { Basic_HTB_Info htbs = Basic_HTB_Info.GetInstance(); for (int classid = 1; classid <= htbs.htbIDClass.Count; classid++) { string formText = string.Format("{0}.{1}", classid, htbs.htbIDClass[classid]); bool flag = true; for (int i = MdiChildren.Length - 1; i > -1; i--) { if (this.MdiChildren[i].Text.Equals(formText)) { if (this.MdiChildren[i] is FormClassNoTimeTable) { FormClassNoTimeTable aTT = (FormClassNoTimeTable)this.MdiChildren[i]; aTT.RefreshContent(); this.MdiChildren[i].WindowState = FormWindowState.Maximized; flag = false; } } } if (flag) { int akey = classid; FormClassNoTimeTable aTT = new FormClassNoTimeTable(formText, new C_ClassNoTimeTable_for_Class(akey), new C_FormClassNoTimeTableDoubleClick_Class(akey),this); aTT.MdiParent = this; aTT.RefreshContent(); aTT.Show(); } } }