Skip to content

Commit

Permalink
add more notification color settings & update pkgs
Browse files Browse the repository at this point in the history
  • Loading branch information
radj307 committed Oct 28, 2023
1 parent d032056 commit 0371755
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 41 deletions.
9 changes: 6 additions & 3 deletions VolumeControl.Core/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Semver;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Windows;
using System.Windows.Media;
using VolumeControl.Core.Input.Enums;
using VolumeControl.Core.Input.Json;
Expand Down Expand Up @@ -189,7 +188,11 @@ private void PropertyWithCollectionChangedEvents_CollectionChanged(object? sende
/// <summary>
/// Gets or sets the configuration for the DeviceListNotification window.
/// </summary>
public NotificationConfigSection DeviceListNotificationConfig { get; set; } = new();
public NotificationConfigSection DeviceListNotificationConfig { get; set; } = new()
{
LockedColor = Color.FromRgb(0x49, 0x80, 0x49),
UnlockedColor = Color.FromRgb(0xA7, 0x33, 0x74),
};
/// <summary>
/// Gets or sets whether the notification can be dragged without holding down the ALT key.
/// </summary>
Expand Down Expand Up @@ -335,7 +338,7 @@ private void PropertyWithCollectionChangedEvents_CollectionChanged(object? sende
/// <summary>
/// Gets or sets the list of (process names of) hidden audio sessions.
/// </summary>
public ObservableImmutableList<string> HiddenSessionProcessNames { get; set; } = new() { };
public ObservableImmutableList<string> HiddenSessionProcessNames { get; set; } = new();
#endregion Audio

#region Log
Expand Down
12 changes: 10 additions & 2 deletions VolumeControl.Core/NotificationConfigSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,21 @@ public class NotificationConfigSection : INotifyPropertyChanged
/// </summary>
public EListNotificationView ViewMode { get; set; } = EListNotificationView.Everything;
/// <summary>
/// Gets or sets the color used to indicate that selection is locked.
/// Gets or sets the background color.
/// </summary>
public Color BackgroundColor { get; set; } = Color.FromRgb(0x25, 0x25, 0x25);
/// <summary>
/// Gets or sets the accent color when selection is locked.
/// </summary>
public Color LockedColor { get; set; } = Color.FromRgb(0xA3, 0x28, 0x28);
/// <summary>
/// Gets or sets the color used to indicate that selection is unlocked.
/// Gets or sets the accent color when selection is unlocked.
/// </summary>
public Color UnlockedColor { get; set; } = Color.FromRgb(0x49, 0x6D, 0x49);
/// <summary>
/// Gets or sets the text color.
/// </summary>
public Color TextColor { get; set; } = Colors.WhiteSmoke;
#endregion Properties
}
}
2 changes: 1 addition & 1 deletion VolumeControl.Core/VolumeControl.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="radj307.AppConfig" Version="1.0.2" />
<PackageReference Include="radj307.AppReconfig" Version="2.1.2" />
<PackageReference Include="SharpDX.DirectInput" Version="4.2.0" />
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion VolumeControl.Log/VolumeControl.Log.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="radj307.AppConfig" Version="1.0.2" />
<PackageReference Include="radj307.AppReconfig" Version="2.1.2" />
</ItemGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
Expand Down
4 changes: 2 additions & 2 deletions VolumeControl.SDK/VolumeControl.SDK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.75" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.77" />
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="radj307.AppConfig" Version="1.0.2" />
<PackageReference Include="radj307.AppReconfig" Version="2.1.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VolumeControl.CoreAudio\VolumeControl.CoreAudio.csproj">
Expand Down
2 changes: 1 addition & 1 deletion VolumeControl.WPF/VolumeControl.WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.75" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.77" />
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
Expand Down
20 changes: 8 additions & 12 deletions VolumeControl/DeviceListNotification.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
Margin="3,0,0,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Foreground="{Binding DeviceListNotificationForegroundBrush, Source={StaticResource Settings}}"
Text="{Binding Volume, UpdateSourceTrigger=LostFocus}">
<i:Interaction.Behaviors>
<wpfBehaviors:EscapeRemovesFocusBehavior />
Expand Down Expand Up @@ -136,7 +137,7 @@
Margin="3,0,0,0"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Foreground="{StaticResource TextBoxForeground}"
Foreground="{Binding DeviceListNotificationForegroundBrush, Source={StaticResource Settings}}"
Text="{Binding Name}" />
</Grid>
</DataTemplate>
Expand Down Expand Up @@ -168,17 +169,12 @@
</Style>
</Window.Style>

<Border BorderThickness="10">
<Border.Style>
<Style TargetType="{x:Type Border}">
<Style.Triggers>
<DataTrigger Binding="{Binding AudioAPI.AudioDeviceSelector.Selected, Source={StaticResource Settings}, Converter={StaticResource IsNullConverter}}" Value="True">
<Setter Property="BorderBrush" Value="{Binding AudioAPI.AudioDeviceSelector.LockSelection, Source={StaticResource Settings}, Converter={StaticResource SelectedItemBackgroundBrushConverter}}" />
</DataTrigger>
</Style.Triggers>
<Setter Property="BorderBrush" Value="{StaticResource WindowBorderBrush}" />
</Style>
</Border.Style>
<Border
Padding="9"
Background="{Binding DeviceListNotificationBackgroundBrush, Source={StaticResource Settings}}"
BorderBrush="{Binding AudioAPI.AudioDeviceSelector.LockSelection, Source={StaticResource Settings}, Converter={StaticResource SelectedItemBackgroundBrushConverter}}"
BorderThickness="7"
CornerRadius="19">
<Grid DataContext="{StaticResource Settings}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
Expand Down
23 changes: 6 additions & 17 deletions VolumeControl/SessionListNotification.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
Margin="3,0,0,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Foreground="{Binding DeviceListNotificationForegroundBrush, Source={StaticResource Settings}}"
Text="{Binding Volume, UpdateSourceTrigger=LostFocus}">
<i:Interaction.Behaviors>
<wpfBehaviors:EscapeRemovesFocusBehavior FocusOnParentWindow="False" />
Expand Down Expand Up @@ -141,7 +142,7 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
FontSize="13"
Foreground="{StaticResource TextBoxForeground}"
Foreground="{Binding DeviceListNotificationForegroundBrush, Source={StaticResource Settings}}"
Text="{Binding Name}" />
</Grid>
</DataTemplate>
Expand All @@ -168,8 +169,9 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
FontSize="13"
Foreground="{StaticResource TextBoxForeground}"
Foreground="{Binding DeviceListNotificationForegroundBrush, Source={StaticResource Settings}}"
Text="{Binding Name}" />
<!-- Always Bold TextBlock (Keeps correct width) -->
<TextBlock
Grid.Column="1"
Margin="{Binding Margin}"
Expand Down Expand Up @@ -205,23 +207,10 @@

<Border
Padding="9"
Background="{StaticResource NotificationBackgroundBrush}"
Background="{Binding SessionListNotificationBackgroundBrush, Source={StaticResource Settings}}"
BorderBrush="{Binding AudioAPI.AudioSessionMultiSelector.LockSelection, Source={StaticResource Settings}, Converter={StaticResource SelectedItemBackgroundBrushConverter}}"
BorderThickness="7"
CornerRadius="19">
<Border.Style>
<Style TargetType="{x:Type Border}">
<Setter Property="BorderBrush" Value="{Binding AudioAPI.AudioSessionMultiSelector.LockSelection, Source={StaticResource Settings}, Converter={StaticResource SelectedItemBackgroundBrushConverter}}" />
<!--<Style.Triggers>
<DataTrigger Binding="{Binding AudioAPI.AudioSessionMultiSelector.CurrentSession, Source={StaticResource Settings}, Converter={StaticResource IsNullConverter}}" Value="True">
<Setter Property="BorderBrush" Value="{Binding AudioAPI.AudioSessionMultiSelector.LockSelection, Source={StaticResource Settings}, Converter={StaticResource SelectedItemBackgroundBrushConverter}}" />
</DataTrigger>
<DataTrigger Binding="{Binding SessionListNotificationFlagsVM.ShowFullList, Source={StaticResource Settings}}" Value="False">
<Setter Property="BorderBrush" Value="{Binding AudioAPI.AudioSessionMultiSelector.LockSelection, Source={StaticResource Settings}, Converter={StaticResource SelectedItemBackgroundBrushConverter}}" />
</DataTrigger>
</Style.Triggers>
<Setter Property="BorderBrush" Value="{StaticResource SelectionBorderBrush}" />-->
</Style>
</Border.Style>
<Grid DataContext="{StaticResource Settings}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
Expand Down
11 changes: 10 additions & 1 deletion VolumeControl/ViewModels/VolumeControlVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,16 @@ public VolumeControlVM() : base()
SessionListNotificationFlagsVM = new(Settings.SessionListNotificationConfig);
DeviceListNotificationFlagsVM = new(Settings.DeviceListNotificationConfig);

// setup notification brushes
// session notification brushes
SessionListNotificationBackgroundBrush = new SolidColorBrush(Settings.SessionListNotificationConfig.BackgroundColor);
SessionListNotificationLockedBrush = new SolidColorBrush(Settings.SessionListNotificationConfig.LockedColor);
SessionListNotificationUnlockedBrush = new SolidColorBrush(Settings.SessionListNotificationConfig.UnlockedColor);
SessionListNotificationForegroundBrush = new SolidColorBrush(Settings.SessionListNotificationConfig.TextColor);
// device notification brushes
DeviceListNotificationBackgroundBrush = new SolidColorBrush(Settings.DeviceListNotificationConfig.BackgroundColor);
DeviceListNotificationLockedBrush = new SolidColorBrush(Settings.DeviceListNotificationConfig.LockedColor);
DeviceListNotificationUnlockedBrush = new SolidColorBrush(Settings.DeviceListNotificationConfig.UnlockedColor);
DeviceListNotificationForegroundBrush = new SolidColorBrush(Settings.DeviceListNotificationConfig.TextColor);
}
#endregion Constructor

Expand Down Expand Up @@ -167,10 +172,14 @@ public string TargetSessionText
public ListNotificationViewFlagsVM SessionListNotificationFlagsVM { get; }
public ListNotificationViewFlagsVM DeviceListNotificationFlagsVM { get; }

public Brush SessionListNotificationBackgroundBrush { get; }
public Brush SessionListNotificationLockedBrush { get; }
public Brush SessionListNotificationUnlockedBrush { get; }
public Brush SessionListNotificationForegroundBrush { get; }
public Brush DeviceListNotificationBackgroundBrush { get; }
public Brush DeviceListNotificationLockedBrush { get; }
public Brush DeviceListNotificationUnlockedBrush { get; }
public Brush DeviceListNotificationForegroundBrush { get; }
#endregion Properties

#region Methods
Expand Down
2 changes: 1 addition & 1 deletion VolumeControl/VolumeControl.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.75" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.77" />
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
Expand Down

0 comments on commit 0371755

Please sign in to comment.