From 9ad8dd9386eed3ec4b101666b3c750cf79e62c07 Mon Sep 17 00:00:00 2001 From: Darren Hoehna Date: Wed, 5 Jun 2024 00:14:51 -0700 Subject: [PATCH] Machine config list navigation, and repo config names. (#3119) * Intial proof working * Removing tab stops * Adding comments * Narrator says the correct name in the repo config screen * Adding comments * Moving some DevDrive code to the view model. * Correct indentation --- .../Models/CloningInformation.cs | 8 + .../ViewModels/AddRepoViewModel.cs | 39 ++++ .../Views/AddRepoDialog.xaml | 18 +- .../Views/AddRepoDialog.xaml.cs | 42 +--- .../DevHome.SetupFlow/Views/MainPageView.xaml | 200 ++++++++++-------- .../Views/RepoConfigView.xaml | 2 +- .../Views/RepoConfigView.xaml.cs | 2 +- 7 files changed, 175 insertions(+), 136 deletions(-) diff --git a/tools/SetupFlow/DevHome.SetupFlow/Models/CloningInformation.cs b/tools/SetupFlow/DevHome.SetupFlow/Models/CloningInformation.cs index a88c3c2d62..15eed1ca75 100644 --- a/tools/SetupFlow/DevHome.SetupFlow/Models/CloningInformation.cs +++ b/tools/SetupFlow/DevHome.SetupFlow/Models/CloningInformation.cs @@ -216,6 +216,14 @@ public string EditClonePathAutomationName get; set; } + /// + /// Gets or sets the string that the narrator should say when the repo is selected in the config screen. + /// + public string RepoConfigAutomationName + { + get; set; + } + /// /// Gets or sets the name of the button that allows a user to remove the repository from being cloned. /// This name can't be static because each button name needs to be unique. Because each name needs to be unique diff --git a/tools/SetupFlow/DevHome.SetupFlow/ViewModels/AddRepoViewModel.cs b/tools/SetupFlow/DevHome.SetupFlow/ViewModels/AddRepoViewModel.cs index a73cc95ec2..1e96653859 100644 --- a/tools/SetupFlow/DevHome.SetupFlow/ViewModels/AddRepoViewModel.cs +++ b/tools/SetupFlow/DevHome.SetupFlow/ViewModels/AddRepoViewModel.cs @@ -445,6 +445,44 @@ private void RepoProviderSelected(string repositoryProviderName) _selectedRepoProvider = repositoryProviderName; } + /// + /// Adds or removes the default dev drive. This dev drive will be made at the loading screen. + /// + [RelayCommand] + private void MakeNewDevDrive(bool isCheckBoxChecked) + { + // Getting here means + // 1. The user does not have any existing dev drives + // 2. The user wants to clone to a new dev drive. + // 3. The user un-checked this and does not want a new dev drive. + if (isCheckBoxChecked) + { + UpdateDevDriveInfo(); + } + else + { + FolderPickerViewModel.CloneLocationAlias = string.Empty; + FolderPickerViewModel.InDevDriveScenario = false; + EditDevDriveViewModel.RemoveNewDevDrive(); + FolderPickerViewModel.EnableBrowseButton(); + FolderPickerViewModel.CloneLocation = _addRepoDialog.OldCloneLocation; + } + } + + /// + /// Update dialog to show Dev Drive information. + /// + public void UpdateDevDriveInfo() + { + EditDevDriveViewModel.MakeDefaultDevDrive(); + FolderPickerViewModel.DisableBrowseButton(); + _addRepoDialog.OldCloneLocation = FolderPickerViewModel.CloneLocation; + FolderPickerViewModel.CloneLocation = EditDevDriveViewModel.GetDriveDisplayName(); + FolderPickerViewModel.CloneLocationAlias = EditDevDriveViewModel.GetDriveDisplayName(DevDriveDisplayNameKind.FormattedDriveLabelKind); + FolderPickerViewModel.InDevDriveScenario = true; + EditDevDriveViewModel.IsDevDriveCheckboxChecked = true; + } + [RelayCommand] private void CancelButtonPressed() { @@ -1066,6 +1104,7 @@ public void AddOrRemoveRepository(string accountName, IList repositories cloningInformation.OwningAccount = developerId; cloningInformation.EditClonePathAutomationName = _stringResource.GetLocalized(StringResourceKey.RepoPageEditClonePathAutomationProperties, Path.Join(_selectedRepoProvider, repositoryToAdd.RepoDisplayName)); cloningInformation.RemoveFromCloningAutomationName = _stringResource.GetLocalized(StringResourceKey.RepoPageRemoveRepoAutomationProperties, Path.Join(_selectedRepoProvider, repositoryToAdd.RepoDisplayName)); + cloningInformation.RepoConfigAutomationName = Path.Join(_providers.DisplayName(_selectedRepoProvider), repositoryToAdd.RepoDisplayName); EverythingToClone.Add(cloningInformation); } } diff --git a/tools/SetupFlow/DevHome.SetupFlow/Views/AddRepoDialog.xaml b/tools/SetupFlow/DevHome.SetupFlow/Views/AddRepoDialog.xaml index 78d3d3aa87..194daca8fb 100644 --- a/tools/SetupFlow/DevHome.SetupFlow/Views/AddRepoDialog.xaml +++ b/tools/SetupFlow/DevHome.SetupFlow/Views/AddRepoDialog.xaml @@ -170,7 +170,13 @@ into the command. I tried converting this to use a command on SelectionChanged and pass SelectedItems into the command. I ran into issues because the viewmodel expects one repository at a time. Not a list. Another issue is .SelectRange() needs to be called to "select" repos when the dialog is opened more than once. --> - + @@ -276,12 +282,18 @@ + x:Uid="NewDevDriveComboBox" + x:Name="NewDevDriveComboBox"> + + + + + + - /// Hold the clone location in case the user decides not to add a dev drive. + /// Gets or sets the clone location in case the user decides not to add a dev drive. /// - private string _oldCloneLocation; + public string OldCloneLocation { get; set; } public AddRepoDialog( SetupFlowOrchestrator setupFlowOrchestrator, @@ -222,30 +222,6 @@ private async void AddRepoContentDialog_PrimaryButtonClick(ContentDialog sender, } } - /// - /// Adds or removes the default dev drive. This dev drive will be made at the loading screen. - /// - private void MakeNewDevDriveCheckBox_Click(object sender, RoutedEventArgs e) - { - // Getting here means - // 1. The user does not have any existing dev drives - // 2. The user wants to clone to a new dev drive. - // 3. The user un-checked this and does not want a new dev drive. - var isChecked = (sender as CheckBox).IsChecked; - if (isChecked.Value) - { - UpdateDevDriveInfo(); - } - else - { - AddRepoViewModel.FolderPickerViewModel.CloneLocationAlias = string.Empty; - AddRepoViewModel.FolderPickerViewModel.InDevDriveScenario = false; - AddRepoViewModel.EditDevDriveViewModel.RemoveNewDevDrive(); - AddRepoViewModel.FolderPickerViewModel.EnableBrowseButton(); - AddRepoViewModel.FolderPickerViewModel.CloneLocation = _oldCloneLocation; - } - } - /// /// Putting the event in the view so SelectRange can be called. /// SelectRange needs a reference to the ListView. @@ -262,20 +238,6 @@ private void FilterTextBox_TextChanged(object sender, TextChangedEventArgs e) } } - /// - /// Update dialog to show Dev Drive information. - /// - public void UpdateDevDriveInfo() - { - AddRepoViewModel.EditDevDriveViewModel.MakeDefaultDevDrive(); - AddRepoViewModel.FolderPickerViewModel.DisableBrowseButton(); - _oldCloneLocation = AddRepoViewModel.FolderPickerViewModel.CloneLocation; - AddRepoViewModel.FolderPickerViewModel.CloneLocation = AddRepoViewModel.EditDevDriveViewModel.GetDriveDisplayName(); - AddRepoViewModel.FolderPickerViewModel.CloneLocationAlias = AddRepoViewModel.EditDevDriveViewModel.GetDriveDisplayName(DevDriveDisplayNameKind.FormattedDriveLabelKind); - AddRepoViewModel.FolderPickerViewModel.InDevDriveScenario = true; - AddRepoViewModel.EditDevDriveViewModel.IsDevDriveCheckboxChecked = true; - } - private void FilterSuggestions(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args) { sender.ItemsSource = _searchFieldsAndValues[sender.Header.ToString()].Where(x => x.Contains(sender.Text)); diff --git a/tools/SetupFlow/DevHome.SetupFlow/Views/MainPageView.xaml b/tools/SetupFlow/DevHome.SetupFlow/Views/MainPageView.xaml index 8d3a4ff698..14e994a4e4 100644 --- a/tools/SetupFlow/DevHome.SetupFlow/Views/MainPageView.xaml +++ b/tools/SetupFlow/DevHome.SetupFlow/Views/MainPageView.xaml @@ -19,7 +19,16 @@ 32 - + @@ -87,19 +96,21 @@ BackgroundSource="{ThemeResource Setup_Banner_Back}" OverlaySource="{ThemeResource Setup_Banner_Front}" /> - + - - + + + - + @@ -163,15 +175,16 @@ - + @@ -179,78 +192,83 @@ + + + + + + + + - - - - - - - - - - - - - - - - + + - + + + + + + + + - - - + + - - - - - - - - - - - + + + + + + + + + + + + diff --git a/tools/SetupFlow/DevHome.SetupFlow/Views/RepoConfigView.xaml b/tools/SetupFlow/DevHome.SetupFlow/Views/RepoConfigView.xaml index bc0eba44a6..9fc152c56d 100644 --- a/tools/SetupFlow/DevHome.SetupFlow/Views/RepoConfigView.xaml +++ b/tools/SetupFlow/DevHome.SetupFlow/Views/RepoConfigView.xaml @@ -94,7 +94,7 @@ - + diff --git a/tools/SetupFlow/DevHome.SetupFlow/Views/RepoConfigView.xaml.cs b/tools/SetupFlow/DevHome.SetupFlow/Views/RepoConfigView.xaml.cs index c0a90a74a3..350fdc2df8 100644 --- a/tools/SetupFlow/DevHome.SetupFlow/Views/RepoConfigView.xaml.cs +++ b/tools/SetupFlow/DevHome.SetupFlow/Views/RepoConfigView.xaml.cs @@ -72,7 +72,7 @@ private async Task AddRepoAsync() if (_addRepoDialog.AddRepoViewModel.EditDevDriveViewModel.CanShowDevDriveUI && ViewModel.ShouldAutoCheckDevDriveCheckbox) { - _addRepoDialog.UpdateDevDriveInfo(); + _addRepoDialog.AddRepoViewModel.UpdateDevDriveInfo(); } _addRepoDialog.IsSecondaryButtonEnabled = true;