private void OpenDeviceListFile()
        {
            string filePath = String.Empty;
            // List<DeviceDataModel> deviceDataList = new List<DeviceDataModel>();
            List <DeviceData> dataUI   = new List <DeviceData>();
            OpenFileDialog    OFDialog = new OpenFileDialog();

            DialogResult result = OFDialog.ShowDialog(); // Show the dialog.

            OFDialog.DefaultExt = BellConstants.BellCSVExtention;
            if (result == DialogResult.OK) // Test result.
            {
                filePath = OFDialog.FileName;
                DeviceDataManager.DeviceListFilePath = filePath;
                DeviceDataManager.LoadData();
            }
            dataUI = DeviceDataManager.DeviceDataUI;
            pnlDeviceList.Controls.Clear();
            for (int i = 0; i < dataUI.Count; i++)
            {
                DeviceData      TempDataUi = dataUI[i];
                DeviceDataModel DDM        = new DeviceDataModel();
                DDM = TempDataUi.deviceDataModel;
                DDM.SerialNumber                          = i + 1;
                TempDataUi.deviceDataModel                = DDM;
                TempDataUi.Location                       = new Point(0, (i * 33));
                TempDataUi.Controls["btnDelete"].Click   += DeleteDeviceFromList;
                TempDataUi.Controls["chkDownload"].Click += SelectDownloadFromList;
                TempDataUi.MakeDirty                     += DeviceDataManager.ActionMakeDirty;

                pnlDeviceList.Controls.Add(TempDataUi);
            }
        }
 public void AssignCommunicationSetup(DeviceDataModel DDM)
 {
     DoClear  = DDM.DoClear;
     Host     = DDM.Host;
     Port     = DDM.Port;
     UserName = DDM.UserName;
     Password = DDM.Password;
     Delay    = DDM.Delay;
 }
 public void UpdateDeviceListUI()
 {
     pnlDeviceList.Controls.Clear();
     for (int i = 0; i < DeviceDataManager.DeviceDataUI.Count; i++)
     {
         DeviceData      TempDataUi = DeviceDataManager.DeviceDataUI[i];
         DeviceDataModel DDM        = new DeviceDataModel();
         DDM = TempDataUi.deviceDataModel;
         DDM.SerialNumber           = i + 1;
         TempDataUi.deviceDataModel = DDM;
         TempDataUi.Location        = new Point(0, (i * 33));
         pnlDeviceList.Controls.Add(TempDataUi);
     }
 }
Exemple #4
0
        public static DeviceData AddEmptyDeviceData(EventHandler aDeleteEventHandler, EventHandler aSelectDownloadEventHandler)
        {
            DeviceData      EmptyData = new DeviceData();
            DeviceDataModel DDM       = new DeviceDataModel();

            DDM.SerialNumber                         = DeviceDataUI.Count + 1;
            EmptyData.deviceDataModel                = DDM;
            EmptyData.Location                       = new Point(0, (DeviceDataUI.Count * 33));
            EmptyData.Controls["btnDelete"].Click   += aDeleteEventHandler;
            EmptyData.Controls["chkDownload"].Click += aSelectDownloadEventHandler;
            EmptyData.MakeDirty                     += ActionMakeDirty;
            DeviceDataUI.Add(EmptyData);
            return(EmptyData);
        }
Exemple #5
0
        public static DeviceData FromCsv(string csvLine)
        {
            string[]        values = csvLine.Split(',');
            DeviceDataModel DDM    = new DeviceDataModel();
            DeviceData      DD     = new DeviceData();

            DDM.SerialNumber   = 0;
            DDM.DoClear        = (values[0] != "0");
            DDM.Host           = values[1].ToString();
            DDM.Port           = values[2].ToString();
            DDM.UserName       = values[3].ToString();
            DDM.Password       = values[4].ToString();
            DDM.Delay          = Convert.ToInt32(values[5]);
            DD.deviceDataModel = DDM;
            return(DD);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < Data.Count; i++)
            {
                //10+(i* Data[i].Height -5)
                Data[i].Location = new Point(0, (i * 33));

                DeviceDataModel deviceDM = new DeviceDataModel();
                deviceDM.SerialNumber   = i + 1;
                Data[i].deviceDataModel = deviceDM;
                //   Data[i].deviceDataModel.SerialNumber = i + 1;
                pnlDeviceList.Controls.Add(Data[i]);
            }

            //FrmScheduleData test = new FrmScheduleData();
            //test.ShowDialog();
        }
        public DeviceData()
        {
            _deviceDM = new DeviceDataModel();

            InitializeComponent();
        }