Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public List<List<Item>> CreateLists(bool showError)
- {
- List<List<Item>> l = new List<List<Item>>();
- for (int x = 1; x <= Workbook.Worksheets.Count; x++)
- {
- l.Add(new List<Item>());
- for (int index = 2; ; index++)
- {
- using (var val = Workbook.Worksheet(x))
- {
- if (val.Cell("A" + index).Value == null || val.Cell("A" + index).Value.ToString() == "")
- {
- break;
- }
- }
- var i = new Item();
- try
- {
- switch (x)
- {
- case 1:
- i = new CPU();
- i.ReadExcelData(Workbook.Worksheet(x).Row(index));
- break;
- case 2:
- i = new RAM();
- i.ReadExcelData(Workbook.Worksheet(x).Row(index));
- break;
- case 3:
- i = new RAM();
- i.ReadExcelData(Workbook.Worksheet(x).Row(index));
- break;
- case 4:
- i = new Flash();
- i.ReadExcelData(Workbook.Worksheet(x).Row(index));
- break;
- default:
- break;
- }
- }
- catch (Exception e)
- {
- Thread.Sleep(5000);
- if (e.GetType().Name == "IOException")
- {
- index--;
- continue;
- }
- else if (showError)
- {
- System.Windows.MessageBox.Show("Data entered incorrectly in row " + index + " of " + Workbook.Worksheet(x).Name + ". Please correct the data and reload.", "Data Entry Error", MessageBoxButton.OK, MessageBoxImage.Error);
- continue;
- }
- else
- {
- continue;
- }
- }
- System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(() =>
- {
- i.CreateCardGrid();
- }));
- l[x - 1].Add(i);
- }
- }
- return l;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement