private void ImportFromFile(string fileName, string themeName) { var parser = new WaterML20Parser(); IList <Series> seriesList; try { seriesList = parser.ParseGetValues(fileName); } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Parse error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { var db = RepositoryFactory.Instance.Get <IRepositoryManager>(); var theme = new Theme(themeName); foreach (var series in seriesList) { db.SaveSeries(series, theme, OverwriteOptions.Copy); } _seriesControl.RefreshSelection(); MessageBox.Show(this, "Data imported successfully.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//To refresh the themes shown in the series selector public void RefreshView() { _seriesSelector.RefreshSelection(); }