public static void RunScreen(STViewsInfo info, ViewMode mode) { ABCBaseScreen screen = GetABCScreen(info, mode); if (screen != null) { screen.ShowDialog(); } }
public static void RunScreen(Guid iViewID, ViewMode mode) { ABCBaseScreen screen = GetABCScreen(iViewID, mode); if (screen != null) { screen.ShowDialog(); } }
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(); }