Esempio n. 1
0
        private void initCurrentProject()
        {
            var project = new Project
                {
                    ApplicationVersionCode = 1,
                    ApplicationVersionName = "Version 1",
                    DeviceName = "Device1",
                    ProjectName = "Project1",
                    ScreenHeight = 800,
                    ScreenWidth = 480,
                    PlatformVersion = "7.1.1",
                    Platform = "Windows Phone 7.5"
                };

            // TODO: implement other design data here

            var sprites = new SpriteList(project);
            var sprite = new Sprite(project);
            sprite.Name = "Object 1";

            sprite.Costumes = new CostumeList(sprite);
            var costume = new Costume("Cat", sprite);
            var image = new byte[0]; //new BitmapImage(new Uri(costume.FileName, UriKind.Relative)); // TODO: fix me
            //costume.Image = image;
            sprite.Costumes.Costumes.Add(costume);

            sprite.Sounds = new SoundList(sprite);
            var sound = new Sound("Miau_Sound", sprite);
            sprite.Sounds.Sounds.Add(sound);

            sprite.Scripts = new ScriptList(sprite);
            Script startScript = new StartScript(sprite);

            startScript.Bricks = new BrickList(sprite);
            var setCostumeBrick = new SetCostumeBrick(sprite);
            var costumeRef = new CostumeReference(sprite);
            costumeRef.Costume = costume;
            //setCostumeBrick.Costume = costumeRef;

            //TODO: Add more Bricks if you need them

            sprites.Sprites.Add(sprite);

            currentProject = project;
        }
Esempio n. 2
0
        public DataObject Copy(Sprite parent)
        {
            var newSoundInfo = new Sound(name, parent);

            string path = CatrobatContext.Instance.CurrentProject.BasePath + "/" + Project.SoundsPath + "/";
            string absoluteFileNameOld = path + fileName;
            string absoluteFileNameNew = path + newSoundInfo.fileName;

            using (IStorage storage = StorageSystem.GetStorage())
            {
                //if (storage.FileExists(absoluteFileNameOld))
                storage.CopyFile(absoluteFileNameOld, absoluteFileNameNew);
                //else
                //  MessageBox.Show("Der Klang konnte nicht kopiert werden.", "Kopieren nicht möglich", MessageBoxButton.OK); // TODO: is this used? names should be unique
            }

            return newSoundInfo;
        }
Esempio n. 3
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     Sound = null;
       NavigationService.GoBack();
 }
Esempio n. 4
0
        //TODO: Write UI Test
        private void btnSave_Click(object sender, EventArgs e)
        {
            Sound sound = new Sound(txtName.Text, editorViewModel.SelectedSprite);

              string absoluteFileName = CatrobatContext.Instance.CurrentProject.BasePath + "/sounds/" + sound.FileName;

              using (IStorage storage = StorageSystem.GetStorage())
              {
            using (var stream = storage.OpenFile(absoluteFileName, StorageFileMode.Create, StorageFileAccess.Write))
            {
              //TODO: write song to isolated storage
            }
              }

              editorViewModel.SelectedSprite.Sounds.Sounds.Add(sound);
              NavigationService.RemoveBackEntry();
              NavigationService.GoBack();
        }
Esempio n. 5
0
 internal override void LoadFromXML(XElement xRoot)
 {
     reference = xRoot.Attribute("reference").Value;
     Sound = XPathHelper.getElement(reference, sprite) as Sound;
 }
 public void CleanUpSoundReferences(Sound deletedSound, Sprite selectedSprite)
 {
     foreach (Script script in selectedSprite.Scripts.Scripts)
     foreach (Brick brick in script.Bricks.Bricks)
       if (brick is PlaySoundBrick)
     (brick as PlaySoundBrick).UpdateReference();
 }
Esempio n. 7
0
        private void DeleteSoundAction(Sound sound)
        {
            sound.Delete();

              SoundList soundList = SelectedSprite.Sounds;
              soundList.Sounds.Remove(sound);

              CatrobatContext.Instance.CleanUpSoundReferences(sound, sound.Sprite);
        }