private void btn_ok_Click(object sender, EventArgs e) { try { StringBuilder sb = new StringBuilder(); for (int i = 0; i < gridView1.RowCount; i++) { if (gridView1.GetRowCellValue(i, col) != null && gridView1.GetRowCellValue(i, col).ToString().Equals("True")) { sb.Append(string.Format("{0},", gridView1.GetRowCellValue(i, "SoHieuLan"))); } } if (sb.Length > 0) { sb.Remove(sb.Length - 1, 1); } MonitorSetting.TimeAutoLoadDb = Convert.ToInt32(set_TimeLoadData.Value); MonitorSetting.TimeRunSlideshow = Convert.ToInt32(set_TimeRunSlideShow.Value); MonitorSetting.Color0Loi1 = color0Loi1.Color.ToArgb(); MonitorSetting.Color0Loi2 = color0Loi2.Color.ToArgb(); MonitorSetting.ColorCoLoi1 = colorCoLoi1.Color.ToArgb(); MonitorSetting.ColorCoLoi2 = colorCoLoi2.Color.ToArgb(); MonitorSetting.ColorDaXem1 = colorDaXem1.Color.ToArgb(); MonitorSetting.ColorDaXem2 = colorDaXem2.Color.ToArgb(); MonitorSetting.ColorChuaXuLy1 = colorChuaXuLy1.Color.ToArgb(); MonitorSetting.ColorChuaXuLy2 = colorChuaXuLy2.Color.ToArgb(); MonitorSetting.TuDongXuLyBanGhiDaXem = checkTuDongXuLyBanGhiDaXem.Checked; MonitorSetting.TuDongPhatHienNghiNgo = checkTuDongPhatHienNghiNgo.Checked; MonitorSetting.ChooseLane = sb.ToString(); // viết các thông số cấu hình vào file Setting Xml MonitorSetting.WriteFile(); logger.Info("Save Setting: "); logger.Info("TimeLoadData: " + set_TimeLoadData.Value.ToString()); logger.Info("TimeRunSlideShow: " + set_TimeRunSlideShow.Value.ToString()); logger.Info("BackColorRow Khong Loi: " + color0Loi1.Color.ToArgb().ToString() + " & " + color0Loi2.Color.ToArgb().ToString()); logger.Info("BackColorRow Co Loi: " + colorCoLoi1.Color.ToArgb().ToString() + " & " + colorCoLoi2.Color.ToArgb().ToString()); logger.Info("BackColorRow Da Xem: " + colorDaXem1.Color.ToArgb().ToString() + " & " + colorDaXem2.Color.ToArgb().ToString()); logger.Info("BackColorRow Chua Xu Ly: " + colorChuaXuLy1.Color.ToArgb().ToString() + " & " + colorChuaXuLy2.Color.ToArgb().ToString()); logger.Info("checkTuDongXuLyBanGhiDaXem: " + checkTuDongXuLyBanGhiDaXem.Checked.ToString()); logger.Info("checkTuDongPhatHienNghiNgo: " + checkTuDongPhatHienNghiNgo.Checked.ToString()); logger.Info("Chooselane: " + sb.ToString()); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } catch (Exception ex) { logger.Error(ex.ToString()); } }
/// private void GetInfoSetting() { MonitorSetting.LoadFile(); color0Loi1.Color = Color.FromArgb(MonitorSetting.Color0Loi1); color0Loi2.Color = Color.FromArgb(MonitorSetting.Color0Loi2); colorChuaXuLy1.Color = Color.FromArgb(MonitorSetting.ColorChuaXuLy1); colorChuaXuLy2.Color = Color.FromArgb(MonitorSetting.ColorChuaXuLy2); colorCoLoi1.Color = Color.FromArgb(MonitorSetting.ColorCoLoi1); colorCoLoi2.Color = Color.FromArgb(MonitorSetting.ColorCoLoi2); colorDaXem1.Color = Color.FromArgb(MonitorSetting.ColorDaXem1); colorDaXem2.Color = Color.FromArgb(MonitorSetting.ColorDaXem2); set_TimeLoadData.Value = MonitorSetting.TimeAutoLoadDb; set_TimeRunSlideShow.Value = MonitorSetting.TimeRunSlideshow; checkTuDongPhatHienNghiNgo.Checked = MonitorSetting.TuDongPhatHienNghiNgo; checkTuDongXuLyBanGhiDaXem.Checked = MonitorSetting.TuDongXuLyBanGhiDaXem; GetLane(); }