From 4b0b06fb655b279d86e98ca1f655a7f014549405 Mon Sep 17 00:00:00 2001 From: Tim Young Date: Sun, 9 Aug 2015 20:09:17 -0600 Subject: [PATCH] Added ctrl-s to save, and removed wireless ports showing mac addresses --- EduNetworkBuilder/Network.cs | 2 +- EduNetworkBuilder/NetworkBuilder.cs | 47 +++++++++++++------ EduNetworkBuilder/NetworkCard.cs | 2 +- EduNetworkBuilder/Resources/ReleaseNotes.rtf | 1 + .../Resources/languages/edustrings.resx | 4 ++ 5 files changed, 39 insertions(+), 17 deletions(-) diff --git a/EduNetworkBuilder/Network.cs b/EduNetworkBuilder/Network.cs index 9f23d0d..523f3ed 100644 --- a/EduNetworkBuilder/Network.cs +++ b/EduNetworkBuilder/Network.cs @@ -202,7 +202,7 @@ namespace EduNetworkBuilder public void Save() { - Save(@"C:\Users\tyoung\Desktop\Test.enbx"); + Save(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Test.enbx")); } public void Save(string filename) diff --git a/EduNetworkBuilder/NetworkBuilder.cs b/EduNetworkBuilder/NetworkBuilder.cs index 909d3f4..43b7677 100644 --- a/EduNetworkBuilder/NetworkBuilder.cs +++ b/EduNetworkBuilder/NetworkBuilder.cs @@ -163,6 +163,10 @@ namespace EduNetworkBuilder pbNetworkView_Delete_Click(sender, e); ItemClickedOn = null; } + if(e.KeyCode == Keys.S && e.Modifiers == Keys.Control) + { + doSave(true); + } //MessageBox.Show(e.KeyCode.ToString()); } @@ -882,24 +886,37 @@ namespace EduNetworkBuilder UpdateForm(); } + public void doSave(bool TrySkipPrompt = false) + { + if (TrySkipPrompt && myNetwork.NetworkFilename != null && File.Exists(myNetwork.NetworkFilename)) + { + //Just save over it + myNetwork.Save(myNetwork.NetworkFilename); + } + else + { + SaveFileDialog mydialog = new SaveFileDialog(); + mydialog.AddExtension = true; + mydialog.Filter = "EduNet File (*.enbx)|*.enbx"; + mydialog.FileName = myNetwork.NetworkFilename; + string initialfolder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); + if (myNetwork.NetworkFilename != "") + initialfolder = Path.GetDirectoryName(myNetwork.NetworkFilename); + mydialog.CreatePrompt = true; + mydialog.OverwritePrompt = true; + mydialog.InitialDirectory = initialfolder; + DialogResult result = mydialog.ShowDialog(); + + if (result == System.Windows.Forms.DialogResult.Cancel) return; + LastPath = mydialog.FileName; + myNetwork.Save(mydialog.FileName); + } + lblStatus.Text = NB.Translate("_Saved"); + } private void saveToolStripMenuItem_Click(object sender, EventArgs e) { - SaveFileDialog mydialog = new SaveFileDialog(); - mydialog.AddExtension = true; - mydialog.Filter = "EduNet File (*.enbx)|*.enbx"; - mydialog.FileName = myNetwork.NetworkFilename; - string initialfolder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); - if (myNetwork.NetworkFilename != "") - initialfolder = Path.GetDirectoryName(myNetwork.NetworkFilename); - mydialog.CreatePrompt = true; - mydialog.OverwritePrompt = true; - mydialog.InitialDirectory = initialfolder; - DialogResult result = mydialog.ShowDialog(); - - if (result == System.Windows.Forms.DialogResult.Cancel) return; - LastPath = mydialog.FileName; - myNetwork.Save(mydialog.FileName); + doSave(false); } private void BuilderWindow_Resize(object sender, EventArgs e) diff --git a/EduNetworkBuilder/NetworkCard.cs b/EduNetworkBuilder/NetworkCard.cs index c9ab84e..3db0809 100644 --- a/EduNetworkBuilder/NetworkCard.cs +++ b/EduNetworkBuilder/NetworkCard.cs @@ -152,7 +152,7 @@ namespace EduNetworkBuilder { string connected = " "; if (isConnected(true)) connected = "*"; - if (myNicType == NicType.port) + if (myNicType == NicType.port || myNicType == NicType.wport) return NicName() + connected; return NicName() + connected + " " + MAC; } diff --git a/EduNetworkBuilder/Resources/ReleaseNotes.rtf b/EduNetworkBuilder/Resources/ReleaseNotes.rtf index b27a905..b9ba8ee 100644 --- a/EduNetworkBuilder/Resources/ReleaseNotes.rtf +++ b/EduNetworkBuilder/Resources/ReleaseNotes.rtf @@ -2,6 +2,7 @@ {\*\generator Riched20 6.3.9600}\viewkind4\uc1 \pard\sa200\sl276\slmult1\f0\fs22\lang9 Version 1.0.20\par * wports do not display on tooltips or when printing the device info\par +* Added ctrl-s to quick-save a network we are working on\par Version 1.0.19 08/08/2015\par *Updated context help for most puzzles that introduce new ideas.\par * Sorted Help topics when adding them in net-tests.\par diff --git a/EduNetworkBuilder/Resources/languages/edustrings.resx b/EduNetworkBuilder/Resources/languages/edustrings.resx index 96aed68..9d9945f 100644 --- a/EduNetworkBuilder/Resources/languages/edustrings.resx +++ b/EduNetworkBuilder/Resources/languages/edustrings.resx @@ -705,4 +705,8 @@ Router Text used in the program on buttons and the like + + Saved + String used when we have successfully saved the network. + \ No newline at end of file