Added code to support automatic updating of formats at start-up via command line parameter

This commit is contained in:
Rich 2013-06-14 22:36:34 +00:00
parent ad2e39dc4d
commit 4847cf0f4b

View File

@ -221,6 +221,13 @@ namespace VEPROMS
ChangeLogFileName("LogFileAppender", Database.SelectedDatabase + " " + dtSunday.ToString("yyyyMMdd") + " ErrorLog.txt"); ChangeLogFileName("LogFileAppender", Database.SelectedDatabase + " " + dtSunday.ToString("yyyyMMdd") + " ErrorLog.txt");
_MyLog.InfoFormat("\r\nSession Beginning\r\n<===================== User: {0}/{1} Started {2} =====================>" _MyLog.InfoFormat("\r\nSession Beginning\r\n<===================== User: {0}/{1} Started {2} =====================>"
, Environment.UserDomainName,Environment.UserName, DateTime.Now.ToString("dddd MMMM d, yyyy h:mm:ss tt")); , Environment.UserDomainName,Environment.UserName, DateTime.Now.ToString("dddd MMMM d, yyyy h:mm:ss tt"));
foreach (string parameter in parameters)
{
if (parameter.ToUpper().StartsWith("/UF="))
UpdateFormats(parameter.Substring(4));
else if (parameter.ToUpper().StartsWith("/UF"))
UpdateFormats(null);
}
VETreeNode tn = VETreeNode.GetFolder(1); VETreeNode tn = VETreeNode.GetFolder(1);
tv.Nodes.Add(tn); tv.Nodes.Add(tn);
tv.NodePSI += new vlnTreeViewPSIEvent(tv_NodePSI); tv.NodePSI += new vlnTreeViewPSIEvent(tv_NodePSI);
@ -2097,6 +2104,13 @@ namespace VEPROMS
pg.Show(); pg.Show();
} }
private void btnUpdateFormat_Click(object sender, EventArgs e) private void btnUpdateFormat_Click(object sender, EventArgs e)
{
UpdateFormats(null);
}
private void UpdateFormats(string mypath)
{
if (mypath == null)
{ {
string fmtPath = Properties.Settings.Default.FormatPath ?? ""; string fmtPath = Properties.Settings.Default.FormatPath ?? "";
DirectoryInfo di = null; DirectoryInfo di = null;
@ -2115,8 +2129,10 @@ namespace VEPROMS
} while (((fmtPath ?? "") == "") || (!di.Exists || !Directory.Exists(di.FullName + @"\fmtall") || !Directory.Exists(di.FullName + @"\genmacall"))); } while (((fmtPath ?? "") == "") || (!di.Exists || !Directory.Exists(di.FullName + @"\fmtall") || !Directory.Exists(di.FullName + @"\genmacall")));
Properties.Settings.Default.FormatPath = fbd.SelectedPath; Properties.Settings.Default.FormatPath = fbd.SelectedPath;
Properties.Settings.Default.Save(); Properties.Settings.Default.Save();
string fmtPathAll = di.FullName + @"\fmtall"; mypath = di.FullName;
string genmacPathAll = di.FullName + @"\genmacall"; }
string fmtPathAll = mypath + @"\fmtall";
string genmacPathAll = mypath + @"\genmacall";
Format.FormatLoaded += new FormatEvent(Format_FormatLoaded); Format.FormatLoaded += new FormatEvent(Format_FormatLoaded);
Format.UpdateFormats(fmtPathAll, genmacPathAll); Format.UpdateFormats(fmtPathAll, genmacPathAll);
Format.FormatLoaded -= new FormatEvent(Format_FormatLoaded); Format.FormatLoaded -= new FormatEvent(Format_FormatLoaded);