Example #1
0
        public DNewWorkspace(string name, string location)
        {
            _name     = name;
            _location = location;

            Title = "New Workspace";

            var     b = new wpfBuilder(this).WinSize(600);
            TextBox tName, tLocation = null;

            b.R.Add("Folder name", out tName, _name).Validation(_Validate);
            b.R.Add("Parent folder", out tLocation, _location).Validation(_Validate);
            b.R.AddButton("Browse...", _Browse).Width(70).Align("L");
            b.R.AddOkCancel();
            b.End();

            void _Browse(WBButtonClickArgs e)
            {
                var d = new FileOpenSaveDialog("{4D1F3AFB-DA1A-45AC-8C12-41DDA5C51CDA}")
                {
                    InitFolderNow = filesystem.exists(tLocation.Text).Directory ? tLocation.Text : folders.ThisAppDocuments,
                };

                if (d.ShowOpen(out string s, this, selectFolder: true))
                {
                    tLocation.Text = s;
                }
            }

            string _Validate(FrameworkElement e)
            {
                var s = (e as TextBox).Text;

                if (e == tLocation)
                {
                    if (!filesystem.exists(s).Directory)
                    {
                        return("Folder does not exist");
                    }
                }
                else
                {
                    if (pathname.isInvalidName(s))
                    {
                        return("Invalid filename");
                    }
                    ResultPath = pathname.combine(tLocation.Text, s);                     //validation is when OK clicked
                    if (filesystem.exists(ResultPath))
                    {
                        return(s + " already exists");
                    }
                }
                return(null);
            }

            //b.OkApply += e => {
            //	print.it(ResultPath); e.Cancel = true;
            //};
        }
Example #2
0
            public static void Import_workspace()
            {
                var d = new FileOpenSaveDialog("{4D1F3AFB-DA1A-45AC-8C12-41DDA5C51CDA}")
                {
                    Title = "Import workspace"
                };

                if (d.ShowOpen(out string s, App.Hmain, selectFolder: true))
                {
                    App.Model.ImportWorkspace(s);
                }
            }
Example #3
0
            public static void Import_zip()
            {
                var d = new FileOpenSaveDialog("{4D1F3AFB-DA1A-45AC-8C12-41DDA5C51CDA}")
                {
                    Title = "Import .zip", FileTypes = "Zip files|*.zip"
                };

                if (d.ShowOpen(out string s, App.Hmain))
                {
                    App.Model.ImportWorkspace(s);
                }
            }
Example #4
0
    public DProperties(FileNode f)
    {
        _f       = f;
        _isClass = f.IsClass;

        Owner = App.Wmain;
        Title = "Properties of " + _f.Name;

        var b = new wpfBuilder(this).WinSize(600).Columns(-1, 0);

        b.WinProperties(WindowStartupLocation.CenterOwner, showInTaskbar: false);
        b.R.Add(out info).Height(80).Margin("B8").Span(-1);
        b.R.StartStack(vertical: true);         //left column
        b.StartGrid().Columns(0, -1, 20, 0, -1.15)
        .R.Add("role", out role).Skip()
        .Add("testScript", out testScript).Validation(o => _ValidateFile(o, "testScript", FNFind.CodeFile));
        b.End();

        b.StartStack(out gRun, "Run", vertical: true);
        b.StartGrid().Columns(0, 120, -1, 0, 80)
        .Add("ifRunning", out ifRunning).Skip()
        .Add("uac", out uac);
        b.End();
        b.End().Brush(Brushes.OldLace);

        b.StartGrid(out gCompile, "Compile").Columns(0, 50, 20, 0, -1);
        b.R.Add(out optimize, "optimize").Skip(2)
        .Add("define", out define);
        b.R.Add("warningLevel", out warningLevel).Editable().Skip()
        .Add("noWarnings", out noWarnings);
        b.R.Add("testInternal", out testInternal);
        b.R.StartGrid().Columns(0, -1, 20, 0, -1)
        .Add("preBuild", out preBuild).Skip().Validation(o => _ValidateFile(o, "preBuild", FNFind.CodeFile))
        .Add("postBuild", out postBuild).Validation(o => _ValidateFile(o, "postBuild", FNFind.CodeFile));
        b.End();
        b.End().Brush(Brushes.OldLace);

        b.StartStack(out gAssembly, "Assembly", vertical: true);
        b.StartGrid().Columns(0, -1, 30)
        .Add("outputPath", out outputPath)
        .AddButton(out outputPathB, "...", _ButtonClick_outputPath)
        .End();
        b.StartGrid().Columns(0, -1, 20, 0, -1);
        b.R.Add("icon", out icon).Skip().Validation(o => _ValidateFile(o, "icon", FNFind.Any))
        .Add("manifest", out manifest).Validation(o => _ValidateFile(o, "manifest", FNFind.File));
        b.R.Add("sign", out sign).Skip().Validation(o => _ValidateFile(o, "sign", FNFind.File));
        b.StartStack()
        .Add(out console, "console")
        .Add(out bit32, "bit32").Margin(15)
        .Add(out xmlDoc, "xmlDoc").Margin(15)
        .End();
        b.End();
        b.End().Brush(Brushes.OldLace);

        b.End();
        b.StartStack(vertical: true).Margin("L20");         //right column
        b.StartGrid <GroupBox>("Add reference");
        b.R.AddButton(out addLibrary, "Library...", _ButtonClick_addLibrary);
        b.R.AddButton(out addNuget, "NuGet ▾", _ButtonClick_addNuget);
        b.R.AddButton(out addComRegistry, "COM ▾", _bAddComRegistry_Click).AddButton(out addComBrowse, "...", _bAddComBrowse_Click).Width(30);
        b.AddButton(out addProject, "Project ▾", _ButtonClick_addProject);
        b.End();
        b.StartStack <GroupBox>("Add file", vertical: true);
        b.AddButton(out addClassFile, "Class file ▾", _ButtonClick_addClass);
        b.AddButton(out addResource, "Resource ▾", _ButtonClick_addResource);
        b.End();
        b.StartStack(vertical: true).Add("Find in lists", out findInLists).Tooltip("In button drop-down lists show only items containing this text").End();
        //b.AddButton("Change icon", _ => DIcons.ZShow(true, _f.CustomIconName)).Margin("T8B8"); //rejected
        b.End();
        b.R.AddOkCancel();
        b.End();

        _meta = new MetaCommentsParser(_f);

        _role = _meta.role switch {
            "miniProgram" => Au.Compiler.ERole.miniProgram,
            "exeProgram" => Au.Compiler.ERole.exeProgram,
            "editorExtension" => Au.Compiler.ERole.editorExtension,
            "classLibrary" when _isClass => Au.Compiler.ERole.classLibrary,
            "classFile" when _isClass => Au.Compiler.ERole.classFile,
            _ => _isClass ? Au.Compiler.ERole.classFile : Au.Compiler.ERole.miniProgram,
        };
        _InitCombo(role, _isClass ? "miniProgram|exeProgram|editorExtension|classLibrary|classFile" : "miniProgram|exeProgram|editorExtension", null, (int)_role);
        testScript.Text = _f.TestScript?.ItemPath;
        //Run
        _InitCombo(ifRunning, "warn_restart|warn|cancel_restart|cancel|wait_restart|wait|run_restart|run|restart", _meta.ifRunning);
        _InitCombo(uac, "inherit|user|admin", _meta.uac);
        //Assembly
        outputPath.Text = _meta.outputPath;
        void _ButtonClick_outputPath(WBButtonClickArgs e)
        {
            var m = new popupMenu();

            m[_GetOutputPath(getDefault: true)] = o => outputPath.Text = o.ToString();
            bool isLibrary = _role == Au.Compiler.ERole.classLibrary;

            if (isLibrary)
            {
                m[@"%folders.ThisApp%\Libraries"] = o => outputPath.Text = o.ToString();
            }
            m["Browse..."] = o => {
                var initf = _GetOutputPath(getDefault: false, expandEnvVar: true);
                filesystem.createDirectory(initf);
                var d = new FileOpenSaveDialog(isLibrary ? "{4D1F3AFB-DA1A-45AC-8C12-41DDA5C51CDD}" : "{4D1F3AFB-DA1A-45AC-8C12-51DDA5C51CDD}")
                {
                    InitFolderFirstTime = initf,
                };
                if (d.ShowOpen(out string s, this, selectFolder: true))
                {
                    outputPath.Text = folders.unexpandPath(s);
                }
            };
            m.Show();
        }

        icon.Text     = _meta.icon;
        manifest.Text = _meta.manifest;
        sign.Text     = _meta.sign;
        if (_meta.console == "true")
        {
            console.IsChecked = true;
        }
        if (_meta.bit32 == "true")
        {
            bit32.IsChecked = true;
        }
        if (_meta.xmlDoc == "true")
        {
            xmlDoc.IsChecked = true;
        }
        //Compile
        if (_meta.optimize == "true")
        {
            optimize.IsChecked = true;
        }
        define.Text = _meta.define;
        _InitCombo(warningLevel, "5|4|3|2|1|0", _meta.warningLevel);
        noWarnings.Text   = _meta.noWarnings;
        testInternal.Text = _meta.testInternal;
        preBuild.Text     = _meta.preBuild;
        postBuild.Text    = _meta.postBuild;