public Screen(Zilog.Z80 cpu, bool renderBorder, bool switchColors, int borderTop = 48, int borderBottom = 56, int borderSide = 64) { for (int a = 0; a < ScreenAttributes.Length; a++) { ScreenAttributes[a] = new ScreenAttribute(); } SwitchColors(switchColors); RenderBorder = renderBorder; if (renderBorder) { this.bordertop = borderTop; this.borderbottom = borderBottom; this.bordersides = borderSide; } else { bordertop = 0; borderbottom = 0; bordersides = 0; } Height = 192 + (bordertop + borderbottom); Width = 256 + (bordersides * 2); screen = new uint[Height * Width]; screenflash = new uint[Height * Width]; pixels = new bool[Height * Width]; this.cpu = cpu; }
private ScreenAttribute GetScreenAttribute(IScreen screen) { ScreenAttribute attribute = null; foreach (var attr in screen.GetType().GetCustomAttributes(typeof(ScreenAttribute), true)) { attribute = attr as ScreenAttribute; break; } return(attribute); }
public ScreenAttribute GetScreenAttribute() { ScreenAttribute attribute = null; foreach (var attr in GetType().GetCustomAttributes(typeof(ScreenAttribute), true)) { attribute = attr as ScreenAttribute; break; } return(attribute); }
/// <summary> /// /// </summary> /// <param name="screenType"></param> /// <exception cref="ArgumentException">Screen Type is invalid.</exception> public InternalScreen(Type screenType) { if (!CheckValidScreen(screenType)) { throw new ArgumentException("Screen Type is invalid."); } m_classType = screenType; m_assemblyName = ClassType.GetType().Assembly.FullName; m_screenAttribute = (ScreenAttribute)ClassType.GetCustomAttributes(typeof(ScreenAttribute), false)[0]; }
private void SetAttributes() { System.Reflection.MemberInfo inf = this.GetType(); System.Attribute[] attrs = System.Attribute.GetCustomAttributes(inf); // reflection foreach (System.Attribute attr in attrs) { if (attr is ScreenAttribute) { ScreenAttribute sa = (ScreenAttribute)attr; if (sa.backgroundColor != 0x000000) { this.color = new Color( ((sa.backgroundColor & 0xFF0000) >> 16) / 255f, ((sa.backgroundColor & 0x00FF00) >> 8) / 255f, ((sa.backgroundColor & 0x0000FF) >> 0) / 255f); } if (sa.depthGroup != 0) { DepthGroup = sa.depthGroup; } if (sa.isPersistantScreen != false) { isPersistantScreen = sa.isPersistantScreen; } } if (attr is V2DShaderAttribute) { V2DShaderAttribute sa = (V2DShaderAttribute)attr; float[] parameters = new float[] { }; ConstructorInfo ci = sa.shaderType.GetConstructor(new Type[] { parameters.GetType() }); this.defaultShader = (V2DShader)ci.Invoke( new object[] { new float[] { sa.param0, sa.param1, sa.param2, sa.param3, sa.param4 } }); } } }
/// <summary> /// Initialize all control text following by stored data on database, depend on current user's language. /// </summary> protected virtual void InitializeControlText() { if (this.ScreenCode == string.Empty) { return; } Map <string, ScreenDetail> mapControlList = this.GetControlList(); ScreenDetailLangBIZ bizScreenDetailLang = new ScreenDetailLangBIZ(); string langCD = CommonLib.Common.SystemLanguage.StrongValue; if (CommonLib.Common.CurrentUserInfomation != null) { langCD = CommonLib.Common.CurrentUserInfomation.LanguageCD.StrongValue; } // Load screen detail depend on language. List <ScreenDetailLangDTO> listScreenDetailLang = bizScreenDetailLang.LoadScreenDetailByLangCD(this.ScreenCode, langCD); for (int i = 0; i < listScreenDetailLang.Count; i++) { ScreenDetailLangDTO dto = listScreenDetailLang[i]; MapKeyValue <string, ScreenDetail> mapKeyValue = mapControlList[dto.CONTROL_CD.StrongValue]; if (mapKeyValue == null) { continue; } ScreenDetail screenDetail = mapKeyValue.Value; Control ctrl = null; switch (screenDetail.Type) { case ScreenDetail.TYPE_FORM: ctrl = screenDetail.ObjOwner as Control; if (ctrl != null) { ctrl.Text = ScreenAttribute.GetScreenAttribute(screenDetail.ObjOwner.GetType()).ScreenCD + ": " + dto.CONTROL_CAPTION.NVL(string.Empty); } break; case ScreenDetail.TYPE_BUTTON: case ScreenDetail.TYPE_CHECKBOX: case ScreenDetail.TYPE_GROUPBOX: case ScreenDetail.TYPE_LABEL: case ScreenDetail.TYPE_RADIOBUTTON: case ScreenDetail.TYPE_TABPAGE: ctrl = screenDetail.ObjOwner as Control; if (ctrl != null) { ctrl.Text = dto.CONTROL_CAPTION.NVL(string.Empty); } break; case ScreenDetail.TYPE_SPREAD_COLUMN: Column column = screenDetail.ObjOwner as Column; if (column != null) { column.Label = dto.CONTROL_CAPTION.NVL(string.Empty); } break; } } }