Skip to content
This repository has been archived by the owner on Dec 21, 2024. It is now read-only.

Commit

Permalink
Refactor and modify variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
StrangeRanger committed Mar 9, 2024
1 parent 6b47790 commit 2777f52
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
18 changes: 9 additions & 9 deletions ActiveDirectoryQuerier/ComboBoxParameterViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ namespace ActiveDirectoryQuerier;
public sealed class ComboBoxParameterViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;
private ObservableCollection<string> _possibleParameterList = new();
private ObservableCollection<string> _possibleParameters = new();
private string _selectedParameter = string.Empty;

/// <summary>
/// Initializes a new instance of the ComboBoxParameterViewModel class.
/// </summary>
/// <param name="possibleParameterList">Initial list of possible parameters for the ComboBox.</param>
public ComboBoxParameterViewModel(ObservableCollection<string> possibleParameterList)
/// <param name="possibleParameters">Initial list of possible parameters for the ComboBox.</param>
public ComboBoxParameterViewModel(ObservableCollection<string> possibleParameters)
{
PossibleParameterList = possibleParameterList ?? throw new ArgumentNullException(nameof(possibleParameterList));
PossibleParameters = possibleParameters ?? throw new ArgumentNullException(nameof(possibleParameters));
}

/// <summary>
Expand All @@ -40,19 +40,19 @@ public string SelectedParameter
/// <summary>
/// Gets or sets the list of possible parameters that can be selected for a command.
/// </summary>
public ObservableCollection<string> PossibleParameterList
public ObservableCollection<string> PossibleParameters
{
get => _possibleParameterList;
get => _possibleParameters;
set {
if (value is null)
{
throw new ArgumentNullException(nameof(value));
}

if (_possibleParameterList != value)
if (_possibleParameters != value)
{
_possibleParameterList = value;
OnPropertyChanged(nameof(PossibleParameterList));
_possibleParameters = value;
OnPropertyChanged(nameof(PossibleParameters));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion ActiveDirectoryQuerier/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
HorizontalAlignment="Left"
VerticalAlignment="Center"
Margin="5"
ItemsSource="{Binding PossibleParameterList}"
ItemsSource="{Binding PossibleParameters}"
SelectedItem="{Binding SelectedParameter}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
Expand Down
2 changes: 1 addition & 1 deletion ActiveDirectoryQuerier/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ private async Task LoadCommandParametersAsync(Command? selectedCommand)
// Update the possible properties of the ComboBoxParameterViewModels.
foreach (ComboBoxParameterViewModel comboBoxParameterViewModel in DynamicParametersCollection)
{
comboBoxParameterViewModel.PossibleParameterList = PossibleCommandParametersList;
comboBoxParameterViewModel.PossibleParameters = PossibleCommandParametersList;
}
}

Expand Down
4 changes: 2 additions & 2 deletions ActiveDirectoryQuerier/RelayCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ namespace ActiveDirectoryQuerier;

/// <summary>
/// A command whose sole purpose is to relay its functionality to other objects by invoking delegates.
/// TODO: Remove any unused methods, after some investigation.
/// </summary>
/// <note>
/// I'm unsure if I'm dealing with the nullability warnings correctly, in this situation...
/// </note>
/// TODO: Remove any unused methods, after some investigation.
public class RelayCommand : ICommand
{
private readonly Action<object> _execute;
Expand All @@ -19,7 +19,6 @@ public class RelayCommand : ICommand
/// </summary>
/// <param name="execute">The execution logic.</param>
/// <param name="canExecute">The execution status logic.</param>
/// <exception cref="ArgumentNullException">If the execute argument is null.</exception>
public RelayCommand(Action<object> execute, Predicate<object?>? canExecute = null)
{
_execute = execute;
Expand All @@ -44,6 +43,7 @@ public bool CanExecute(object? parameter)
/// <param name="parameter">
/// Data used by the command. If the command does not require data to be passed, this object can be set to null.
/// </param>
/// TODO: Perform null checking before calling the _execute property.
public void Execute(object? parameter)
{
// For now, we are ignoring the warning about the parameter being null.
Expand Down

0 comments on commit 2777f52

Please sign in to comment.