public AskExitFormResult AskExit(AskExitFormObjectState ObjectState, AskExitFormResult AdmittedResults)
        {
            /*
            this.button1.Enabled = this.button2.Enabled = this.button3.Enabled = this.button4.Enabled = this.button5.Enabled = this.button6.Enabled = false;

            if ((ProhibitedResults & AskExitFormResult.Save) == AskExitFormResult.Save)
                this.button1.Enabled = true;

            if ((ProhibitedResults & AskExitFormResult.Reject) == AskExitFormResult.Reject)
                this.button2.Enabled = true;

            if ((ProhibitedResults & AskExitFormResult.EndEdit) == AskExitFormResult.EndEdit)
                this.button3.Enabled = true;

            if ((ProhibitedResults & AskExitFormResult.CancelEdit) == AskExitFormResult.CancelEdit)
                this.button4.Enabled = true;

            if ((ProhibitedResults & AskExitFormResult.CancelExit) == AskExitFormResult.CancelExit)
                this.button5.Enabled = true;

            if ((ProhibitedResults & AskExitFormResult.JustExit) == AskExitFormResult.JustExit)
                this.button6.Enabled = true;
             */

            this.button1.Visible = this.button2.Visible = this.button3.Visible = this.button4.Visible = this.button5.Visible = this.button6.Visible = false;

            if ((AdmittedResults & AskExitFormResult.Save) == AskExitFormResult.Save)
                this.button1.Visible = true;

            if ((AdmittedResults & AskExitFormResult.Reject) == AskExitFormResult.Reject)
                this.button2.Visible = true;

            if ((AdmittedResults & AskExitFormResult.EndEdit) == AskExitFormResult.EndEdit)
                this.button3.Visible = true;

            if ((AdmittedResults & AskExitFormResult.CancelEdit) == AskExitFormResult.CancelEdit)
                this.button4.Visible = true;

            if ((AdmittedResults & AskExitFormResult.CancelExit) == AskExitFormResult.CancelExit)
                this.button5.Visible = true;

            if ((AdmittedResults & AskExitFormResult.JustExit) == AskExitFormResult.JustExit)
                this.button6.Visible = true;


            this.ShowDialog();

            return _askExitFormResult;
        }
        private ControllerAskExitResult GetXtraBindingControllerAskExitResult(AskExitFormResult Result)
        {
            ControllerAskExitResult res = ControllerAskExitResult.None;

            if ((Result & AskExitFormResult.Save) == AskExitFormResult.Save)
                res |= ControllerAskExitResult.Save;

            if ((Result & AskExitFormResult.Reject) == AskExitFormResult.Reject)
                res |= ControllerAskExitResult.Reject;

            if ((Result & AskExitFormResult.EndEdit) == AskExitFormResult.EndEdit)
                res |= ControllerAskExitResult.EndEdit;

            if ((Result & AskExitFormResult.CancelEdit) == AskExitFormResult.CancelEdit)
                res |= ControllerAskExitResult.CancelEdit;

            if ((Result & AskExitFormResult.CancelExit) == AskExitFormResult.CancelExit)
                res |= ControllerAskExitResult.CancelExit;

            if ((Result & AskExitFormResult.JustExit) == AskExitFormResult.JustExit)
                res |= ControllerAskExitResult.JustExit;

            return res;
        }
        private void button6_Click(object sender, EventArgs e)
        {
            _askExitFormResult = AskExitFormResult.JustExit;

            this.Close();
        }
        private void button4_Click(object sender, EventArgs e)
        {
            _askExitFormResult = AskExitFormResult.CancelEdit;

            this.Close();
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            _askExitFormResult = AskExitFormResult.Reject;
        }
 public static AskExitFormResult Ask(AskExitFormResult EnabledResults)
 {
     return Ask(AskExitFormObjectState.Unchanged, EnabledResults);
 }
        public static AskExitFormResult Ask(AskExitFormObjectState ObjectState, AskExitFormResult EnabledResults)
        {
            AskExitForm form = new AskExitForm();

            return form.AskExit(ObjectState, EnabledResults);
        }