Ejemplo n.º 1
0
 public BasicAssemblyInfoSpecialFileProvider([Import(ExportContractNames.ProjectTreeProviders.PhysicalProjectTreeService)] IProjectTreeService projectTreeService,
                                             [Import(ExportContractNames.ProjectItemProviders.SourceFiles)] IProjectItemProvider sourceItemsProvider,
                                             [Import(AllowDefault = true)] Lazy <ICreateFileFromTemplateService> templateFileCreationService,
                                             IFileSystem fileSystem) :
     base(projectTreeService, sourceItemsProvider, templateFileCreationService, fileSystem)
 {
 }
Ejemplo n.º 2
0
        //public IItem RootItem
        //{
        //    get { return mProjectTreeService.RootItem; }
        //}

        //public IItem SeRootItem
        //{
        //    get { return mProjectTreeService.RootItem; }
        //}

        /// <summary>
        /// Initializes a new instance of the <see cref="MDModel" /> class.
        /// </summary>
        /// <param name="commandManager">The injected command manager.</param>
        /// <param name="menuService">The menu service.</param>
        public ProjectToolModel()//ICommandManager commandManager, IMenuService menuService)
        {
            var commandManager = VEFModule.UnityContainer.Resolve(typeof(ICommandManager), "") as ICommandManager;

            //  var menuService = VEFModule.UnityContainer.Resolve<IMenuService>();
            mProjectTreeService = VEFModule.UnityContainer.Resolve(typeof(IProjectTreeService), "") as IProjectTreeService;

            mProjectTreeService.Items = new CollectionOfIItem();

            //tray.ContextMenu.ItemsSource = _children;

            //      mItems = new ObservableCollection<ContentModel>();


            //    CategoryModel cdata = new CategoryModel(commandManager, menuService) { Name = "Data" };
            //   mProjectTreeService.Items.Add(cdata);
            //------------- Scenes ----------------------
            //VMCategory cScenes = new VMCategory(,commandManager, menuService) { Name = "Scenes" };

            //p1.Items.Add(cScenes);

            //CVMScene sv = new CVMScene() { Name = "Scene 1" };
            //sv.Items.Add(new CVMCategory() { Name = "Cameras" });
            //sv.Items.Add(new CVMCategory() { Name = "Models" });
            //sv.Items.Add(new CVMCategory() { Name = "Sound" });
            //cScenes.Items.Add(sv);
        }
Ejemplo n.º 3
0
        public static async Task InstallTargets(EnvDTE.Project envDteProject, IProjectLockService projectLockService, UnconfiguredProject unconfiguredProject, string toolsPath)
        {
            var logger = new TraceLogger();

            try
            {
                if (projectLockService == null)
                {
                    throw new ArgumentNullException("projectLockService");
                }

                if (unconfiguredProject == null)
                {
                    throw new ArgumentNullException("unconfiguredProject");
                }

                using (var access = await projectLockService.WriteLockAsync())
                {
                    var configuredProject = await unconfiguredProject.GetSuggestedConfiguredProjectAsync();

                    Project project = await access.GetProjectAsync(configuredProject);

                    // If you're going to change the project in any way,
                    // check it out from SCC first:
                    await access.CheckoutAsync(configuredProject.UnconfiguredProject.FullPath);

                    // install targets

                    var installer = new InstallTargetsHelper(logger);
                    installer.Install(project, toolsPath);
                    // configureCallback(project);

                    IProjectTreeService projectTreeService = configuredProject.Services.ExportProvider.GetExportedValue <IProjectTreeService>();
                    await projectTreeService.PublishLatestTreeAsync();

                    // envDteProject.Save(envDteProject.FullName);

                    // save changes.
                    //project.Save(project.FullPath);
                }
            }
            catch (AggregateException ex)
            {
                logger.LogError(ex.Message);
                foreach (var e in ex.InnerExceptions)
                {
                    logger.LogError(e.Message);
                }

                throw;
            }
            catch (Exception e)
            {
                logger.LogError(e.Message);
            }
        }
Ejemplo n.º 4
0
        public ContentViewModel NewContent(object parameter)
        {
            var vm    = VEFModule.UnityContainer.Resolve(typeof(AnimationEditorViewModel), "") as AnimationEditorViewModel;
            var model = VEFModule.UnityContainer.Resolve(typeof(AnimationEditorModel), "") as AnimationEditorModel;
            var view  = VEFModule.UnityContainer.Resolve(typeof(AnimationEditorView), "") as AnimationEditorView;

            //Model details
            _loggerService.Log("Creating a new simple file using AnimationEditorHandler", LogCategory.Info, LogPriority.Low);

            //Clear the undo stack
            //   model.Document.UndoStack.ClearAll();

            //Set the model and view
            vm.SetModel(model);
            vm.SetView(view);
            vm.Title = "AnimationEditor";
            (vm.View as UserControl).DataContext = model;
            vm.SetHandler(this);
            model.SetDirty(true);

            model.SetLocation("AnimationEditorID:##:");

            IProjectTreeService    pfExplorerService      = VEFModule.UnityContainer.Resolve(typeof(IProjectTreeService), "") as IProjectTreeService;
            AnimationEditorManager AnimationEditorService = VEFModule.UnityContainer.Resolve(typeof(AnimationEditorManager), "") as AnimationEditorManager;

            AnimationEditorService.AnimationEditors.Add(model);


            model.GraphViewModel = view.GraphControl.DataContext as GraphViewModel;
            AnimationEditorService.AnimationEditors[0].GraphViewModel.AddElement <OutputNodeViewModel>(300, 200);



            PItem parent = null;

            if (pfExplorerService.SelectedItem != null)
            {
                parent = pfExplorerService.SelectedItem;
            }

            AnimationEditorModel newAnimationEditor = new AnimationEditorModel();

            newAnimationEditor.Parent = parent;

            if (pfExplorerService.SelectedItem != null)
            {
                pfExplorerService.SelectedItem.Items.Add(newAnimationEditor);
            }

            AnimationEditorService.AnimationEditors.Add(newAnimationEditor);
            //  AnimationEditorService.SelectedAnimationEditor = newAnimationEditor;
            newAnimationEditor.Open(-1);


            return(vm);
        }
 public PhysicalProjectTreeStorage(
     UnconfiguredProject project,
     [Import(ExportContractNames.ProjectTreeProviders.PhysicalProjectTreeService)] IProjectTreeService treeService,
     Lazy <IFileSystem> fileSystem,
     ActiveConfiguredProject <ConfiguredImports> configuredImports)
 {
     _project           = project;
     _treeService       = treeService;
     _fileSystem        = fileSystem;
     _configuredImports = configuredImports;
 }
Ejemplo n.º 6
0
        public ContentViewModel NewContent(object parameter)
        {
            var vm    = VEFModule.UnityContainer.Resolve(typeof(SceneViewModel), "") as SceneViewModel;
            var model = VEFModule.UnityContainer.Resolve(typeof(SceneDataModel), "") as SceneDataModel;
            var view  = VEFModule.UnityContainer.Resolve(typeof(SceneView), "") as SceneView;

            //Model details
            _loggerService.Log("Creating a new simple file using SceneHandler", LogCategory.Info, LogPriority.Low);

            //Clear the undo stack
            //   model.Document.UndoStack.ClearAll();

            //Set the model and view
            vm.SetModel(model);
            vm.SetView(view);
            vm.Title = "Scene New";
            (vm.View as UserControl).DataContext = model;
            vm.SetHandler(this);
            model.SetDirty(true);

            model.SetLocation("SceneID:##:");

            IProjectTreeService pfExplorerService = VEFModule.UnityContainer.Resolve(typeof(IProjectTreeService), "") as IProjectTreeService;
            ISceneService       sceneService      = VEFModule.UnityContainer.Resolve(typeof(ISceneService), "") as ISceneService;

            PItem parent = null;

            if (pfExplorerService.SelectedItem != null)
            {
                parent = pfExplorerService.SelectedItem;
            }

            SceneDataModel newScene = new SceneDataModel()
            {
                Name = "Scene NEW", ContentID = "SceneID:##:"
            };

            newScene.Parent = parent;

            if (pfExplorerService.SelectedItem != null)
            {
                pfExplorerService.SelectedItem.Items.Add(newScene);
            }

            sceneService.Scenes.Add(newScene);
            //  sceneService.SelectedScene = newScene;
            newScene.Open(-1);


            return(vm);
        }
        /// <summary>
        ///     Returns a task that will complete when a tree that includes data that meets the
        ///     specified requirements is published, and whose result will be the data about
        ///     that tree.
        /// </summary>
        /// <param name="treeService">
        ///     The <see cref="IProjectTreeService"/> tow
        /// </param>
        /// <param name="minimumRequiredDataSourceVersions">
        ///     The minimum required versions of various data sources that may be included in
        ///     the tree.
        /// </param>
        /// <param name="blockDuringLoadingTree">
        ///     <see langword="true"/> if the caller wants to block until the initial (real) project
        ///     tree (not the loading tree) is published.
        /// </param>
        /// <param name="cancellationToken">
        ///      A token whose cancellation signals lost interest in the result.
        /// </param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">
        ///     <paramref name="treeService"/> is <see langword="null"/>.
        /// </exception>
        public static Task <IProjectTreeServiceState> PublishTreeAsync(this IProjectTreeService treeService, IImmutableDictionary <NamedIdentity, IProjectVersionRequirement> minimumRequiredDataSourceVersions, bool blockDuringLoadingTree, CancellationToken cancellationToken = default(CancellationToken))
        {
            Requires.NotNull(treeService, nameof(treeService));

            if (blockDuringLoadingTree)
            {
                minimumRequiredDataSourceVersions = minimumRequiredDataSourceVersions.SetItem(
                    ProjectTreeDataSources.BaseTreeGeneration,
                    new ProjectVersionRequirement(MinimumPhysicalTreeGeneration, allowMissingData: false));
            }


            return(treeService.PublishTreeAsync(minimumRequiredDataSourceVersions));
        }
        private PhysicalProjectTreeStorage CreateInstance(IProjectTreeService treeService = null, IProjectTreeProvider treeProvider = null, IFileSystem fileSystem = null, IFolderManager folderManager = null, UnconfiguredProject project = null)
        {
            treeService = treeService ?? IProjectTreeServiceFactory.Create(ProjectTreeParser.Parse("Root"));
            treeProvider = treeProvider ?? IProjectTreeProviderFactory.Create();
            fileSystem = fileSystem ?? IFileSystemFactory.Create();
            folderManager = folderManager ?? IFolderManagerFactory.Create();
            project = project ?? UnconfiguredProjectFactory.Create();

            return new PhysicalProjectTreeStorage(new Lazy<IProjectTreeService>(() => treeService),
                                                  new Lazy<IProjectTreeProvider>(() => treeProvider),
                                                  new Lazy<IFileSystem>(() => fileSystem),
                                                  ActiveConfiguredProjectFactory.ImplementValue(() => folderManager),
                                                  project);
        }
        public AbstractSpecialFileProvider([Import(ExportContractNames.ProjectTreeProviders.PhysicalProjectTreeService)] IProjectTreeService projectTreeService,
                                           [Import(ExportContractNames.ProjectItemProviders.SourceFiles)] IProjectItemProvider sourceItemsProvider,
                                           [Import(AllowDefault = true)] Lazy <ICreateFileFromTemplateService> templateFileCreationService,
                                           IFileSystem fileSystem)
        {
            Requires.NotNull(projectTreeService, nameof(projectTreeService));
            Requires.NotNull(sourceItemsProvider, nameof(sourceItemsProvider));
            Requires.NotNull(fileSystem, nameof(fileSystem));

            _projectTreeService          = projectTreeService;
            _sourceItemsProvider         = sourceItemsProvider;
            _templateFileCreationService = templateFileCreationService;
            _fileSystem = fileSystem;
        }
Ejemplo n.º 10
0
        public ContentViewModel NewContent(object parameter)
        {
            var vm    = VEFModule.UnityContainer.Resolve(typeof(AtlasViewModel), "") as AtlasViewModel;
            var model = VEFModule.UnityContainer.Resolve(typeof(AtlasModel), "") as AtlasModel;
            var view  = VEFModule.UnityContainer.Resolve(typeof(AtlasView), "") as AtlasView;

            //Model details
            _loggerService.Log("Creating a new simple file using AtlasHandler", LogCategory.Info, LogPriority.Low);

            //Clear the undo stack
            //   model.Document.UndoStack.ClearAll();

            //Set the model and view
            vm.SetModel(model);
            vm.SetView(view);
            vm.Title = "Atlas";
            (vm.View as UserControl).DataContext = model;
            vm.SetHandler(this);
            model.SetDirty(true);

            model.SetLocation("AtlasID:##:");

            IProjectTreeService pfExplorerService = VEFModule.UnityContainer.Resolve(typeof(IProjectTreeService), "") as IProjectTreeService;
            IAtlasService       AtlasService      = VEFModule.UnityContainer.Resolve(typeof(IAtlasService), "") as IAtlasService;

            PItem parent = null;

            if (pfExplorerService.SelectedItem != null)
            {
                parent = pfExplorerService.SelectedItem;
            }

            AtlasModel newAtlas = new AtlasModel();

            newAtlas.Parent = parent;

            if (pfExplorerService.SelectedItem != null)
            {
                pfExplorerService.SelectedItem.Items.Add(newAtlas);
            }

            AtlasService.Atlass.Add(newAtlas);
            //  AtlasService.SelectedAtlas = newAtlas;
            newAtlas.Open(-1);


            return(vm);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Opens a file and returns the corresponding FileWatcherViewModel
        /// </summary>
        /// <param name="info">The string location of the file</param>
        /// <returns>The <see cref="FileWatcherViewModel"/> for the file.</returns>
        public ContentViewModel OpenContent(object info, object param)
        {
            var location = info as string;

            if (location != null)
            {
                try
                {
                    var mProjectTreeService = VEFModule.UnityContainer.Resolve(typeof(IProjectTreeService), "") as IProjectTreeService;
                    var vm = VEFModule.UnityContainer.Resolve(typeof(FileWatcherViewModel), "") as FileWatcherViewModel;

                    FileWatcherModel model = null;// VEFModule.UnityContainer.Resolve(typeof(FileWatcherModel), "") as FileWatcherModel;

                    FileWatcherManager  fileWatcherService = VEFModule.UnityContainer.Resolve(typeof(FileWatcherManager), "") as FileWatcherManager;
                    IProjectTreeService pfExplorerService  = VEFModule.UnityContainer.Resolve(typeof(IProjectTreeService), "") as IProjectTreeService;


                    var fileWatcher = fileWatcherService.FileWatchers.Where(x => x.ContentID == info.ToString());
                    if (fileWatcher.Any())
                    {
                        fileWatcherService.SelectedFileWatcher = fileWatcher.First();
                        fileWatcherService.SelectedFileWatcher.Open(info);
                    }
                    else //new fileWatcher
                    {
                        //    fileWatcherDataModel newfileWatcher = new fileWatcherDataModel() { Name = "fileWatcher NEW", ContentID = "fileWatcherID:##:" };
                        // newfileWatcher.Parent = parent;

                        if (pfExplorerService.SelectedItem is FileWatcherModel)
                        {    // pfExplorerService.SelectedItem.Items.Add(newfileWatcher);
                            var newfileWatcher = pfExplorerService.SelectedItem as FileWatcherModel;
                            if (newfileWatcher != null)
                            {
                                fileWatcherService.FileWatchers.Add(newfileWatcher);
                                //  fileWatcherService.SelectedfileWatcher = newfileWatcher;
                                newfileWatcher.Open(-1);

                                model = newfileWatcher;
                            }
                        }
                    }

                    //Model details
                    if (model == null)
                    {
                        model = VEFModule.UnityContainer.Resolve(typeof(FileWatcherModel), "") as FileWatcherModel;
                    }

                    var view = VEFModule.UnityContainer.Resolve(typeof(FileWatcherView), "") as FileWatcherView;


                    //Model details
                    model.SetLocation(info);

                    //Set the model and view
                    vm.SetModel(model);
                    vm.SetView(view);
                    vm.Title = "FileWatcher_" + Path.GetFileName(location);
                    (vm.View as UserControl).DataContext = model;



                    model.Open(location);

                    //      model.Document.Text = File.ReadAllText(location);
                    model.SetDirty(false);

                    //   mProjectTreeService.SetAsRoot(model);


                    return(vm);
                }
                catch (Exception exception)
                {
                    _loggerService.Log(exception.Message, LogCategory.Exception, LogPriority.High);
                    _loggerService.Log(exception.StackTrace, LogCategory.Exception, LogPriority.High);
                    return(null);
                }

                //Clear the undo stack
                //   model.Document.UndoStack.ClearAll();
            }
            return(null);
        }
        public static IPhysicalProjectTree Create(IProjectTreeProvider provider = null, IProjectTree currentTree = null, IProjectTreeService service = null)
        {
            var mock = new Mock <IPhysicalProjectTree>();

            mock.Setup(t => t.TreeProvider)
            .Returns(provider ?? IProjectTreeProviderFactory.Create());

            mock.Setup(t => t.CurrentTree)
            .Returns(currentTree ?? ProjectTreeParser.Parse("Project"));

            mock.Setup(t => t.TreeService)
            .Returns(service ?? IProjectTreeServiceFactory.Create());

            return(mock.Object);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Opens a file and returns the corresponding MDViewModel
        /// </summary>
        /// <param name="info">The string location of the file</param>
        /// <returns>The <see cref="MDViewModel"/> for the file.</returns>
        public ContentViewModel OpenContent(object info, object param)
        {
            var location = info as string;

            if (location != null)
            {
                AnimationEditorModel     model = null;
                AnimationEditorViewModel vm    = VEFModule.UnityContainer.Resolve(typeof(AnimationEditorViewModel), "") as AnimationEditorViewModel;
                var view = VEFModule.UnityContainer.Resolve(typeof(AnimationEditorView), "") as AnimationEditorView;

                try
                {
                    //  IAnimationEditorService AnimationEditorService = VEFModule.UnityContainer.Resolve(typeof(IAnimationEditorService), "") as IAnimationEditorService;
                    IProjectTreeService pfExplorerService = VEFModule.UnityContainer.Resolve(typeof(IProjectTreeService), "") as IProjectTreeService;

                    AnimationEditorManager AnimationEditorService = VEFModule.UnityContainer.Resolve(typeof(AnimationEditorManager), "") as AnimationEditorManager;


                    //          string[] split = Regex.Split(info.ToString(), ":##:");
                    //if (split.Count() == 2)
                    //{
                    //    string identifier = split[0];
                    //    string ID = split[1];
                    //    if (identifier == "AnimationEditorID")
                    //    {
                    var AnimationEditor = AnimationEditorService.AnimationEditors.Where(x => x.ContentID == info.ToString());
                    if (AnimationEditor.Any())
                    {
                        AnimationEditorService.SelectedAnimationEditor = AnimationEditor.First();
                        AnimationEditorService.SelectedAnimationEditor.Open(info);
                    }
                    else //new AnimationEditor
                    {
                        //    AnimationEditorModel newAnimationEditor = new AnimationEditorModel() { Name = "AnimationEditor NEW", ContentID = "AnimationEditorID:##:" };
                        // newAnimationEditor.Parent = parent;

                        if (pfExplorerService.SelectedItem is AnimationEditorModel)
                        {    // pfExplorerService.SelectedItem.Items.Add(newAnimationEditor);
                            var newAnimationEditor = pfExplorerService.SelectedItem as AnimationEditorModel;
                            if (newAnimationEditor != null)
                            {
                                AnimationEditorService.AnimationEditors.Add(newAnimationEditor);
                                //  AnimationEditorService.SelectedAnimationEditor = newAnimationEditor;
                                newAnimationEditor.Open(-1);

                                model = newAnimationEditor;
                            }
                        }
                    }

                    //Model details
                    if (model == null)
                    {
                        model = VEFModule.UnityContainer.Resolve(typeof(AnimationEditorModel), "") as AnimationEditorModel;
                        AnimationEditorService.AnimationEditors.Add(model);
                    }

                    model.GraphViewModel = view.GraphControl.DataContext as GraphViewModel;
                    AnimationEditorService.AnimationEditors[0].GraphViewModel.AddElement <OutputNodeViewModel>(300, 200);


                    model.SetLocation(info);

                    //  model.SetLocation("AuftragID:##:" + info + "");

                    //      model.Document.Text = File.ReadAllText(location);
                    model.SetDirty(true);
                    //   }
                }



                catch (Exception exception)
                {
                    _loggerService.Log(exception.Message, LogCategory.Exception, LogPriority.High);
                    _loggerService.Log(exception.StackTrace, LogCategory.Exception, LogPriority.High);
                    return(null);
                }

                //Clear the undo stack
                // model.Document.UndoStack.ClearAll();

                //Set the model and view
                vm.SetModel(model);
                vm.SetView(view);
                vm.Title = "AnimationEditorViewer";//model.nae  // Path.GetFileName("AnimationEditor gefunden");
                (vm.View as UserControl).DataContext = model;

                return(vm);
            }
            return(null);
        }
 protected AbstractSpecialFileProvider(IPhysicalProjectTree projectTree, bool isFolder = false)
 {
     _treeService = projectTree.TreeService;
     _storage     = projectTree.TreeStorage;
     _isFolder    = isFolder;
 }
Ejemplo n.º 15
0
 public ProjectTreeController(IProjectTreeService projectTreeService)
 {
     _projectTreeService = projectTreeService;
 }
Ejemplo n.º 16
0
        /// <summary>
        /// Opens a file and returns the corresponding MDViewModel
        /// </summary>
        /// <param name="info">The string location of the file</param>
        /// <returns>The <see cref="MDViewModel"/> for the file.</returns>
        public ContentViewModel OpenContent(object info, object param)
        {
            var location = info as string;

            if (location != null)
            {
                SceneDataModel model = null;
                SceneViewModel vm    = VEFModule.UnityContainer.Resolve(typeof(SceneViewModel), "") as SceneViewModel;
                var            view  = VEFModule.UnityContainer.Resolve(typeof(SceneView), "") as SceneView;

                try
                {
                    ISceneService       sceneService      = VEFModule.UnityContainer.Resolve(typeof(ISceneService), "") as ISceneService;
                    IProjectTreeService pfExplorerService = VEFModule.UnityContainer.Resolve(typeof(IProjectTreeService), "") as IProjectTreeService;

                    //          string[] split = Regex.Split(info.ToString(), ":##:");
                    //if (split.Count() == 2)
                    //{
                    //    string identifier = split[0];
                    //    string ID = split[1];
                    //    if (identifier == "SceneID")
                    //    {
                    var scene = sceneService.Scenes.Where(x => x.ContentID == info.ToString());
                    if (scene.Any())
                    {
                        sceneService.SelectedScene = scene.First();
                        sceneService.SelectedScene.Open(info);
                    }
                    else //new scene
                    {
                        //    SceneDataModel newScene = new SceneDataModel() { Name = "Scene NEW", ContentID = "SceneID:##:" };
                        // newScene.Parent = parent;

                        if (pfExplorerService.SelectedItem is SceneDataModel)
                        {    // pfExplorerService.SelectedItem.Items.Add(newScene);
                            var newScene = pfExplorerService.SelectedItem as SceneDataModel;
                            if (newScene != null)
                            {
                                sceneService.Scenes.Add(newScene);
                                //  sceneService.SelectedScene = newScene;
                                newScene.Open(-1);

                                model = newScene;
                            }
                        }
                    }

                    //Model details
                    if (model == null)
                    {
                        model = VEFModule.UnityContainer.Resolve(typeof(SceneDataModel), "") as SceneDataModel;
                    }

                    model.SetLocation(info);

                    //  model.SetLocation("AuftragID:##:" + info + "");

                    //      model.Document.Text = File.ReadAllText(location);
                    model.SetDirty(true);
                    //   }
                }



                catch (Exception exception)
                {
                    _loggerService.Log(exception.Message, LogCategory.Exception, LogPriority.High);
                    _loggerService.Log(exception.StackTrace, LogCategory.Exception, LogPriority.High);
                    return(null);
                }

                //Clear the undo stack
                // model.Document.UndoStack.ClearAll();

                //Set the model and view
                vm.SetModel(model);
                vm.SetView(view);
                vm.Title = model.Name ?? "Scene";//model.nae  // Path.GetFileName("Scene gefunden");
                (vm.View as UserControl).DataContext = model;

                return(vm);
            }
            return(null);
        }