Database menu can now be accessed during database load.

This commit is contained in:
gb.luke 2010-07-06 18:41:11 +00:00
parent 00ab317c70
commit f4d321b377

View File

@ -58,7 +58,7 @@ namespace NUS_Downloader
private delegate void WriteStatusCallback(string Update); private delegate void WriteStatusCallback(string Update);
private delegate void BootChecksCallback(); private delegate void BootChecksCallback();
private delegate void SetEnableForDownloadCallback(bool enabled); private delegate void SetEnableForDownloadCallback(bool enabled);
private delegate void SetTextThreadSafeCallback(System.Windows.Forms.Control what, string setto); private delegate void SetPropertyThreadSafeCallback(System.ComponentModel.Component what, object setto, string property);
// Images do not compare unless globalized... // Images do not compare unless globalized...
private Image green = Properties.Resources.bullet_green; private Image green = Properties.Resources.bullet_green;
@ -288,7 +288,7 @@ namespace NUS_Downloader
WriteStatus("Database.xml detected."); WriteStatus("Database.xml detected.");
WriteStatus(" - Version: " + version); WriteStatus(" - Version: " + version);
updateDatabaseToolStripMenuItem.Text = "Update Database"; updateDatabaseToolStripMenuItem.Text = "Update Database";
databaseButton.Enabled = false; //databaseButton.Enabled = false;
databaseButton.Text = "DB Loading"; databaseButton.Text = "DB Loading";
// Load it up... // Load it up...
this.fds.RunWorkerAsync(); this.fds.RunWorkerAsync();
@ -331,7 +331,7 @@ namespace NUS_Downloader
private void DoAllDatabaseyStuff_Completed(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e) private void DoAllDatabaseyStuff_Completed(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
{ {
this.databaseButton.Enabled = true; //this.databaseButton.Enabled = true;
this.databaseButton.Text = "Database..."; this.databaseButton.Text = "Database...";
if (this.KoreaMassUpdate.HasDropDownItems || this.PALMassUpdate.HasDropDownItems || this.NTSCMassUpdate.HasDropDownItems) if (this.KoreaMassUpdate.HasDropDownItems || this.PALMassUpdate.HasDropDownItems || this.NTSCMassUpdate.HasDropDownItems)
{ {
@ -848,14 +848,20 @@ namespace NUS_Downloader
} }
private void SetTextThreadSafe(System.Windows.Forms.Control what, string setto) private void SetTextThreadSafe(System.Windows.Forms.Control what, string setto)
{
SetPropertyThreadSafe(what, "Name", setto);
}
private void SetPropertyThreadSafe(System.ComponentModel.Component what, object setto, string property)
{ {
if (this.InvokeRequired) if (this.InvokeRequired)
{ {
SetTextThreadSafeCallback sttscb = new SetTextThreadSafeCallback(SetTextThreadSafe); SetPropertyThreadSafeCallback sptscb = new SetPropertyThreadSafeCallback(SetPropertyThreadSafe);
this.Invoke(sttscb, new object[] { what, setto }); this.Invoke(sptscb, new object[] { what, setto, property });
return; return;
} }
what.Text = setto; what.GetType().GetProperty(property).SetValue(what, setto, null);
//what.Text = setto;
} }
private void NUSDownloader_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) private void NUSDownloader_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
@ -1586,22 +1592,24 @@ namespace NUS_Downloader
/// </summary> /// </summary>
private void ClearDatabaseStrip() private void ClearDatabaseStrip()
{ {
SystemMenuList.DropDownItems.Clear(); object[] thingstoclear = new object[] {
IOSMenuList.DropDownItems.Clear(); SystemMenuList, IOSMenuList, WiiWareMenuList, VCMenuList,
WiiWareMenuList.DropDownItems.Clear();
// Now Virtual Console
C64MenuList, NeoGeoMenuList, NESMenuList,
SNESMenuList, N64MenuList, TurboGrafx16MenuList,
TurboGrafxCDMenuList, MSXMenuList, SegaMSMenuList,
GenesisMenuList, VCArcadeMenuList
};
// VC Games Sections... foreach (System.Windows.Forms.ToolStripMenuItem tsmiclear in thingstoclear)
C64MenuList.DropDownItems.Clear(); {
NeoGeoMenuList.DropDownItems.Clear(); if (tsmiclear.Name != "VCMenuList") // Don't clear the VC Menu...
NESMenuList.DropDownItems.Clear(); tsmiclear.DropDownItems.Clear();
SNESMenuList.DropDownItems.Clear();
N64MenuList.DropDownItems.Clear(); if (tsmiclear.OwnerItem != VCMenuList) // and don't disable the VC menu subparts...
TurboGrafx16MenuList.DropDownItems.Clear(); tsmiclear.Enabled = false;
TurboGrafxCDMenuList.DropDownItems.Clear(); }
MSXMenuList.DropDownItems.Clear();
SegaMSMenuList.DropDownItems.Clear();
GenesisMenuList.DropDownItems.Clear();
VCArcadeMenuList.DropDownItems.Clear();
} }
/// <summary> /// <summary>
@ -1733,6 +1741,23 @@ namespace NUS_Downloader
} }
AddToolStripItemToStrip(i, XMLToolStripItem, XMLAttributes); AddToolStripItemToStrip(i, XMLToolStripItem, XMLAttributes);
} }
// Now enable the specific toolbar
switch (XMLNodeTypes[i])
{
case "IOS":
//IOSMenuList.Enabled = true;
SetPropertyThreadSafe(IOSMenuList, true, "Enabled");
break;
case "SYS":
SetPropertyThreadSafe(SystemMenuList, true, "Enabled");
break;
case "VC":
SetPropertyThreadSafe(VCMenuList, true, "Enabled");
break;
case "WW":
SetPropertyThreadSafe(WiiWareMenuList, true, "Enabled");
break;
}
} }
} }
@ -2080,6 +2105,9 @@ namespace NUS_Downloader
if (this.InvokeRequired) if (this.InvokeRequired)
{ {
Debug.Write("TOLDYOUSO!"); Debug.Write("TOLDYOUSO!");
BootChecksCallback bcc = new BootChecksCallback(LoadRegionCodes);
this.Invoke(bcc);
return;
} }
XmlDocument xDoc = new XmlDocument(); XmlDocument xDoc = new XmlDocument();
xDoc.Load("database.xml"); xDoc.Load("database.xml");
@ -2518,7 +2546,7 @@ namespace NUS_Downloader
{ {
WriteStatus("Database successfully created!"); WriteStatus("Database successfully created!");
databaseButton.Visible = true; databaseButton.Visible = true;
databaseButton.Enabled = false; //databaseButton.Enabled = false;
updateDatabaseToolStripMenuItem.Text = "Download Database"; updateDatabaseToolStripMenuItem.Text = "Download Database";
} }
else else