Ejemplo n.º 1
0
        private void UpdateButtonsEnabledStatus()
        {
            UIOutputItem source = SelectedSource;
            UIInputItem  target = SelectedTarget;

            List <UIExchangeItem> sources = _treeSource.GetCheckedExchangeItems();

            bool checkedSourceAndTarget = source != null && target != null;

            // Make it look as if inactive rather than do it as
            // tooltips will not work on inactive buttons

            btnLinkAdd.ForeColor = checkedSourceAndTarget
                ? SystemColors.ActiveCaptionText : SystemColors.InactiveCaptionText;
            btnLinkRemove.ForeColor = listLinks.SelectedItem != null
                ? SystemColors.ActiveCaptionText : SystemColors.InactiveCaptionText;

            btnViewer.ForeColor = checkedSourceAndTarget
                ? SystemColors.ActiveCaptionText : SystemColors.InactiveCaptionText;

            btnAddSources.ForeColor = checkedSourceAndTarget
                ? SystemColors.ActiveCaptionText : SystemColors.InactiveCaptionText;
            btnArgEdit.ForeColor = source != null && source.IExchangeItem is IAdaptedOutput
                ? SystemColors.ActiveCaptionText : SystemColors.InactiveCaptionText;
        }
Ejemplo n.º 2
0
        private void OnLinkAdd(object sender, System.EventArgs e)
        {
            if (_treeSource.GetCheckedExchangeItems().Count < 1 ||
                _treeTarget.GetCheckedExchangeItems().Count < 1)
            {
                return;
            }

            List <UIExchangeItem> providers = _treeSource.GetCheckedExchangeItems();
            List <UIExchangeItem> acceptors = _treeTarget.GetCheckedExchangeItems();

            if (providers.Count == 0)
            {
                // ADH: should realy disable apply button and provide tooltip as to why
                MessageBox.Show("No Output Exchange Item selected.", "Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
                return;
            }

            if (acceptors.Count == 0)
            {
                // ADH: should realy disable apply button and provide tooltip as to why
                MessageBox.Show("No Input Exchange Item selected.", "Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
                return;
            }

            // Are the connection dialogs check boxes screwed up?
            Debug.Assert(acceptors.Count == 1);

            _uilink.Links.Add(new UIConnection.Link(
                                  (UIOutputItem)providers[providers.Count - 1], (UIInputItem)acceptors[0]));

            UpdateListLinks();
            UpdateButtonsEnabledStatus();

            _shouldBeSaved = true;
        }