Add the ability to log out

This commit is contained in:
Tim Young 2017-08-12 10:34:43 -05:00
parent c905a5a952
commit 68bdd59727
3 changed files with 65 additions and 29 deletions

View File

@ -45,6 +45,9 @@
this.classSetupToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.classSetupToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.profileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.profileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.addToClassworkToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addToClassworkToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.updateClassworkToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.submitHomeworkToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.markAsGradedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.allToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.allToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.dHCPRequestToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.dHCPRequestToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.clearArpTableToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.clearArpTableToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -83,9 +86,7 @@
this.HelpPanel = new System.Windows.Forms.Panel(); this.HelpPanel = new System.Windows.Forms.Panel();
this.cbViewTitles = new System.Windows.Forms.CheckBox(); this.cbViewTitles = new System.Windows.Forms.CheckBox();
this.myProgressBar = new System.Windows.Forms.ProgressBar(); this.myProgressBar = new System.Windows.Forms.ProgressBar();
this.updateClassworkToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.logoutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.submitHomeworkToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.markAsGradedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.msMainMenuStrip.SuspendLayout(); this.msMainMenuStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pbNetworkView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pbNetworkView)).BeginInit();
this.HelpPanel.SuspendLayout(); this.HelpPanel.SuspendLayout();
@ -114,6 +115,7 @@
this.loadToolStripMenuItem, this.loadToolStripMenuItem,
this.reloadToolStripMenuItem, this.reloadToolStripMenuItem,
this.saveToolStripMenuItem, this.saveToolStripMenuItem,
this.logoutToolStripMenuItem,
this.exitToolStripMenuItem}); this.exitToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(44, 24); this.fileToolStripMenuItem.Size = new System.Drawing.Size(44, 24);
@ -122,35 +124,35 @@
// newToolStripMenuItem // newToolStripMenuItem
// //
this.newToolStripMenuItem.Name = "newToolStripMenuItem"; this.newToolStripMenuItem.Name = "newToolStripMenuItem";
this.newToolStripMenuItem.Size = new System.Drawing.Size(131, 26); this.newToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
this.newToolStripMenuItem.Text = "New"; this.newToolStripMenuItem.Text = "New";
this.newToolStripMenuItem.Click += new System.EventHandler(this.newToolStripMenuItem_Click); this.newToolStripMenuItem.Click += new System.EventHandler(this.newToolStripMenuItem_Click);
// //
// loadToolStripMenuItem // loadToolStripMenuItem
// //
this.loadToolStripMenuItem.Name = "loadToolStripMenuItem"; this.loadToolStripMenuItem.Name = "loadToolStripMenuItem";
this.loadToolStripMenuItem.Size = new System.Drawing.Size(131, 26); this.loadToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
this.loadToolStripMenuItem.Text = "Load"; this.loadToolStripMenuItem.Text = "Load";
this.loadToolStripMenuItem.Click += new System.EventHandler(this.loadToolStripMenuItem_Click); this.loadToolStripMenuItem.Click += new System.EventHandler(this.loadToolStripMenuItem_Click);
// //
// reloadToolStripMenuItem // reloadToolStripMenuItem
// //
this.reloadToolStripMenuItem.Name = "reloadToolStripMenuItem"; this.reloadToolStripMenuItem.Name = "reloadToolStripMenuItem";
this.reloadToolStripMenuItem.Size = new System.Drawing.Size(131, 26); this.reloadToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
this.reloadToolStripMenuItem.Text = "Reload"; this.reloadToolStripMenuItem.Text = "Reload";
this.reloadToolStripMenuItem.Click += new System.EventHandler(this.reloadToolStripMenuItem_Click); this.reloadToolStripMenuItem.Click += new System.EventHandler(this.reloadToolStripMenuItem_Click);
// //
// saveToolStripMenuItem // saveToolStripMenuItem
// //
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
this.saveToolStripMenuItem.Size = new System.Drawing.Size(131, 26); this.saveToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
this.saveToolStripMenuItem.Text = "Save"; this.saveToolStripMenuItem.Text = "Save";
this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click); this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click);
// //
// exitToolStripMenuItem // exitToolStripMenuItem
// //
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(131, 26); this.exitToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
this.exitToolStripMenuItem.Text = "Exit"; this.exitToolStripMenuItem.Text = "Exit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
// //
@ -232,6 +234,27 @@
this.addToClassworkToolStripMenuItem.Text = "Add To Classwork"; this.addToClassworkToolStripMenuItem.Text = "Add To Classwork";
this.addToClassworkToolStripMenuItem.Click += new System.EventHandler(this.addToClassworkToolStripMenuItem_Click); this.addToClassworkToolStripMenuItem.Click += new System.EventHandler(this.addToClassworkToolStripMenuItem_Click);
// //
// updateClassworkToolStripMenuItem
//
this.updateClassworkToolStripMenuItem.Name = "updateClassworkToolStripMenuItem";
this.updateClassworkToolStripMenuItem.Size = new System.Drawing.Size(208, 26);
this.updateClassworkToolStripMenuItem.Text = "Update Classwork";
this.updateClassworkToolStripMenuItem.Click += new System.EventHandler(this.updateClassworkToolStripMenuItem_Click);
//
// submitHomeworkToolStripMenuItem
//
this.submitHomeworkToolStripMenuItem.Name = "submitHomeworkToolStripMenuItem";
this.submitHomeworkToolStripMenuItem.Size = new System.Drawing.Size(208, 26);
this.submitHomeworkToolStripMenuItem.Text = "Submit Homework";
this.submitHomeworkToolStripMenuItem.Click += new System.EventHandler(this.submitHomeworkToolStripMenuItem_Click);
//
// markAsGradedToolStripMenuItem
//
this.markAsGradedToolStripMenuItem.Name = "markAsGradedToolStripMenuItem";
this.markAsGradedToolStripMenuItem.Size = new System.Drawing.Size(208, 26);
this.markAsGradedToolStripMenuItem.Text = "Mark As Graded";
this.markAsGradedToolStripMenuItem.Click += new System.EventHandler(this.markAsGradedToolStripMenuItem_Click);
//
// allToolStripMenuItem // allToolStripMenuItem
// //
this.allToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.allToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -586,26 +609,12 @@
this.myProgressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous; this.myProgressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
this.myProgressBar.TabIndex = 11; this.myProgressBar.TabIndex = 11;
// //
// updateClassworkToolStripMenuItem // logoutToolStripMenuItem
// //
this.updateClassworkToolStripMenuItem.Name = "updateClassworkToolStripMenuItem"; this.logoutToolStripMenuItem.Name = "logoutToolStripMenuItem";
this.updateClassworkToolStripMenuItem.Size = new System.Drawing.Size(208, 26); this.logoutToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
this.updateClassworkToolStripMenuItem.Text = "Update Classwork"; this.logoutToolStripMenuItem.Text = "Logout";
this.updateClassworkToolStripMenuItem.Click += new System.EventHandler(this.updateClassworkToolStripMenuItem_Click); this.logoutToolStripMenuItem.Click += new System.EventHandler(this.logoutToolStripMenuItem_Click);
//
// submitHomeworkToolStripMenuItem
//
this.submitHomeworkToolStripMenuItem.Name = "submitHomeworkToolStripMenuItem";
this.submitHomeworkToolStripMenuItem.Size = new System.Drawing.Size(208, 26);
this.submitHomeworkToolStripMenuItem.Text = "Submit Homework";
this.submitHomeworkToolStripMenuItem.Click += new System.EventHandler(this.submitHomeworkToolStripMenuItem_Click);
//
// markAsGradedToolStripMenuItem
//
this.markAsGradedToolStripMenuItem.Name = "markAsGradedToolStripMenuItem";
this.markAsGradedToolStripMenuItem.Size = new System.Drawing.Size(208, 26);
this.markAsGradedToolStripMenuItem.Text = "Mark As Graded";
this.markAsGradedToolStripMenuItem.Click += new System.EventHandler(this.markAsGradedToolStripMenuItem_Click);
// //
// BuilderWindow // BuilderWindow
// //
@ -700,6 +709,7 @@
private System.Windows.Forms.ToolStripMenuItem updateClassworkToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem updateClassworkToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem submitHomeworkToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem submitHomeworkToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem markAsGradedToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem markAsGradedToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem logoutToolStripMenuItem;
} }
} }

View File

@ -397,12 +397,15 @@ namespace EduNetworkBuilder
{ {
classSetupToolStripMenuItem.Visible = true; classSetupToolStripMenuItem.Visible = true;
profileToolStripMenuItem.Visible = false; profileToolStripMenuItem.Visible = false;
logoutToolStripMenuItem.Visible = false;
this.Text = NB.Translate("NB_Form", OurSettings); //From up above
} }
else else
{ {
logoutToolStripMenuItem.Visible = true;
profileToolStripMenuItem.Visible = true; profileToolStripMenuItem.Visible = true;
classSetupToolStripMenuItem.Visible = false; classSetupToolStripMenuItem.Visible = false;
this.Text = "EduNetworkBuilder : " + CurrentUser.FullName; this.Text = NB.Translate("NB_Form", OurSettings) + " : " + CurrentUser.FullName;
} }
if (CurrentUser == null || !CurrentUser.isAdmin) if (CurrentUser == null || !CurrentUser.isAdmin)
{ {
@ -2065,5 +2068,24 @@ namespace EduNetworkBuilder
UpdateMenu(); UpdateMenu();
} }
private void logoutToolStripMenuItem_Click(object sender, EventArgs e)
{
if (CurrentUser == null) return; //Nobody to logout
DialogResult answer = MessageBox.Show(NB.Translate("NB_Logout"), NB.Translate("NB_Logout"),MessageBoxButtons.YesNoCancel);
if (answer != DialogResult.Yes) return;
//Save current user
CurrentUser.Save(true); //Save it and rotate it
//Get rid of the current project. This way we keep them from logging out, and then exporting the homework
PrepForLoad();
//set current user to null
CurrentUser = null;
//rebuild menu
UpdateMenu();
}
} }
} }

View File

@ -1881,6 +1881,10 @@
<value>Name already exists.</value> <value>Name already exists.</value>
<comment>PC_HWHasName = Name already exists.</comment> <comment>PC_HWHasName = Name already exists.</comment>
</data> </data>
<data name="NB_Logout" xml:space="preserve">
<value>Log out?</value>
<comment>NB_Logout = Log out?</comment>
</data>
<data name="N_PromptToSubmit" xml:space="preserve"> <data name="N_PromptToSubmit" xml:space="preserve">
<value>You have completed the homework. Would you like to submit it? If you want to clean it up and submit later, click No. Go to "Edit" -&gt; "Submit" when you want to submit it.</value> <value>You have completed the homework. Would you like to submit it? If you want to clean it up and submit later, click No. Go to "Edit" -&gt; "Submit" when you want to submit it.</value>
<comment>N_PromptToSubmit = You have completed the homework. Would you like to submit it? If you want to clean it up and submit later, click No. Go to "Edit" -&gt; "Submit" when you want to submit it.</comment> <comment>N_PromptToSubmit = You have completed the homework. Would you like to submit it? If you want to clean it up and submit later, click No. Go to "Edit" -&gt; "Submit" when you want to submit it.</comment>