/// <summary> /// return if exist config in SQLite /// </summary> /// <returns></returns> public List <UiFontConf> EnumUiFont() { List <UiFontConf> t = new List <UiFontConf>(); string file = AppDomain.CurrentDomain.BaseDirectory + "Database\\Shamia.db"; if (Connection.State != ConnectionState.Closed) { Connection.Close(); } Connection = new SQLiteConnection("Data Source=" + file + ";Version=3" + ";New=False;Compress=True"); try { Connection.Open(); C = Connection.CreateCommand(); C.CommandText = @"select * from uifontconf top1"; DataReader = C.ExecuteReader(); while (DataReader.Read()) { UiFontConf f = new UiFontConf() { Fontname = DataReader["fontname"].ToString(), FontSize = Convert.ToInt32(DataReader["fontsize"].ToString()), Isbold = Convert.ToBoolean(DataReader["isbold"].ToString()), Isitalic = Convert.ToBoolean(DataReader["isitalic"].ToString()), ColorName = DataReader["fontcolor"].ToString() }; t.Add(f); } } catch (Exception ex) { MyDelegates.OnDebugMessageCallBack(ex.StackTrace); return(null); } finally { if (Connection.State != ConnectionState.Closed) { Connection.Close(); } } return(t); }
/// <summary> /// creat object Dx9Overlay /// </summary> internal static void InitializedObjectD3() { UiFontConf use = new UiFontConf(); foreach (UiFontConf i in MainWindow.SqliteSource.EnumUiFont()) { use.Fontname = i.Fontname; use.FontSize = i.FontSize; use.Isbold = i.Isbold; use.Isitalic = i.Isitalic; // set default brush // ReSharper disable once PossibleNullReferenceException foreach (ColorsHexDefault c in ColorsHex) { if (c.Color == i.ColorName) { use.Brush = c.Hex; } } //use.Brush = ColorDefault.Hex; //0xFF00FFFF } _overlayText1 = Dx9Overlay.TextCreate(use.Fontname, use.FontSize, use.Isbold, use.Isitalic, 5, 80, use.Brush, string.Empty, false, true); // Initialize 'overlayText' _overlayText2 = Dx9Overlay.TextCreate(use.Fontname, use.FontSize, use.Isbold, use.Isitalic, 5, 100, use.Brush, string.Empty, false, true); // Initialize 'overlayText' _overlayText3 = Dx9Overlay.TextCreate(use.Fontname, use.FontSize, use.Isbold, use.Isitalic, 5, 120, use.Brush, string.Empty, false, true); // Initialize 'overlayText' _overlayText4 = Dx9Overlay.TextCreate(use.Fontname, use.FontSize, use.Isbold, use.Isitalic, 5, 130, use.Brush, string.Empty, false, true); // Initialize 'overlayText' _overlayText5 = Dx9Overlay.TextCreate(use.Fontname, use.FontSize, use.Isbold, use.Isitalic, 5, 150, use.Brush, string.Empty, false, true); // Initialize 'overlayText' Initialized = true; _listChat.Items.Add( ((MainWindow)Application.Current.MainWindow).Resources.MergedDictionaries[0]["WelcomeShamiaDraw"] .ToString()); }
internal void _GetFonts() { try { MyFont = new UiFontConf(); foreach (UiFontConf i in MainWindow.SqliteSource.EnumUiFont()) { MyFont.Brush = i.Brush; MyFont.FontSize = i.FontSize; MyFont.Fontname = i.Fontname; MyFont.Isbold = i.Isbold; MyFont.Isitalic = i.Isitalic; MyFont.ColorName = i.ColorName; } ChkIsBold.IsChecked = MyFont.Isbold; ChkIsItalic.IsChecked = MyFont.Isitalic; foreach (var i in CboxFont.Items) { if (i.Equals(MyFont.Fontname)) { CboxFont.SelectedItem = i; } } foreach (var i in CboxFontSize.Items) { if (i.Equals(MyFont.FontSize)) { CboxFontSize.SelectedItem = i; } } foreach (var i in CboxColors.Items) { var n = i.ToString().ToUpper(); if (n.Equals(MyFont.ColorName.ToUpper())) { CboxColors.SelectedItem = i; } } } catch (Exception ex) { MyDelegates.OnDebugMessageCallBack(ex.ToString()); } }
/// <summary> /// return if exist config in SQLite /// </summary> /// <returns></returns> public List<UiFontConf> EnumUiFont() { List<UiFontConf> t = new List<UiFontConf>(); string file = AppDomain.CurrentDomain.BaseDirectory + "Database\\Shamia.db"; if (Connection.State != ConnectionState.Closed) { Connection.Close(); } Connection = new SQLiteConnection("Data Source=" + file + ";Version=3" + ";New=False;Compress=True"); try { Connection.Open(); C = Connection.CreateCommand(); C.CommandText = @"select * from uifontconf top1"; DataReader = C.ExecuteReader(); while (DataReader.Read()) { UiFontConf f = new UiFontConf() { Fontname = DataReader["fontname"].ToString(), FontSize = Convert.ToInt32(DataReader["fontsize"].ToString()), Isbold =Convert.ToBoolean(DataReader["isbold"].ToString()), Isitalic = Convert.ToBoolean(DataReader["isitalic"].ToString()), ColorName = DataReader["fontcolor"].ToString() }; t.Add(f); } } catch (Exception ex) { MyDelegates.OnDebugMessageCallBack(ex.StackTrace); return null; } finally { if (Connection.State != ConnectionState.Closed) { Connection.Close(); } } return t; }
/// <summary> /// creat object Dx9Overlay /// </summary> internal static void InitializedObjectD3() { UiFontConf use = new UiFontConf(); foreach (UiFontConf i in MainWindow.SqliteSource.EnumUiFont()) { use.Fontname = i.Fontname; use.FontSize = i.FontSize; use.Isbold = i.Isbold; use.Isitalic = i.Isitalic; // set default brush // ReSharper disable once PossibleNullReferenceException foreach (ColorsHexDefault c in ColorsHex) { if (c.Color == i.ColorName) { use.Brush = c.Hex; } } //use.Brush = ColorDefault.Hex; //0xFF00FFFF } _overlayText1 = Dx9Overlay.TextCreate(use.Fontname, use.FontSize, use.Isbold, use.Isitalic, 5, 80, use.Brush, string.Empty, false, true); // Initialize 'overlayText' _overlayText2 = Dx9Overlay.TextCreate(use.Fontname, use.FontSize, use.Isbold, use.Isitalic, 5, 100, use.Brush, string.Empty, false, true); // Initialize 'overlayText' _overlayText3 = Dx9Overlay.TextCreate(use.Fontname, use.FontSize, use.Isbold, use.Isitalic, 5, 120, use.Brush, string.Empty, false, true); // Initialize 'overlayText' _overlayText4 = Dx9Overlay.TextCreate(use.Fontname, use.FontSize, use.Isbold, use.Isitalic, 5, 130, use.Brush, string.Empty, false, true); // Initialize 'overlayText' _overlayText5 = Dx9Overlay.TextCreate(use.Fontname, use.FontSize, use.Isbold, use.Isitalic, 5, 150, use.Brush, string.Empty, false, true); // Initialize 'overlayText' Initialized = true; _listChat.Items.Add( ((MainWindow) Application.Current.MainWindow).Resources.MergedDictionaries[0]["WelcomeShamiaDraw"] .ToString()); }