Exemple #1
0
        public static void ShowClient(IApplicationForm frm, Control parentControl, ref object id, Dictionary <string, object> @params = null)
        {
            if (frm == null)
            {
                return;
            }

            //if (!CanViewObject(frm))
            //{
            //    return;
            //}
            if (!Register(frm, id))
            {
                return;
            }
            try
            {
                if (!LoadData(frm, ref id))
                {
                    return;
                }

                //if (frm is IBasePanel)
                //{
                //    (frm as IBasePanel).StartUpParameters = @params;
                //    (frm as IBasePanel).LoadData(ref id);
                //}
                using (new WaitDialog())
                {
                    DisplayClientForm(frm, parentControl);
                    frm.Activate();
                }
            }
            catch (Exception ex)
            {
                UnRegister(frm);
                Dbg.Debug("error during form showing", ex.ToString());
                throw;
            }
        }
Exemple #2
0
 private static void Activate(IApplicationForm form)
 {
     if (form == null)
     {
         if (MainForm != null)
         {
             MainForm.Activate();
             MainForm.BringToFront();
         }
         return;
     }
     if (ModalFormCount > 0)
     {
         return;
     }
     if (m_FormList.IndexOf(form) >= 0)
     {
         form.Activate();
         ((Control)form).BringToFront();
         m_CurrentForm = form;
     }
 }
Exemple #3
0
        private static Form Show
            (IApplicationForm appForm, IObject bo, bool isModal, bool readOnly, Dictionary <string, object> parameters = null, int width = 0,
            int height = 0)
        {
            if (appForm == null)
            {
                return(null);
            }

            if (appForm is IBasePanel && bo == null)
            {
                bo = ((IBasePanel)appForm).BusinessObject;
            }
            var id = (bo != null && bo.Key != null) ? bo.Key : appForm.Key;

            if (!Register(appForm, id))
            {
                var frm = ((Control)m_CurrentForm).FindForm();
                if (frm != null)
                {
                    return(frm);
                }
            }
            try
            {
                Form baseFormContainer;
                using (new WaitDialog())
                {
                    if (appForm is IBasePanel && ((IBasePanel)appForm).BusinessObject != bo)
                    {
                        var basePanel = (IBasePanel)appForm;
                        basePanel.BusinessObject = bo;
                    }

                    if (readOnly || ReadOnly)
                    {
                        SetReadOnly(appForm, true);
                    }
                    baseFormContainer = PrepareFormShowing(appForm, false, parameters, width, height);

                    appForm.Activate();
                    InitDesignManager(appForm);
                }
                if (isModal)
                {
                    ModalFormCount++;
                    baseFormContainer.ShowDialog();
                    FormDisposer.Add(appForm as Control);
                }
                else
                {
                    baseFormContainer.Show();
                }
                baseFormContainer.BringToFront();
                //активируем форму и готовим её к отображению
                return(baseFormContainer);
            }
            catch (Exception ex)
            {
                UnRegister(appForm);
                Dbg.Debug("error during form showing", ex.ToString());
                return(null);
            }
            finally
            {
                if (isModal)
                {
                    ModalFormCount--;
                }
            }
        }