/// <summary> /// Uses the xml files in resource to retrieve desired settings. /// I use the GetTestData for testing various methods of retrieving data. /// the RetrieveFirmwareInfo is used to retrieve the product release name and firmware version /// </summary> private void RetrieveDeviceData() { Cursor.Current = Cursors.WaitCursor; btnRun.Enabled = false; RetrieveFirmwareInfo(); ProcessXML px = new ProcessXML(); //px.GetTestData(); px.GetFIM_TestingInfo(); // px.GetDeviceInformation(); RetrieveSettings(px.ListDeviceEndPoints); // start of new request if (_listDeviceData.Count == 0) { LoadDataFim(px.ListDeviceEndPoints, _listDeviceData); } else // retrieving the second set for comparison { RetrieveFirmwareInfo(); DataFims lstTemp = new DataFims(); LoadDataFim(px.ListDeviceEndPoints, lstTemp); AddedNewValue(lstTemp); } BindDataGrid(); SetRowIndicator(); Cursor.Current = Cursors.Default; btnRun.Enabled = true; }
private DataFim SetDeviceData(DataFim df, EndPoint ds, DataFims listData) { df.EndPoint = ds.EndPointName; df = ProcessParents(df, listData, ds.EndPointName, ds.ListParents); return(df); }
public WriteExcel(DataFims lstDeviceValues) { ListDeviceValues = lstDeviceValues; Row = 1; _xlWorkBook = _xlApp.Workbooks.Add(); _xlWorkSheet = _xlWorkBook.Worksheets.get_Item(1); }
/// <summary> /// Starts the process for placing the retrieved device information into list that will be displayed in the grid. /// DataFims is the list displayed in the grid. /// </summary> /// <param name="listDs">DeviceSettings</param> /// <param name="listDat">DataFims</param> private void LoadDataFim(DeviceSettings listDs, DataFims listDat) { DataFim df = new DataFim(); foreach (EndPoint ds in listDs) { if (ds.HasValues) { df = SetDeviceData(df, ds, listDat); } } }
/// <summary> /// Compares the lists in order to later display if any mismatches after firmware update /// </summary> /// <param name="lstTemp"></param> private void AddedNewValue(DataFims lstTemp) { if (_listDeviceData.Count == lstTemp.Count) { for (int idx = 0; idx < _listDeviceData.Count; idx++) { _listDeviceData[idx].ValueNew = lstTemp[idx].ValueOrig; if (_listDeviceData[idx].ValueNew.Equals(_listDeviceData[idx].ValueOrig)) { _listDeviceData[idx].SameValue = true; } else { _listDeviceData[idx].SameValue = false; } } } }
private DataFim ProcessParents(DataFim df, DataFims listData, string endpoint, Parents listParents) { foreach (Parent p in listParents) { df.Parent = p.ParentName; foreach (PairedValue pv in p.ListPairedValues) { df.Element = pv.IdentName; df.ValueOrig = pv.IdentValue; listData.Add(df); df = new DataFim(); df.EndPoint = endpoint; df.Parent = p.ParentName; } if (p.ListParents.Count > 0) { df = ProcessParents(df, listData, endpoint, p.ListParents); } } return(df); }
private void MnuFileOpen_Click(object sender, EventArgs e) { ofdFiles = new OpenFileDialog(); ofdFiles.Filter = FILTERS_CSV; ofdFiles.FilterIndex = 2; if (ofdFiles.ShowDialog() == DialogResult.OK) { string filePath = ofdFiles.FileName; if (Path.GetExtension(filePath).ToLower().Equals(".csv")) { ProcessFile pf = new ProcessFile(ofdFiles.FileName, ofdFiles.FileName, _listDeviceData); if (pf.LoadDeviceData()) { txtIPAddress.Text = pf.IPAddress; lblProductName.Text = pf.DeviceName; lblFimOld.Text = pf.OrigFIM; lblFimNew.Text = pf.NewFIM; _listDeviceData = pf.ListDeviceSettings; BindDataGrid(); } } } }
public FrmDeviceSettings() { InitializeComponent(); _listDeviceData = new DataFims(); txtIPAddress.Focus(); }
public ProcessFile(string filePathName) { FileName = filePathName; ListDeviceSettings = new DataFims(); }
public ProcessFile(string fileName, string path, DataFims lstDeviceSettings) { FileName = fileName; SaveDirectory = path; ListDeviceSettings = lstDeviceSettings; }