Skip to content

Commit

Permalink
Disable the textSearch, filter and sort (#12517)
Browse files Browse the repository at this point in the history
Co-authored-by: Jesus Alfredo Alviño Lescano <[email protected]>
  • Loading branch information
jesusalvino and Jesus Alfredo Alviño Lescano authored Dec 28, 2021
1 parent 1c4c855 commit c7e17ad
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/DynamoCoreWpf/UI/GuidedTour/GuidesValidationMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ private static void PackageManagerViewModel_PropertyChanged(object sender, Syste
searchPackagesLoaded = true;

EnableNextButton(null, uiAutomationData, true, GuideFlow.FORWARD);
packageManagerViewModel.DisableSearchTextBox();

//Unsubscribe from the PropertyChanged event otherwise it will enter everytime the SearchTextBox is updated
packageManagerViewModel.PropertyChanged -= searchPackagesPropertyChanged.Invoke;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ public bool CanSetSortingKey(object par)
}

public event EventHandler<PackagePathEventArgs> RequestShowFileDialog;
public event EventHandler<PackagePathEventArgs> RequestDisableTextSearch;
public virtual void OnRequestShowFileDialog(object sender, PackagePathEventArgs e)
{
if (RequestShowFileDialog != null)
Expand Down Expand Up @@ -980,5 +981,16 @@ public void ExecuteSelected()

SearchResults[SelectedIndex].Model.Execute();
}

/// <summary>
/// Once the sample package is filled in the textbox search we rise the event to the view to disable the actions to change it , filter and sort it.
/// </summary>
public void DisableSearchTextBox()
{
if (RequestDisableTextSearch != null)
{
RequestDisableTextSearch(null, null);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@
Visibility="{Binding Path=SearchText, Converter={StaticResource NonEmptyStringToCollapsedConverter}}" />

<!-- 'X' button to reset search query text -->
<Button Margin="10"
<Button Name="clearSearchTextBox" Margin="10"
HorizontalAlignment="Right"
Command="{Binding ClearSearchTextBoxCommand}"
Cursor="Hand"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,24 @@ public PackageManagerSearchView(PackageManagerSearchViewModel pm)
InitializeComponent();
ViewModel.RegisterTransientHandlers();
ViewModel.RequestShowFileDialog += OnRequestShowFileDialog;
ViewModel.RequestDisableTextSearch += ViewModel_RequestDisableTextSearch;
Logging.Analytics.TrackScreenView("PackageManager");
}

private void ViewModel_RequestDisableTextSearch(object sender, PackagePathEventArgs e)
{
this.searchTextBox.IsEnabled = false;
this.clearSearchTextBox.IsEnabled = false;
this.filterResultsButton.IsEnabled = false;
this.sortResultsButton.IsEnabled = false;
}

protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
var viewModel = DataContext as PackageManagerSearchViewModel;

ViewModel.RequestShowFileDialog -= OnRequestShowFileDialog;
ViewModel.RequestDisableTextSearch -= ViewModel_RequestDisableTextSearch;
viewModel.UnregisterTransientHandlers();

// Clears the search text so that the 'Please Wait' prompt appears next time this dialog is opened.
Expand Down

0 comments on commit c7e17ad

Please sign in to comment.