Beispiel #1
0
        public int restoreDeviceConfiguration(deviceEntry[] dEntry, int nDevice, TeSysTConfiFile confFiles)
        {
            int retCode = -1;

            progressInfo.actOn = actionOnControl.PROGRESS_BAR;
            progressInfo.pbVal = 0;
            progressInfo.pbMax = nDevice;
            progressInfo.pbMin = 0;
            cbPp(progressInfo);

            if (nDevice < 1)
            {
                Console.WriteLine("device list is 0 can't be restored");
                return(retCode);
            }

            deviceList   = dEntry;
            deviceLstCnt = nDevice;
            cParam       = confFiles.cParam;

            Thread restoreTh = new Thread(ltmrRestoreTask);

            restoreTh.Start();
            retCode = 0;

            return(retCode);
        }
Beispiel #2
0
 private void initToDeafult()
 {
     deviceList   = null;
     deviceLstCnt = 0;
     cbPp         = null;
     progressInfo = new backupNRestoreProgressInfo();
     mbAccess     = new ModbusRegisterAccess();
     devIdObj     = new deviceIdentification();
     cParam       = new TeSysTConfFileCompatibilityParam();
 }
Beispiel #3
0
        private void btStart_Click(object sender, RoutedEventArgs e)
        {
            int selectedLst = grdBnRDeviceList.SelectedItems.Count;

            deviceEntry[] dEntry         = new deviceEntry[selectedLst];
            bool          isFileSelected = false;
            TeSysTConfFileCompatibilityParam compatibilityParam = new TeSysTConfFileCompatibilityParam();

            try
            {
                if (selectedLst < 1)
                {
                    MessageBox.Show("Please select at leat one device to be Backed-up or Restored");
                    return;
                }


                for (int i = 0; i < selectedLst; i++)
                {
                    dEntry[i] = (deviceEntry)(grdBnRDeviceList.SelectedItems[i]);
                }
            }
            catch (excepetion ex)
            {
                Console.WriteLine(ex.Message);
            }
            if (rdBackup.IsChecked == true)
            {
                ltmrBnR.backupDeviceConfiguration(dEntry, selectedLst);
            }
            else if (rdRestore.IsChecked == true)
            {
                TeSysTConfiFile confFiles = new TeSysTConfiFile();
                if (txtRef100Amp.Text != "")
                {
                    confFiles.fileName100Amp = txtRef100Amp.Text.ToString();
                    isFileSelected           = true;
                }
                else
                {
                    confFiles.fileName100Amp = "";
                }

                if (txtRef27Amp.Text != "")
                {
                    confFiles.fileName27Amp = txtRef27Amp.Text.ToString();
                    isFileSelected          = true;
                }
                else
                {
                    confFiles.fileName27Amp = "";
                }
                if (txtRef8Amp.Text != "")
                {
                    confFiles.fileName8Amp = txtRef8Amp.Text.ToString();
                    isFileSelected         = true;
                }
                else
                {
                    confFiles.fileName8Amp = "";
                }


                if (isFileSelected == true)
                {
                    compatibilityParam.comercialReference = (bool)chComRef.IsChecked;
                    compatibilityParam.kuFirmwareVer      = (bool)chKuVer.IsChecked;
                    compatibilityParam.kcFirmwareVer      = (bool)chKCVer.IsChecked;
                    compatibilityParam.deviceSerialNumber = (bool)chSerialN.IsChecked;
                    confFiles.cParam = compatibilityParam;

                    ltmrBnR.restoreDeviceConfiguration(dEntry, selectedLst, confFiles);
                }
                else
                {
                    MessageBox.Show("please select at least one configuration file");
                }
            }
        }