private void TextBoxTitleColor_TextChanged(object sender, TextChangedEventArgs e) { if (TextBoxTitleColor.Text.Count() == 6) { RectangleTitleColor.Fill = MiscConverter.IntToSolidColorBrush(MiscConverter.StringToIntColor(TextBoxTitleColor.Text)); } }
// Thread threadRemote; public void GetTitleColor() { try { titleColor = MiscConverter.IntToSolidColorBrush(MiscConverter.StringToIntColor(Setting.GetAttribute("titleColor"))); } catch (Exception ex) { Console.WriteLine(ex.Message); titleColor = MiscConverter.IntToSolidColorBrush(0xffff00); } if (freePresentationText != null) { // free text presentation: don't change contents UpdateFree(); } if (WrapPanelPageList != null && WrapPanelPageList.Children.Count > 1) { // if a text file is open, the minimum of Count is 2 int len = textList.Count; for (int i = 1; i < len; i++) { if (isTitleList[i]) { (WrapPanelPageList.Children[i - 1] as Button).Foreground = titleColor; } } } if (isTitleList != null) { if (PgmContent != null && isTitleList[pgmManager.PageNumber]) { PgmContent.Foreground = titleColor; if (pw != null) { pw.LabelPresenterText.Foreground = titleColor; } } if (PvwContent != null && isTitleList[pvwManager.PageNumber]) { PvwContent.Foreground = titleColor; } } }
// Load current settings from Setting class private void GetSettings() { if (!int.TryParse(Setting.GetAttribute("presenterScreen"), out presenterScreen)) { presenterScreen = System.Windows.Forms.Screen.AllScreens.Length; } if (!int.TryParse(Setting.GetAttribute("textEncoding"), out textEncoding)) { textEncoding = 0; } switch (textEncoding) { case 0: // default case 1200: // UTF-16 LE case 1201: // UTF-16 BE case 65001: // UTF-8 break; default: textEncoding = 0; break; } if (!decimal.TryParse(Setting.GetAttribute("marginBasic"), out marginBasic) || marginBasic < 0) { marginBasic = 5; } if (!decimal.TryParse(Setting.GetAttribute("marginOverflow"), out marginOverflow) || marginOverflow < 0) { marginOverflow = 1; } if (!int.TryParse(Setting.GetAttribute("textPosition"), out textPosition) || textPosition < 1 || textPosition > 9) { textPosition = 5; } if (!int.TryParse(Setting.GetAttribute("textAlign"), out textAlign) || textAlign < 1 || textAlign > 3) { textAlign = 2; } if ((fontFamily = Setting.GetAttribute("fontFamily")) == null) { fontFamily = "Malgun Gothic"; } if (Setting.GetAttribute("fontWeight").Equals("bold")) { fontWeightBold = true; } if (Setting.GetAttribute("fontStyle").Equals("italic")) { fontStyleItalic = true; } if (!decimal.TryParse(Setting.GetAttribute("fontSize"), out fontSize) || fontSize <= 0) { fontSize = 8.75m; } try { string tempTitleColor = Setting.GetAttribute("titleColor"); if (tempTitleColor == null) { titleColor = 0xffff00; } else { titleColor = MiscConverter.StringToIntColor(tempTitleColor); } } catch (Exception ex) { // invalid color format Console.WriteLine(ex.Message); titleColor = 0xffff00; } if (!decimal.TryParse(Setting.GetAttribute("lineHeight"), out lineHeight) || lineHeight < 0) { lineHeight = 140; } if (!bool.TryParse(Setting.GetAttribute("screenRatioSimulation"), out screenRatioSimulation)) { screenRatioSimulation = false; } if (!int.TryParse(Setting.GetAttribute("screenRatioSimulationWidth"), out screenRatioSimulationWidth) || screenRatioSimulationWidth <= 0) { screenRatioSimulationWidth = 4; } if (!int.TryParse(Setting.GetAttribute("screenRatioSimulationHeight"), out screenRatioSimulationHeight) || screenRatioSimulationHeight <= 0) { screenRatioSimulationHeight = 3; } }