示例#1
0
        private Dialog_Error(HoneybeeSchema.ValidationReport report)
        {
            this.Title = $"Validation Report - {DialogHelper.PluginName}";
            this.Width = 800;
            this.Icon  = DialogHelper.HoneybeeIcon;

            _vm = new ErrorViewModel(report, this);

            _grid = GenGridView();
            var nextBtn = new Button()
            {
                Text = ">>"
            };
            var currentErrorIndex = new Label();
            var preBtn            = new Button()
            {
                Text = "<<"
            };
            var showBtn = new Button()
            {
                Text = "Show"
            };
            var showParentBtn = new Button()
            {
                Text = "Show Parent"
            };
            var moreInfoBtn = new Button()
            {
                Text = "More Info"
            };

            var message = new TextArea()
            {
                Height = 84
            };


            message.TextBinding.Bind(_vm, _ => _.CurrentErrorMessage);
            currentErrorIndex.TextBinding.Bind(_vm, _ => _.CurrentErrorIndex);
            nextBtn.Bind(_ => _.Enabled, _vm, _ => _.NextBtnEnabled);
            preBtn.Bind(_ => _.Enabled, _vm, _ => _.PreBtnEnabled);
            moreInfoBtn.Bind(_ => _.Enabled, _vm, _ => _.MoreBtnEnabled);

            showBtn.Bind(_ => _.Enabled, _vm, _ => _.ShowBtnEnabled);
            showParentBtn.Bind(_ => _.Enabled, _vm, _ => _.ShowParentBtnEnabled);

            nextBtn.Command       = _vm.NextBtnCommand;
            preBtn.Command        = _vm.PreBtnCommand;
            moreInfoBtn.Command   = _vm.ErrorLinkCommand;
            showBtn.Command       = _vm.ShowCommand;
            showParentBtn.Command = _vm.ShowParentCommand;
            //errorLink.Command = _vm.ErrorLinkCommand;


            var group = new GroupBox();

            group.Bind(_ => _.Text, _vm, _ => _.TotalErrorMessage);

            group.Size = new Eto.Drawing.Size(-1, -1);
            var groupLayout = new DynamicLayout();

            groupLayout.DefaultSpacing = new Eto.Drawing.Size(5, 5);
            groupLayout.DefaultPadding = new Eto.Drawing.Padding(5);
            groupLayout.AddSeparateRow(_grid);
            groupLayout.AddSeparateRow(preBtn, currentErrorIndex, nextBtn, null, showBtn, showParentBtn, moreInfoBtn);
            groupLayout.AddSeparateRow(message);
            group.Content = groupLayout;

            var validateBtn = new Eto.Forms.Button()
            {
                Text = "Re-Validate"
            };

            validateBtn.Bind(_ => _.Visible, _vm, _ => _.ValidateBtnEnabled);
            validateBtn.Command = _vm.ValidateCommand;

            var abortButton = new Eto.Forms.Button()
            {
                Text = "Close", Height = 24
            };

            abortButton.Click += (s, e) => { this.Close(); };

            var layout = new Eto.Forms.DynamicLayout();

            layout.DefaultSpacing = new Eto.Drawing.Size(5, 2);
            layout.DefaultPadding = new Eto.Drawing.Padding(4);
            layout.AddSeparateRow(controls: new[] { group }, xscale: true, yscale: true);
            layout.AddSeparateRow(null, validateBtn, abortButton);
            this.Content = layout;

            _vm.UILoaded();
        }