Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Open()
- {
- ObservableCollection<DataItem> d = new ObservableCollection<DataItem>();
- ReadWriteDialog rwd = new ReadWriteDialog();
- List <string[]> content = rwd.ReadCSVFile(Window, out fileName);
- if (fileName != null)
- {
- Window.Title = fileName;
- }
- if (content != null)
- {
- foreach (var c in content)
- {
- try
- {
- uint date = Convert.ToUInt32(c[0]);
- double temperature = Convert.ToDouble(c[1]);
- int place = Convert.ToInt32(c[2]);
- d.Add(new DataItem(date, temperature, place % 3 == 0 ? METERS.NAMES.AIRPORT : (place % 3 == 1 ? METERS.NAMES.CENTER : METERS.NAMES.RUISSALO)));
- }
- catch (Exception)
- {
- MessageBox.Show("Error reading data in file, check its contents.");
- Window.Close();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment