public BlockDetailsForm(IEnumerable<SaveBlock> blocks, Point popupLocation, BlockViewWrapperControl Wrapper)
        {
            this.oldBlocks.AddRange(blocks.Clone());
            this.blocks.AddRange(blocks);
            this.wrapper = Wrapper;
            StartPosition = FormStartPosition.Manual;
            Location = popupLocation;

            InitializeComponent();
            blockTypesDropDown.Items.AddRange(Enum.GetNames(typeof(BlockType)));
            blockTypesDropDown.Items.Remove(Enum.GetName(typeof(BlockType), BlockType.OUT_OF_BOUNDS));
            blockTypesDropDown.Items.Remove(Enum.GetName(typeof(BlockType), BlockType.EMPTY));

            if (this.blocks.All(block => block.Type == this.blocks.First().Type))
            {
                oldBlockType.Text = blockTypesDropDown.Text = System.Enum.GetName(typeof(BlockType), this.blocks.First().Type);
            }
            else
            {
                oldBlockType.Text = blockTypesDropDown.Text = MULTIPLE_ENTRY_TEXT;
            }

            if (this.blocks.All(block => string.IsNullOrWhiteSpace(block.Script)))
            {
                scriptNameBox.Text = "";
                oldScriptName.Text = NO_SCRIPT_NAME_TEXT;
            }
            else if (this.blocks.All(block => block.Script == this.blocks.First().Script))
            {
                oldScriptName.Text = scriptNameBox.Text = this.blocks.First().Script;
            }
            else
            {
                oldScriptName.Text = scriptNameBox.Text = MULTIPLE_ENTRY_TEXT;
            }

            setupDone = true;
            updateBlocks();
        }
Example #2
0
        /// <summary>
        /// Bind this instance to a new DomFragment created from a sequence of elements.
        /// </summary>
        ///
        /// <param name="elements">
        /// The elements to provide the source for this object's DOM.
        /// </param>

        protected void CreateNewFragment(IEnumerable<IDomObject> elements)
        {

            Document = DomDocument.Create(elements.Clone(), HtmlParsingMode.Fragment);
            AddSelection(Document.ChildNodes);
        }
Example #3
0
        /// <summary>
        /// Bind this instance to a new DomFragment created from a sequence of elements.
        /// </summary>
        ///
        /// <param name="elements">
        /// The elements to provide the source for this object's DOM.
        /// </param>

        protected void CreateNewFragment(IEnumerable<IDomObject> elements)
        {
            Document = new DomFragment(elements.Clone());
            AddSelection(Document.ChildNodes);
            FinishCreatingNewDocument();
        }