private void _okButton_Click(object sender, EventArgs e)
            {
                object[] bufferNodes = new object[_treeView.Nodes.Count];

                for (int i = 0; i < bufferNodes.Length; i++)
                {
                    bufferNodes[i] = _treeView.Nodes[i].Clone();
                }

                base.Items = bufferNodes;

                _treeView.Dispose();
                _treeView = null;
            }
Esempio n. 2
0
            private void InitializeComponent()
            {
                _addRootButton  = new Button();
                _addChildButton = new Button();
                _deleteButton   = new Button();
                _dialogBlock    = new NuGenCollectionEditorDialogBlock();
                _mainBlock      = new NuGenCollectionEditorMainBlock();
                _moveDownButton = _mainBlock.GetMoveDownButton();
                _moveUpButton   = _mainBlock.GetMoveUpButton();
                _propertyBlock  = new NuGenCollectionEditorPropertyBlock();
                _splitContainer = new SplitContainer();
                _treeView       = new NodesEditorTreeView();

                this.SuspendLayout();

                /* DialogBlock */

                _dialogBlock.Dock     = DockStyle.Bottom;
                _dialogBlock.Parent   = this;
                _dialogBlock.TabIndex = 10;

                Button okButton     = _dialogBlock.GetOkButton();
                Button cancelButton = _dialogBlock.GetCancelButton();

                okButton.Click     += _okButton_Click;
                cancelButton.Click += _cancelButton_Click;

                /* SplitContainer */

                _splitContainer.Dock          = DockStyle.Fill;
                _splitContainer.Panel1MinSize = 250;
                _splitContainer.Panel2MinSize = 100;
                _splitContainer.Parent        = this;
                _splitContainer.BringToFront();

                /* MainBlock */

                _mainBlock.Dock     = DockStyle.Fill;
                _mainBlock.Parent   = _splitContainer.Panel1;
                _mainBlock.TabIndex = 20;
                _mainBlock.SetTitle(Resources.Text_TreeNodeCollectionEditor_mainTitle);

                /* Action buttons */

                _moveDownButton.Click += _moveDownButton_Click;
                _moveUpButton.Click   += _moveUpButton_Click;

                _deleteButton.Dock   = DockStyle.Top;
                _deleteButton.Image  = Resources.Delete;
                _deleteButton.Click += _deleteButton_Click;

                Control.ControlCollection actionControls = _mainBlock.GetActionControls();
                actionControls.Add(_deleteButton);
                _deleteButton.BringToFront();

                /* Populate buttons */

                _addRootButton.Dock     = DockStyle.Left;
                _addRootButton.TabIndex = 10;
                _addRootButton.Text     = Resources.Text_TreeNodeCollectionEditor_addRootButton;
                _addRootButton.Click   += _addRootButton_Click;

                _addChildButton.Dock     = DockStyle.Left;
                _addChildButton.TabIndex = 20;
                _addChildButton.Text     = Resources.Text_TreeNodeCollectionEditor_addChildButton;
                _addChildButton.Click   += _addChildButton_Click;

                Control.ControlCollection populateControls = _mainBlock.GetPopulateControls();
                populateControls.Add(_addChildButton);
                populateControls.Add(_addRootButton);

                /* PropertyBlock */

                _propertyBlock.Dock     = DockStyle.Fill;
                _propertyBlock.Parent   = _splitContainer.Panel2;
                _propertyBlock.TabIndex = 30;
                _propertyBlock.SetTitle(Resources.Text_TreeNodeCollectionEditor_propertyTitleNone);
                _propertyBlock.SelectedObjectsChanged += _propertyBlock_SelectedObjectsChanged;

                /* TreeView */

                _treeView.Dock   = DockStyle.Fill;
                _treeView.Parent = _mainBlock;
                _treeView.BringToFront();
                _treeView.AfterSelect += _treeView_AfterSelect;

                /* Form */

                NuGenCollectionEditorInitializer.InitializeEditorForm(this);
                this.AcceptButton = okButton;
                this.CancelButton = cancelButton;
                this.Size         = new Size(580, 480);
                this.MinimumSize  = this.Size;
                this.Text         = Resources.Text_TreeNodeCollectionEditor_EditorForm;
                base.ResumeLayout(false);
            }
            /*
             * InitializeComponent
             */

            private void InitializeComponent()
            {
                _okButton     = new Button();
                _cancelButton = new Button();

                _addRootButton  = new Button();
                _addChildButton = new Button();
                _deleteButton   = new Button();
                _moveDownButton = new Button();
                _moveUpButton   = new Button();

                _propertyDescriptionLabel = new Label();
                _treeViewDescriptionLabel = new Label();

                _propertyGrid      = new NuGenPropertyGrid();
                _propertyGrid.Dock = DockStyle.Fill;

                _okCancelPanel                     = new TableLayoutPanel();
                _nodeControlPanel                  = new TableLayoutPanel();
                _overarchingTableLayoutPanel       = new TableLayoutPanel();
                _navigationButtonsTableLayoutPanel = new TableLayoutPanel();

                _treeView      = new NodesEditorTreeView();
                _treeView.Dock = DockStyle.Fill;

                _okCancelPanel.SuspendLayout();
                _nodeControlPanel.SuspendLayout();
                _overarchingTableLayoutPanel.SuspendLayout();
                _navigationButtonsTableLayoutPanel.SuspendLayout();
                this.SuspendLayout();

                _okCancelPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50f));
                _okCancelPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50f));
                _okCancelPanel.Controls.Add(_okButton, 0, 0);
                _okCancelPanel.Controls.Add(_cancelButton, 1, 0);
                _okCancelPanel.Dock   = DockStyle.Right;
                _okCancelPanel.Margin = new Padding(3, 0, 0, 0);
                _okCancelPanel.RowStyles.Add(new RowStyle());

                _okButton.DialogResult = DialogResult.OK;
                _okButton.Dock         = DockStyle.Fill;
                _okButton.Text         = Resources.Text_TreeNodeCollectionEditor_okButton;

                _cancelButton.DialogResult = DialogResult.Cancel;
                _cancelButton.Dock         = DockStyle.Fill;
                _cancelButton.Text         = Resources.Text_TreeNodeCollectionEditor_cancelButton;

                _nodeControlPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50f));
                _nodeControlPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50f));
                _nodeControlPanel.Dock = DockStyle.Fill;
                _nodeControlPanel.Controls.Add(_addRootButton, 0, 0);
                _nodeControlPanel.Controls.Add(_addChildButton, 1, 0);
                _nodeControlPanel.Margin = new Padding(0, 3, 3, 3);
                _nodeControlPanel.RowStyles.Add(new RowStyle());

                _addRootButton.Dock   = DockStyle.Fill;
                _addRootButton.Margin = new Padding(0, 0, 3, 0);
                _addRootButton.Text   = Resources.Text_TreeNodeCollectionEditor_addRootButton;

                _addChildButton.Dock   = DockStyle.Fill;
                _addChildButton.Margin = new Padding(3, 0, 0, 0);
                _addChildButton.Text   = Resources.Text_TreeNodeCollectionEditor_addChildButton;

                _deleteButton.Dock   = DockStyle.Fill;
                _deleteButton.Margin = new Padding(0, 3, 0, 0);
                _deleteButton.Image  = Resources.Delete;
                _deleteButton.Size   = new Size(30, 30);

                _moveDownButton.Dock   = DockStyle.Fill;
                _moveDownButton.Margin = new Padding(0, 1, 0, 3);
                _moveDownButton.Image  = Resources.Down;
                _moveDownButton.Size   = new Size(30, 30);

                _moveUpButton.Dock   = DockStyle.Fill;
                _moveUpButton.Margin = new Padding(0, 0, 0, 1);
                _moveUpButton.Image  = Resources.Up;
                _moveUpButton.Size   = new Size(30, 30);

                _propertyGrid.LineColor = SystemColors.ScrollBar;
                _overarchingTableLayoutPanel.SetRowSpan(_propertyGrid, 2);

                _propertyDescriptionLabel.Dock   = DockStyle.Fill;
                _propertyDescriptionLabel.Margin = new Padding(3, 1, 0, 0);

                _treeView.AllowDrop = true;

                _treeView.HideSelection = false;
                _treeView.Margin        = new Padding(0, 3, 3, 3);

                _treeViewDescriptionLabel.Dock   = DockStyle.Fill;
                _treeViewDescriptionLabel.Margin = new Padding(0, 1, 3, 0);
                _treeViewDescriptionLabel.Text   = Resources.Text_TreeNodeCollectionEditor_treeViewDescriptionLabel;

                _overarchingTableLayoutPanel.Dock = DockStyle.Fill;
                _overarchingTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 250f));
                _overarchingTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 40f));
                _overarchingTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100f));
                _overarchingTableLayoutPanel.Controls.Add(_navigationButtonsTableLayoutPanel, 1, 1);
                _overarchingTableLayoutPanel.Controls.Add(_propertyDescriptionLabel, 2, 0);
                _overarchingTableLayoutPanel.Controls.Add(_propertyGrid, 2, 1);
                _overarchingTableLayoutPanel.Controls.Add(_treeView, 0, 1);
                _overarchingTableLayoutPanel.Controls.Add(_treeViewDescriptionLabel, 0, 0);
                _overarchingTableLayoutPanel.Controls.Add(_nodeControlPanel, 0, 2);
                _overarchingTableLayoutPanel.Controls.Add(_okCancelPanel, 2, 3);
                _overarchingTableLayoutPanel.RowStyles.Add(new RowStyle());
                _overarchingTableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100f));
                _overarchingTableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 30f));
                _overarchingTableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 30f));

                _navigationButtonsTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
                _navigationButtonsTableLayoutPanel.Controls.Add(_moveUpButton, 0, 0);
                _navigationButtonsTableLayoutPanel.Controls.Add(_deleteButton, 0, 2);
                _navigationButtonsTableLayoutPanel.Controls.Add(_moveDownButton, 0, 1);
                _navigationButtonsTableLayoutPanel.RowStyles.Add(new RowStyle());
                _navigationButtonsTableLayoutPanel.RowStyles.Add(new RowStyle());
                _navigationButtonsTableLayoutPanel.RowStyles.Add(new RowStyle());

                this.AcceptButton  = _okButton;
                this.AutoScaleMode = AutoScaleMode.Font;
                this.CancelButton  = _cancelButton;
                this.Controls.Add(_overarchingTableLayoutPanel);
                this.Padding = new Padding(10);

                this.MaximizeBox   = false;
                this.MinimizeBox   = false;
                this.ShowIcon      = false;
                this.ShowInTaskbar = false;
                this.Size          = new Size(580, 480);
                this.MinimumSize   = this.Size;
                this.Text          = Resources.Text_TreeNodeCollectionEditor_EditorForm;

                _okCancelPanel.ResumeLayout(false);
                _okCancelPanel.PerformLayout();
                _nodeControlPanel.ResumeLayout(false);
                _nodeControlPanel.PerformLayout();
                _overarchingTableLayoutPanel.ResumeLayout(false);
                _overarchingTableLayoutPanel.PerformLayout();
                _navigationButtonsTableLayoutPanel.ResumeLayout(false);

                base.ResumeLayout(false);
            }
			private void _okButton_Click(object sender, EventArgs e)
			{
				object[] bufferNodes = new object[_treeView.Nodes.Count];

				for (int i = 0; i < bufferNodes.Length; i++)
				{
					bufferNodes[i] = _treeView.Nodes[i].Clone();
				}

				base.Items = bufferNodes;
				
				_treeView.Dispose();
				_treeView = null;
			}
			/*
			 * InitializeComponent
			 */

			private void InitializeComponent()
			{
				_okButton = new Button();
				_cancelButton = new Button();
				
				_addRootButton = new Button();
				_addChildButton = new Button();
				_deleteButton = new Button();
				_moveDownButton = new Button();
				_moveUpButton = new Button();

				_propertyDescriptionLabel = new Label();
				_treeViewDescriptionLabel = new Label();

				_propertyGrid = new NuGenPropertyGrid();
				_propertyGrid.Dock = DockStyle.Fill;

				_okCancelPanel = new TableLayoutPanel();
				_nodeControlPanel = new TableLayoutPanel();
				_overarchingTableLayoutPanel = new TableLayoutPanel();
				_navigationButtonsTableLayoutPanel = new TableLayoutPanel();

				_treeView = new NodesEditorTreeView();
				_treeView.Dock = DockStyle.Fill;
				
				_okCancelPanel.SuspendLayout();
				_nodeControlPanel.SuspendLayout();
				_overarchingTableLayoutPanel.SuspendLayout();
				_navigationButtonsTableLayoutPanel.SuspendLayout();
				this.SuspendLayout();

				_okCancelPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50f));
				_okCancelPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50f));
				_okCancelPanel.Controls.Add(_okButton, 0, 0);
				_okCancelPanel.Controls.Add(_cancelButton, 1, 0);
				_okCancelPanel.Dock = DockStyle.Right;
				_okCancelPanel.Margin = new Padding(3, 0, 0, 0);
				_okCancelPanel.RowStyles.Add(new RowStyle());
				
				_okButton.DialogResult = DialogResult.OK;
				_okButton.Dock = DockStyle.Fill;
				_okButton.Text = Resources.Text_TreeNodeCollectionEditor_okButton;
				
				_cancelButton.DialogResult = DialogResult.Cancel;
				_cancelButton.Dock = DockStyle.Fill;
				_cancelButton.Text = Resources.Text_TreeNodeCollectionEditor_cancelButton;
				
				_nodeControlPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50f));
				_nodeControlPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50f));
				_nodeControlPanel.Dock = DockStyle.Fill;
				_nodeControlPanel.Controls.Add(_addRootButton, 0, 0);
				_nodeControlPanel.Controls.Add(_addChildButton, 1, 0);
				_nodeControlPanel.Margin = new Padding(0, 3, 3, 3);
				_nodeControlPanel.RowStyles.Add(new RowStyle());

				_addRootButton.Dock = DockStyle.Fill;
				_addRootButton.Margin = new Padding(0, 0, 3, 0);
				_addRootButton.Text = Resources.Text_TreeNodeCollectionEditor_addRootButton;

				_addChildButton.Dock = DockStyle.Fill;
				_addChildButton.Margin = new Padding(3, 0, 0, 0);
				_addChildButton.Text = Resources.Text_TreeNodeCollectionEditor_addChildButton;

				_deleteButton.Dock = DockStyle.Fill;
				_deleteButton.Margin = new Padding(0, 3, 0, 0);
				_deleteButton.Image = Resources.Delete;
				_deleteButton.Size = new Size(30, 30);

				_moveDownButton.Dock = DockStyle.Fill;
				_moveDownButton.Margin = new Padding(0, 1, 0, 3);
				_moveDownButton.Image = Resources.Down;
				_moveDownButton.Size = new Size(30, 30);

				_moveUpButton.Dock = DockStyle.Fill;
				_moveUpButton.Margin = new Padding(0, 0, 0, 1);
				_moveUpButton.Image = Resources.Up;
				_moveUpButton.Size = new Size(30, 30);
				
				_propertyGrid.LineColor = SystemColors.ScrollBar;
				_overarchingTableLayoutPanel.SetRowSpan(_propertyGrid, 2);

				_propertyDescriptionLabel.Dock = DockStyle.Fill;
				_propertyDescriptionLabel.Margin = new Padding(3, 1, 0, 0);

				_treeView.AllowDrop = true;
				
				_treeView.HideSelection = false;
				_treeView.Margin = new Padding(0, 3, 3, 3);

				_treeViewDescriptionLabel.Dock = DockStyle.Fill;
				_treeViewDescriptionLabel.Margin = new Padding(0, 1, 3, 0);
				_treeViewDescriptionLabel.Text = Resources.Text_TreeNodeCollectionEditor_treeViewDescriptionLabel;

				_overarchingTableLayoutPanel.Dock = DockStyle.Fill;
				_overarchingTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 250f));
				_overarchingTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 40f));
				_overarchingTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100f));
				_overarchingTableLayoutPanel.Controls.Add(_navigationButtonsTableLayoutPanel, 1, 1);
				_overarchingTableLayoutPanel.Controls.Add(_propertyDescriptionLabel, 2, 0);
				_overarchingTableLayoutPanel.Controls.Add(_propertyGrid, 2, 1);
				_overarchingTableLayoutPanel.Controls.Add(_treeView, 0, 1);
				_overarchingTableLayoutPanel.Controls.Add(_treeViewDescriptionLabel, 0, 0);
				_overarchingTableLayoutPanel.Controls.Add(_nodeControlPanel, 0, 2);
				_overarchingTableLayoutPanel.Controls.Add(_okCancelPanel, 2, 3);
				_overarchingTableLayoutPanel.RowStyles.Add(new RowStyle());
				_overarchingTableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100f));
				_overarchingTableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 30f));
				_overarchingTableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 30f));

				_navigationButtonsTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
				_navigationButtonsTableLayoutPanel.Controls.Add(_moveUpButton, 0, 0);
				_navigationButtonsTableLayoutPanel.Controls.Add(_deleteButton, 0, 2);
				_navigationButtonsTableLayoutPanel.Controls.Add(_moveDownButton, 0, 1);
				_navigationButtonsTableLayoutPanel.RowStyles.Add(new RowStyle());
				_navigationButtonsTableLayoutPanel.RowStyles.Add(new RowStyle());
				_navigationButtonsTableLayoutPanel.RowStyles.Add(new RowStyle());

				this.AcceptButton = _okButton;
				this.AutoScaleMode = AutoScaleMode.Font;
				this.CancelButton = _cancelButton;
				this.Controls.Add(_overarchingTableLayoutPanel);
				this.Padding = new Padding(10);
				
				this.MaximizeBox = false;
				this.MinimizeBox = false;
				this.ShowIcon = false;
				this.ShowInTaskbar = false;
				this.Size = new Size(580, 480);
				this.MinimumSize = this.Size;
				this.Text = Resources.Text_TreeNodeCollectionEditor_EditorForm;

				_okCancelPanel.ResumeLayout(false);
				_okCancelPanel.PerformLayout();
				_nodeControlPanel.ResumeLayout(false);
				_nodeControlPanel.PerformLayout();
				_overarchingTableLayoutPanel.ResumeLayout(false);
				_overarchingTableLayoutPanel.PerformLayout();
				_navigationButtonsTableLayoutPanel.ResumeLayout(false);

				base.ResumeLayout(false);
			}
			private void InitializeComponent()
			{
				_addRootButton = new Button();
				_addChildButton = new Button();
				_deleteButton = new Button();
				_dialogBlock = new NuGenCollectionEditorDialogBlock();
				_mainBlock = new NuGenCollectionEditorMainBlock();
				_moveDownButton = _mainBlock.GetMoveDownButton();
				_moveUpButton = _mainBlock.GetMoveUpButton();
				_propertyBlock = new NuGenCollectionEditorPropertyBlock();
				_splitContainer = new SplitContainer();
				_treeView = new NodesEditorTreeView();

				this.SuspendLayout();

				/* DialogBlock */

				_dialogBlock.Dock = DockStyle.Bottom;
				_dialogBlock.Parent = this;
				_dialogBlock.TabIndex = 10;

				Button okButton = _dialogBlock.GetOkButton();
				Button cancelButton = _dialogBlock.GetCancelButton();
				okButton.Click += _okButton_Click;
				cancelButton.Click += _cancelButton_Click;

				/* SplitContainer */

				_splitContainer.Dock = DockStyle.Fill;
				_splitContainer.Panel1MinSize = 250;
				_splitContainer.Panel2MinSize = 100;
				_splitContainer.Parent = this;
				_splitContainer.BringToFront();

				/* MainBlock */

				_mainBlock.Dock = DockStyle.Fill;
				_mainBlock.Parent = _splitContainer.Panel1;
				_mainBlock.TabIndex = 20;
				_mainBlock.SetTitle(Resources.Text_TreeNodeCollectionEditor_mainTitle);

				/* Action buttons */

				_moveDownButton.Click += _moveDownButton_Click;
				_moveUpButton.Click += _moveUpButton_Click;

				_deleteButton.Dock = DockStyle.Top;
				_deleteButton.Image = Resources.Delete;
				_deleteButton.Click += _deleteButton_Click;

				Control.ControlCollection actionControls = _mainBlock.GetActionControls();
				actionControls.Add(_deleteButton);
				_deleteButton.BringToFront();

				/* Populate buttons */

				_addRootButton.Dock = DockStyle.Left;
				_addRootButton.TabIndex = 10;
				_addRootButton.Text = Resources.Text_TreeNodeCollectionEditor_addRootButton;
				_addRootButton.Click += _addRootButton_Click;

				_addChildButton.Dock = DockStyle.Left;
				_addChildButton.TabIndex = 20;
				_addChildButton.Text = Resources.Text_TreeNodeCollectionEditor_addChildButton;
				_addChildButton.Click += _addChildButton_Click;

				Control.ControlCollection populateControls = _mainBlock.GetPopulateControls();
				populateControls.Add(_addChildButton);
				populateControls.Add(_addRootButton);

				/* PropertyBlock */

				_propertyBlock.Dock = DockStyle.Fill;
				_propertyBlock.Parent = _splitContainer.Panel2;
				_propertyBlock.TabIndex = 30;
				_propertyBlock.SetTitle(Resources.Text_TreeNodeCollectionEditor_propertyTitleNone);
				_propertyBlock.SelectedObjectsChanged += _propertyBlock_SelectedObjectsChanged;

				/* TreeView */

				_treeView.Dock = DockStyle.Fill;
				_treeView.Parent = _mainBlock;
				_treeView.BringToFront();
				_treeView.AfterSelect += _treeView_AfterSelect;

				/* Form */

				NuGenCollectionEditorInitializer.InitializeEditorForm(this);
				this.AcceptButton = okButton;
				this.CancelButton = cancelButton;
				this.Size = new Size(580, 480);
				this.MinimumSize = this.Size;
				this.Text = Resources.Text_TreeNodeCollectionEditor_EditorForm;
				base.ResumeLayout(false);
			}