HeadMeld 0.0.0.1
- Initial submit, functionality is incomplete
@@ -0,0 +1,3 @@
|
||||
obj
|
||||
bin
|
||||
.vs
|
||||
@@ -0,0 +1,17 @@
|
||||
<Application x:Class="HeadMeld.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="http://schemas.modernwpf.com/2019"
|
||||
xmlns:local="clr-namespace:HeadMeld"
|
||||
StartupUri="Startup.xaml">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ui:ThemeResources />
|
||||
<ui:XamlControlsResources />
|
||||
<!-- Other merged dictionaries here -->
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<!-- Other app resources here -->
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace HeadMeld
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System.Windows;
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
@@ -0,0 +1,47 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace HeadMeld
|
||||
{
|
||||
internal class ConfigManager
|
||||
{
|
||||
private readonly string configPath = @"C:\Program Files\EqualizerAPO\config\config.txt";
|
||||
internal List<string> configFile = new();
|
||||
public ConfigManager()
|
||||
{
|
||||
configFile = File.ReadAllLines(configPath).ToList();
|
||||
/*
|
||||
ToggleProfiles(new List<string>
|
||||
{
|
||||
"# Include: ATH-M50x.txt",
|
||||
"Include: 900ProX.txt"
|
||||
}, false);
|
||||
Write();
|
||||
*/
|
||||
}
|
||||
|
||||
public void Write()
|
||||
{
|
||||
File.WriteAllLines(configPath, configFile);
|
||||
}
|
||||
|
||||
public void ToggleProfiles(List<string> profiles, bool enableProfile)
|
||||
{
|
||||
foreach (var profile in profiles)
|
||||
{
|
||||
string rawProfile = profile.Replace("# ", string.Empty);
|
||||
var filter = configFile.FindIndex(x => x.Contains(rawProfile));
|
||||
|
||||
if (enableProfile)
|
||||
{
|
||||
configFile[filter] = rawProfile.Replace("# ", string.Empty);
|
||||
}
|
||||
else
|
||||
{
|
||||
configFile[filter] = rawProfile.Insert(0, "# ");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net5.0-windows10.0.18362.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWPF>true</UseWPF>
|
||||
<AssemblyVersion>0.0.0.1</AssemblyVersion>
|
||||
<FileVersion>0.0.0.1</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Hardcodet.NotifyIcon.Wpf" Version="1.1.0" />
|
||||
<PackageReference Include="ModernWpfUI" Version="0.9.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Resources.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Resources\headphones_dark.ico">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\headphones_light.ico">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\loudspeakers_dark.ico">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\loudspeakers_light.ico">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Update="App.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="MainWindow.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Update="MainWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Startup.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.1.32319.34
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeadMeld", "HeadMeld.csproj", "{59252E1F-C598-4A62-8E03-26ED4D1468EF}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{59252E1F-C598-4A62-8E03-26ED4D1468EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{59252E1F-C598-4A62-8E03-26ED4D1468EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{59252E1F-C598-4A62-8E03-26ED4D1468EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{59252E1F-C598-4A62-8E03-26ED4D1468EF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {9D75AEA6-B515-4F8F-B62E-5814099D0232}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,22 @@
|
||||
<Window x:Class="HeadMeld.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
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:ui="http://schemas.modernwpf.com/2019"
|
||||
ui:WindowHelper.UseModernWindowStyle="True"
|
||||
mc:Ignorable="d" Height="450" Width="300"
|
||||
Loaded="Window_Loaded" ResizeMode="NoResize" ShowInTaskbar="False" Activated="Window_Activated" Closing="Window_Closing">
|
||||
<Grid>
|
||||
<ui:SimpleStackPanel Margin="12" Spacing="24" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.CanContentScroll="True">
|
||||
<TextBlock Text="🎧HeadMeld" Style="{StaticResource HeaderTextBlockStyle}" />
|
||||
|
||||
<ui:NavigationViewItemHeader Content="Equalizer APO Status"/>
|
||||
<ui:ToggleSwitch Margin="15,-15,0,0" x:Name="toggleAPOEnabled" HorizontalAlignment="Stretch" OffContent="Disabled" OnContent="Enabled" Toggled="toggleAPOEnabled_Toggled"/>
|
||||
|
||||
<ui:NavigationViewItemHeader Content="Selected Profile"/>
|
||||
<ui:RadioButtons x:Name="btnRadioProfiles" Margin="15,-15,0,0" d:ItemsSource="{d:SampleData ItemCount=2}" SelectedIndex="0" HorizontalAlignment="Stretch" />
|
||||
<Button x:Name="btnExit" Content="Exit" HorizontalAlignment="Stretch" Click="btnExit_Click" />
|
||||
</ui:SimpleStackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,55 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
|
||||
namespace HeadMeld
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
ConfigManager configManager = new();
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
foreach (var item in configManager.configFile)
|
||||
{
|
||||
btnRadioProfiles.Items.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnExit_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
|
||||
private void Window_Activated(object sender, System.EventArgs e)
|
||||
{
|
||||
// Set window position based on taskbar location
|
||||
var desktopWorkArea = SystemParameters.WorkArea;
|
||||
Left = desktopWorkArea.Right - Width - 15;
|
||||
Top = desktopWorkArea.Bottom - Height - 15;
|
||||
}
|
||||
|
||||
private void toggleAPOEnabled_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
configManager.ToggleProfiles(new List<string>
|
||||
{
|
||||
"# Include: ATH-M50x.txt",
|
||||
"Include: 900ProX.txt"
|
||||
},
|
||||
toggleAPOEnabled.IsOn);
|
||||
configManager.Write();
|
||||
}
|
||||
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
Visibility = Visibility.Collapsed;
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace HeadMeld {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
public class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
public static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HeadMeld.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
public static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
public static byte[] Dark_Headphones {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Dark_Headphones", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
public static byte[] Dark_Loudspeaker {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Dark_Loudspeaker", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
public static byte[] Light_Headphones {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Light_Headphones", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
public static byte[] Light_Loudspeaker {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Light_Loudspeaker", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="Dark_Headphones" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>Resources\headphones_dark.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="Dark_Loudspeaker" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>Resources\loudspeakers_dark.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="Light_Headphones" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>Resources\headphones_light.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="Light_Loudspeaker" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>Resources\loudspeakers_light.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
||||
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
@@ -0,0 +1,8 @@
|
||||
<Window x:Class="HeadMeld.Startup"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
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"
|
||||
mc:Ignorable="d"
|
||||
Visibility ="Hidden" Closed="Window_Closed">
|
||||
</Window>
|
||||
@@ -0,0 +1,54 @@
|
||||
using ModernWpf;
|
||||
using System.Windows;
|
||||
|
||||
namespace HeadMeld
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class Startup : Window
|
||||
{
|
||||
MainWindow mainWindow = new();
|
||||
TrayManager trayManager = new();
|
||||
public Startup()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
CreateTray();
|
||||
}
|
||||
|
||||
private void CreateTray()
|
||||
{
|
||||
if (ThemeManager.GetActualTheme(this).ToString() == "Dark")
|
||||
{
|
||||
trayManager.UseDarkMode = true;
|
||||
}
|
||||
else if (ThemeManager.GetActualTheme(this).ToString() == "Light")
|
||||
{
|
||||
trayManager.UseDarkMode = false;
|
||||
}
|
||||
trayManager.UpdateTrayIcon();
|
||||
trayManager.Create();
|
||||
|
||||
trayManager.ToggleWindowState += TrayManager_ToggleWindowState;
|
||||
}
|
||||
|
||||
private void TrayManager_ToggleWindowState(object? sender, System.EventArgs e)
|
||||
{
|
||||
if (mainWindow.Visibility == Visibility.Collapsed)
|
||||
{
|
||||
mainWindow.Visibility = Visibility.Visible;
|
||||
mainWindow.Activate();
|
||||
}
|
||||
else
|
||||
{
|
||||
mainWindow.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_Closed(object sender, System.EventArgs e)
|
||||
{
|
||||
trayManager.Destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HeadMeld
|
||||
{
|
||||
internal class TrayManager
|
||||
{
|
||||
NotifyIcon notifyIcon = new();
|
||||
|
||||
public bool UseHeadphoneMode { get; set; } = true;
|
||||
public bool UseDarkMode { get; set; }
|
||||
|
||||
public TrayManager() => notifyIcon.Click += NotifyIcon_Click;
|
||||
|
||||
public void Create()
|
||||
{
|
||||
notifyIcon.Visible = true;
|
||||
}
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
notifyIcon.Visible = false;
|
||||
notifyIcon.Dispose();
|
||||
}
|
||||
|
||||
public void UpdateTrayIcon()
|
||||
{
|
||||
if (UseHeadphoneMode == true)
|
||||
{
|
||||
if (UseDarkMode == true)
|
||||
notifyIcon.Icon = new System.Drawing.Icon("Resources/headphones_light.ico");
|
||||
else
|
||||
notifyIcon.Icon = new System.Drawing.Icon("Resources/headphones_dark.ico");
|
||||
}
|
||||
else if (UseHeadphoneMode == false)
|
||||
{
|
||||
if (UseDarkMode == true)
|
||||
notifyIcon.Icon = new System.Drawing.Icon("Resources/loudspeakers_light.ico");
|
||||
else
|
||||
notifyIcon.Icon = new System.Drawing.Icon("Resources/loudspeakers_dark.ico");
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler ToggleWindowState;
|
||||
private void NotifyIcon_Click(object? sender, EventArgs e)
|
||||
{
|
||||
ToggleWindowState?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||