示例#1
0
        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);
            }
        }
示例#2
0
        private void radMenuItem13_Click(object sender, EventArgs e)
        {
            var np = new NewItemDialog();

            if (np.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                var f = new File();
                f.Name = np.Filename;
                f.Src  = np.Filename;
                f.ID   = np.Type;

                Workspace.SelectedProject.Files.Add(f);

                radTreeView1.Nodes.Clear();
                radTreeView1.Nodes.Add(SolutionExplorer.Build(Workspace.Solution));

                Workspace.Solution.Save(Workspace.SolutionPath);
                var p = np.Template;

                var editor = EditorBuilder.Build(p.Extension, null, null, null);

                var doc = new DocumentWindow(f.Name);
                doc.Controls.Add(editor);

                radDock1.AddDocument(doc);
            }
        }
示例#3
0
        private void newProjectMenuItem_Click(object sender, EventArgs e)
        {
            var np = new NewProjectDialog();

            if (np.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                var f = new Project();
                f.Name = np.Filename;
                f.Type = np.Type;

                Workspace.Solution.Projects.Add(f);

                explorerTreeView.Nodes.Clear();
                explorerTreeView.Nodes.Add(SolutionExplorer.Build(Workspace.Solution, solutionContextMenu, projectContextMenu, fileContextMenu));

                var path = new FileInfo(Workspace.SolutionPath).Directory.FullName;

                Directory.CreateDirectory(path + "\\" + f.Name);
                Directory.CreateDirectory(path + "\\" + f.Name + "\\Properties");

                np.Plugin.Events.Fire("OnCreateProject", f);

                Workspace.Solution.Save(Workspace.SolutionPath);
            }
        }
示例#4
0
        private void renameSolutionContextItem_Click(object sender, EventArgs e)
        {
            var newName = Prompt.Show("Please enter a new Name", "Rename");

            Workspace.Solution.Name = newName;

            explorerTreeView.Nodes.Clear();
            explorerTreeView.Nodes.Add(SolutionExplorer.Build(Workspace.Solution, solutionContextMenu, projectContextMenu, fileContextMenu));

            Workspace.Solution.Save(Workspace.SolutionPath);
        }
示例#5
0
        private void radMenuItem9_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "Solution (*.sln)|*.sln";

            if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Workspace.Solution     = Solution.Load(openFileDialog1.FileName);
                Workspace.SolutionPath = openFileDialog1.FileName;

                radTreeView1.Nodes.Clear();
                radTreeView1.Nodes.Add(SolutionExplorer.Build(Workspace.Solution));
            }
        }
示例#6
0
        private void radMenuItem11_Click(object sender, EventArgs e)
        {
            saveFileDialog1.Filter = "Solution (*.sln)|*.sln";
            if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Workspace.Solution = new Solution();
                var name = Prompt.Show("Please specifiy an solution name", "Name");
                Workspace.Solution.Name = name;

                radTreeView1.Nodes.Clear();
                radTreeView1.Nodes.Add(SolutionExplorer.Build(Workspace.Solution));

                Workspace.SolutionPath = saveFileDialog1.FileName;

                Workspace.Solution.Save(saveFileDialog1.FileName);
            }
        }
示例#7
0
        private void radMenuItem12_Click(object sender, EventArgs e)
        {
            var np = new NewProjectDialog();

            if (np.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                var f = new Project();
                f.Name = np.Filename;
                f.Type = np.Type;

                Workspace.Solution.Projects.Add(f);

                radTreeView1.Nodes.Clear();
                radTreeView1.Nodes.Add(SolutionExplorer.Build(Workspace.Solution));

                Workspace.Solution.Save(Workspace.SolutionPath);
            }
        }
示例#8
0
        private void openMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "Solution (*.sln)|*.sln";

            if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Workspace.Solution     = Solution.Load(openFileDialog1.FileName);
                Workspace.SolutionPath = openFileDialog1.FileName;

                startpageDocument.Hide();
                solutionExplorerWindow.Show();

                newProjectMenuItem.Enabled = true;
                newFileMenuItem.Enabled    = true;

                explorerTreeView.Nodes.Clear();
                explorerTreeView.Nodes.Add(SolutionExplorer.Build(Workspace.Solution, solutionContextMenu, projectContextMenu, fileContextMenu));
            }
        }
示例#9
0
        private void radMenuItem12_Click(object sender, EventArgs e)
        {
            var np = new NewProjectDialog();

            if (np.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                var f = new Project();
                f.Name = np.Filename;
                f.Type = np.Type;

                Workspace.Solution.Projects.Add(f);

                explorerTreeView.Nodes.Clear();
                explorerTreeView.Nodes.Add(SolutionExplorer.Build(Workspace.Solution, radContextMenu1));

                np.Plugin.Events.Fire("OnCreateProject", f);

                Workspace.Solution.Save(Workspace.SolutionPath);
            }
        }
示例#10
0
        private void radMenuItem11_Click(object sender, EventArgs e)
        {
            if (folderBrowserDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Workspace.Solution = new Solution();
                var name = Prompt.Show(LanguageManager._("Please specifiy an solution name"), LanguageManager._("Name"));
                Workspace.Solution.Name = name;

                explorerTreeView.Nodes.Clear();
                explorerTreeView.Nodes.Add(SolutionExplorer.Build(Workspace.Solution, solutionContextMenu, projectContextMenu, fileContextMenu));

                Directory.CreateDirectory(folderBrowserDialog1.SelectedPath + "\\" + name);

                Workspace.SolutionPath = folderBrowserDialog1.SelectedPath + "\\" + name + "\\" + name + ".sln";
                Workspace.Solution.Save(Workspace.SolutionPath);

                newProjectMenuItem.Enabled = true;
                newFileMenuItem.Enabled    = true;

                startpageDocument.Hide();
                solutionExplorerWindow.Show();
            }
        }
示例#11
0
        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;
        }