Beispiel #1
0
        public async Task CloseModal(ModalDialog modalForm, FormBase oldForm)
        {
            DeviceSession ds = this.Device;

            if (ds == null)
            {
                return;
            }

            if (modalForm == null)
            {
                throw new Exception("No modal form");
            }

            ds.FormSwitched = true;

            ds.PreviousForm = ds.ActiveForm;

            ds.ActiveForm = oldForm;
        }
Beispiel #2
0
        /// <summary>
        /// Opens this form modal, but don't closes the original ones
        /// </summary>
        /// <param name="newForm"></param>
        /// <returns></returns>
        public virtual async Task OpenModal(ModalDialog newForm, params object[] args)
        {
            DeviceSession ds = this.Device;

            if (ds == null)
            {
                return;
            }

            var parentForm = this;

            ds.FormSwitched = true;

            ds.PreviousForm = ds.ActiveForm;

            ds.ActiveForm      = newForm;
            newForm.Client     = parentForm.Client;
            newForm.Device     = ds;
            newForm.ParentForm = parentForm;

            newForm.Closed += async(s, en) =>
            {
                await CloseModal(newForm, parentForm);
            };

            foreach (var b in this.Controls)
            {
                if (!b.Enabled)
                {
                    continue;
                }

                await b.Hidden(false);
            }

            await newForm.OnInit(new InitEventArgs(args));

            await newForm.OnOpened(new EventArgs());
        }
Beispiel #3
0
 /// <summary>
 /// Get invoked when a modal child from has been closed.
 /// </summary>
 /// <param name="message"></param>
 /// <returns></returns>
 public virtual async Task ReturnFromModal(ModalDialog modal)
 {
 }