/// <summary> /// 默认皮肤 /// Gets the default skin teme. /// </summary> /// <returns>Return a data(or instance) of SkinTheme.</returns> /// User:Ryan CreateTime:2012-8-3 14:14. private static SkinTheme GetSkinTeme() { try { IniConfig ini = new IniConfig(SkinFilePath); int value; value = int.TryParse(ini.IniReadValue(SkinSectionName, CurrentSkinName, "0"), out value) ? value : 0; EnumTheme theme = value.ToEnumByValue <EnumTheme>(); switch (theme) { case EnumTheme.BlueSea: return(new SkinThemeBlueSea()); case EnumTheme.KissOfAngel: return(new SkinThemeKissOfAngel()); case EnumTheme.NoFlower: return(new SkinThemeNoFlower()); case EnumTheme.SunsetRed: return(new SkinThemeSunsetRed()); case EnumTheme.Custom: return(new SkinThemeCustom()); case EnumTheme.Default: default: return(new SkinThemeDefault()); } } catch (Exception ex) { return(new SkinThemeDefault()); } }
public static EnumTheme Load(int id) { EnumTheme myItem = null; StringBuilder mySql = new StringBuilder(); mySql.Append("SELECT "); mySql.Append(GetSelectFields() + " "); mySql.Append("FROM `EnumTheme` enumtheme "); mySql.Append("WHERE `id` = @id "); using (MySqlConnection myConnection = new MySqlConnection(Param.MySQLConnectionString)) { MySqlCommand myCommand = new MySqlCommand(mySql.ToString(), myConnection); myCommand.CommandType = CommandType.Text; myCommand.Parameters.AddWithValue("@id", id); myConnection.Open(); using (MySqlDataReader myReader = myCommand.ExecuteReader()) { if (myReader.HasRows) { myReader.Read(); myItem = LoadADO(myReader); } myReader.Close(); } myConnection.Close(); } return(myItem); }
/// <summary> /// 设置当前主题皮肤 /// </summary> /// <param name="theme">The theme.</param> /// User:Ryan CreateTime:2012-8-7 22:57. public static void SettingSkinTeme(EnumTheme theme) { switch (theme) { case EnumTheme.BlueSea: _CurrentSkin = new SkinThemeBlueSea(); break; case EnumTheme.KissOfAngel: _CurrentSkin = new SkinThemeKissOfAngel(); break; case EnumTheme.NoFlower: _CurrentSkin = new SkinThemeNoFlower(); break; case EnumTheme.SunsetRed: _CurrentSkin = new SkinThemeSunsetRed(); break; case EnumTheme.Default: default: _CurrentSkin = new SkinThemeDefault(); break; } }
public static List <EnumTheme> FindAll() { EnumTheme myItem = null; List <EnumTheme> listItem = new List <EnumTheme>(); StringBuilder mySql = new StringBuilder(); mySql.Append("SELECT "); mySql.Append(GetSelectFields() + " "); mySql.Append("FROM `EnumTheme` enumtheme "); mySql.Append("WHERE 1 "); using (MySqlConnection myConnection = new MySqlConnection(Param.MySQLConnectionString)) { MySqlCommand myCommand = new MySqlCommand(mySql.ToString(), myConnection); myCommand.CommandType = CommandType.Text; myConnection.Open(); using (MySqlDataReader myReader = myCommand.ExecuteReader()) { if (myReader.HasRows) { while (myReader.Read()) { myItem = LoadADO(myReader); listItem.Add(myItem); } } myReader.Close(); } myConnection.Close(); } return(listItem); }
public static void ChangeTheme(Form form, EnumTheme theme) { var container = form.Controls; ThemeColor color; switch (theme) { case EnumTheme.Dark: color.ForeColor = Color.White; color.BackgroundColor = Color.Black; color.TextBoxBackground = Color.DarkGray; color.ResultColor = Color.White; color.ResultBackGroundColor = Color.Black; form.BackColor = Color.Black; break; default: color.ForeColor = Color.Black; color.BackgroundColor = SystemColors.Control; color.TextBoxBackground = SystemColors.Window; color.ResultColor = Color.Black; color.ResultBackGroundColor = SystemColors.Control; form.BackColor = SystemColors.Control; break; } foreach (Control component in container) { if (component.Name == "tbxResult") { component.BackColor = color.ResultBackGroundColor; component.ForeColor = color.ResultColor; } else if (component is Button) { component.BackColor = color.BackgroundColor; component.ForeColor = color.ForeColor; } else if (component is TextBox) { component.BackColor = color.TextBoxBackground; component.ForeColor = color.ForeColor; } else if (component is ComboBox) { component.BackColor = color.TextBoxBackground; component.ForeColor = color.ForeColor; } else if (component is CheckBox) { component.BackColor = color.BackgroundColor; component.ForeColor = color.ForeColor; } else if (component is Label) { component.BackColor = color.BackgroundColor; component.ForeColor = color.ForeColor; } } }
private static EnumTheme LoadADO(MySqlDataReader myReader) { EnumTheme myItem = new EnumTheme(); myItem.id = iZyMySQL.GetIntFromDBInt(myReader["enumtheme_id"]); myItem.libelle = iZyMySQL.GetStringFromDBString(myReader["enumtheme_libelle"]); myItem.cssClass = iZyMySQL.GetStringFromDBString(myReader["enumtheme_cssClass"]); return(myItem); }
public EnumTheme ConvertTheme(string theme) { EnumTheme themeEnum = EnumTheme.LIGHT; if (theme.ToLower() == "Black") { themeEnum = EnumTheme.DARK; } return(themeEnum); }
public static EnumTheme Update(EnumTheme myItem) { using (MySqlConnection myConnection = new MySqlConnection(Param.MySQLConnectionString)) { StringBuilder mySql = new StringBuilder(); mySql.Append("UPDATE `EnumTheme` SET "); mySql.Append("`libelle` = @libelle, "); mySql.Append("`cssClass` = @cssClass "); mySql.Append("WHERE `id` = @id "); MySqlCommand myCommand = new MySqlCommand(mySql.ToString(), myConnection); myCommand.CommandType = CommandType.Text; myCommand.Parameters.AddWithValue("@id", myItem.id); myCommand.Parameters.AddWithValue("@libelle", myItem.libelle); myCommand.Parameters.AddWithValue("@cssClass", myItem.cssClass); myConnection.Open(); myCommand.ExecuteNonQuery(); myConnection.Close(); } return(myItem); }
public static EnumTheme Insert(EnumTheme myItem) { using (MySqlConnection myConnection = new MySqlConnection(Param.MySQLConnectionString)) { StringBuilder mySql = new StringBuilder(); mySql.Append("INSERT INTO `EnumTheme` "); mySql.Append("(`libelle`, `cssClass` )"); mySql.Append(" VALUES "); mySql.Append("(@libelle, @cssClass );"); mySql.Append("SELECT LAST_INSERT_ID(); "); MySqlCommand myCommand = new MySqlCommand(mySql.ToString(), myConnection); myCommand.CommandType = CommandType.Text; myCommand.Parameters.AddWithValue("@libelle", myItem.libelle); myCommand.Parameters.AddWithValue("@cssClass", myItem.cssClass); myConnection.Open(); myItem.id = iZyMySQL.GetIntFromDBInt(myCommand.ExecuteScalar()); myConnection.Close(); } return(myItem); }
public static EnumTheme Insert(EnumTheme myItem) { using (MySqlConnection myConnection = new MySqlConnection(Param.MySQLConnectionString)) { StringBuilder mySql = new StringBuilder(); mySql.Append("INSERT INTO `EnumTheme` "); mySql.Append("(`libelle`, `cssClass` )"); mySql.Append(" VALUES "); mySql.Append("(@libelle, @cssClass );"); mySql.Append("SELECT LAST_INSERT_ID(); "); MySqlCommand myCommand = new MySqlCommand(mySql.ToString(), myConnection); myCommand.CommandType = CommandType.Text; myCommand.Parameters.AddWithValue("@libelle", myItem.libelle); myCommand.Parameters.AddWithValue("@cssClass", myItem.cssClass); myConnection.Open(); myItem.id = iZyMySQL.GetIntFromDBInt(myCommand.ExecuteScalar()); myConnection.Close(); } return myItem; }
private static EnumTheme LoadADO(MySqlDataReader myReader) { EnumTheme myItem = new EnumTheme(); myItem.id = iZyMySQL.GetIntFromDBInt(myReader["enumtheme_id"]); myItem.libelle = iZyMySQL.GetStringFromDBString(myReader["enumtheme_libelle"]); myItem.cssClass = iZyMySQL.GetStringFromDBString(myReader["enumtheme_cssClass"]); return myItem; }
public static EnumTheme Update(EnumTheme myItem) { using (MySqlConnection myConnection = new MySqlConnection(Param.MySQLConnectionString)) { StringBuilder mySql = new StringBuilder(); mySql.Append("UPDATE `EnumTheme` SET "); mySql.Append("`libelle` = @libelle, "); mySql.Append("`cssClass` = @cssClass "); mySql.Append("WHERE `id` = @id "); MySqlCommand myCommand = new MySqlCommand(mySql.ToString(), myConnection); myCommand.CommandType = CommandType.Text; myCommand.Parameters.AddWithValue("@id", myItem.id); myCommand.Parameters.AddWithValue("@libelle", myItem.libelle); myCommand.Parameters.AddWithValue("@cssClass", myItem.cssClass); myConnection.Open(); myCommand.ExecuteNonQuery(); myConnection.Close(); } return myItem; }