Added logic so that FormatUpdate doesn’t work in production mode

Added Folder Browser to select Format Folder
Added FormatFolder setting to update formats
This commit is contained in:
Rich 2012-04-20 15:17:38 +00:00
parent ed896b70c1
commit 31b5ba8c7b
5 changed files with 40 additions and 3 deletions

View File

@ -137,6 +137,9 @@
<setting name="LastVersion" serializeAs="String"> <setting name="LastVersion" serializeAs="String">
<value>0.0</value> <value>0.0</value>
</setting> </setting>
<setting name="FormatPath" serializeAs="String">
<value>C:\Development</value>
</setting>
</VEPROMS.Properties.Settings> </VEPROMS.Properties.Settings>
<UISampleNetBar1.Properties.Settings> <UISampleNetBar1.Properties.Settings>
<setting name="ShowDefaultFolderProp" serializeAs="String"> <setting name="ShowDefaultFolderProp" serializeAs="String">

View File

@ -267,5 +267,17 @@ namespace VEPROMS.Properties {
this["LastVersion"] = value; this["LastVersion"] = value;
} }
} }
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("C:\\Development")]
public string FormatPath {
get {
return ((string)(this["FormatPath"]));
}
set {
this["FormatPath"] = value;
}
}
} }
} }

View File

@ -65,5 +65,8 @@
<Setting Name="LastVersion" Type="System.String" Scope="User"> <Setting Name="LastVersion" Type="System.String" Scope="User">
<Value Profile="(Default)">0.0</Value> <Value Profile="(Default)">0.0</Value>
</Setting> </Setting>
<Setting Name="FormatPath" Type="System.String" Scope="User">
<Value Profile="(Default)">C:\Development</Value>
</Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>

View File

@ -114,6 +114,7 @@ namespace VEPROMS
this.buttonItem1 = new DevComponents.DotNetBar.ButtonItem(); this.buttonItem1 = new DevComponents.DotNetBar.ButtonItem();
this.itemAnnotationsBindingSource = new System.Windows.Forms.BindingSource(this.components); this.itemAnnotationsBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.tc = new Volian.Controls.Library.DisplayTabControl(); this.tc = new Volian.Controls.Library.DisplayTabControl();
this.fbd = new System.Windows.Forms.FolderBrowserDialog();
((System.ComponentModel.ISupportInitialize)(this.bottomBar)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.bottomBar)).BeginInit();
this.bottomBar.SuspendLayout(); this.bottomBar.SuspendLayout();
this.epAnnotations.SuspendLayout(); this.epAnnotations.SuspendLayout();
@ -1434,6 +1435,7 @@ namespace VEPROMS
private DevComponents.DotNetBar.TabItem infotabHistory; private DevComponents.DotNetBar.TabItem infotabHistory;
private Volian.Controls.Library.DisplayHistory displayHistory; private Volian.Controls.Library.DisplayHistory displayHistory;
private DevComponents.DotNetBar.ButtonItem btnUpdateFormats; private DevComponents.DotNetBar.ButtonItem btnUpdateFormats;
private System.Windows.Forms.FolderBrowserDialog fbd;
} }
} }

View File

@ -436,6 +436,9 @@ namespace VEPROMS
} }
else else
RunAutomatic(); RunAutomatic();
// Shutoff UpdateFormats for Production Mode
if (Volian.Base.Library.VlnSettings.ProductionMode)
btnAdmin.Visible = false;
} }
void tmrShutDown_Tick(object sender, EventArgs e) void tmrShutDown_Tick(object sender, EventArgs e)
{ {
@ -1787,9 +1790,23 @@ namespace VEPROMS
} }
private void btnUpdateFormat_Click(object sender, EventArgs e) private void btnUpdateFormat_Click(object sender, EventArgs e)
{ {
string appPath = Application.ExecutablePath; DirectoryInfo di = new DirectoryInfo(Properties.Settings.Default.FormatPath);
FileInfo fi = new FileInfo(appPath); if (!di.Exists || !File.Exists(di.FullName + @"\fmtall") || !File.Exists(di.FullName + @"\genmacall"))
DirectoryInfo di = fi.Directory.Parent.Parent.Parent.Parent; {
while (!di.Exists || !Directory.Exists(di.FullName + @"\fmtall") || !Directory.Exists(di.FullName + @"\genmacall"))
{
fbd.Description = "Select folder containing FmtAll and GenMacAll folders to update formats";
DialogResult dr = fbd.ShowDialog();
if (dr == DialogResult.Cancel)
{
bottomProgBar.Text = "Format Update Cancelled";
return;
}
di = new DirectoryInfo(fbd.SelectedPath);
}
Properties.Settings.Default.FormatPath = fbd.SelectedPath;
Properties.Settings.Default.Save();
}
string fmtPath = di.FullName + @"\fmtall"; string fmtPath = di.FullName + @"\fmtall";
string genmacPath = di.FullName + @"\genmacall"; string genmacPath = di.FullName + @"\genmacall";
Format.FormatLoaded += new FormatEvent(Format_FormatLoaded); Format.FormatLoaded += new FormatEvent(Format_FormatLoaded);