private void ImportPageData() { if (Root != null && !(Root.CurrentItem is WellboreGridViewModel)) { DialogService.Message("Импорт профиля невозможен! Необходимо выбрать ствол!"); return; } WellboreGridViewModel currentwelWellboreGridViewModel = Root.CurrentItem as WellboreGridViewModel; if (currentwelWellboreGridViewModel.ChildItems.Count > 0) { if (DialogService.Ask(String.Format("Данные профиля по стволу \"{0}\"\nбудут удалены.\nПродолжить?", currentwelWellboreGridViewModel.Name)) != InternalDialogResult.OK) { return; } } string filePath = DialogService.OpenFileDialog("Excel Files(*.xls;*.xlsx)|*.xls;*.xlsx"); if (String.IsNullOrEmpty(filePath)) { return; } try { List <ProfilePathPoint> profilePaths = ImportService.GetProfilePaths(filePath); FixFirstRow(profilePaths); currentwelWellboreGridViewModel.ChildItems.Clear(); List <ProfilePathGridViewModel> profilePathGridViewModels = Mapper.Map(profilePaths, new List <ProfilePathGridViewModel>()); currentwelWellboreGridViewModel.ChildItems.AddRange(profilePathGridViewModels); } catch (RangeNotFoundException e) { DialogService.Message(e.Message); } }