コード例 #1
0
        public Project AddNewProject(ResourceFolder parentResourceItem, IList <ResourceItem> selectesItem = null)
        {
            IMainTool mainTool = MainWindowPartFactory.GetMainTool();

            if (mainTool == null)
            {
                throw new MissingMethodException("Can not find GetMainTool...");
            }
            FilePath         baseDirectory    = parentResourceItem.BaseDirectory;
            FileDialogResult fileDialogResult = new NewFileDialog((Window)Services.MainWindow, (string)parentResourceItem.BaseDirectory, mainTool.CanvasSize).ShowDialog();

            if (fileDialogResult == null)
            {
                return((Project)null);
            }
            return(this.AddNewProject(parentResourceItem, new ProjectCreateInformation((FilePath)Path.Combine((string)baseDirectory, fileDialogResult.FileName), (IProjectContent)null, selectesItem, (float)fileDialogResult.Size.Width, (float)fileDialogResult.Size.Height)
            {
                ContentType = fileDialogResult.FileType.ToString()
            }));
        }
コード例 #2
0
        public Project CreateDefalutSceneProject(bool isUpdateUI = true)
        {
            IMainTool      mainTool   = MainWindowPartFactory.GetMainTool();
            float          width      = mainTool == null ? 480f : (float)mainTool.CanvasSize.Width;
            float          height     = mainTool == null ? 320f : (float)mainTool.CanvasSize.Height;
            ResourceFolder rootFolder = this.CurrentResourceGroup.RootFolder;
            Project        project    = this.AddNewProject(rootFolder, new ProjectCreateInformation((FilePath)Path.Combine(rootFolder.FullPath, "MainScene.csd"), (IProjectContent)null, (IList <ResourceItem>)null, width, height)
            {
                ContentType = "Scene"
            });

            if (isUpdateUI)
            {
                Services.EventsService.GetEvent <AddResourcesEvent>().Publish(new AddResourcesArgs(rootFolder, (IEnumerable <ResourceItem>) new List <ResourceItem>()
                {
                    (ResourceItem)project
                }, true));
                Services.Workbench.OpenDocument(project);
            }
            return(project);
        }
コード例 #3
0
ファイル: ToolAction.cs プロジェクト: NEKERAFA/CS-IndustryLP
 /// <summary>
 /// Invoked the first time that the main tool creates the controller
 /// </summary>
 /// <param name="mainTool"></param>
 public virtual void OnStart(IMainTool mainTool)
 {
 }