Exemplo n.º 1
0
        public void OpenProject(string filename)
        {
            var project = _projectFactory.Load(filename);

            if (project != null)
            {
                var args = new ProjectOpenedEventArgs() { Project = project };
                ViewModelMediator.Current.GetEvent<ProjectOpenedEventArgs>().Raise(this, args);
            }
        }
Exemplo n.º 2
0
        private void ProjectOpened(object sender, ProjectOpenedEventArgs args)
        {
            SetupProjectDependencies(args.Project);

            AppData.AddRecentProject(args.Project);
            AppData.Save();
        }
Exemplo n.º 3
0
 private void ProjectOpened(object sender, ProjectOpenedEventArgs e)
 {
     Entities = e.Project.Entities.Where(x => x.EditorData == null || !x.EditorData.HideFromPlacement);
     OnPropertyChanged("Entities");
 }
Exemplo n.º 4
0
 private void ProjectOpened(object sender, ProjectOpenedEventArgs e)
 {
     _project = e.Project;
 }
        private void ProjectOpened(object sender, ProjectOpenedEventArgs e)
        {
            MaxTrack = 0;

            if (e.Project.MusicNsf != null)
            {
                bgm = new BackgroundMusic(AudioContainer.LoadContainer(e.Project.MusicNsf));
                AudioManager.Instance.LoadBackgroundMusic(bgm);
                MaxTrack = bgm.AudioContainer.TrackCount;
            }

            OnPropertyChanged("MaxTrack");
        }
Exemplo n.º 6
0
        public void Create()
        {
            var path = DirectoryPath;
            if (CreateProjectDirectory)
            {
                var invalidChars = System.IO.Path.GetInvalidPathChars();
                var nameFolder = new String(Name
                    .Where(x => !invalidChars.Contains(x))
                    .ToArray());
                path = System.IO.Path.Combine(path, nameFolder);
            }

            var document = _projectFactory.CreateNew(path);

            document.Name = Name;
            document.Author = Author;
            document.Save();

            var args = new ProjectOpenedEventArgs() { Project = document };
            ViewModelMediator.Current.GetEvent<ProjectOpenedEventArgs>().Raise(this, args);
        }
        public void Create(object param)
        {
            var fullProjectPath = DirectoryPath;
            if (CreateProjectDirectory)
            {
                var invalidChars = System.IO.Path.GetInvalidPathChars();
                var nameFolder = new String(Name
                    .Where(x => !invalidChars.Contains(x))
                    .ToArray());
                fullProjectPath = System.IO.Path.Combine(fullProjectPath, nameFolder);
            }

            var document = _projectFactory.CreateNew(fullProjectPath);

            document.Name = Name;
            document.Author = Author;
            _dataService.SaveProject(document);

            var resBasePath = "resources/includes";
            var includes = GetResourcesUnder(resBasePath).ToDictionary(n => n, n => n.Substring(resBasePath.Length + 1));
            foreach (var p in includes)
            {
                var resPath = p.Value;
                var filePath = Path.Combine(fullProjectPath, resPath);
                var stream = System.Windows.Application.GetResourceStream(new Uri(p.Key, UriKind.Relative)).Stream;
                WriteResourceToFile(filePath, stream);
            }

            var embeddedKey = "Resources.Includes.";
            var embeddedIncludes = Assembly.GetExecutingAssembly().GetManifestResourceNames()
                .Where(n => n.Contains(embeddedKey))
                .ToDictionary(n => n, n => EmbedPathToFilePath(n, embeddedKey));

            foreach (var p in embeddedIncludes)
            {
                var filePath = Path.Combine(fullProjectPath, p.Value);
                var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(p.Key);
                WriteResourceToFile(filePath, stream);
            }

            var allPaths = includes.Values.Concat(embeddedIncludes.Values);
            var folders = allPaths.Select(p => p.Split('/')[0]).Distinct();
            document.Project.AddIncludeFolders(folders);
            document.MusicNsf = document.EffectsNsf = fullProjectPath + "/sound/mm5.nsf";
            _dataService.SaveProject(document);

            var args = new ProjectOpenedEventArgs() { Project = document };
            ViewModelMediator.Current.GetEvent<ProjectOpenedEventArgs>().Raise(this, args);
        }
        private void ProjectOpened(object sender, ProjectOpenedEventArgs e)
        {
            _currentProject = e.Project;

            Entities = e.Project.Entities
                .Where(x => x.EditorData == null || !x.EditorData.HideFromPlacement)
                .Select(x => new EntityViewModel(x, e.Project));

            OnPropertyChanged("Entities");
        }
        public void OpenProject(string filename)
        {
            var project = _projectFactory.Load(filename);

            if (project != null)
            {
                var proceed = CheckProjectForDuplicateIncludes(project);
                if (!proceed)
                    return;

                var args = new ProjectOpenedEventArgs() { Project = project };
                ViewModelMediator.Current.GetEvent<ProjectOpenedEventArgs>().Raise(this, args);
            }
        }