internal static IArhiveOperationMasterForm CreateAttachmentWindow(MyChildForm masterForm, WindowInfo masterWindowInfo)
        {
            WindowInfo windowInfo = ADInfoBll.Instance.GetWindowInfo("SD_Attachment");

            MyForm form = null;
            if (windowInfo != null && !string.IsNullOrEmpty(masterWindowInfo.AttachmentId))
            {
                form = ServiceProvider.GetService<IWindowFactory>().CreateWindow(windowInfo) as MyForm;
                masterForm.SetCustomProperty("AttachmentEntityIdExp", masterWindowInfo.AttachmentId);

                if (form != null)
                {
                    form.FormClosing += new FormClosingEventHandler(delegate(object sender1, FormClosingEventArgs e1)
                    {
                        e1.Cancel = true;
                        form.Visible = false;
                    });
                }
                //if (form != null)
                //{
                    //form.Text = masterForm.Text + "的附件";
                    //form.Show();
                    //form.DisplayManager.SearchManager.LoadData(SearchExpression.And(
                    //    SearchExpression.Eq("EntityName", entityName), SearchExpression.Eq("EntityId", entityId)), null);
                    //(form.ControlManager.Dao as BaseDao<AttachmentInfo>).EntityOperating += new EventHandler<OperateArgs<AttachmentInfo>>(delegate(object sender1, OperateArgs<AttachmentInfo> e1)
                    //{
                    //    e1.Entity.EntityName = entityName;
                    //    e1.Entity.EntityId = entityId;
                    //});
                //}
            }
            return form as IArhiveOperationMasterForm;
        }
        internal static IArhiveOperationMasterForm CreateAttachmentWindow(MyChildForm masterForm, WindowInfo masterWindowInfo)
        {
            WindowInfo windowInfo = ADInfoBll.Instance.GetWindowInfo("SD_Attachment");

            MyForm form = null;

            if (windowInfo != null && !string.IsNullOrEmpty(masterWindowInfo.AttachmentId))
            {
                form = ServiceProvider.GetService <IWindowFactory>().CreateWindow(windowInfo) as MyForm;
                masterForm.SetCustomProperty("AttachmentEntityIdExp", masterWindowInfo.AttachmentId);

                if (form != null)
                {
                    form.FormClosing += new FormClosingEventHandler(delegate(object sender1, FormClosingEventArgs e1)
                    {
                        e1.Cancel    = true;
                        form.Visible = false;
                    });
                }
                //if (form != null)
                //{
                //form.Text = masterForm.Text + "的附件";
                //form.Show();
                //form.DisplayManager.SearchManager.LoadData(SearchExpression.And(
                //    SearchExpression.Eq("EntityName", entityName), SearchExpression.Eq("EntityId", entityId)), null);
                //(form.ControlManager.Dao as BaseDao<AttachmentInfo>).EntityOperating += new EventHandler<OperateArgs<AttachmentInfo>>(delegate(object sender1, OperateArgs<AttachmentInfo> e1)
                //{
                //    e1.Entity.EntityName = entityName;
                //    e1.Entity.EntityId = entityId;
                //});
                //}
            }
            return(form as IArhiveOperationMasterForm);
        }
Exemple #3
0
        private void TryAddButtons(MyButton btn, MyChildForm menuWindow)
        {
            IList <IButton> tsbs = menuWindow.GetCustomProperty(MenuWindowExtention.s_windowMenuButtonName) as IList <IButton>;

            if (tsbs == null)
            {
                tsbs = new List <IButton>();
                menuWindow.SetCustomProperty(MenuWindowExtention.s_windowMenuButtonName, tsbs);
            }
            tsbs.Add(btn);
        }
 internal static void InitializeWindowProcess(WindowInfo windowInfo, MyChildForm masterForm)
 {
     if (windowInfo.AutoProcess != null)
     {
         ProcessInfoHelper.ExecuteProcess(ADInfoBll.Instance.GetProcessInfo(windowInfo.AutoProcess.Name),
                                          new Dictionary <string, object> {
             { "masterForm", masterForm }
         });
     }
     if (!string.IsNullOrEmpty(windowInfo.EventInitialized))
     {
         EventProcessUtils.ExecuteEventProcess(ADInfoBll.Instance.GetEventProcessInfos(windowInfo.EventInitialized), masterForm, System.EventArgs.Empty);
     }
 }
        private static void TestAction(ActionInfo actionInfo)
        {
            switch (actionInfo.ActionType)
            {
            case ActionType.Window:
            {
                WindowInfo windowInfo = ADInfoBll.Instance.GetWindowInfo(actionInfo.Window.Name);
                if (windowInfo == null)
                {
                    throw new ArgumentException("Invalid WindowID in menuInfo");
                }
                MyChildForm form = null;
                try
                {
                    form             = ServiceProvider.GetService <IWindowFactory>().CreateWindow(windowInfo) as MyChildForm;
                    form.WindowState = FormWindowState.Maximized;
                    var mdiForm = ServiceProvider.GetService <IApplication>() as TabbedMdiForm;
                    //form.Show();
                    mdiForm.ShowChildForm(form);
                    TestWindow(form);
                }
                catch (Exception ex)
                {
                    ExceptionProcess.ProcessWithNotify(ex);
                }
                finally
                {
                    if (form != null)
                    {
                        form.Close();
                    }
                }
            }
            break;

            case ActionType.Form:
            {
                FormInfo formInfo = null;
                if (actionInfo.Form != null)
                {
                    formInfo = ADInfoBll.Instance.GetFormInfo(actionInfo.Form.Name);
                }

                if (formInfo == null)
                {
                    throw new ArgumentException("Invalid FormInfo in menuInfo");
                }
                Form form = null;
                try
                {
                    form             = ArchiveFormFactory.CreateForm(formInfo);
                    form.WindowState = FormWindowState.Maximized;
                    var mdiForm = ServiceProvider.GetService <IApplication>() as TabbedMdiForm;
                    //form.Show();
                    if (form is MyChildForm)
                    {
                        mdiForm.ShowChildForm(form as MyChildForm);
                    }
                    else
                    {
                        form.Show();
                    }
                    TestForm(form);
                }
                catch (Exception ex)
                {
                    ExceptionProcess.ProcessWithNotify(ex);
                }
                finally
                {
                    if (form != null)
                    {
                        form.Close();
                    }
                }
            }
            break;

            case ActionType.Process:
                break;

            case ActionType.Url:
                break;

            default:
                throw new ArgumentException("menuInfo's MenuAction is Invalid");
            }
        }
 internal static void InitializeWindowProcess(WindowInfo windowInfo, MyChildForm masterForm)
 {
     if (windowInfo.AutoProcess != null)
     {
         ProcessInfoHelper.ExecuteProcess(ADInfoBll.Instance.GetProcessInfo(windowInfo.AutoProcess.Name),
            new Dictionary<string, object> { { "masterForm", masterForm } });
     }
     if (!string.IsNullOrEmpty(windowInfo.EventInitialized))
     {
         EventProcessUtils.ExecuteEventProcess(ADInfoBll.Instance.GetEventProcessInfos(windowInfo.EventInitialized), masterForm, System.EventArgs.Empty);
     }
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="formShow"></param>
        /// <returns></returns>
        internal MyChildForm ShowChildForm(MyChildForm formShow)
        {
            if (formShow == null)
                return null;

            if (m_forms.ContainsKey(formShow.Name))
            {
                m_forms[formShow.Name].Activate();
                return m_forms[formShow.Name];
            }

            try
            {
                formShow.FormClosing += new FormClosingEventHandler(ChildForm_FormClosing);
                formShow.FormClosed += new FormClosedEventHandler(ChildForm_FormClosed);

                AddFormToGroup(formShow, 0);
                formShow.Show();
            }
            catch (Exception ex)
            {
                ExceptionProcess.ProcessWithNotify(ex);

                formShow.Close();
                //m_forms.Remove(menuInfo.Name);
                return null;
            }

            m_forms[formShow.Name] = formShow;
            return m_forms[formShow.Name];
        }
        /// <summary>
        /// ���ݲ�ͬ���Ӵ��壬��MdiForm������Ӧ�ı�
        /// </summary>
        /// <param name="childForm"></param>
        public void OnChildFormShow(MyChildForm childForm)
        {
            // ��ʱ��ArchiveSeeForm����Ϊ��������ʹ��
            if (childForm != null && !childForm.IsMdiChild)
                return;

            if (m_lastChildForm == childForm)
                return;

            m_lastChildForm = childForm;

            if (m_twSearch != null)
            {
                m_twSearch.Controls.Clear();
                if (childForm != null)
                {
                    var r = childForm.GetSearchPanel();
                    if (r != null)
                    {
                        r.Dock = DockStyle.Fill;
                        m_twSearch.Controls.Add(r);
                    }
                }
            }

            if (m_twReletedInfos != null)
            {
                m_twReletedInfos.Controls.Clear();
                if (childForm != null)
                {
                    GridRelatedControl taskPane = childForm.GetGridRelatedPanel() as GridRelatedControl;
                    if (taskPane != null)
                    {
                        m_twReletedInfos.Controls.Add(taskPane);
                        taskPane.Dock = DockStyle.Fill;
                    }
                }
            }
        }
 private void TryAddButtons(MyButton btn, MyChildForm menuWindow)
 {
     IList<IButton> tsbs = menuWindow.GetCustomProperty(MenuWindowExtention.s_windowMenuButtonName) as IList<IButton>;
     if (tsbs == null)
     {
         tsbs = new List<IButton>();
         menuWindow.SetCustomProperty(MenuWindowExtention.s_windowMenuButtonName, tsbs);
     }
     tsbs.Add(btn);
 }