private void btnReportSettingSave_Click(object sender, RoutedEventArgs e) { try { if (!string.IsNullOrEmpty(txtMailPwd.Password)) { App.reportSettingModel.MailPwd = txtMailPwd.Password; } OperateIniFile.WriteIniData("Base", "MEIK base", App.reportSettingModel.MeikBase, System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Report", "Use Default Signature", App.reportSettingModel.UseDefaultSignature.ToString(), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); User[] doctorUsers = App.reportSettingModel.DoctorNames.ToArray <User>(); List <string> doctorsArr = new List <string>(); foreach (var item in doctorUsers) { doctorsArr.Add(item.Name + "|" + item.License); } OperateIniFile.WriteIniData("Report", "Doctor Names List", string.Join(";", doctorsArr.ToArray()), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Report", "Doctor Name Required", App.reportSettingModel.ShowDoctorSignature.ToString(), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Report", "Use Default Logo", App.reportSettingModel.DefaultLogo.ToString(), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Report", "Transfer Mode", App.reportSettingModel.TransferMode.ToString(), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Report", "Print Paper", App.reportSettingModel.PrintPaper.ToString(), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Mail", "My Mail Address", App.reportSettingModel.MailAddress, System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Mail", "To Mail Address", App.reportSettingModel.ToMailAddress, System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Mail", "To Mail Address List", string.Join(";", App.reportSettingModel.ToMailAddressList), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Mail", "Mail Subject", App.reportSettingModel.MailSubject, System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Mail", "Mail Content", App.reportSettingModel.MailSubject, System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Mail", "Mail Host", App.reportSettingModel.MailHost, System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Mail", "Mail Port", App.reportSettingModel.MailPort.ToString(), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Mail", "Mail Username", App.reportSettingModel.MailUsername, System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); string mailPwd = App.reportSettingModel.MailPwd; if (!string.IsNullOrEmpty(mailPwd)) { mailPwd = SecurityTools.EncryptText(mailPwd); } OperateIniFile.WriteIniData("Mail", "Mail Password", mailPwd, System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Mail", "Mail SSL", App.reportSettingModel.MailSsl.ToString(), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Device", "Device No", App.reportSettingModel.DeviceNo.ToString(), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); Logo[] deviceLogos = App.reportSettingModel.DeciceLogo.ToArray <Logo>(); List <string> logoArr = new List <string>(); foreach (var item in deviceLogos) { logoArr.Add(item.Device + "||" + item.Address); } OperateIniFile.WriteIniData("Report", "Logo List", string.Join("&&", logoArr.ToArray()), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); MessageBox.Show(this, App.Current.FindResource("Message_14").ToString()); } catch (Exception ex) { MessageBox.Show(this, App.Current.FindResource("Message_13").ToString() + " " + ex.Message); } }
private void btnReportSettingSave_Click(object sender, RoutedEventArgs e) { Regex re = new Regex("[0-9]{3}"); if (!re.IsMatch(txtDeviceId.Text)) { MessageBox.Show(this, App.Current.FindResource("Message_64").ToString()); txtDeviceId.Focus(); return; } try { if (!string.IsNullOrEmpty(txtMailPwd.Password)) { App.reportSettingModel.MailPwd = txtMailPwd.Password; } OperateIniFile.WriteIniData("Base", "MEIK base", App.reportSettingModel.MeikBase, System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Report", "Use Default Signature", App.reportSettingModel.UseDefaultSignature.ToString(), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); User[] techUsers = App.reportSettingModel.TechNames.ToArray <User>(); List <string> techArr = new List <string>(); foreach (var item in techUsers) { techArr.Add(item.Name + "|" + item.License); } OperateIniFile.WriteIniData("Report", "Technician Names List", string.Join(";", techArr.ToArray()), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Report", "Screen Venue", App.reportSettingModel.ScreenVenue.ToString(), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Report", "Technician Name Required", App.reportSettingModel.ShowTechSignature.ToString(), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Report", "Transfer Mode", App.reportSettingModel.TransferMode.ToString(), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Mail", "My Mail Address", App.reportSettingModel.MailAddress, System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Mail", "To Mail Address", App.reportSettingModel.ToMailAddress, System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Mail", "To Mail Address List", string.Join(";", App.reportSettingModel.ToMailAddressList), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Mail", "Mail Subject", App.reportSettingModel.MailSubject, System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Mail", "Mail Content", App.reportSettingModel.MailSubject, System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Mail", "Mail Host", App.reportSettingModel.MailHost, System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Mail", "Mail Port", App.reportSettingModel.MailPort.ToString(), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Mail", "Mail Username", App.reportSettingModel.MailUsername, System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); string mailPwd = App.reportSettingModel.MailPwd; if (!string.IsNullOrEmpty(mailPwd)) { mailPwd = SecurityTools.EncryptText(mailPwd); } OperateIniFile.WriteIniData("Mail", "Mail Password", mailPwd, System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Mail", "Mail SSL", App.reportSettingModel.MailSsl.ToString(), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); OperateIniFile.WriteIniData("Device", "Device No", App.reportSettingModel.DeviceNo.ToString(), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini"); var userListWin = this.Owner as UserList; userListWin.labDeviceNo.Content = App.reportSettingModel.DeviceNo; //if (App.reportSettingModel.TransferMode == TransferMode.CloudServer) //{ // userListWin.btnReceivePdf.Visibility = Visibility.Visible; //} //else //{ // userListWin.btnReceivePdf.Visibility = Visibility.Collapsed; //} MessageBox.Show(this, App.Current.FindResource("Message_14").ToString()); } catch (Exception ex) { MessageBox.Show(this, App.Current.FindResource("Message_13").ToString() + " " + ex.Message); } }