Esempio n. 1
0
        /// <summary>
        /// Configure option handler related stuff
        /// </summary>
        private void SetupNodePlacerOptions()
        {
            // create the EditorControl
            var editorFactory = new DefaultEditorFactory();

            nodePlacerOptionHandler = new OptionHandler("Placer Options");
            editorControl           = editorFactory.CreateControl(nodePlacerOptionHandler, true, true);
            editorControl.Dock      = DockStyle.Fill;
            //order is important here...
            placerOptionsBox.Controls.Add(editorControl);
            placerOptionsBox.PerformLayout();

            descriptorCollection = new List <INodePlacerConfiguration>();
            selectionProvider    = new DefaultSelectionProvider <INodePlacerConfiguration>(descriptorCollection,
                                                                                           delegate { return(true); })
            {
                ContextLookup = Lookups.CreateContextLookupChainLink(
                    (subject, type) =>
                    ((type == typeof(IPropertyMapBuilder) && (subject is INodePlacerConfiguration))
             ? new AttributeBasedPropertyMapBuilderAttribute().CreateBuilder(subject.GetType())
             : null))
            };
            //when the selection content changes, trigger this action (usually rebuild associated option handlers)
            selectionProvider.SelectedItemsChanged += SelectionProviderSelectionChanged;

            selectionProvider.PropertyItemsChanged += delegate {
                UpdatePreview();
                SelectionProviderSelectionChanged(this, null);
            };
        }
        private bool ShowNonModal(Control owner)
        {
            if (Handler != null)
            {
                EditorFactory factory = EditorFactory;
                if (factory == null)
                {
                    factory = new DefaultEditorFactory();
                }
                EditorForm form = factory.CreateEditor(Handler, true, false, true);
                form.ValuesAdopted  += OnValuesAdopted;
                form.ValuesCommited += OnValuesCommitted;
                form.Disposed       += OnEditorDisposed;

                if (owner != null)
                {
                    form.StartPosition = FormStartPosition.CenterParent;
                    form.Show(owner);
                    return(true);
                }
                else
                {
                    form.Show(owner);
                    return(true);
                }
            }
            return(false);
        }
        private bool ShowModal(Control owner)
        {
            if (Handler != null)
            {
                EditorFactory factory = EditorFactory;
                if (factory == null)
                {
                    factory = new DefaultEditorFactory();
                }
                EditorForm form = factory.CreateEditor(Handler, true, true, true);

                if (owner != null)
                {
                    form.StartPosition = FormStartPosition.CenterParent;
                    DialogResult dialog = form.ShowDialog(owner);
                    return(dialog == DialogResult.OK);
                }
                else
                {
                    DialogResult dialog = form.ShowDialog();
                    return(dialog == DialogResult.OK);
                }
            }
            return(false);
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes the option handler for the label editing properties.
        /// </summary>
        private void InitializeOptionHandler()
        {
            var           optionHandler = CreateOptionHandler();
            EditorControl editorControl = new DefaultEditorFactory {
                MultiLine = true
            }.CreateControl(optionHandler, true, true);

            splitContainer1.Panel2.Controls.Add(editorControl);
            splitContainer1.SplitterDistance = splitContainer1.Width - editorControl.Width - 5;
        }
Esempio n. 5
0
        private void AddEditorControlToForm()
        {
            EditorControl editorControl = new DefaultEditorFactory()
            {
                MultiLine = true
            }.CreateControl(Handler, true, true);

            splitContainer1.Panel2.Controls.Add(editorControl);
            splitContainer1.SplitterDistance = splitContainer1.Width - editorControl.Width - 5;
        }
        private void SetupOptions()
        {
            // create the options
            SetupHandler();

            // create the EditorControl
            DefaultEditorFactory tableEditorFactory = new DefaultEditorFactory();

            editorControl      = tableEditorFactory.CreateControl(Handler, true, true);
            editorControl.Dock = DockStyle.Fill;

            //order is important here...
            optionPanel.Controls.Add(editorControl);
            optionPanel.PerformLayout();
        }
Esempio n. 7
0
        private void InitializeOptions()
        {
            Handler = CreateOptionHandler();

            DefaultEditorFactory tableEditorFactory = new DefaultEditorFactory();
            var editorControl = tableEditorFactory.CreateControl(Handler, true, true);

            editorControl.Dock         = DockStyle.Fill;
            editorControl.IsAutoAdopt  = true;
            editorControl.IsAutoCommit = true;

            //order is important here...
            editorControl.Padding = new Padding(5);
            propertiesPanel.Controls.Add(editorControl);
            propertiesPanel.Controls.SetChildIndex(editorControl, 0);
            propertiesPanel.PerformLayout();
        }