Exemple #1
0
        public void Save()
        {
            if (!Valid)
            {
                return;
            }

            IContractEditor edit = Editor as IContractEditor;

            edit.Save();

            IResultGetter result      = Editor as IResultGetter;
            XmlElement    authElement = result.GetAuthElement();

            XmlHelper h = new XmlHelper("<Definition/>");

            h.AddElement(".", authElement);

            try
            {
                Contract.SetDefinition(h.GetElement("."), _owner);

                MessageBox.Show("儲存完畢!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("儲存失敗!" + ex.Message, "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #2
0
        public void Save()
        {
            IContractEditor edit = this.Editor as IContractEditor;

            edit.Save();

            if (SaveCompleted != null)
            {
                SaveCompleted.Invoke(this, EventArgs.Empty);
            }
        }
Exemple #3
0
        private void DockControl(IContractEditor editor)
        {
            Control ctrl = editor as UserControl;

            panel.Controls.Clear();
            ctrl.Dock = DockStyle.Fill;
            panel.Controls.Add(ctrl);
            this.Editor = ctrl;

            if (Contract.Definition != null)
            {
                IResultGetter rg = ctrl as IResultGetter;
                rg.SetDefinition(Contract.Definition);
            }
        }
Exemple #4
0
        private void ChangeType(ExtendType type)
        {
            IContractEditor editor = null;

            if (type == ExtendType.open)
            {
                rbPublic.Checked = true;
                editor           = new PublicAuthEditor();
            }
            else if (type == ExtendType.ta)
            {
                rbTA.Checked = true;
                editor       = new ExtendAuthEditor(type);
            }
            else if (type == ExtendType.sa)
            {
                rbSA.Checked = true;
                editor       = new ExtendAuthEditor(type);
            }
            else if (type == ExtendType.admin)
            {
                rbAdmin.Checked = true;
                editor          = new ExtendAuthEditor(type);
            }
            else if (type == ExtendType.none)
            {
                rbOther.Checked = true;
                editor          = new AdvAuthEditor();
            }
            else if (type == ExtendType.parent)
            {
                rbParent.Checked = true;
                editor           = new ExtendAuthEditor(type);
            }

            DockControl(editor);
            editor.DataChanged     += new EventHandler(editor_DataChanged);
            editor.ChangeRecovered += new EventHandler(editor_ChangeRecovered);
        }
Exemple #5
0
        public override void Save()
        {
            IContractEditor edit = this.Editor as IContractEditor;

            edit.Save();
        }
        private void DockControl(IContractEditor editor)
        {
            Control ctrl = editor as UserControl;
            panel.Controls.Clear();
            ctrl.Dock = DockStyle.Fill;
            panel.Controls.Add(ctrl);
            this.Editor = ctrl;

            if (Contract.Definition != null)
            {
                IResultGetter rg = ctrl as IResultGetter;
                rg.SetDefinition(Contract.Definition);
            }
        }