diff --git a/tools/Customization/DevHome.Customization/ViewModels/FileExplorerViewModel.cs b/tools/Customization/DevHome.Customization/ViewModels/FileExplorerViewModel.cs index 56b4321711..77516af617 100644 --- a/tools/Customization/DevHome.Customization/ViewModels/FileExplorerViewModel.cs +++ b/tools/Customization/DevHome.Customization/ViewModels/FileExplorerViewModel.cs @@ -306,4 +306,11 @@ private void AdjustFocus(object sender) _log.Information($"Set focus to add reposiotry card result: {isFocusSet}"); } } + + public void UnassignSourceControlProviderFromRepository(string repositoryRootPath) + { + ExtraFolderPropertiesWrapper.Unregister(repositoryRootPath); + RepoTracker.ModifySourceControlProviderForTrackedRepository(_unassigned, repositoryRootPath); + RefreshTrackedRepositories(); + } } diff --git a/tools/Customization/DevHome.Customization/Views/AddRepositoriesView.xaml.cs b/tools/Customization/DevHome.Customization/Views/AddRepositoriesView.xaml.cs index c3665cb807..b52902078f 100644 --- a/tools/Customization/DevHome.Customization/Views/AddRepositoriesView.xaml.cs +++ b/tools/Customization/DevHome.Customization/Views/AddRepositoriesView.xaml.cs @@ -43,6 +43,7 @@ private void SourceControlProviderMenuFlyout_Opening(object sender, object e) { if (sender is MenuFlyout menuFlyout) { + var stringResource = new StringResource("DevHome.Customization.pri", "DevHome.Customization/Resources"); menuFlyout.Items.Clear(); foreach (var extension in ViewModel.ExtensionService.GetInstalledExtensionsAsync(ProviderType.LocalRepository).Result) @@ -54,10 +55,26 @@ private void SourceControlProviderMenuFlyout_Opening(object sender, object e) }; menuItem.Click += AssignSourceControlProviderButton_Click; - var stringResource = new StringResource("DevHome.Customization.pri", "DevHome.Customization/Resources"); ToolTipService.SetToolTip(menuItem, stringResource.GetLocalized("PrefixForDevHomeVersion", extension.PackageDisplayName)); menuFlyout.Items.Add(menuItem); } + + var unassignMenuItem = new MenuFlyoutItem + { + Text = stringResource.GetLocalized("MenuFlyoutUnregisteredRepository_Content"), + }; + unassignMenuItem.Click += UnassignFolderButton_Click; + menuFlyout.Items.Add(unassignMenuItem); + } + } + + public void UnassignFolderButton_Click(object sender, RoutedEventArgs e) + { + // Extract relevant data from view and give to view model for unassign + MenuFlyoutItem menuItem = (MenuFlyoutItem)sender; + if (menuItem.DataContext is RepositoryInformation repoInfo) + { + ViewModel.UnassignSourceControlProviderFromRepository(repoInfo.RepositoryRootPath); } }