コード例 #1
0
        public RDMPControlCommonFunctionality(IRDMPControl hostControl)
        {
            _hostControl = hostControl;
            ToolStrip    = new ToolStrip();

            ToolStrip.Location = new Point(0, 0);
            ToolStrip.TabIndex = 1;

            //Add the three lines dropdown for seldom used options (See AddToMenu). This starts disabled.
            _menuDropDown         = new ToolStripMenuItem();
            _menuDropDown.Image   = CatalogueIcons.Menu;
            _menuDropDown.Enabled = false;
            ToolStrip.Items.Add(_menuDropDown);

            _runChecksToolStripButton.Click += (s, e) => StartChecking();
        }
コード例 #2
0
ファイル: ObjectSaverButton.cs プロジェクト: lulzzz/RDMP
        public void SetupFor(IRDMPControl control, DatabaseEntity o, IActivateItems activator)
        {
            control.CommonFunctionality.Add(btnSave);
            control.CommonFunctionality.Add(btnUndoRedo);

            Form f = control as Form ?? ((Control)control).FindForm();

            if (f == null)
            {
                throw new NotSupportedException("Cannot call SetupFor before the control has been added to it's parent form");
            }

            _parent = control;

            Enable(false);

            //if it is a fresh instance
            if (!ReferenceEquals(_o, o))
            {
                //subscribe to property change events
                if (_o != null)
                {
                    _o.PropertyChanged -= PropertyChanged;
                }
                _o = o;
                _o.PropertyChanged += PropertyChanged;
            }

            //already set up before
            if (_activator != null)
            {
                return;
            }

            _activator = activator;

            f.Enter += ParentForm_Enter;
            f.Leave += ParentFormOnLeave;

            //the first time it is set up it could still be out of date!
            CheckForOutOfDateObjectAndOfferToFix();
        }