private void radMenuItem13_Click(object sender, EventArgs e) { var np = new NewItemDialog(); if (np.ShowDialog() == System.Windows.Forms.DialogResult.OK) { var f = new Core.ProjectSystem.File(); f.Name = np.Filename; f.Src = np.Filename; f.ID = np.Type; Workspace.SelectedProject.Files.Add(f); explorerTreeView.Nodes.Clear(); explorerTreeView.Nodes.Add(SolutionExplorer.Build(Workspace.Solution, solutionContextMenu, projectContextMenu, fileContextMenu)); Workspace.Solution.Save(Workspace.SolutionPath); var fi = new FileInfo(Workspace.SolutionPath).Directory.FullName + "\\" + f.Name; System.IO.File.WriteAllBytes(fi, np.Template.Raw); np.Plugin.Events.Fire("OnCreateItem", f, np.Template.Raw); var doc = new DocumentWindow(f.Name); doc.Controls.Add(ViewSelector.Select(np.Template, System.IO.File.ReadAllBytes(fi), f, np.Template.AutoCompletionProvider as IntellisenseProvider).GetView()); AddDocument(doc); } }
private void explorerTreeView_NodeMouseDoubleClick(object sender, RadTreeViewEventArgs e) { var p = e.Node.Tag as PropertiesView; var f = e.Node.Tag as Core.ProjectSystem.File; if (p != null) { var v = new PropertiesView(); var doc = new DocumentWindow(e.Node.Text); doc.Controls.Add(v.GetView()); AddDocument(doc); } if (f != null) { ItemTemplate np = null; Plugin nn = null; foreach (var item in Workspace.PluginManager.Plugins) { foreach (var it in item.ItemTemplates) { if (it.ID == f.ID) { np = it; nn = item; } } } byte[] raw = null; if (Workspace.SelectedProject != null) { raw = System.IO.File.ReadAllBytes(new FileInfo(Workspace.SolutionPath).Directory.FullName + "\\" + f.Src); } else { raw = System.IO.File.ReadAllBytes(f.Src); } nn?.Events.Fire("OnCreateItem", np, f, raw); var doc = new DocumentWindow(f.Name); doc.Controls.Add(ViewSelector.Select(np, raw, f, np?.AutoCompletionProvider as IntellisenseProvider, doc).GetView()); AddDocument(doc); } }
public Form1() { InitializeComponent(); startpageDocument.Controls.Add(new StartPage(openMenuItem_Click, newProjectMenuItem_Click) { Dock = System.Windows.Forms.DockStyle.Fill }); NotificationService.Init(radDesktopAlert1); ThemeResolutionService.ApplicationThemeName = "VisualStudio2012Dark"; Workspace.Settings.Load(); if (!Workspace.Settings.Get <bool>("BetaAccepted")) { new BetaKeyDialog(this).ShowDialog(); Hide(); } Workspace.Output = new Core.Contracts.Debug(outputTextBox); Workspace.PluginManager.Load(Environment.CurrentDirectory + "\\Plugins"); foreach (var item in Workspace.PluginManager.Plugins) { foreach (var win in item.Windows) { var tw = new ToolWindow(win.Value.Title); var ctrl = win.Value.View.Build(); ctrl.Dock = System.Windows.Forms.DockStyle.Fill; tw.Controls.Add(ctrl); dock.AddDocument(tw); } } // add here loading from startup // file, project, solution var args = Environment.GetCommandLineArgs(); if (args.Length > 0) { string file = null; #if DEBUG if (args.Length > 1) { file = args[1]; } #else file = args[0]; #endif if (file != null) { switch (Path.GetExtension(file)) { case ".sln": Workspace.Solution = Solution.Load(file); Workspace.SolutionPath = file; startpageDocument.Hide(); solutionExplorerWindow.Show(); newProjectMenuItem.Enabled = true; newFileMenuItem.Enabled = true; explorerTreeView.Nodes.Clear(); explorerTreeView.Nodes.Add(SolutionExplorer.Build(Workspace.Solution, solutionContextMenu, projectContextMenu, fileContextMenu)); break; case "proj": var p = Project.Load(file); explorerTreeView.Nodes.Clear(); explorerTreeView.Nodes.Add(SolutionExplorer.Build(p, projectContextMenu, fileContextMenu)); break; default: var f = new Core.ProjectSystem.File(); var shortF = Path.GetFileName(file); f.Name = shortF; f.Src = file; f.ID = Utils.GetTemplateID(shortF); explorerTreeView.Nodes.Clear(); explorerTreeView.Nodes.Add(SolutionExplorer.Build(f, fileContextMenu)); ItemTemplate np = null; Plugin npp = null; foreach (var item in Workspace.PluginManager.Plugins) { foreach (var it in item.ItemTemplates) { if (it.ID == f.ID) { np = it; npp = item; } } } var raw = System.IO.File.ReadAllBytes(file); npp.Events.Fire("OnCreateItem", np, f, raw); var doc = new DocumentWindow(f.Name); doc.Controls.Add(ViewSelector.Select(np, raw, f, np.AutoCompletionProvider as IntellisenseProvider, doc).GetView()); AddDocument(doc); startpageDocument.Hide(); break; } } } RefreshLanguage(); addItemContextItem.Click += radMenuItem13_Click; }