Ejemplo n.º 1
0
        private void HandleAtlasCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            ////////////////////////////// Early out:////////////////////////////
            if (ViewModel.SuppressChangedEvents)
            {
                return;
            }
            ////////////////////////////// End early out////////////////////////////

            var shouldSave = false;

            if (e.Action == NotifyCollectionChangedAction.Add)
            {
                var whatWasAdded = e.NewItems[0] as AtlasViewModel;

                string folderToAdd = whatWasAdded.Folder;

                loadedFile.AddAtlas(folderToAdd);

                shouldSave = true;
            }
            else if (e.Action == NotifyCollectionChangedAction.Remove)
            {
                // Someone: Check this when deletion is supported:
                var whatWasRemoved = e.OldItems[0] as AtlasViewModel;

                string folderToRemove = whatWasRemoved.Folder;

                loadedFile.RemoveAtlas(folderToRemove);

                shouldSave = true;
            }
            else if (e.Action == NotifyCollectionChangedAction.Reset)
            {
                loadedFile.ClearAtlases();
                shouldSave = true;
            }
            else
            {
                throw new NotImplementedException();
            }

            if (shouldSave)
            {
                var fileName = GlueCommands.Self.GetAbsoluteFileName(referencedFileSave);

                loadedFile.Save(fileName);
            }
        }
Ejemplo n.º 2
0
        public void CreateNewProject()
        {
            var newTps = new TpsFileSave();

            newTps.SetDefaultValues();

            string fileName = AtlasFolder + "TexturePackerProject.tps";

            newTps.Save(fileName);

            bool userCancelled = false;

            // Select the Global Content tree node to add the file there:
            GlueState.Self.CurrentTreeNode = FlatRedBall.Glue.FormHelpers.ElementViewWindow.GlobalContentFileNode;


            var rfs = FlatRedBall.Glue.FormHelpers.RightClickHelper.AddSingleFile(
                fileName, ref userCancelled);

            GlueState.Self.CurrentReferencedFileSave = rfs;
        }
Ejemplo n.º 3
0
        public void CreateNewProject()
        {
            var newTps = new TpsFileSave();
            newTps.SetDefaultValues();

            string fileName = AtlasFolder + "TexturePackerProject.tps";

            newTps.Save(fileName);

            bool userCancelled = false;

            // Select the Global Content tree node to add the file there:
            GlueState.Self.CurrentTreeNode = FlatRedBall.Glue.FormHelpers.ElementViewWindow.GlobalContentFileNode;


            var rfs = FlatRedBall.Glue.FormHelpers.RightClickHelper.AddSingleFile(
                    fileName, ref userCancelled);

            GlueState.Self.CurrentReferencedFileSave = rfs;


        }