private async void LoadDataFromFile() { _maxPrimka = UraPrimke.Count > 0 ? UraPrimke.Max(y => y.BrojUKnjiziUra) : 0; OpenFileDialog ofd = new OpenFileDialog { Filter = "Xlsx Files *.xlsx|*.xlsx|Xls Files *.xls|*.xls|Csv files *.csv|*.csv", FilterIndex = 1, Multiselect = false }; bool?result = ofd.ShowDialog(); if (result != null && result == true) { IsLoading = true; FilePath = ofd.FileName; var data = _xlsFileReader.Convert(FilePath, _bookName); if (data != null) { FromStringToList(data); _loaded = true; } await Application.Current.Dispatcher.BeginInvoke(new Action(DatagridLoaded), DispatcherPriority.ContextIdle, null); } }
private void LoadDataFromFile() { _maxPrimka = UraPrimke.Count > 0 ? UraPrimke.Max(y => y.BrojUKnjiziUra) : 0; OpenFileDialog ofd = new OpenFileDialog { Filter = "Xlsx Files *.xlsx|*.xlsx|Xls Files *.xls|*.xls|Csv files *.csv|*.csv", FilterIndex = 1, Multiselect = false }; Nullable <bool> result = ofd.ShowDialog(); if (result != null && result == true) { FilePath = ofd.FileName; var data = _xlsFileReader.Convert(FilePath, _bookName); if (data != null) { FromStringToList(data); _loaded = true; } } }