/// <summary> /// load button background /// </summary> private void LoadBtnBackground() { if (btnSetupOrUninstallService.IsEnabled) { btnSetupOrUninstallService.Background = new SolidColorBrush(Color.FromRgb((byte)42, (byte)72, (byte)254)); } else { btnSetupOrUninstallService.Background = new SolidColorBrush(Color.FromRgb((byte)212, (byte)208, (byte)200)); } if (btnStartOrStopService.IsEnabled) { btnStartOrStopService.Background = new SolidColorBrush(Color.FromRgb((byte)42, (byte)72, (byte)254)); } else { btnStartOrStopService.Background = new SolidColorBrush(Color.FromRgb((byte)212, (byte)208, (byte)200)); } if (ConvertTool.GetBool(XmlTool.GetNodeValueByXPath(_xPathIsLogging, _path))) { btnStartOrStopLog.Content = "停用日志"; } else { btnStartOrStopLog.Content = "启用日志"; } }
/// <summary> /// load all setting /// </summary> internal static void LoadSetting() { BasicConfigLoaded = true; string styleXPath = "/DbConfig/DbStyle"; string trustedXPath = "/DbConfig/DbTrusted"; string hostXPath = "/DbConfig/DbHost"; string userXPath = "/DbConfig/DbUser"; string passwordXPath = "/DbConfig/DbPassword"; string portXPath = "/DbConfig/DbPort"; string instanceXPath = "/DbConfig/DbInstance"; string nameXPath = "/DbConfig/DbName"; string embedXPath = "/DbConfig/DbEmbed"; string positionXPath = "/DbConfig/DbPosition"; string dbStyle = XmlTool.GetNodeValueByXPath(styleXPath, _path); switch (dbStyle.ToLower()) { case "sqlserver": DbStyle = DbStyleDefine.SqlServer; break; case "oracle": DbStyle = DbStyleDefine.Oracle; break; case "postgres": DbStyle = DbStyleDefine.Postgres; break; case "mysql": DbStyle = DbStyleDefine.MySql; break; case "firebird": DbStyle = DbStyleDefine.Firebird; break; case "sqlite": DbStyle = DbStyleDefine.Sqlite; break; case "access": DbStyle = DbStyleDefine.Access; break; default: DbStyle = DbStyleDefine.MySql; break; } DbTrusted = ConvertTool.GetBool(XmlTool.GetNodeValueByXPath(trustedXPath, _path)); DbHost = XmlTool.GetNodeValueByXPath(hostXPath, _path); DbUser = XmlTool.GetNodeValueByXPath(userXPath, _path); DbPassword = XmlTool.GetNodeValueByXPath(passwordXPath, _path); DbPort = ConvertTool.GetInt(XmlTool.GetNodeValueByXPath(portXPath, _path)); if (DbPort > 65535) { DbPort = 65534; XmlTool.SetNodeValueByXPath(portXPath, DbPort.ToString(), _path); } DbInstance = XmlTool.GetNodeValueByXPath(instanceXPath, _path); DbName = XmlTool.GetNodeValueByXPath(nameXPath, _path); DbEmbed = ConvertTool.GetBool(XmlTool.GetNodeValueByXPath(embedXPath, _path)); DbPosition = XmlTool.GetNodeValueByXPath(positionXPath, _path); }