Beispiel #1
0
        private void lưuTậpTinToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SwitchBindingModel model = new SwitchBindingModel();

            InputDataFromDataGridView(model);
            _switchManager.SaveIntoFile(model);
        }
Beispiel #2
0
        public void SaveData()
        {
            SwitchBindingModel model = new SwitchBindingModel();

            InputDataFromDataGridView(model);
            _switchManager.SaveIntoFile(model);
        }
Beispiel #3
0
        private void mởTậpTinToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SwitchBindingModel model = _switchManager.OpenFile();

            if (model != null)
            {
                InputDataIntoDGVFromModel(model);
            }
        }
Beispiel #4
0
        public void LoadData()
        {
            SwitchBindingModel model = _switchManager.OpenFile();

            if (model != null)
            {
                InputDataIntoDGVFromModel(model);//
            }
        }
Beispiel #5
0
        public SwitchBindingModel OpenFile()
        {
            SwitchBindingModel res = Z119.ATK.Common.ProjectManager.LoadObject <SwitchBindingModel>(Const.FD_CHUYENMACH);

            if (res == null)
            {
                res = new SwitchBindingModel();
            }
            return(res);
        }
Beispiel #6
0
        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;
                }
            }
        }
Beispiel #7
0
        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();
        }
Beispiel #8
0
 public void InputDataFromDataGridView(SwitchBindingModel model)
 {
     model.ListFrame = GetDataByteFromDataGridView();
     model.ListChan  = GetDataStringFromDataGridView();
 }
Beispiel #9
0
 public void SaveIntoFile(SwitchBindingModel model)
 {
     Z119.ATK.Common.ProjectManager.SaveObject(model, Const.FD_CHUYENMACH);
 }
Beispiel #10
0
 public void SaveIntoFile(SwitchBindingModel model)
 {
     Z119.ATK.Common.CommonFile.SaveIntoFile(model, Const.FD_CHUYENMACH);
 }