public static List <CyberDanger> GetDataFromFile(string path) { ExcelPackage.LicenseContext = LicenseContext.NonCommercial; var file = new FileInfo(path); var dangersList = new List <CyberDanger>(); using (var p = new ExcelPackage(file)) { var ws = p.Workbook.Worksheets["Sheet"]; int rowsNum = ws.Dimension.End.Row; for (int i = 3; i < rowsNum; i++) { var danger = new CyberDanger(); danger.Id = int.Parse(ws.Cells[i, 1].Text); danger.Name = ws.Cells[i, 2].Text; danger.Description = ws.Cells[i, 3].Text; danger.Source = ws.Cells[i, 4].Text; danger.Target = ws.Cells[i, 5].Text; danger.Conf = ws.Cells[i, 6].Text == "1"; danger.Integrity = ws.Cells[i, 7].Text == "1"; danger.Access = ws.Cells[i, 8].Text == "1"; dangersList.Add(danger); } } return(dangersList); }
private void Data_Table_RowClick(object sender, MouseButtonEventArgs e) { { if (sender != null) { DataGrid grid = sender as DataGrid; if (grid != null && grid.SelectedItems != null && grid.SelectedItems.Count == 1) { DataGridRow dgr = grid.ItemContainerGenerator.ContainerFromItem(grid.SelectedItem) as DataGridRow; CyberDanger selectedDanger = dgr.Item as CyberDanger; FullInformation fullInfoWindow = new FullInformation(selectedDanger); fullInfoWindow.Show(); } } } }
public FullInformation(CyberDanger danger) { CurrDanger = danger; InitializeComponent(); }