Will now save and default to the last format path that was entered.

This commit is contained in:
2020-02-21 19:09:08 +00:00
parent 9cbfb4cb84
commit c962d8785a
3 changed files with 32 additions and 10 deletions

View File

@@ -19,9 +19,15 @@ namespace Formats
private void SetDefaults()
{
string curFolder = Environment.CurrentDirectory; // C:\development/PROMS/Formats/bin/debug
int idx = curFolder.ToUpper().IndexOf(@"\PROMS\");
txbxPROMSFormatsPath.Text = curFolder.Substring(0, idx);
string savedFormatPath = Properties.Settings.Default.FormatPath ?? ""; // Get the last saved format copy path
if (savedFormatPath.Length > 0)
txbxPROMSFormatsPath.Text = savedFormatPath;
else
{
string curFolder = Environment.CurrentDirectory; // C:\development/PROMS/Formats/bin/debug
int idx = curFolder.ToUpper().IndexOf(@"\PROMS\");
txbxPROMSFormatsPath.Text = curFolder.Substring(0, idx);
}
}
// This will create the folders if they don't exist or clear the contents if they do.
@@ -139,6 +145,8 @@ namespace Formats
if (fio.Exists && fio.IsReadOnly) fio.IsReadOnly = false;
}
}
Properties.Settings.Default.FormatPath = txbxPROMSFormatsPath.Text.Substring(0,txbxPROMSFormatsPath.Text.Length-1); // save the copy format path minus the ending backslash
Properties.Settings.Default.Save();
if(MessageBox.Show("Do you want to end the Format Copier?","Formats Copied.", MessageBoxButtons.YesNo, MessageBoxIcon.Question)== DialogResult.Yes)Application.Exit();
}