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

Commit

Permalink
Cleaned up the drop down to make it look a little bit better
Browse files Browse the repository at this point in the history
  • Loading branch information
J0seph0 committed Mar 10, 2024
1 parent 0f892af commit 4761ad0
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 16 deletions.
61 changes: 45 additions & 16 deletions ActiveDirectoryQuerier/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:activeDirectoryQuerier="clr-namespace:ActiveDirectoryQuerier"
xmlns:activeDirectoryQuerier="clr-namespace:ActiveDirectoryQuerier"
mc:Ignorable="d"
Title="Active Directory Querier" Height="720" Width="1280">
<Window.DataContext>
Expand Down Expand Up @@ -145,54 +145,83 @@
<!-- END of Dynamic ComboxBoxes for parameters and values-->

<!-- START of Button ComboBox -->
<ComboBox Margin="0,4,0,6" Height="Auto" Grid.Row="2" Grid.Column="0" HorizontalAlignment="Center" MinWidth="160" Width="Auto">
<ComboBox SelectedItem="{Binding OptionsSelectedComboBoxItem}" Margin="0,4,0,6" Height="Auto" Grid.Row="2" Grid.Column="0" HorizontalAlignment="Center" MinWidth="160" Width="Auto" >
<ComboBoxItem>
<Button Content="Add New Command Slot" Command="{Binding AddCommandComboBoxRelay}" />
<Button Content="Add New Command Slot"
Command="{Binding AddCommandComboBoxRelay}"
Background="Transparent"
BorderBrush="Transparent"
IsHitTestVisible="False"/>
</ComboBoxItem>
<ComboBoxItem>
<Button Content="Add New Parameter Slot" Command="{Binding AddParameterComboBoxRelay}" />
<Button Content="Add New Parameter Slot" Command="{Binding AddParameterComboBoxRelay}"
Background="Transparent"
BorderBrush="Transparent"
IsHitTestVisible="False"/>
</ComboBoxItem>
<ComboBoxItem>
<Button Content="Remove Parameter Slot" Command="{Binding RemoveParameterComboBoxRelay}" />
<Button Content="Remove Parameter Slot" Command="{Binding RemoveParameterComboBoxRelay}"
Background="Transparent"
BorderBrush="Transparent"
IsHitTestVisible="False"/>
</ComboBoxItem>
<ComboBoxItem>
<Button Content="Save Query" Command="{Binding SaveCustomQueriesRelay}" />
<Button Content="Save Query" Command="{Binding SaveCustomQueriesRelay}"
Background="Transparent"
BorderBrush="Transparent"
IsHitTestVisible="False"/>
</ComboBoxItem>
<ComboBoxItem>
<Button Content="Execute" Command="{Binding ExecuteCommandRelay}" />
<Button Content="Execute" Command="{Binding ExecuteCommandRelay}"
Background="Transparent"
BorderBrush="Transparent"
IsHitTestVisible="False"/>
</ComboBoxItem>
<ComboBoxItem>
<Button Content="Execute to CSV" Command="{Binding OutputToCsvFileRelay}" />
<Button Content="Execute to CSV" Command="{Binding OutputToCsvFileRelay}"
Background="Transparent"
BorderBrush="Transparent"
IsHitTestVisible="False" />
</ComboBoxItem>
<ComboBoxItem>
<Button Content="Execute to Text" Command="{Binding OutputToTextFileRelay}" />
<Button Content="Execute to Text" Command="{Binding OutputToTextFileRelay}"
Background="Transparent"
BorderBrush="Transparent"
IsHitTestVisible="False"/>
</ComboBoxItem>
<ComboBoxItem>
<Button Content="Export Console Output" Command="{Binding ExportConsoleOutputRelay}" />
<Button Content="Export Console Output" Command="{Binding ExportConsoleOutputRelay}"
Background="Transparent"
BorderBrush="Transparent"
IsHitTestVisible="False"/>
</ComboBoxItem>
<ComboBoxItem>
<Button Content="Clear Console Output" Command="{Binding ClearConsoleOutputRelay}" />
<Button Content="Clear Console Output" Command="{Binding ClearConsoleOutputRelay}"
Background="Transparent"
BorderBrush="Transparent"
IsHitTestVisible="False"/>
</ComboBoxItem>
<ComboBoxItem>
<Button Content="Clear Query" Command="{Binding ClearQueryBuilderRelay}" />
<Button Content="Clear Query" Command="{Binding ClearQueryBuilderRelay}"
Background="Transparent"
BorderBrush="Transparent"
IsHitTestVisible="False"/>
</ComboBoxItem>
</ComboBox>
<!-- END of Button ComboBox-->

<CheckBox Grid.Row="2" Grid.Column="0" Content="Editing" HorizontalAlignment="Left" Margin="10,6,0,0"
<CheckBox Grid.Row="2" Grid.Column="0" Content="Editing" HorizontalAlignment="Left" Margin="10,6,10,0"
VerticalAlignment="Top" IsChecked="{Binding EditingEnabled}" Height="15" Width="57" />
</Grid>
<!-- ROW 0 END -->

<!-- TODO: Figure out why I can't get the console to be resizable to the min height! -->
<!-- TODO: Pieter refer here for the console output... try replicate for tab three -->
<!-- GRID ROW 1 START -->
<Grid Grid.Row="1">
<!-- TextBox as Console Output -->
<TextBox Text="{Binding PowerShellOutput.ConsoleOutput}" HorizontalAlignment="Stretch"
<TextBox Grid.Row="1" Text="{Binding PowerShellOutput.ConsoleOutput}" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" Margin="10" IsReadOnly="True" TextWrapping="Wrap"
VerticalScrollBarVisibility="Auto" />
</Grid>
<!-- GRID ROW 1 END -->
</Grid>
</TabItem>
Expand Down
24 changes: 24 additions & 0 deletions ActiveDirectoryQuerier/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Diagnostics;
using System.IO;
using System.Management.Automation.Runspaces;
using System.Reflection;
using System.Text;
using System.Windows;
using System.Windows.Controls;
Expand Down Expand Up @@ -32,6 +33,7 @@ public sealed class MainWindowViewModel : INotifyPropertyChanged
private AppConsole _activeDirectoryInfoOutput; // Pieter TODO
private Command? _selectedComboBoxCommand;
private ObservableCollection<Button>? _buttons;
private object _optionsSelectedComboBoxItem;

// [[ Other fields ]] ----------------------------------------------------------- //

Expand Down Expand Up @@ -126,6 +128,27 @@ public Command? SelectedComboBoxCommand
}
}

/// <summary>
///
/// </summary>
public object OptionsSelectedComboBoxItem
{
get { return _optionsSelectedComboBoxItem; }
set
{
_optionsSelectedComboBoxItem = value;
OnPropertyChanged("SelectedItem");

ComboBoxItem? tempCBI = value as ComboBoxItem;

if (tempCBI != null)
{
Button? tempButton = tempCBI.Content as Button;
tempButton.Command.Execute(this);
}
}
}

/// <summary>
/// This property creates a collection of buttons to be added to the stack panel for custom queries
/// </summary>
Expand Down Expand Up @@ -262,6 +285,7 @@ public MainWindowViewModel()
ClearConsoleOutputRelay = new RelayCommand(ClearConsoleOutput);
ClearQueryBuilderRelay = new RelayCommand(ClearQueryBuilder);


// TODO: Figure out how resolve the warning about the async method not being awaited.
InitializeActiveDirectoryCommandsAsync();
LoadCustomQueries(); // Calls method to deserialize and load buttons.
Expand Down

0 comments on commit 4761ad0

Please sign in to comment.