コード例 #1
0
        public T ShowDialog <T>(WindowPrepareOptions options) where T : FrmBase, new()
        {
            var newForm = PrepareShowDialog <T>(options);

            newForm.ShowDialog();

            return(newForm);
        }
コード例 #2
0
        public T PrepareShowWindow <T>(WindowPrepareOptions options, out bool createdWindow) where T : FrmBase, new()
        {
            T newForm = null;

            using (new StatusBusy(options.StatusText, options.ShowWaitForm))
            {
                if (options.UseExistingFormIfPresent)
                {
                    if (options.FormDataIdValueToSearchFor != null)
                    {
                        newForm = FindWindowInstanceByData <T>(options.FormDataIdValueToSearchFor);
                    }
                    else
                    {
                        newForm = FindWindowInstance <T>(options.FormIdValueToSearchFor);
                    }
                }

                if (newForm == null)
                {
                    newForm             = new T();
                    newForm.MdiParent   = _mdiContainer;
                    newForm.WindowState = options.NewFormState;

                    if (newForm is IInitializableForm)
                    {
                        ((IInitializableForm)newForm).InitializeForm(options.InitalizationParameters);
                    }

                    if (newForm is ILoadableForm && options.NewFormLoadBusinessData)
                    {
                        ((ILoadableForm)newForm).LoadBusiness();
                    }

                    if (newForm is IFormPermissions)
                    {
                        ((IFormPermissions)newForm).InitPermissions();
                    }

                    createdWindow = true;
                }
                else
                {
                    createdWindow = false;
                    newForm.Focus();

                    if (newForm is IReloadableForm && options.ExistingFormReloadBusinessData)
                    {
                        ((IReloadableForm)newForm).ReloadBusiness();
                    }
                }
            }

            return(newForm);
        }
コード例 #3
0
        public T ShowWindow <T>(WindowPrepareOptions options) where T : FrmBase, new()
        {
            bool createdWindow;
            var  newForm = PrepareShowWindow <T>(options, out createdWindow);

            if (createdWindow)
            {
                newForm.Show();
            }

            return(newForm);
        }
コード例 #4
0
        public T ShowDialog <T>(string statusText, bool showWaitForm, FormWindowState state) where T : FrmBase, new()
        {
            var options = new WindowPrepareOptions
            {
                StatusText              = statusText,
                ShowWaitForm            = showWaitForm,
                NewFormState            = state,
                NewFormLoadBusinessData = true,
            };

            return(ShowDialog <T>(options));
        }
コード例 #5
0
        public T PrepareShowWindow <T>(string statusText, bool showWaitForm, bool checkExists, FormWindowState state,
                                       object formIdValue) where T : FrmBase, new()
        {
            var options = new WindowPrepareOptions
            {
                StatusText               = statusText,
                ShowWaitForm             = showWaitForm,
                UseExistingFormIfPresent = checkExists,
                NewFormState             = state,
                FormIdValueToSearchFor   = formIdValue
            };

            return(PrepareShowWindow <T>(options));
        }
コード例 #6
0
        public T PrepareShowDialog <T>(WindowPrepareOptions options) where T : FrmBase, new()
        {
            T newForm;

            using (new StatusBusy(options.StatusText, options.ShowWaitForm))
            {
                newForm             = new T();
                newForm.WindowState = options.NewFormState;
                newForm.ControlBox  = false;
                newForm.Owner       = _mdiContainer;

                if (newForm is IInitializableForm)
                {
                    ((IInitializableForm)newForm).InitializeForm(options.InitalizationParameters);
                }

                if (newForm is ILoadableForm && options.NewFormLoadBusinessData)
                {
                    ((ILoadableForm)newForm).LoadBusiness();
                }
            }

            return(newForm);
        }
コード例 #7
0
        public T PrepareShowWindow <T>(WindowPrepareOptions options) where T : FrmBase, new()
        {
            bool createdWindow;

            return(PrepareShowWindow <T>(options, out createdWindow));
        }