public void RunLink(STViewsInfo viewIfo, ViewMode mode, bool isShowDialog, Guid iMainID, ABCScreenAction action) { if (viewIfo != null) { ABCHelper.ABCWaitingDialog.Show("", "Đang mở . . .!"); ABCScreen.ABCBaseScreen scr = ABCScreenFactory.GetABCScreen(viewIfo, mode); if (scr != null) { scr.InvalidateData(iMainID); ABCHelper.ABCWaitingDialog.Close(); if (action != ABCScreenAction.None) { scr.DoAction(action, true); } if (action == ABCScreenAction.Disable) { scr.UIManager.View.ShowToolbar = false; } if (isShowDialog) { scr.ShowDialog(); } else { scr.Show(); } } ABCHelper.ABCWaitingDialog.Close(); } }
public void RunLink(String strScreenName, ViewMode mode, bool isShowDialog, ABCScreenAction action, params object[] objParams) { ABCHelper.ABCWaitingDialog.Show("", "Đang mở . . .!"); ABCScreen.ABCBaseScreen scr = ABCScreenFactory.GetABCScreen(strScreenName, mode); if (scr != null) { scr.InvalidateData(objParams); } ABCHelper.ABCWaitingDialog.Close(); if (scr != null) { if (action != ABCScreenAction.None) { scr.DoAction(action, true); } if (action == ABCScreenAction.Disable) { scr.UIManager.View.ShowToolbar = false; } if (isShowDialog) { scr.ShowDialog(); } else { scr.Show(); } } }
public void OpenScreenForNew(String strTableName, ViewMode mode, bool isShowDialog) { #region Get View STViewsInfo viewResult = null; STViewsController viewCtrl = new STViewsController(); List <BusinessObject> lstViews = viewCtrl.GetListFromDataset(viewCtrl.GetDataSet(String.Format("SELECT * FROM STViews WHERE [MainTableName] = '{0}' ", strTableName))); foreach (STViewsInfo viewIfo in lstViews) { if (String.IsNullOrWhiteSpace(viewIfo.MainFieldName) == false && DataStructureProvider.IsTableColumn(strTableName, viewIfo.MainFieldName)) { viewResult = viewIfo; break; } } if (viewResult == null && lstViews.Count > 0) { viewResult = lstViews[0] as STViewsInfo; } #endregion if (viewResult != null) { ABCHelper.ABCWaitingDialog.Show("", "Đang mở . . .!"); ABCScreen.ABCBaseScreen scr = ABCScreenFactory.GetABCScreen(viewResult, mode); scr.DoAction(ABCScreenAction.New, true); ABCHelper.ABCWaitingDialog.Close(); if (isShowDialog) { scr.ShowDialog(); } else { scr.Show(); } } }
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); }
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(); }