Implemented toggle and inverted settings for muted actions
This commit is contained in:
parent
0183d50c46
commit
de27a6ccee
@ -5,12 +5,15 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:getMuted="clr-namespace:MassiveKnob.Plugin.CoreAudio.GetMuted"
|
xmlns:getMuted="clr-namespace:MassiveKnob.Plugin.CoreAudio.GetMuted"
|
||||||
xmlns:base="clr-namespace:MassiveKnob.Plugin.CoreAudio.Base"
|
xmlns:base="clr-namespace:MassiveKnob.Plugin.CoreAudio.Base"
|
||||||
|
xmlns:coreAudio="clr-namespace:MassiveKnob.Plugin.CoreAudio"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="200" d:DesignWidth="800"
|
d:DesignHeight="200" d:DesignWidth="800"
|
||||||
d:DataContext="{d:DesignInstance getMuted:DeviceGetMutedActionSettingsViewModel}">
|
d:DataContext="{d:DesignInstance getMuted:DeviceGetMutedActionSettingsViewModel}">
|
||||||
<StackPanel Orientation="Vertical">
|
<StackPanel Orientation="Vertical">
|
||||||
<base:BaseDeviceSettingsView />
|
<base:BaseDeviceSettingsView />
|
||||||
|
|
||||||
<!-- TODO Inverted -->
|
<CheckBox Margin="0,8,0,0" IsChecked="{Binding Inverted}">
|
||||||
|
<TextBlock Text="{x:Static coreAudio:Strings.SettingGetMutedInverted}" />
|
||||||
|
</CheckBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System.Threading;
|
using System;
|
||||||
|
using System.Threading;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using AudioSwitcher.AudioApi;
|
using AudioSwitcher.AudioApi;
|
||||||
|
|
||||||
@ -20,6 +21,7 @@ namespace MassiveKnob.Plugin.CoreAudio.OSD
|
|||||||
{
|
{
|
||||||
windowViewModel = new OSDWindowViewModel();
|
windowViewModel = new OSDWindowViewModel();
|
||||||
window = new OSDWindow(windowViewModel);
|
window = new OSDWindow(windowViewModel);
|
||||||
|
window.Closed += WindowOnClosed;
|
||||||
|
|
||||||
hideTimer = new Timer(state =>
|
hideTimer = new Timer(state =>
|
||||||
{
|
{
|
||||||
@ -34,9 +36,17 @@ namespace MassiveKnob.Plugin.CoreAudio.OSD
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static void WindowOnClosed(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
hideTimer?.Dispose();
|
||||||
|
hideTimer = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void Hide()
|
private static void Hide()
|
||||||
{
|
{
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
Application.Current?.Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
window?.Close();
|
window?.Close();
|
||||||
window = null;
|
window = null;
|
||||||
|
@ -5,13 +5,23 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:setMuted="clr-namespace:MassiveKnob.Plugin.CoreAudio.SetMuted"
|
xmlns:setMuted="clr-namespace:MassiveKnob.Plugin.CoreAudio.SetMuted"
|
||||||
xmlns:base="clr-namespace:MassiveKnob.Plugin.CoreAudio.Base"
|
xmlns:base="clr-namespace:MassiveKnob.Plugin.CoreAudio.Base"
|
||||||
|
xmlns:coreAudio="clr-namespace:MassiveKnob.Plugin.CoreAudio"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="200" d:DesignWidth="800"
|
d:DesignHeight="200" d:DesignWidth="800"
|
||||||
d:DataContext="{d:DesignInstance setMuted:DeviceSetMutedActionSettingsViewModel}">
|
d:DataContext="{d:DesignInstance setMuted:DeviceSetMutedActionSettingsViewModel}">
|
||||||
<StackPanel Orientation="Vertical">
|
<StackPanel Orientation="Vertical">
|
||||||
<base:BaseDeviceSettingsView />
|
<base:BaseDeviceSettingsView />
|
||||||
|
|
||||||
<!-- TODO Toggle -->
|
<RadioButton Margin="0,8,0,0" IsChecked="{Binding ToggleTrue}">
|
||||||
<!-- TODO SetInverted -->
|
<TextBlock Text="{x:Static coreAudio:Strings.SettingSetMutedToggleTrue}" />
|
||||||
|
</RadioButton>
|
||||||
|
|
||||||
|
<RadioButton Margin="0,8,0,0" IsChecked="{Binding ToggleFalse}">
|
||||||
|
<TextBlock Text="{x:Static coreAudio:Strings.SettingSetMutedToggleFalse}" />
|
||||||
|
</RadioButton>
|
||||||
|
|
||||||
|
<CheckBox Margin="24,8,0,0" IsChecked="{Binding SetInverted}">
|
||||||
|
<TextBlock Text="{x:Static coreAudio:Strings.SettingSetMutedSetInverted}" />
|
||||||
|
</CheckBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
@ -5,15 +5,35 @@ namespace MassiveKnob.Plugin.CoreAudio.SetMuted
|
|||||||
public class DeviceSetMutedActionSettingsViewModel : BaseDeviceSettingsViewModel<DeviceSetMutedActionSettings>
|
public class DeviceSetMutedActionSettingsViewModel : BaseDeviceSettingsViewModel<DeviceSetMutedActionSettings>
|
||||||
{
|
{
|
||||||
// ReSharper disable UnusedMember.Global - used by WPF Binding
|
// ReSharper disable UnusedMember.Global - used by WPF Binding
|
||||||
public bool Toggle
|
public bool ToggleTrue
|
||||||
{
|
{
|
||||||
get => Settings.Toggle;
|
get => Settings.Toggle;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == Settings.Toggle)
|
if (!value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Settings.Toggle = value;
|
if (Settings.Toggle)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Settings.Toggle = true;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public bool ToggleFalse
|
||||||
|
{
|
||||||
|
get => !Settings.Toggle;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (!value)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!Settings.Toggle)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Settings.Toggle = false;
|
||||||
OnPropertyChanged();
|
OnPropertyChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ namespace MassiveKnob.Plugin.CoreAudio {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Inverted (muted is off).
|
/// Looks up a localized string similar to Inverted (off when muted).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string SettingGetMutedInverted {
|
public static string SettingGetMutedInverted {
|
||||||
get {
|
get {
|
||||||
@ -205,7 +205,7 @@ namespace MassiveKnob.Plugin.CoreAudio {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Inverted (off is muted).
|
/// Looks up a localized string similar to Inverted (muted when off).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string SettingSetMutedSetInverted {
|
public static string SettingSetMutedSetInverted {
|
||||||
get {
|
get {
|
||||||
|
@ -157,7 +157,7 @@
|
|||||||
<value>Mute / unmute</value>
|
<value>Mute / unmute</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="SettingGetMutedInverted" xml:space="preserve">
|
<data name="SettingGetMutedInverted" xml:space="preserve">
|
||||||
<value>Inverted (muted is off)</value>
|
<value>Inverted (off when muted)</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="SettingOSD" xml:space="preserve">
|
<data name="SettingOSD" xml:space="preserve">
|
||||||
<value>Show On-Screen Display</value>
|
<value>Show On-Screen Display</value>
|
||||||
@ -166,7 +166,7 @@
|
|||||||
<value>Playback device</value>
|
<value>Playback device</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="SettingSetMutedSetInverted" xml:space="preserve">
|
<data name="SettingSetMutedSetInverted" xml:space="preserve">
|
||||||
<value>Inverted (off is muted)</value>
|
<value>Inverted (muted when off)</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="SettingSetMutedToggleFalse" xml:space="preserve">
|
<data name="SettingSetMutedToggleFalse" xml:space="preserve">
|
||||||
<value>Set mute depending on value (eg. switch)</value>
|
<value>Set mute depending on value (eg. switch)</value>
|
||||||
|
Loading…
Reference in New Issue
Block a user