Hide unnecessary tabs when cycling through homework

This commit is contained in:
Tim Young 2017-08-01 21:09:05 -05:00
parent d19b6ea938
commit ebf1a6b04e
2 changed files with 63 additions and 13 deletions

View File

@ -38,7 +38,6 @@
this.TabClasswork = new System.Windows.Forms.TabPage();
this.tcTreeData = new System.Windows.Forms.TabControl();
this.tabClass = new System.Windows.Forms.TabPage();
this.btnImportStudents = new System.Windows.Forms.Button();
this.TabHomework = new System.Windows.Forms.TabPage();
this.btnLaunch = new System.Windows.Forms.Button();
this.btnHWDelete = new System.Windows.Forms.Button();
@ -62,6 +61,7 @@
this.lblStudentFullName = new System.Windows.Forms.Label();
this.btnStudentChangePassword = new System.Windows.Forms.Button();
this.btnStudentUpdateFile = new System.Windows.Forms.Button();
this.btnImportStudents = new System.Windows.Forms.Button();
this.tcTabControl.SuspendLayout();
this.TabProfile.SuspendLayout();
this.TabClasswork.SuspendLayout();
@ -178,16 +178,6 @@
this.tabClass.Text = "Class";
this.tabClass.UseVisualStyleBackColor = true;
//
// btnImportStudents
//
this.btnImportStudents.Location = new System.Drawing.Point(6, 6);
this.btnImportStudents.Name = "btnImportStudents";
this.btnImportStudents.Size = new System.Drawing.Size(152, 23);
this.btnImportStudents.TabIndex = 0;
this.btnImportStudents.Text = "Import Students";
this.btnImportStudents.UseVisualStyleBackColor = true;
this.btnImportStudents.Click += new System.EventHandler(this.btnImportStudents_Click);
//
// TabHomework
//
this.TabHomework.Controls.Add(this.btnLaunch);
@ -410,6 +400,15 @@
this.btnStudentUpdateFile.Text = "Update File";
this.btnStudentUpdateFile.UseVisualStyleBackColor = true;
//
// btnImportStudents
//
this.btnImportStudents.Location = new System.Drawing.Point(6, 6);
this.btnImportStudents.Name = "btnImportStudents";
this.btnImportStudents.Size = new System.Drawing.Size(152, 23);
this.btnImportStudents.TabIndex = 2;
this.btnImportStudents.Text = "Import Students";
this.btnImportStudents.UseVisualStyleBackColor = true;
//
// PersonProfileForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
@ -460,7 +459,6 @@
private System.Windows.Forms.TextBox tbHWSubmitted;
private System.Windows.Forms.Label lblHWDue;
private System.Windows.Forms.DateTimePicker dtpHWDue;
private System.Windows.Forms.Button btnImportStudents;
private System.Windows.Forms.Button btnHWDelete;
private System.Windows.Forms.Button btnLaunch;
private System.Windows.Forms.TabPage TabStudent;
@ -470,5 +468,6 @@
private System.Windows.Forms.TextBox tbStudentUsername;
private System.Windows.Forms.Button btnStudentUpdateFile;
private System.Windows.Forms.Button btnStudentChangePassword;
private System.Windows.Forms.Button btnImportStudents;
}
}

View File

@ -300,8 +300,59 @@ namespace EduNetworkBuilder
private void ChangeTreeDataTab(TreeDataTab WhatTo)
{
foreach (TreeDataTab one in Enum.GetValues(typeof(TreeDataTab)))
{
if (one == WhatTo) ShowTabPage(one);
else HideTabPage(one);
}
tcTabControl.SelectedIndex = (int)TopTab.classworktab;
tcTreeData.SelectedIndex = (int)WhatTo;
//Now there is just one tab. Select it
//tcTreeData.SelectedIndex = (int)WhatTo;
tcTreeData.SelectedIndex = 0;
}
private void HideTabPage(TreeDataTab What)
{
TabPage Tab = null;
switch(What)
{
case TreeDataTab.classtab:
Tab = tabClass;
break;
case TreeDataTab.homeworktab:
Tab = TabHomework;
break;
case TreeDataTab.studentstab:
Tab = TabStudents;
break;
case TreeDataTab.studenttab:
Tab = TabStudent;
break;
}
if(tcTreeData.TabPages.Contains(Tab))
tcTreeData.TabPages.Remove(Tab);
}
private void ShowTabPage(TreeDataTab What)
{
TabPage Tab = null;
switch (What)
{
case TreeDataTab.classtab:
Tab = tabClass;
break;
case TreeDataTab.homeworktab:
Tab = TabHomework;
break;
case TreeDataTab.studentstab:
Tab = TabStudents;
break;
case TreeDataTab.studenttab:
Tab = TabStudent;
break;
}
if (!tcTreeData.TabPages.Contains(Tab))
tcTreeData.TabPages.Add(Tab);
}
private void tvClasswork_Click(object sender, EventArgs e)