diff --git a/SpriteLibrary/SpriteDatabase.cs b/SpriteLibrary/SpriteDatabase.cs index 278d5a1..aca30d7 100644 --- a/SpriteLibrary/SpriteDatabase.cs +++ b/SpriteLibrary/SpriteDatabase.cs @@ -81,6 +81,17 @@ namespace SpriteLibrary return false; } + public void OpenEditWindow(int FirstItemIndex=-1) + { + SpriteEntryForm SEF = new SpriteEntryForm(myResourceManager, SpriteInfoList); + SEF.ShowDialog(); + //Use the updated list returned from the form. + SpriteInfoList.Clear(); + SpriteInfoList.AddRange(SEF.GetUpdatedList()); + } + #endregion + + #region General Functions public Image GetImageFromName(string Name, bool UseSmartImages) { Image MyImage = null; diff --git a/SpriteLibrary/SpriteEntryForm.cs b/SpriteLibrary/SpriteEntryForm.cs index a5514ad..e3d3349 100644 --- a/SpriteLibrary/SpriteEntryForm.cs +++ b/SpriteLibrary/SpriteEntryForm.cs @@ -18,33 +18,41 @@ using System.Collections; namespace SpriteLibrary { - public partial class SpriteEntryForm : Form + internal partial class SpriteEntryForm : Form { SpriteController MyController; ResourceManager myResources = null; + List SpriteInformation = new List(); - public SpriteEntryForm(ResourceManager theResourceManager) + internal SpriteEntryForm(ResourceManager theResourceManager, List ListToWorkOn) { InitializeComponent(); + if (theResourceManager == null) throw new Exception("NullException: The ResourceManager passed to the SpriteEntryForm cannot be null. Pass it Properties.Resources.ResourceManager"); myResources = theResourceManager; LocalSetup(); + SpriteInformation.AddRange(ListToWorkOn); } - public void LocalSetup() + private void LocalSetup() { pbImageField.BackgroundImageLayout = ImageLayout.Stretch; MyController = new SpriteController(pbImageField); PopulateMenu(); } - public void PopulateMenu() + internal List GetUpdatedList() { - ResourceManager rm = Properties.Resources.ResourceManager; - if (myResources != null) rm = myResources; + return SpriteInformation; + } + + private void PopulateMenu() + { + ResourceManager rm = myResources; PopulateMenu(rm); } - public void PopulateMenu(ResourceManager rm) + + private void PopulateMenu(ResourceManager rm) { if (myResources == null) myResources = rm; ResourceSet RS = rm.GetResourceSet(System.Globalization.CultureInfo.CurrentCulture, true, true);