Пример #1
0
        public static ABCBaseScreen GetABCScreen(String strLayoutXMLPath, STViewsInfo viewInfo, ViewMode mode)
        {
            //if ( ABCBaseProvider.BaseInstance.CheckViewPermission( viewInfo.STViewNo , ViewPermission.AllowView )==false )
            //{
            //    ABCHelper.ABCMessageBox.Show( "Bạn không đủ quyền hạn sử dụng tính năng này!" , "Thông báo" , MessageBoxButtons.OK , MessageBoxIcon.Error );
            //    return null;
            //}

            ABCBaseScreen screen = null;
            Type          type   = null;

            if (viewInfo != null)
            {
                type = GetABCScreenType(viewInfo.STViewID);
            }

            if (type == null)
            {
                type = typeof(ABCBaseScreen);
            }

            screen = (ABCBaseScreen)ABCDynamicInvoker.CreateInstanceObject(type);
            if (screen != null)
            {
                screen.LoadScreen(strLayoutXMLPath, mode);
            }

            return(screen);
        }
Пример #2
0
        public static void RunScreen(STViewsInfo info, ViewMode mode)
        {
            ABCBaseScreen screen = GetABCScreen(info, mode);

            if (screen != null)
            {
                screen.ShowDialog();
            }
        }
Пример #3
0
        public static void RunScreen(Guid iViewID, ViewMode mode)
        {
            ABCBaseScreen screen = GetABCScreen(iViewID, mode);

            if (screen != null)
            {
                screen.ShowDialog();
            }
        }
Пример #4
0
        public static void RunScreen(String strLayoutXMLPath, STViewsInfo info, ViewMode mode)
        {
            ABCBaseScreen screen = GetABCScreen(strLayoutXMLPath, info, mode);

            if (screen != null)
            {
                Form frm = screen.GetDialog();
                if (info.STViewDesc != null)
                {
                    frm.Text = info.STViewDesc;
                }
                frm.ShowDialog();
            }
        }
Пример #5
0
        public void OpenHomePage(Guid iViewID)
        {
            if (ScreenList.ContainsKey(iViewID) == false)
            {
                ABCBaseScreen scr = ABCScreen.ABCScreenFactory.GetABCScreen(iViewID);
                if (scr == null)
                {
                    return;
                }

                ScreenList.Add(iViewID, scr);
                scr.UIManager.View.Dock = DockStyle.Fill;

                DevExpress.XtraEditors.PanelControl pnl = new PanelControl();
                pnl.Controls.Add(scr.UIManager.View);
                pnl.Dock = DockStyle.Fill;

                DevExpress.XtraTab.XtraTabPage page = new DevExpress.XtraTab.XtraTabPage();
                page.Text = scr.UIManager.View.Caption;
                page.Controls.Add(pnl);
                xtraTabControl1.TabPages.Add(page);
            }
        }
Пример #6
0
        public static ABCBaseScreen GetABCScreen(STViewsInfo info, ViewMode mode)
        {
            if (info.STViewID == null || info.STViewID == Guid.Empty)
            {
                return(null);
            }

            info = (STViewsInfo) new STViewsController().GetObjectByID(info.STViewID);
            if (info == null)
            {
                return(null);
            }


            if (ABCScreenManager.Instance.CheckViewPermission(info.STViewID, ViewPermission.AllowView) == false)
            {
                ABCHelper.ABCMessageBox.Show("Bạn không đủ quyền hạn sử dụng tính năng này!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }
            ABCBaseScreen screen = null;

            #region Get Type
            Type type = GetABCScreenType(info.STViewID);
            if (type == null)
            {
                if (info.STViewUseCode && String.IsNullOrWhiteSpace(info.STViewCode) == false)
                {
                    Assembly ass = ABCScreenFactory.CompileScreenSouceCode(info);
                    if (ass != null)
                    {
                        if (!String.IsNullOrWhiteSpace(info.ScreenName))
                        {
                            type = ass.GetType("ABCApp.Screens." + info.ScreenName + "Screen");
                        }

                        if (type == null && !String.IsNullOrWhiteSpace(info.STViewNo))
                        {
                            type = ass.GetType("ABCApp.Screens." + info.STViewNo + "Screen");
                        }

                        if (type != null)
                        {
                            screen = (ABCBaseScreen)ass.CreateInstance(type.FullName);
                        }
                        //   screen=(ABCBaseScreen)AppDomain.CurrentDomain.CreateInstanceAndUnwrap( type.Assembly.FullName ,type.FullName );
                        if (screen != null)
                        {
                            screen.LoadScreen(info, mode);
                            return(screen);
                        }
                    }
                }
            }

            if (type == null)
            {
                type = typeof(ABCBaseScreen);
            }
            #endregion

            if (type != null)
            {
                screen = (ABCBaseScreen)ABCDynamicInvoker.CreateInstanceObject(type);
            }

            if (screen != null)
            {
                screen.LoadScreen(info, mode);
            }

            return(screen);
        }
Пример #7
0
        public static void DebugScreen(String strLayoutXMLPath, String strSourceCode, String strViewNo, ViewMode mode)
        {
            ABCHelper.ABCWaitingDialog.Show("", ". . .");

            try
            {
                ABCBaseScreen screen = null;
                Type          type   = null;
                Assembly      ass    = null;

                #region Build
                if (String.IsNullOrWhiteSpace(strSourceCode) == false)
                {
                    ass = ABCScreenFactory.CompileScreenSouceCode(strSourceCode, strViewNo);
                    if (ass != null)
                    {
                        type = ass.GetType("ABCApp.Screens." + strViewNo + "Screen");
                    }
                }
                if (type == null)
                {
                    type = typeof(ABCBaseScreen);
                }
                #endregion

                Assembly         asBase     = null;
                ABCScreenManager globalBase = null;

                AppDomain domain = AppDomain.CreateDomain("DebugABCScreen", AppDomain.CurrentDomain.Evidence, AppDomain.CurrentDomain.SetupInformation);
                try
                {
                    asBase     = domain.Load(typeof(ABCScreenManager).Assembly.FullName);
                    globalBase = (ABCScreenManager)domain.CreateInstanceAndUnwrap("ABCBaseScreen", "ABCScreen.ABCScreenManager");
                    globalBase.CallInitialize();

                    if (ass != null)
                    {
                        domain.Load(ass.GetName());
                    }

                    screen = (ABCBaseScreen)domain.CreateInstanceAndUnwrap(type.Assembly.FullName, type.FullName);
                    if (screen != null)
                    {
                        screen.LoadScreen(strLayoutXMLPath, mode);
                        ABCHelper.ABCWaitingDialog.Close();
                        screen.ShowDialog();
                    }
                }
                catch (Exception ex)
                {
                }

                screen     = null;
                globalBase = null;
                asBase     = null;

                AppDomain.Unload(domain);
                domain = null;
            }
            catch (Exception exx)
            { }

            GC.Collect();                  // collects all unused memory
            GC.WaitForPendingFinalizers(); // wait until GC has finished its work
            GC.Collect();
            ABCHelper.ABCWaitingDialog.Close();
        }
Пример #8
0
 public UIManager(ABCBaseScreen scr)
 {
     Screen = scr;
 }