Choose a good image at the start of the window being opened.
This commit is contained in:
		| @@ -8,6 +8,7 @@ using System.Xml; | ||||
| using System.Xml.Serialization; | ||||
| using System.Resources; | ||||
| using System.IO; | ||||
| using System.Collections; | ||||
|  | ||||
| namespace SpriteLibrary | ||||
| { | ||||
| @@ -203,6 +204,25 @@ namespace SpriteLibrary | ||||
|             return MyImage; | ||||
|         } | ||||
|  | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Return a list of the image names in the Properties.Resources | ||||
|         /// </summary> | ||||
|         /// <returns></returns> | ||||
|         public List<string> GetImageNames() | ||||
|         { | ||||
|             List<string> Names = new List<string>(); | ||||
|             if (myResourceManager == null) return Names; | ||||
|             ResourceSet Rs = myResourceManager.GetResourceSet(System.Globalization.CultureInfo.CurrentCulture, true, true); | ||||
|             foreach (DictionaryEntry entry in Rs) | ||||
|             { | ||||
|                 string resourceKey = entry.Key.ToString(); //The name | ||||
|                 object resource = entry.Value; //The object itself | ||||
|                 if (resource is Image) Names.Add(resourceKey); | ||||
|             } | ||||
|             return Names; | ||||
|         } | ||||
|              | ||||
|         /// <summary> | ||||
|         /// This code is mostly handled by the sprite controller.  If the SpriteController has a SpriteDatabase | ||||
|         /// registered, then it will automatically ask the SpriteDatabase to create any sprite it does not already | ||||
|   | ||||
| @@ -261,11 +261,23 @@ namespace SpriteLibrary | ||||
|  | ||||
|         private void SetUpEmptyInfo() | ||||
|         { | ||||
|             string startingimage = cbStartingImage.Text; //grab whatever we were using last | ||||
|             Console.WriteLine("Setting up an empty info rec."); | ||||
|             if(startingimage == null || startingimage == "")//If we are not looking at anything yet | ||||
|             { | ||||
|                 List<string> ImageNames = myDatabase.GetImageNames(); | ||||
|                 if (ImageNames.Count > 0) | ||||
|                     startingimage = ImageNames[0]; | ||||
|                 foreach(string name in ImageNames) | ||||
|                     Console.WriteLine("  Name: " + name); | ||||
|             } | ||||
|             Console.WriteLine("NewName=" + startingimage); | ||||
|             TempInformation = new SpriteInfo(); | ||||
|             TempInformation.SpriteName = ""; | ||||
|             TempInformation.ViewPercent = 100; | ||||
|             AnimationInfo AI = new AnimationInfo(); | ||||
|             AI.AnimSpeed = 200; | ||||
|             AI.ImageName = startingimage; | ||||
|             AI.FieldsToUse = AnimationType.SpriteDefinition; | ||||
|             AI.Height = 100; | ||||
|             AI.Width = 100; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user