Exemple #1
0
        public ascx_Edit_AspNet_Pages setPageViewers()
        {
            Action <string> showFile =
                (file) => {
                if (OpenSourceCodeFiles)
                {
                    Aspx_CodeViewer.open(file);
                    var csharpFile = "{0}.cs".format(file);
                    if (csharpFile.fileExists())
                    {
                        CSharp_CodeViewer.open(csharpFile);
                    }
                    else
                    {
                        var folder   = file.directoryName();
                        var fileName = System.IO.Path.GetFileNameWithoutExtension(file);
                        csharpFile = folder.pathCombine("App_Code").pathCombine("{0}.cs".format(fileName));
                        if (csharpFile.fileExists())
                        {
                            CSharp_CodeViewer.open(csharpFile);
                        }
                    }
                }
                var pageUrl = new Uri(this.Web_Address.uri(), file.remove(this.File_Path));
                this.ie.open_ASync(pageUrl.str());
            };

            AspNetFiles.afterSelect <string>(showFile);
            AspNetFiles.onDoubleClick <string>(showFile);

            return(this);
        }
Exemple #2
0
        public ascx_Edit_AspNet_Pages buildGui()
        {
            var topPanel = this.add_Panel();

            topPanel.insert_LogViewer();

            ActionsPanel = topPanel.insert_Above <Panel>(70).add_GroupBox("Actions").add_Panel();
            AspNetFiles  = topPanel.insert_Left <Panel>(300).add_GroupBox("ASP.NET Files")
                           .add_TreeView()
                           .sort();


            ActionsPanel.add_Label("WebRoot", 30, 0).autoSize()
            .append_TextBox(this.File_Path)
            .width(200)
            .onEnter(
                (text) => {
                this.File_Path = text;
                this.loadFiles_FromLocalFolder();
            })
            .append_Label("Url").top(30).autoSize()
            .append_TextBox(this.Web_Address)
            .width(200)
            .onTextChange((text) => this.Web_Address = text)
            .append_Link("refresh IE", () => ie.open_ASync(ie.url()));

            Aspx_CodeViewer   = topPanel.add_GroupBox("Aspx page").add_SourceCodeViewer();
            CSharp_CodeViewer = Aspx_CodeViewer.parent().insert_Below().add_GroupBox("CSharp page").add_SourceCodeEditor();

            this.ie = topPanel.add_IE_SideView();
            ActionsPanel.add_Link("Compile project", 5, 0,
                                  () => {
                if (this.CSProj_File.fileExists())
                {
                    var msBuild    = @"C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe";
                    var parameters = "\"{0}\"".format(CSProj_File);
                    msBuild.startProcess(parameters,
                                         (log) => {
                        if (log.isNull())
                        {
                            return;
                        }
                        if (log.lower().contains("error "))
                        {
                            log.error();
                        }
                        else
                        if (log.lower().contains("warning "))
                        {
                            log.debug();
                        }
                        else
                        {
                            log.info();
                        }
                    });
                }
                else
                {
                    "CSProj_File variable is not set of file does not exist: {0}".error(CSProj_File);
                }
            });


            this.ActionsPanel.add_CheckBox("Show *.cs files", 5, 200,
                                           (value) => {
                this.ShowFilesWithExtension_CS = value;
                this.loadFiles_FromLocalFolder();
            }).autoSize();

            this.ActionsPanel.add_CheckBox("Show *.ascx, *.asax, *.config files", 5, 320,
                                           (value) => {
                this.ShowFilesWithExtension_AscxAsaxConfig = value;
                this.loadFiles_FromLocalFolder();
            }).autoSize();

            var splitContainers = this.controls <SplitContainer>(true);

            this.ActionsPanel.add_CheckBox("show/open source code files", 5, 550,
                                           (value) => {
                this.OpenSourceCodeFiles = value;
                splitContainers[2].panel1Collapsed(value.isFalse());
            }).autoSize().@check();

            setPageViewers();


            AspNetFiles.add_ContextMenu().add_MenuItem("refresh", () => this.loadFiles_FromLocalFolder());
            return(this);
        }