Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Machine config list navigation, and repo config names. #3119

Merged
merged 8 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,14 @@ public string EditClonePathAutomationName
get; set;
}

/// <summary>
/// Gets or sets the string that the narrator should say when the repo is selected in the config screen.
/// </summary>
public string RepoConfigAutomationName
{
get; set;
}

/// <summary>
/// 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
Expand Down
39 changes: 39 additions & 0 deletions tools/SetupFlow/DevHome.SetupFlow/ViewModels/AddRepoViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,44 @@ private void RepoProviderSelected(string repositoryProviderName)
_selectedRepoProvider = repositoryProviderName;
}

/// <summary>
/// Adds or removes the default dev drive. This dev drive will be made at the loading screen.
/// </summary>
[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;
}
}

/// <summary>
/// Update dialog to show Dev Drive information.
/// </summary>
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()
{
Expand Down Expand Up @@ -1066,6 +1104,7 @@ public void AddOrRemoveRepository(string accountName, IList<object> 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);
}
}
Expand Down
18 changes: 15 additions & 3 deletions tools/SetupFlow/DevHome.SetupFlow/Views/AddRepoDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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. -->
<ListView x:Name="RepositoriesListView" Visibility="{x:Bind AddRepoViewModel.IsFetchingRepos, Mode=OneWay, Converter={StaticResource NegatedBoolToVisibilityConverter}}" SelectionMode="Multiple" Height="300" HorizontalAlignment="Stretch" SelectionChanged="RepositoriesListView_SelectionChanged" ItemsSource="{x:Bind AddRepoViewModel.RepositoriesToDisplay, Mode=OneWay}">
<ListView x:Name="RepositoriesListView"
Visibility="{x:Bind AddRepoViewModel.IsFetchingRepos, Mode=OneWay, Converter={StaticResource NegatedBoolToVisibilityConverter}}"
SelectionMode="Multiple"
Height="300"
HorizontalAlignment="Stretch"
SelectionChanged="RepositoriesListView_SelectionChanged"
ItemsSource="{x:Bind AddRepoViewModel.RepositoriesToDisplay, Mode=OneWay}">
<ListView.ItemTemplate>
<DataTemplate x:DataType="models:RepoViewListItem">
<Grid ColumnSpacing="7" AutomationProperties.Name="{x:Bind RepoDisplayName}">
Expand Down Expand Up @@ -276,12 +282,18 @@
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<CheckBox
Click="MakeNewDevDriveCheckBox_Click"
IsEnabled="{x:Bind AddRepoViewModel.EditDevDriveViewModel.IsDevDriveCheckboxEnabled}"
IsChecked="{x:Bind AddRepoViewModel.EditDevDriveViewModel.IsDevDriveCheckboxChecked, Mode=TwoWay}"
Grid.Column="0"
Grid.Row="0"
x:Uid="NewDevDriveComboBox"/>
x:Uid="NewDevDriveComboBox"
x:Name="NewDevDriveComboBox">
<i:Interaction.Behaviors>
<ic:EventTriggerBehavior EventName="Click">
<ic:InvokeCommandAction Command="{x:Bind AddRepoViewModel.MakeNewDevDriveCommand}" CommandParameter="{x:Bind NewDevDriveComboBox.IsChecked, Mode=OneWay}"/>
</ic:EventTriggerBehavior>
</i:Interaction.Behaviors>
</CheckBox>
<HyperlinkButton
x:Uid="CustomizeHyperLink"
Grid.Column="1"
Expand Down
42 changes: 2 additions & 40 deletions tools/SetupFlow/DevHome.SetupFlow/Views/AddRepoDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ public AddRepoViewModel AddRepoViewModel
public SetupFlowOrchestrator Orchestrator { get; set; }

/// <summary>
/// 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.
/// </summary>
private string _oldCloneLocation;
public string OldCloneLocation { get; set; }

public AddRepoDialog(
SetupFlowOrchestrator setupFlowOrchestrator,
Expand Down Expand Up @@ -222,30 +222,6 @@ private async void AddRepoContentDialog_PrimaryButtonClick(ContentDialog sender,
}
}

/// <summary>
/// Adds or removes the default dev drive. This dev drive will be made at the loading screen.
/// </summary>
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;
}
}

/// <summary>
/// Putting the event in the view so SelectRange can be called.
/// SelectRange needs a reference to the ListView.
Expand All @@ -262,20 +238,6 @@ private void FilterTextBox_TextChanged(object sender, TextChangedEventArgs e)
}
}

/// <summary>
/// Update dialog to show Dev Drive information.
/// </summary>
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));
Expand Down
Loading
Loading