private void SaveAppInfo() { try { using (ApplicationInfoDS applicationInfoDS = new ApplicationInfoDS()) { string text = ApplicationInfo.GetTemplatePathByUser() + "\\ApplicationInfo.xml"; if (File.Exists(text)) { applicationInfoDS.ReadXml(text); applicationInfoDS.Info.Clear(); } ApplicationInfoDS.InfoRow infoRow = applicationInfoDS.Info.NewInfoRow(); if (ApplicationInfo.IsSupportTPBlinkColor) { infoRow.TPBlinkColor = "Y"; } else { infoRow.TPBlinkColor = "N"; } infoRow.ValidatePolicy = ApplicationInfo.IsRiskActive; infoRow.AlertEnable = ApplicationInfo.AlertOpen; infoRow.AlertSound = ApplicationInfo.AlertSound; infoRow.AlertAutoPopup = ApplicationInfo.AlertAutoPopup; applicationInfoDS.Info.AddInfoRow(infoRow); if (File.Exists(text)) { applicationInfoDS.WriteXml(text); } else { if (!Directory.Exists(ApplicationInfo.GetTemplatePathByUser())) { Directory.CreateDirectory(ApplicationInfo.GetTemplatePathByUser()); } applicationInfoDS.WriteXml(text); } } } catch (Exception ex) { this.ShowError("SaveUserProfile", ex); } }
private void LoadAppInfo() { try { using (ApplicationInfoDS applicationInfoDS = new ApplicationInfoDS()) { string templatePathByUser = ApplicationInfo.GetTemplatePathByUser(); string text = templatePathByUser + "\\ApplicationInfo.xml"; if (File.Exists(text)) { applicationInfoDS.ReadXml(text); } if (applicationInfoDS.Info.Rows.Count > 0) { if (applicationInfoDS.Info.Columns.Contains("TPBlinkColor")) { if (applicationInfoDS.Info[0].TPBlinkColor == "Y") { ApplicationInfo.IsSupportTPBlinkColor = true; } else { ApplicationInfo.IsSupportTPBlinkColor = false; } } if (applicationInfoDS.Info.Columns.Contains("ValidatePolicy")) { ApplicationInfo.IsRiskActive = applicationInfoDS.Info[0].ValidatePolicy; } if (applicationInfoDS.Info.Columns.Contains("AlertEnable")) { ApplicationInfo.AlertOpen = applicationInfoDS.Info[0].AlertEnable; } if (applicationInfoDS.Info.Columns.Contains("AlertAutoPopup")) { ApplicationInfo.AlertAutoPopup = applicationInfoDS.Info[0].AlertAutoPopup; } if (applicationInfoDS.Info.Columns.Contains("AlertSound")) { ApplicationInfo.AlertSound = applicationInfoDS.Info[0].AlertSound; } } else { ApplicationInfo.IsSupportTPBlinkColor = true; ApplicationInfo.IsRiskActive = false; ApplicationInfo.AlertOpen = false; ApplicationInfo.AlertAutoPopup = true; ApplicationInfo.AlertSound = false; } applicationInfoDS.Clear(); } } catch (Exception ex) { this.ShowError("LoadAppInfo", ex); } }