private void ButtonBrowseImportFolder_Click(object sender, RoutedEventArgs e) { BrowseFolderWindow browseFolderWindow = new BrowseFolderWindow() { Owner = this, SelectedPath = ViewModel.ImportPath }; browseFolderWindow.ShowDialog(); if (browseFolderWindow.DialogResult == true) { ViewModel.ImportPath = browseFolderWindow.SelectedPath; } }
private void ButtonBrowseLibrary_Click(object sender, RoutedEventArgs e) { LibraryRoot t = (sender as Button).DataContext as LibraryRoot; BrowseFolderWindow browseFolderWindow = new BrowseFolderWindow() { Owner = this, SelectedPath = t?.Path }; browseFolderWindow.ShowDialog(); if (browseFolderWindow.DialogResult == true) { if (t == null) { MainWindowViewModel ViewModel = DataContext as MainWindowViewModel; ViewModel.LibraryRootDirectories.Add(new LibraryRoot(browseFolderWindow.SelectedPath)); } else { t.Path = browseFolderWindow.SelectedPath; } } }