/// <summary> /// /// </summary> /// <param name="item"></param> /// <returns></returns> public bool Contain(InternalScreen item) { for (int i = 0; i < this.Count; i++) { if (this[i] == item) { return(true); } } return(false); }
/// <summary> /// Initialize program screen cache. /// If any time has change, should be dispose and call GetInstance method again to reset cache. /// </summary> private void InitializeProgramScreens() { m_programScreenList.Clear(); for (int i = 0; i < m_internalScreenCache.InternalScreenList.Count; i++) { InternalScreen internalScreen = m_internalScreenCache.InternalScreenList[i]; if (m_databaseScreenCache.IsFoundDatabaseScreen(internalScreen.ScreenAttribute.ScreenCD)) { // Store program screen cache. ProgramScreen programScreen = new ProgramScreen(internalScreen, m_databaseScreenCache[internalScreen.ScreenAttribute.ScreenCD]); m_programScreenList.Add(programScreen); } } }
/// <summary> /// /// </summary> /// <param name="item"></param> /// <exception cref="ArgumentNullException"><c>item</c> is null.</exception> /// <exception cref="ArgumentException"><c>ArgumentException</c>.</exception> public void Add(InternalScreen item) { if (item == null) { throw new ArgumentNullException("item"); } string screenCD = item.ScreenAttribute.ScreenCD; if (m_internalScreenList.FoundKey(screenCD)) { throw new ArgumentException(String.Format("Key: \"{0}\" has already exists.", screenCD)); } this.m_internalScreenList.Put(screenCD, item); }
/// <summary> /// Get internal screen list filter by ScreenType. /// </summary> /// <param name="screenTypes">Array of ScreenType which need to filter.</param> /// <returns></returns> public InternalScreenList Get(params eScreenType[] screenTypes) { InternalScreenList list = new InternalScreenList(); for (int i = 0; i < m_internalScreenList.Count; i++) { InternalScreen screen = m_internalScreenList[i]; for (int iType = 0; iType < screenTypes.Length; iType++) { if (screen.ScreenAttribute.ScreenType.Equals(screenTypes[iType])) { list.Add(screen); } } } return(list); }
/// <summary> /// Load all screens from assembly into cache. /// </summary> /// <param name="assembly"></param> public void LoadScreensFromAssembly(Assembly assembly) { Type[] types = assembly.GetTypes(); // Loop for search all type in this assembly to retrieve Screen class. for (int i = 0; i < types.Length; i++) { // Find class which define ScreenAttribute over class name. Type currentType = types[i]; if (InternalScreen.CheckValidScreen(currentType)) { // Store Cache. InternalScreen internalScreen = new InternalScreen(currentType); m_internalScreenList.Add(internalScreen); } } // end for }
public ProgramScreen(InternalScreen internalScreen, DatabaseScreen databaseScreen) { this.m_internalScreen = internalScreen; this.m_databaseScreen = databaseScreen; }
/// <summary> /// /// </summary> /// <param name="item"></param> public void Remove(InternalScreen item) { string screenCD = item.ScreenAttribute.ScreenCD; this.m_internalScreenList.Remove(screenCD); }