private void ThisApplication_InitializedApplication(object sender, EventArgs e) { if (!TryLoadDockPanelState()) { _toolBox.Show(_mainDockPanel, DockState.DockLeft); _propertiesWindow.Show(_mainDockPanel, DockState.DockRight); _errorList.Show(_mainDockPanel, DockState.DockBottomAutoHide); _outputWindow.Show(_mainDockPanel, DockState.DockBottomAutoHide); _solutionExplorer.Show(_propertiesWindow.Pane, DockAlignment.Top, 0.5); } this.Controls.Add(_mainDockPanel); _mainDockPanel.ContentAdded += _mainDockPanel_ContentAdded; _mainDockPanel.ActiveContentChanged += _mainDockPanel_ActiveContentChanged; _extensionHost = LiteDevelopApplication.Current.ExtensionHost as LiteExtensionHost; _extensionHost.ErrorManager.NavigateToErrorRequested += ErrorManager_NavigateToErrorRequested; _extensionHost.SolutionLoad += _extensionHost_SolutionLoad; _extensionHost.SolutionUnload += _extensionHost_SolutionUnload; _extensionHost.ControlManager.AppearanceChanged += ControlManager_AppearanceChanged; ControlManager_AppearanceChanged(null, null); this.toolStripPanel1.Resize += toolStripPanel1_Resize; this.Resize += MainForm_Resize; _errorList.SetErrorManager(_extensionHost.ErrorManager); mainMenuStrip.Renderer = mainToolBar.Renderer = mainStatusStrip.Renderer = toolStripPanel1.Renderer = _extensionHost.ControlManager.MenuRenderer; _extensionHost.UILanguageChanged += _extensionHost_UILanguageChanged; _extensionHost_UILanguageChanged(null, null); }
public static void UserCreateFile(LiteExtensionHost extensionHost, Project currentProject, string directory) { using (var dlg = new CreateFileDialog(currentProject)) { if (!string.IsNullOrEmpty(directory)) { dlg.Directory = directory; } if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { var result = (dlg.Template as FileTemplate).CreateFile(extensionHost.FileService, currentProject, new FilePath(dlg.FileName)); foreach (var createdFile in result.CreatedFiles) { var openedFile = createdFile.File as OpenedFile; openedFile.Save(extensionHost.CreateOrGetReporter("Build")); if (currentProject != null) { currentProject.ProjectFiles.Add(new ProjectFileEntry(openedFile)); } createdFile.ExtensionToUse.OpenFile(openedFile); } } } }
private void InitializeExtensionHost() { _extensionHost = new LiteExtensionHost(); var solutionExplorer = _mainForm.GetToolWindow <SolutionExplorerContent>(); var outputWindow = _mainForm.GetToolWindow <OutputContent>(); _extensionHost.SettingsManager = new ExtensionSettingsManager(); _extensionHost.ControlManager = new ControlManager(_extensionHost) { DockPanel = _mainForm.DockPanel, ToolStripPanel = _mainForm.ToolStripPanel, MenuStrip = _mainForm.MenuStrip, EditMenu = _mainForm.EditItem, ViewMenu = _mainForm.ViewItem, DebugMenu = _mainForm.DebugItem, ToolsMenu = _mainForm.ToolsItem, StatusStrip = _mainForm.StatusStrip, SolutionExplorerMenu = FindControl(solutionExplorer, "mainTreeView").ContextMenuStrip }; _extensionHost.FileService = new FileService(_extensionHost); _extensionHost.BookmarkManager = new BookmarkManager(); _extensionHost.ErrorManager = new ErrorManager(); _extensionHost.OutputContent = outputWindow; _extensionHost.ProgressBar = _mainForm.DefaultStatusProgressBar.ProgressBar; _extensionHost.CredentialManager = new CredentialManager(); _extensionHost.UILanguage = UILanguage.GetLanguageById(LiteDevelopSettings.Instance.GetValue("Application.LanguageID")); _muiProcessor = new Framework.Mui.MuiProcessor(_extensionHost, Path.Combine(Application.StartupPath, "MUI")); _extensionHost.ExtensionManager = new ExtensionManager(_extensionHost); _appearanceProcessor = _extensionHost.ControlManager.GlobalAppearanceMap.Processor; }
public ViewContentContainer(LiteViewContent viewContent) { base.HideOnClose = viewContent is LiteToolWindow; _extensionHost = LiteDevelopApplication.Current.ExtensionHost; ViewContent = viewContent; ViewContent.ControlChanged += ViewContent_ControlChanged; ViewContent.TextChanged += ViewContent_TextChanged; ViewContent.IconChanged += ViewContent_IconChanged; ViewContent.Closing += ViewContent_Closing; ViewContent.Closed += ViewContent_Closed; if (DocumentContent != null) { _currentFile = DocumentContent.AssociatedFile; DocumentContent.AssociatedFileChanged += DocumentContent_AssociatedFileChanged; DocumentContent_AssociatedFileChanged(null, null); } else if (ToolWindow != null) { ToolWindow.DockStateChanged += ToolWindow_DockStateChanged; } UpdateText(); UpdateControl(); UpdateIcon(); }
private void Current_InitializedApplication(object sender, EventArgs e) { _componentMuiIdentifiers = new Dictionary <object, string>() { { this, "SolutionExplorerContent.Title" }, { this.addToolStripMenuItem, "SolutionExplorerContent.ContextMenu.Add" }, { this.newFileToolStripMenuItem, "SolutionExplorerContent.ContextMenu.Add.NewFile" }, { this.newDirectoryToolStripMenuItem, "SolutionExplorerContent.ContextMenu.Add.NewDirectory" }, { this.newProjectToolStripMenuItem, "SolutionExplorerContent.ContextMenu.Add.NewProject" }, { this.existingFileToolStripMenuItem, "SolutionExplorerContent.ContextMenu.Add.ExistingFile" }, { this.openToolStripMenuItem, "SolutionExplorerContent.ContextMenu.Open" }, { this.removeToolStripMenuItem, "SolutionExplorerContent.ContextMenu.Remove" }, { this.renameToolStripMenuItem, "SolutionExplorerContent.ContextMenu.Rename" }, { this.setAsStartupProjectToolStripMenuItem, "SolutionExplorerContent.ContextMenu.SetAsStartupProject" }, { this.viewInExplorerToolStripMenuItem, "SolutionExplorerContent.ContextMenu.ViewInExplorer" }, }; _extensionHost = LiteDevelopApplication.Current.ExtensionHost; _extensionHost.UILanguageChanged += _extensionHost_UILanguageChanged; _extensionHost.SolutionLoad += _extensionHost_SolutionLoad; _extensionHost.SolutionUnload += _extensionHost_SolutionUnload; _extensionHost.ControlManager.AppearanceChanged += ControlManager_AppearanceChanged; _extensionHost_UILanguageChanged(null, null); }
public static void UserCreateFile(LiteExtensionHost extensionHost, Project currentProject, string directory) { using (var dlg = new CreateFileDialog(currentProject)) { if (!string.IsNullOrEmpty(directory)) { dlg.Directory = directory; } if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { var filePath = new FilePath(dlg.FileName); var files = dlg.Template.Create(new FileCreationContext() { CurrentProject = currentProject, CurrentSolution = extensionHost.CurrentSolution, FilePath = filePath, FileService = extensionHost.FileService, ProgressReporter = extensionHost.CreateOrGetReporter("Build"), }); foreach (var createdFile in files) { extensionHost.FileService.SelectFileHandler( extensionHost.ExtensionManager.GetFileHandlers(createdFile.FilePath), createdFile.FilePath).OpenFile((OpenedFile)createdFile); } } } }
private void Current_InitializedApplication(object sender, EventArgs e) { _extensionHost = LiteDevelopApplication.Current.ExtensionHost; _extensionHost.BookmarkManager.Bookmarks.InsertedItem += Bookmarks_InsertedItem; _extensionHost.BookmarkManager.Bookmarks.RemovedItem += Bookmarks_RemovedItem; _extensionHost.UILanguageChanged += _extensionHost_UILanguageChanged; _extensionHost_UILanguageChanged(_extensionHost, EventArgs.Empty); }
public static void UserCreateProject(LiteExtensionHost extensionHost) { var solution = extensionHost.CurrentSolution; using (var dlg = new CreateProjectDialog(solution)) { if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string projectDirectory = Path.Combine(dlg.Directory, Path.GetFileNameWithoutExtension(dlg.FileName)); if (dlg.CreateSolutionDirectory) { projectDirectory = Path.Combine(projectDirectory, Path.GetFileNameWithoutExtension(dlg.FileName)); } if (System.IO.Directory.Exists(projectDirectory)) { if (MessageBox.Show(LiteDevelopApplication.Current.MuiProcessor.GetString("CreateProjectDialog.FolderAlreadyExists", "folder=" + projectDirectory), "LiteDevelop", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes) { return; } } else { System.IO.Directory.CreateDirectory(projectDirectory); } var projectTemplate = dlg.Template as ProjectTemplate; var result = projectTemplate.CreateProject(extensionHost.FileService, new FilePath(projectDirectory, Path.GetFileName(dlg.FileName))); result.Project.Save(extensionHost.CreateOrGetReporter("Build")); if (solution == null) { string solutionDirectory = dlg.CreateSolutionDirectory ? Path.GetDirectoryName(projectDirectory) : projectDirectory; solution = Solution.CreateSolution(result.Project.Name); solution.FilePath = new FilePath(solutionDirectory, Path.GetFileNameWithoutExtension(dlg.FileName) + ".sln"); solution.Settings.StartupProjects.Add(result.Project.ProjectGuid); solution.Save(extensionHost.CreateOrGetReporter("Build")); extensionHost.DispatchSolutionCreated(new SolutionEventArgs(solution)); solution.Nodes.Add(new ProjectEntry(result.Project)); extensionHost.DispatchSolutionLoad(new SolutionEventArgs(solution)); } else { solution.Nodes.Add(new ProjectEntry(result.Project)); } for (int i = 0; i < result.CreatedFiles.Count; i++) { result.CreatedFiles[i].ExtensionToUse.OpenFile(result.CreatedFiles[i].File as OpenedFile); } } } }
private void Current_InitializedApplication(object sender, EventArgs e) { _extensionHost = LiteDevelopApplication.Current.ExtensionHost; errorsToolStripButton.Checked = LiteDevelopSettings.Instance.GetValue <bool>("ErrorList.ErrorsVisible"); warningsToolStripButton.Checked = LiteDevelopSettings.Instance.GetValue <bool>("ErrorList.WarningsVisible"); messagesToolStripButton.Checked = LiteDevelopSettings.Instance.GetValue <bool>("ErrorList.MessagesVisible"); _extensionHost.UILanguageChanged += extensionHost_UILanguageChanged; _extensionHost.ControlManager.AppearanceChanged += ControlManager_AppearanceChanged; extensionHost_UILanguageChanged(null, null); }
public static void UserCreateFile(LiteExtensionHost extensionHost, string directory) { UserCreateFile(extensionHost, extensionHost.GetCurrentSelectedProject(), directory); }
public static void UserCreateFile(LiteExtensionHost extensionHost) { UserCreateFile(extensionHost, string.Empty); }
public static void UserCreateProject(LiteExtensionHost extensionHost) { var solution = extensionHost.CurrentSolution; using (var dlg = new CreateProjectDialog(solution)) { if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { var projectDirectory = new FilePath(dlg.Directory, dlg.FileName); if (dlg.CreateSolutionDirectory) { projectDirectory = projectDirectory.Combine(projectDirectory.FileName); } if (System.IO.Directory.Exists(projectDirectory.FullPath)) { if (MessageBox.Show(LiteDevelopApplication.Current.MuiProcessor.GetString("CreateProjectDialog.FolderAlreadyExists", "folder=" + projectDirectory), "LiteDevelop", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes) { return; } } else { System.IO.Directory.CreateDirectory(projectDirectory.FullPath); } bool newSolution = solution == null; if (newSolution) { var solutionDirectory = dlg.CreateSolutionDirectory ? projectDirectory.ParentDirectory : projectDirectory; solution = Solution.CreateSolution(projectDirectory.FileName); solution.FilePath = solutionDirectory.Combine(projectDirectory.FileName + ".sln"); } var projects = dlg.Template.Create(new FileCreationContext() { CurrentProject = null, CurrentSolution = solution, FilePath = projectDirectory, FileService = extensionHost.FileService, ProgressReporter = extensionHost.CreateOrGetReporter("Build"), }).Cast <Project>(); if (newSolution) { extensionHost.DispatchSolutionCreated(new SolutionEventArgs(solution)); } foreach (var project in projects) { solution.Nodes.Add(new ProjectEntry(project)); } if (newSolution) { extensionHost.DispatchSolutionLoad(new SolutionEventArgs(solution)); } } } }