Пример #1
0
        /// <summary>
        ///		Abre la ventana de creación de un nuevo archivo
        /// </summary>
        private void NewFile()
        {
            Definitions.SelectNewFileViewModel viewModel = new Definitions.SelectNewFileViewModel(PlugStudioController.ControllerWindow, Definition);

            if (PlugStudioController.SelectNewFile(viewModel) == BauMvvm.ViewModels.Controllers.SystemControllerEnums.ResultType.Yes)
            {
                string fileName = viewModel.FileName;

                // Cambia la extensión
                if (!viewModel.SelectedDefinition.IsEqualExtension(System.IO.Path.GetExtension(fileName)))
                {
                    fileName += viewModel.SelectedDefinition.Extension;
                }
                // Y lo añade a la carpeta
                fileName = System.IO.Path.Combine(GetNodeFileName(), fileName);
                // Crea el archivo
                if (CreateFile(fileName, viewModel.SelectedDefinition.Template))
                {
                    // Abre el archivo
                    if (viewModel.SelectedDefinition.EditorType == ProjectItemDefinitionModel.WindowEditorType.Unknown)
                    {
                        OpenProperties(fileName);
                    }
                    else
                    {
                        PlugStudioController.OpenEditor(fileName, viewModel.SelectedDefinition.Template, viewModel.SelectedDefinition.HelpFile);
                    }
                    // Actualiza el árbol
                    Refresh();
                }
            }
        }
Пример #2
0
        /// <summary>
        ///		Abre el formulario de propiedades de un archivo con el editor del proyecto
        /// </summary>
        protected override void OpenProperties(string fileName)
        {
            if (!string.IsNullOrEmpty(fileName) && !string.IsNullOrEmpty(System.IO.Path.GetExtension(fileName)))
            {
                switch (System.IO.Path.GetExtension(fileName).ToLower())
                {
                case ProjectModel.ImportScriptExtension:
                case ProjectModel.StyleExtension:
                    PlugStudioController.OpenEditor(fileName, string.Empty, string.Empty);
                    break;

                case ProjectModel.QueryExtension:
                    MainViewModel.Instance.ViewsController.OpenQueryView(new Queries.QueryViewModel(Project, fileName));
                    break;

                case ProjectModel.ReportExtension:
                    MainViewModel.Instance.ViewsController.OpenReportView(new Reports.ReportViewModel(fileName));
                    break;
                }
            }
        }
Пример #3
0
        /// <summary>
        ///		Abre las propiedades del nodo
        /// </summary>
        private void OpenPropertiesNode()
        {
            switch (SelectedNodeDefinition?.EditorType ?? ProjectItemDefinitionModel.WindowEditorType.Unknown)
            {
            case ProjectItemDefinitionModel.WindowEditorType.Unknown:
                OpenProperties();
                break;

            case ProjectItemDefinitionModel.WindowEditorType.Browser:
                // PlugStudioController.OpenWebBrowser();
                break;

            case ProjectItemDefinitionModel.WindowEditorType.Image:
                PlugStudioController.OpenImage(GetNodeFileName());
                break;

            case ProjectItemDefinitionModel.WindowEditorType.Script:
                PlugStudioController.OpenEditor(GetNodeFileName(), SelectedNodeDefinition?.Template, SelectedNodeDefinition?.HelpFile);
                break;
            }
        }