protected override void Initialize()
        {
            this.menuTreeWidth  = this.GetPersistentValue <float>("menuTreeWidth", 320);
            this.overviewHeight = this.GetPersistentValue <float>("overviewHeight", 300);
            this.columns        = new List <ResizableColumn>()
            {
                ResizableColumn.FlexibleColumn(this.menuTreeWidth.Value, 80), ResizableColumn.DynamicColumn(0, 200)
            };
            this.runner                = new ValidationRunner();
            this.overview              = new ValidationOverview();
            this.editor                = this.ValueEntry.SmartValue;
            this.profile               = this.editor.Profile;
            this.sourceProperty        = this.Property.Children["selectedSourceTarget"];
            this.validationProfileTree = new ValidationProfileTree();
            this.overviewToggle        = this.GetPersistentValue <bool>("overviewToggle", true);

            this.validationProfileTree.Selection.SelectionChanged += (x) =>
            {
                if (x == SelectionChangedType.ItemAdded)
                {
                    var value  = this.validationProfileTree.Selection.SelectedValue;
                    var result = value as ValidationProfileResult;
                    if (result != null)
                    {
                        this.editor.SetTarget(result.GetSource());
                    }
                    else
                    {
                        this.editor.SetTarget(value);
                    }
                }
            };

            this.overview.OnProfileResultSelected += result =>
            {
                var mi = this.validationProfileTree.GetMenuItemForObject(result);
                mi.Select();
                var source = result.GetSource();
                this.editor.SetTarget(source);
            };

            this.validationProfileTree.AddProfileRecursive(this.ValueEntry.SmartValue.Profile);

            OdinMenuTree.ActiveMenuTree = this.validationProfileTree;

            if (this.editor.ScanProfileImmediatelyWhenOpening)
            {
                this.editor.ScanProfileImmediatelyWhenOpening = false;
                this.ScanProfile(this.editor.Profile);
            }
        }
示例#2
0
        private ResizableColumn GetColumn(DisplayOptions option)
        {
            ResizableColumn result;

            if (!this.columnLookup.TryGetValue(option, out result))
            {
                switch (option)
                {
                case DisplayOptions.Category:
                    result = ResizableColumn.FixedColumn(23);
                    break;

                case DisplayOptions.Message:
                    result = ResizableColumn.DynamicColumn(250, 50);
                    break;

                case DisplayOptions.Path:
                    result = ResizableColumn.FlexibleColumn(150, 50);
                    break;

                case DisplayOptions.PropertyPath:
                    result = ResizableColumn.FlexibleColumn(150, 50);
                    break;

                case DisplayOptions.Validator:
                    result = ResizableColumn.FlexibleColumn(150, 50);
                    break;

                case DisplayOptions.Object:
                    result = ResizableColumn.FlexibleColumn(150, 50);
                    break;

                case DisplayOptions.Scene:
                    result = ResizableColumn.FlexibleColumn(150, 50);
                    break;

                default:
                    result = ResizableColumn.FlexibleColumn(150, 50);
                    break;
                }

                this.columnLookup[option] = result;
            }

            return(result);
        }