private void lưuTậpTinToolStripMenuItem_Click(object sender, EventArgs e) { SwitchBindingModel model = new SwitchBindingModel(); InputDataFromDataGridView(model); _switchManager.SaveIntoFile(model); }
public void SaveData() { SwitchBindingModel model = new SwitchBindingModel(); InputDataFromDataGridView(model); _switchManager.SaveIntoFile(model); }
private void mởTậpTinToolStripMenuItem_Click(object sender, EventArgs e) { SwitchBindingModel model = _switchManager.OpenFile(); if (model != null) { InputDataIntoDGVFromModel(model); } }
public void LoadData() { SwitchBindingModel model = _switchManager.OpenFile(); if (model != null) { InputDataIntoDGVFromModel(model);// } }
public SwitchBindingModel OpenFile() { SwitchBindingModel res = Z119.ATK.Common.ProjectManager.LoadObject <SwitchBindingModel>(Const.FD_CHUYENMACH); if (res == null) { res = new SwitchBindingModel(); } return(res); }
public void InputDataIntoDGVFromModel(SwitchBindingModel model) { if (model.ListChan == null) { return; } if (model.ListFrame == null) { return; } int row = model.ListChan.Count; for (int i = 0; i < row; i++) { dgvSwitch.Rows[i].Cells[1].Tag = model.ListChan[i]; switch (model.ListChan[i]) { case "": dgvSwitch.Rows[i].Cells[1].Value = imageList1.Images["value6.png"]; break; case "U1": dgvSwitch.Rows[i].Cells[1].Value = imageList1.Images["value0.png"]; break; case "+U2": dgvSwitch.Rows[i].Cells[1].Value = imageList1.Images["value1.png"]; break; case "U3": dgvSwitch.Rows[i].Cells[1].Value = imageList1.Images["value2.png"]; break; case "U4": dgvSwitch.Rows[i].Cells[1].Value = imageList1.Images["value3.png"]; break; case "Đất": dgvSwitch.Rows[i].Cells[1].Value = imageList1.Images["value4.png"]; break; case "-U2": dgvSwitch.Rows[i].Cells[1].Value = imageList1.Images["value5.png"]; break; default: break; } } }
public fSwitchForm() { InitializeComponent(); _switchManager = new SwitchManager(); _switchManager.mode = Mode.None; _switchManager.IsOn = false; Model = new SwitchBindingModel(); Model.ListFrame = new List <List <byte> >(); Model.ListChan = new List <string>(); initialize_DataGridView1(); btnOnOff.BackgroundImage = Image.FromFile(Z119.ATK.Common.Const.ICON_POWER_OFF); btnOnOff.BackgroundImageLayout = ImageLayout.Stretch; ConnectCOMPort(); }
public void InputDataFromDataGridView(SwitchBindingModel model) { model.ListFrame = GetDataByteFromDataGridView(); model.ListChan = GetDataStringFromDataGridView(); }
public void SaveIntoFile(SwitchBindingModel model) { Z119.ATK.Common.ProjectManager.SaveObject(model, Const.FD_CHUYENMACH); }
public void SaveIntoFile(SwitchBindingModel model) { Z119.ATK.Common.CommonFile.SaveIntoFile(model, Const.FD_CHUYENMACH); }