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

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

View File

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -22,5 +22,17 @@ namespace Formats.Properties {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string FormatPath {
get {
return ((string)(this["FormatPath"]));
}
set {
this["FormatPath"] = value;
}
}
}
}

View File

@ -1,7 +1,9 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Formats.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="FormatPath" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>

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();
}