Skip to content

Commit

Permalink
imp - Improved selection window apparance
Browse files Browse the repository at this point in the history
We've improved the selection window.

---

We've improved the appearance of the selection window.

---

Type: imp
Breaking: False
Doc Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Aug 29, 2023
1 parent f2cf863 commit 303c9c6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
8 changes: 6 additions & 2 deletions BassBoom/Views/MainView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ public void SelectDriver()
{
var drivers = DeviceTools.GetDrivers();
var driverArray = drivers.Keys.ToArray();
var selection = new SelectionWindow(new ObservableCollection<string>(driverArray));
var selection = new SelectionWindow();
selection.selection.ItemsSource = driverArray;
selection.SelectInfo.Text = $"Select a driver. {driverArray.Length} drivers found in your system.";
selection.Closed += (s, e) =>
{
string answer = selection.SelectionInput;
Expand Down Expand Up @@ -268,7 +270,9 @@ public void SelectDevice()
string activeDevice = selectedDevice;
var devices = DeviceTools.GetDevices(selectedDriver, ref activeDevice);
var deviceArray = devices.Keys.ToArray();
var selection = new SelectionWindow(new ObservableCollection<string>(deviceArray));
var selection = new SelectionWindow();
selection.selection.ItemsSource = deviceArray;
selection.SelectInfo.Text = $"Select a device for the {selectedDriver} driver. {deviceArray.Length} devices found.";
selection.Closed += (s, e) =>
{
string answer = selection.SelectionInput;
Expand Down
9 changes: 6 additions & 3 deletions BassBoom/Views/SelectionWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@
x:Class="BassBoom.Views.SelectionWindow"
Title="Select...">
<StackPanel>
<Grid RowDefinitions="Auto" ColumnDefinitions="Auto, Auto" Margin="15">
<Label Grid.Row="0" Grid.Column="0">Select:</Label>
<ComboBox Name="selection" Grid.Row="0" Grid.Column="1" x:CompileBindings="False" ItemsSource="{Binding Selections}"></ComboBox>
<Grid RowDefinitions="Auto, Auto" ColumnDefinitions="Auto, Auto" Margin="15">
<TextBlock Name="SelectInfo" Grid.Row="0" Grid.Column="0">Please select an item from the drop-down box below.</TextBlock>
</Grid>
<Grid RowDefinitions="Auto, Auto" ColumnDefinitions="Auto, Auto" Margin="15">
<Label Grid.Row="1" Grid.Column="0">Select an item:</Label>
<ComboBox Name="selection" Grid.Row="1" Grid.Column="1" x:CompileBindings="False"></ComboBox>
</Grid>
<Grid RowDefinitions="Auto" ColumnDefinitions="Auto" Margin="15" HorizontalAlignment="Right">
<Button Grid.Row="2" Grid.Column="0" Name="Acknowledge" x:CompileBindings="False" Command="{Binding Acknowledge}">OK</Button>
Expand Down
9 changes: 2 additions & 7 deletions BassBoom/Views/SelectionWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,10 @@ public partial class SelectionWindow : Window
{
public string SelectionInput { get; set; }

public SelectionWindow(ObservableCollection<string> selections)
public SelectionWindow()
{
InitializeComponent();
DataContext = new SelectionData(this)
{
Selections = selections
};
DataContext = new SelectionData(this);
ShowInTaskbar = false;
CanResize = false;
}
Expand All @@ -41,8 +38,6 @@ public class SelectionData
{
private readonly Window view;

public ObservableCollection<string> Selections { get; set; } = new();

public void Acknowledge()
{
var thisView = (SelectionWindow)view;
Expand Down

0 comments on commit 303c9c6

Please sign in to comment.