Exemple #1
0
        public NavigatorComponentContainerControl(NavigatorComponentContainer component)
        {
            InitializeComponent();

            _nodeMap = new Dictionary <NavigatorPage, TreeNode>();

            _component = component;
            _component.CurrentPageChanged += _component_CurrentNodeChanged;
            _component.Pages.ItemAdded    += Pages_ItemAdded;
            _component.Pages.ItemRemoved  += Pages_ItemRemoved;

            if (!_component.ShowApply)
            {
                _applyButton.Dispose();
                _applyButton = null;
            }
            else
            {
                _applyButton.Click += delegate { _component.Apply(); };
                _applyButton.DataBindings.Add("Enabled", _component, "ApplyEnabled", true, DataSourceUpdateMode.OnPropertyChanged);
            }

            base.AcceptButton = this._okButton;
            base.CancelButton = this._cancelButton;

            splitContainer1.Panel1Collapsed = _component.ShowTree == false;
            _nextButton.DataBindings.Add("Enabled", _component, "ForwardEnabled");
            _backButton.DataBindings.Add("Enabled", _component, "BackEnabled");
            _okButton.DataBindings.Add("Enabled", _component, "AcceptEnabled");

            // build the tree
            UpdateTree();

            if (_component.StartFullyExpanded)
            {
                // expand entire tree
                _treeView.ExpandAll();
            }
            else
            {
                // expand first-level of tree
                foreach (TreeNode treeNode in _treeView.Nodes)
                {
                    treeNode.Expand();
                }
            }

            ShowPage(_component.CurrentPage);
        }
 public void SetComponent(IApplicationComponent component)
 {
     _component = (NavigatorComponentContainer)component;
 }
        public NavigatorComponentContainerControl(NavigatorComponentContainer component)
		{
            InitializeComponent();

            _nodeMap = new Dictionary<NavigatorPage, TreeNode>();

            _component = component;
            _component.CurrentPageChanged += _component_CurrentNodeChanged;
			_component.Pages.ItemAdded += Pages_ItemAdded;
			_component.Pages.ItemRemoved += Pages_ItemRemoved;

			if (!_component.ShowApply)
			{
				_applyButton.Dispose();
				_applyButton = null;
			}
			else
			{
				_applyButton.Click += delegate { _component.Apply(); };
				_applyButton.DataBindings.Add("Enabled", _component, "ApplyEnabled", true, DataSourceUpdateMode.OnPropertyChanged);
			}

    		base.AcceptButton = this._okButton;
			base.CancelButton = this._cancelButton;

        	splitContainer1.Panel1Collapsed = _component.ShowTree == false;
            _nextButton.DataBindings.Add("Enabled", _component, "ForwardEnabled");
            _backButton.DataBindings.Add("Enabled", _component, "BackEnabled");
            _okButton.DataBindings.Add("Enabled", _component, "AcceptEnabled");

            // build the tree
            UpdateTree();

			if(_component.StartFullyExpanded)
			{
				// expand entire tree
				_treeView.ExpandAll();
			}
			else
			{
				// expand first-level of tree
				foreach (TreeNode treeNode in _treeView.Nodes)
				{
					treeNode.Expand();
				}
			}

            ShowPage(_component.CurrentPage);
        }