Skip to content

Commit

Permalink
Add collapsible list to the Settings.cs
Browse files Browse the repository at this point in the history
See #444
Fixes #445
  • Loading branch information
Belphemur committed May 16, 2020
1 parent c733f09 commit 0f540ef
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
14 changes: 13 additions & 1 deletion SoundSwitch.UI.UserControls/ListView/ListViewExtended.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,23 @@ private static void setGrpFooter(ListViewGroup lstvwgrp, string footer)
}
}

public void SetGroupState(ListViewGroupState state)
public void SetGroupsState(ListViewGroupState state)
{
foreach (ListViewGroup lvg in Groups)
SetGrpState(lvg, state);
}

public void SetGroupState(string name, ListViewGroupState state)
{
var group = Groups[name];
if (group == null)
{
throw new ArgumentOutOfRangeException($"Unknown group {name}");
}

SetGrpState(group, state);
}

public void SetGroupFooter(ListViewGroup lvg, string footerText)
{
setGrpFooter(lvg, footerText);
Expand Down Expand Up @@ -345,6 +356,7 @@ public enum ListViewGroupMask
SubsetItems = 0x10000
}

[Flags]
public enum ListViewGroupState
{
/// <summary>
Expand Down
7 changes: 5 additions & 2 deletions SoundSwitch/UI/Forms/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,11 @@ public async Task AsyncInit()
_audioDeviceLister = new CachedAudioDeviceLister(DeviceState.All);
await _audioDeviceLister.Refresh();
PopulateAudioDevices();
playbackListView.SetGroupState(ListViewGroupState.Collapsible);
recordingListView.SetGroupState(ListViewGroupState.Collapsible);
playbackListView.SetGroupsState(ListViewGroupState.Collapsible);
recordingListView.SetGroupsState(ListViewGroupState.Collapsible);

playbackListView.SetGroupState(DeviceState.NotPresent.ToString(), ListViewGroupState.Collapsible | ListViewGroupState.Collapsed);
recordingListView.SetGroupState(DeviceState.NotPresent.ToString(), ListViewGroupState.Collapsible | ListViewGroupState.Collapsed);
// Profiles
PopulateProfiles();

Expand Down

0 comments on commit 0f540ef

Please sign in to comment.