Ejemplo n.º 1
0
        // Internal Calls to Model
        public void AddSubsprite()
        {
            ImageIO imgIO = new ImageIO();

            imgIO.OpenDiag.Filter      = "Image Files (.png, .jpg, .bmp)|*.png;*.jpg;*.bmp";
            imgIO.OpenDiag.Multiselect = true;

            if (imgIO.CreateOpenDialog() != null)
            {
                string[] selectedSubs = imgIO.OpenDiag.FileNames;

                List <Subsprite> toAdd = new List <Subsprite>();

                for (int i = 0; i < selectedSubs.Length; i++)
                {
                    Subsprite tempSub = new Subsprite(selectedSubs[i]);
                    tempSub.DeriveNameFromSource();

                    SubspriteList.Add(new SubspriteViewmodel(tempSub));

                    // Queue this to be added to the packer's list
                    toAdd.Add(tempSub);
                }

                // add things to the packer's list
                for (int i = 0; i < toAdd.Count; i++)
                {
                    PackerMan.SubspriteList.Add(toAdd[i]);
                }
            }

            // User didn't select anything, just stop
            else
            {
                return;
            }
        }