Return a spriteinfo list from the entry form

This commit is contained in:
Tim Young 2017-09-15 19:15:37 -05:00
parent 846d4b569f
commit 23814be473
2 changed files with 26 additions and 7 deletions

View File

@ -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;

View File

@ -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<SpriteInfo> SpriteInformation = new List<SpriteInfo>();
public SpriteEntryForm(ResourceManager theResourceManager)
internal SpriteEntryForm(ResourceManager theResourceManager, List<SpriteInfo> 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<SpriteInfo> 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);