Resources file management, french translation and a bit of design

This commit is contained in:
Théo Marchal 2021-09-02 19:47:55 +02:00
parent c568a957f7
commit be8cef35d3
17 changed files with 982 additions and 83 deletions

View File

@ -8,6 +8,7 @@
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Views/Systray.xaml" /> <ResourceDictionary Source="Views/Systray.xaml" />
<ResourceDictionary Source="Resources/Resources.xaml" />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
<Style x:Key="RepeatButtonTransparent" TargetType="{x:Type RepeatButton}"> <Style x:Key="RepeatButtonTransparent" TargetType="{x:Type RepeatButton}">

View File

@ -1,4 +1,5 @@
using System.Windows; using System.Globalization;
using System.Windows;
using Hardcodet.Wpf.TaskbarNotification; using Hardcodet.Wpf.TaskbarNotification;
namespace unison namespace unison
@ -12,6 +13,9 @@ namespace unison
protected override void OnStartup(StartupEventArgs e) protected override void OnStartup(StartupEventArgs e)
{ {
//debug language
//unison.Resources.Resources.Culture = CultureInfo.GetCultureInfo("fr-FR");
base.OnStartup(e); base.OnStartup(e);
_mpd = new MPDHandler(); _mpd = new MPDHandler();

View File

@ -12,7 +12,6 @@ using System.Windows.Threading;
using MpcNET; using MpcNET;
using MpcNET.Commands.Database; using MpcNET.Commands.Database;
using MpcNET.Commands.Playback; using MpcNET.Commands.Playback;
using MpcNET.Commands.Reflection;
using MpcNET.Commands.Status; using MpcNET.Commands.Status;
using MpcNET.Message; using MpcNET.Message;
using MpcNET.Types; using MpcNET.Types;
@ -165,7 +164,7 @@ namespace unison
MpcConnection connection = new MpcConnection(_mpdEndpoint); MpcConnection connection = new MpcConnection(_mpdEndpoint);
await connection.ConnectAsync(token); await connection.ConnectAsync(token);
if (!string.IsNullOrEmpty(Properties.Settings.Default.mpd_password)) /*if (!string.IsNullOrEmpty(Properties.Settings.Default.mpd_password))
{ {
IMpdMessage<string> result = await connection.SendAsync(new PasswordCommand(Properties.Settings.Default.mpd_password)); IMpdMessage<string> result = await connection.SendAsync(new PasswordCommand(Properties.Settings.Default.mpd_password));
if (!result.IsResponseValid) if (!result.IsResponseValid)
@ -173,7 +172,7 @@ namespace unison
string mpdError = result.Response?.Result?.MpdError; string mpdError = result.Response?.Result?.MpdError;
Trace.WriteLine(mpdError); Trace.WriteLine(mpdError);
} }
} }*/
return connection; return connection;
} }
@ -189,7 +188,6 @@ namespace unison
if (token.IsCancellationRequested || _connection == null) if (token.IsCancellationRequested || _connection == null)
break; break;
Trace.WriteLine("loop");
var idleChanges = await _connection.SendAsync(new IdleCommand("stored_playlist playlist player mixer output options")); var idleChanges = await _connection.SendAsync(new IdleCommand("stored_playlist playlist player mixer output options"));
if (idleChanges.IsResponseValid) if (idleChanges.IsResponseValid)
@ -259,7 +257,6 @@ namespace unison
catch (Exception e) catch (Exception e)
{ {
Trace.WriteLine($"Error in Idle connection thread: {e.Message}"); Trace.WriteLine($"Error in Idle connection thread: {e.Message}");
Connect();
} }
_isUpdatingStatus = false; _isUpdatingStatus = false;
} }
@ -288,7 +285,6 @@ namespace unison
catch (Exception e) catch (Exception e)
{ {
Trace.WriteLine($"Error in Idle connection thread: {e.Message}"); Trace.WriteLine($"Error in Idle connection thread: {e.Message}");
Connect();
} }
_isUpdatingSong = false; _isUpdatingSong = false;
} }
@ -337,7 +333,7 @@ namespace unison
List<byte> data = new List<byte>(); List<byte> data = new List<byte>();
try try
{ {
if (_connection == null) // We got cancelled if (_connection == null)
return; return;
long totalBinarySize = 9999; long totalBinarySize = 9999;
@ -346,15 +342,16 @@ namespace unison
do do
{ {
var albumReq = await _connection.SendAsync(new AlbumArtCommand(path, currentSize)); var albumReq = await _connection.SendAsync(new AlbumArtCommand(path, currentSize));
if (!albumReq.IsResponseValid) break; if (!albumReq.IsResponseValid)
break;
var response = albumReq.Response.Content; var response = albumReq.Response.Content;
if (response.Binary == 0) break; // MPD isn't giving us any more data, let's roll with what we have. if (response.Binary == 0)
break;
totalBinarySize = response.Size; totalBinarySize = response.Size;
currentSize += response.Binary; currentSize += response.Binary;
data.AddRange(response.Data); data.AddRange(response.Data);
//Debug.WriteLine($"Downloading albumart: {currentSize}/{totalBinarySize}");
} while (currentSize < totalBinarySize && !token.IsCancellationRequested); } while (currentSize < totalBinarySize && !token.IsCancellationRequested);
} }
catch (Exception e) catch (Exception e)
@ -364,10 +361,7 @@ namespace unison
} }
if (data.Count == 0) if (data.Count == 0)
{
Trace.WriteLine("empty cover");
_cover = null; _cover = null;
}
else else
{ {
using MemoryStream stream = new MemoryStream(data.ToArray()); using MemoryStream stream = new MemoryStream(data.ToArray());

387
Resources/Resources.Designer.cs generated Normal file
View File

@ -0,0 +1,387 @@
//------------------------------------------------------------------------------
// <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 unison.Resources {
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", "16.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("unison.Resources.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 string similar to Exit.
/// </summary>
public static string Exit {
get {
return ResourceManager.GetString("Exit", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Settings.
/// </summary>
public static string Settings {
get {
return ResourceManager.GetString("Settings", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to About.
/// </summary>
public static string Settings_About {
get {
return ResourceManager.GetString("Settings_About", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to unison is a free software. It is built with the following technologies:.
/// </summary>
public static string Settings_AboutInfo {
get {
return ResourceManager.GetString("Settings_AboutInfo", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Connect.
/// </summary>
public static string Settings_ConnectButton {
get {
return ResourceManager.GetString("Settings_ConnectButton", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Connection.
/// </summary>
public static string Settings_Connection {
get {
return ResourceManager.GetString("Settings_Connection", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Connected to MPD.
/// </summary>
public static string Settings_ConnectionStatusConnected {
get {
return ResourceManager.GetString("Settings_ConnectionStatusConnected", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Connecting....
/// </summary>
public static string Settings_ConnectionStatusConnecting {
get {
return ResourceManager.GetString("Settings_ConnectionStatusConnecting", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Not connected..
/// </summary>
public static string Settings_ConnectionStatusOffline {
get {
return ResourceManager.GetString("Settings_ConnectionStatusOffline", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Host.
/// </summary>
public static string Settings_Host {
get {
return ResourceManager.GetString("Settings_Host", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to License.
/// </summary>
public static string Settings_License {
get {
return ResourceManager.GetString("Settings_License", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Made by.
/// </summary>
public static string Settings_MadeBy {
get {
return ResourceManager.GetString("Settings_MadeBy", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &apos;s updated MpcNET.
/// </summary>
public static string Settings_MpcNET {
get {
return ResourceManager.GetString("Settings_MpcNET", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Next track.
/// </summary>
public static string Settings_NextTrack {
get {
return ResourceManager.GetString("Settings_NextTrack", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Play / pause.
/// </summary>
public static string Settings_PlayPause {
get {
return ResourceManager.GetString("Settings_PlayPause", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Port.
/// </summary>
public static string Settings_Port {
get {
return ResourceManager.GetString("Settings_Port", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Previous track.
/// </summary>
public static string Settings_PreviousTrack {
get {
return ResourceManager.GetString("Settings_PreviousTrack", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Shortcut.
/// </summary>
public static string Settings_Shortcuts {
get {
return ResourceManager.GetString("Settings_Shortcuts", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Show window.
/// </summary>
public static string Settings_ShowWindow {
get {
return ResourceManager.GetString("Settings_ShowWindow", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You can change to your own locally installed version of the Snapcast client with an.
/// </summary>
public static string Settings_SnapcastInfo1 {
get {
return ResourceManager.GetString("Settings_SnapcastInfo1", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to absolute .
/// </summary>
public static string Settings_SnapcastInfo2 {
get {
return ResourceManager.GetString("Settings_SnapcastInfo2", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to path..
/// </summary>
public static string Settings_SnapcastInfo3 {
get {
return ResourceManager.GetString("Settings_SnapcastInfo3", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Launch at startup.
/// </summary>
public static string Settings_SnapcastLauch {
get {
return ResourceManager.GetString("Settings_SnapcastLauch", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Executable path.
/// </summary>
public static string Settings_SnapcastPath {
get {
return ResourceManager.GetString("Settings_SnapcastPath", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Port.
/// </summary>
public static string Settings_SnapcastPort {
get {
return ResourceManager.GetString("Settings_SnapcastPort", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Reset.
/// </summary>
public static string Settings_SnapcastResetButton {
get {
return ResourceManager.GetString("Settings_SnapcastResetButton", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Show Snapcast window.
/// </summary>
public static string Settings_SnapcastWindow {
get {
return ResourceManager.GetString("Settings_SnapcastWindow", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Source code freely available.
/// </summary>
public static string Settings_SourceCode1 {
get {
return ResourceManager.GetString("Settings_SourceCode1", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to here.
/// </summary>
public static string Settings_SourceCode2 {
get {
return ResourceManager.GetString("Settings_SourceCode2", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Version:.
/// </summary>
public static string Settings_Version {
get {
return ResourceManager.GetString("Settings_Version", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Volume down.
/// </summary>
public static string Settings_VolumeDown {
get {
return ResourceManager.GetString("Settings_VolumeDown", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Volume offset.
/// </summary>
public static string Settings_VolumeOffset {
get {
return ResourceManager.GetString("Settings_VolumeOffset", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Volume up.
/// </summary>
public static string Settings_VolumeUp {
get {
return ResourceManager.GetString("Settings_VolumeUp", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Show window.
/// </summary>
public static string ShowWindow {
get {
return ResourceManager.GetString("ShowWindow", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Start Snapcast.
/// </summary>
public static string StartSnapcast {
get {
return ResourceManager.GetString("StartSnapcast", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Stop Snapcast.
/// </summary>
public static string StopSnapcast {
get {
return ResourceManager.GetString("StopSnapcast", resourceCulture);
}
}
}
}

View File

@ -0,0 +1,228 @@
<?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=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Exit" xml:space="preserve">
<value>Quitter</value>
</data>
<data name="Settings" xml:space="preserve">
<value>Configuration</value>
</data>
<data name="Settings_About" xml:space="preserve">
<value>À propos</value>
</data>
<data name="Settings_AboutInfo" xml:space="preserve">
<value>unison est un logiciel libre. Il est développé avec les technologies suivantes :</value>
</data>
<data name="Settings_ConnectButton" xml:space="preserve">
<value>Connexion</value>
</data>
<data name="Settings_Connection" xml:space="preserve">
<value>Connexion</value>
</data>
<data name="Settings_ConnectionStatusConnected" xml:space="preserve">
<value>Connecté à MPD</value>
</data>
<data name="Settings_ConnectionStatusConnecting" xml:space="preserve">
<value>Connexion en cours...</value>
</data>
<data name="Settings_ConnectionStatusOffline" xml:space="preserve">
<value>Non connecté.</value>
</data>
<data name="Settings_Host" xml:space="preserve">
<value>Hôte</value>
</data>
<data name="Settings_License" xml:space="preserve">
<value>Licence</value>
</data>
<data name="Settings_MadeBy" xml:space="preserve">
<value>Créé par</value>
</data>
<data name="Settings_MpcNET" xml:space="preserve">
<value> et sa version de MpcNET</value>
</data>
<data name="Settings_NextTrack" xml:space="preserve">
<value>Piste suivante</value>
</data>
<data name="Settings_PlayPause" xml:space="preserve">
<value>Jouer / pause</value>
</data>
<data name="Settings_Port" xml:space="preserve">
<value>Port</value>
</data>
<data name="Settings_PreviousTrack" xml:space="preserve">
<value>Piste précédente</value>
</data>
<data name="Settings_Shortcuts" xml:space="preserve">
<value>Raccourcis</value>
</data>
<data name="Settings_ShowWindow" xml:space="preserve">
<value>Afficher la fenêtre</value>
</data>
<data name="Settings_SnapcastInfo1" xml:space="preserve">
<value>Il est possible de mettre votre version localement installé de Snapcast avec un </value>
</data>
<data name="Settings_SnapcastInfo2" xml:space="preserve">
<value>chemin absolu</value>
</data>
<data name="Settings_SnapcastInfo3" xml:space="preserve">
<value>.</value>
</data>
<data name="Settings_SnapcastLauch" xml:space="preserve">
<value>Lancer au démarrage</value>
</data>
<data name="Settings_SnapcastPath" xml:space="preserve">
<value>Chemin de l'exécutable</value>
</data>
<data name="Settings_SnapcastPort" xml:space="preserve">
<value>Port</value>
</data>
<data name="Settings_SnapcastResetButton" xml:space="preserve">
<value>Réinitialiser</value>
</data>
<data name="Settings_SnapcastWindow" xml:space="preserve">
<value>Afficher la fenêtre de Snapcast</value>
</data>
<data name="Settings_SourceCode1" xml:space="preserve">
<value>Code source librement disponible</value>
</data>
<data name="Settings_SourceCode2" xml:space="preserve">
<value>ici</value>
</data>
<data name="Settings_Version" xml:space="preserve">
<value>Version :</value>
</data>
<data name="Settings_VolumeDown" xml:space="preserve">
<value>Baisse de volume</value>
</data>
<data name="Settings_VolumeOffset" xml:space="preserve">
<value>Écart de volume</value>
</data>
<data name="Settings_VolumeUp" xml:space="preserve">
<value>Augmentation de volume</value>
</data>
<data name="ShowWindow" xml:space="preserve">
<value>Montrer la fenêtre</value>
</data>
<data name="StartSnapcast" xml:space="preserve">
<value>Démarrer Snapcast</value>
</data>
<data name="StopSnapcast" xml:space="preserve">
<value>Stopper Snapcast</value>
</data>
</root>

228
Resources/Resources.resx Normal file
View File

@ -0,0 +1,228 @@
<?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=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Exit" xml:space="preserve">
<value>Exit</value>
</data>
<data name="Settings" xml:space="preserve">
<value>Settings</value>
</data>
<data name="Settings_About" xml:space="preserve">
<value>About</value>
</data>
<data name="Settings_AboutInfo" xml:space="preserve">
<value>unison is a free software. It is built with the following technologies:</value>
</data>
<data name="Settings_ConnectButton" xml:space="preserve">
<value>Connect</value>
</data>
<data name="Settings_Connection" xml:space="preserve">
<value>Connection</value>
</data>
<data name="Settings_ConnectionStatusConnected" xml:space="preserve">
<value>Connected to MPD</value>
</data>
<data name="Settings_ConnectionStatusConnecting" xml:space="preserve">
<value>Connecting...</value>
</data>
<data name="Settings_ConnectionStatusOffline" xml:space="preserve">
<value>Not connected.</value>
</data>
<data name="Settings_Host" xml:space="preserve">
<value>Host</value>
</data>
<data name="Settings_License" xml:space="preserve">
<value>License</value>
</data>
<data name="Settings_MadeBy" xml:space="preserve">
<value>Made by</value>
</data>
<data name="Settings_MpcNET" xml:space="preserve">
<value>'s updated MpcNET</value>
</data>
<data name="Settings_NextTrack" xml:space="preserve">
<value>Next track</value>
</data>
<data name="Settings_PlayPause" xml:space="preserve">
<value>Play / pause</value>
</data>
<data name="Settings_Port" xml:space="preserve">
<value>Port</value>
</data>
<data name="Settings_PreviousTrack" xml:space="preserve">
<value>Previous track</value>
</data>
<data name="Settings_Shortcuts" xml:space="preserve">
<value>Shortcut</value>
</data>
<data name="Settings_ShowWindow" xml:space="preserve">
<value>Show window</value>
</data>
<data name="Settings_SnapcastInfo1" xml:space="preserve">
<value>You can change to your own locally installed version of the Snapcast client with an</value>
</data>
<data name="Settings_SnapcastInfo2" xml:space="preserve">
<value> absolute </value>
</data>
<data name="Settings_SnapcastInfo3" xml:space="preserve">
<value>path.</value>
</data>
<data name="Settings_SnapcastLauch" xml:space="preserve">
<value>Launch at startup</value>
</data>
<data name="Settings_SnapcastPath" xml:space="preserve">
<value>Executable path</value>
</data>
<data name="Settings_SnapcastPort" xml:space="preserve">
<value>Port</value>
</data>
<data name="Settings_SnapcastResetButton" xml:space="preserve">
<value>Reset</value>
</data>
<data name="Settings_SnapcastWindow" xml:space="preserve">
<value>Show Snapcast window</value>
</data>
<data name="Settings_SourceCode1" xml:space="preserve">
<value>Source code freely available</value>
</data>
<data name="Settings_SourceCode2" xml:space="preserve">
<value>here</value>
</data>
<data name="Settings_Version" xml:space="preserve">
<value>Version:</value>
</data>
<data name="Settings_VolumeDown" xml:space="preserve">
<value>Volume down</value>
</data>
<data name="Settings_VolumeOffset" xml:space="preserve">
<value>Volume offset</value>
</data>
<data name="Settings_VolumeUp" xml:space="preserve">
<value>Volume up</value>
</data>
<data name="ShowWindow" xml:space="preserve">
<value>Show window</value>
</data>
<data name="StartSnapcast" xml:space="preserve">
<value>Start Snapcast</value>
</data>
<data name="StopSnapcast" xml:space="preserve">
<value>Stop Snapcast</value>
</data>
</root>

15
Resources/Resources.xaml Normal file
View File

@ -0,0 +1,15 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="snapcastPath">snapclient_0.25.0-1_win64</system:String>
<system:String x:Key="snapcastPort">1704</system:String>
<system:String x:Key="connectionOk1">&#xf385;</system:String>
<system:String x:Key="connectionOk2">&#xf386;</system:String>
<system:String x:Key="connectionFail">&#xf384;</system:String>
<system:String x:Key="playButton">&#xedb4;</system:String>
<system:String x:Key="pauseButton">&#xedb5;</system:String>
</ResourceDictionary>

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

Before

Width:  |  Height:  |  Size: 294 KiB

After

Width:  |  Height:  |  Size: 294 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -4,9 +4,9 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:emoji="clr-namespace:Emoji.Wpf;assembly=Emoji.Wpf" xmlns:emoji="clr-namespace:Emoji.Wpf;assembly=Emoji.Wpf"
xmlns:properties="clr-namespace:unison.Resources"
mc:Ignorable="d" mc:Ignorable="d"
Title="unison" Title="unison" Closing="Window_Closing" Icon="/Resources/icon-full.ico" ResizeMode="CanMinimize" SizeToContent="WidthAndHeight">
Closing="Window_Closing" Icon="/Ressources/icon-full.ico" ResizeMode="CanMinimize" SizeToContent="WidthAndHeight">
<Window.Resources> <Window.Resources>
<Style TargetType="Border" x:Key="UnselectedButton"> <Style TargetType="Border" x:Key="UnselectedButton">
@ -103,8 +103,8 @@
<StackPanel.OpacityMask> <StackPanel.OpacityMask>
<VisualBrush Visual="{Binding ElementName=mask}"/> <VisualBrush Visual="{Binding ElementName=mask}"/>
</StackPanel.OpacityMask> </StackPanel.OpacityMask>
<Image x:Name="Cover" HorizontalAlignment="Center" VerticalAlignment="Center" Source="/Ressources/nocover.png" Visibility="Collapsed" /> <Image x:Name="Cover" HorizontalAlignment="Center" VerticalAlignment="Center" Source="/Resources/nocover.png" Visibility="Collapsed" />
<Image x:Name="NoCover" HorizontalAlignment="Center" VerticalAlignment="Center" Source="/Ressources/nocover.png" /> <Image x:Name="NoCover" HorizontalAlignment="Center" VerticalAlignment="Center" Source="/Resources/nocover.png" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</Border> </Border>
@ -113,10 +113,19 @@
<Button x:Name="Snapcast" HorizontalAlignment="Left" VerticalAlignment="Center" Click="Snapcast_Clicked" Margin="10,0,0,0" Padding="5, 2" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" FocusVisualStyle="{x:Null}" IsEnabled="False"> <Button x:Name="Snapcast" HorizontalAlignment="Left" VerticalAlignment="Center" Click="Snapcast_Clicked" Margin="10,0,0,0" Padding="5, 2" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" FocusVisualStyle="{x:Null}" IsEnabled="False">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<emoji:TextBlock Text="🔊" Padding="0,0,0,2"/> <emoji:TextBlock Text="🔊" Padding="0,0,0,2"/>
<TextBlock x:Name="SnapcastText" Text="Start Snapcast" Margin="5, 0, 0, 0"/> <TextBlock x:Name="SnapcastText" Text="{x:Static properties:Resources.StartSnapcast}" Margin="5, 0, 0, 0"/>
</StackPanel> </StackPanel>
</Button> </Button>
<TextBlock x:Name="Connection" HorizontalAlignment="Center" Text="Not connected" TextWrapping="Wrap" VerticalAlignment="Center" TextAlignment="Center" MinWidth="350" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Grid x:Name="ConnectionOkIcon" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock FontFamily="Segoe MDL2 Assets" Text="&#xf385;" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" VerticalAlignment="Center" HorizontalAlignment="Center" />
<TextBlock FontFamily="Segoe MDL2 Assets" Text="&#xf386;" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Grid>
<Grid x:Name="ConnectionFailIcon" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock FontFamily="Segoe MDL2 Assets" Text="&#xf384;" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Grid>
<TextBlock x:Name="Connection" HorizontalAlignment="Center" Text="Not connected" TextWrapping="Wrap" VerticalAlignment="Top" TextAlignment="Center" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" Margin="5,0,0,0" />
</StackPanel>
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,10,0"> <StackPanel HorizontalAlignment="Right" Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,10,0">
<!--<Button x:Name="Shuffle" Padding="5, 2" HorizontalAlignment="Right" Margin="0,0,10,0" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"> <!--<Button x:Name="Shuffle" Padding="5, 2" HorizontalAlignment="Right" Margin="0,0,10,0" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
@ -127,7 +136,7 @@
<Button x:Name="Settings" Padding="5, 2" Click="Settings_Clicked" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" FocusVisualStyle="{x:Null}"> <Button x:Name="Settings" Padding="5, 2" Click="Settings_Clicked" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" FocusVisualStyle="{x:Null}">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<emoji:TextBlock Text="🛠️" Padding="0,0,0,2"/> <emoji:TextBlock Text="🛠️" Padding="0,0,0,2"/>
<TextBlock Text="Settings" Margin="5, 0, 0, 0"/> <TextBlock Text="{x:Static properties:Resources.Settings}" Margin="5, 0, 0, 0"/>
</StackPanel> </StackPanel>
</Button> </Button>
</StackPanel> </StackPanel>

View File

@ -19,6 +19,7 @@ namespace unison
{ {
InitHwnd(); InitHwnd();
InitializeComponent(); InitializeComponent();
DefaultState(true);
WindowState = WindowState.Minimized; WindowState = WindowState.Minimized;
_settingsWin = new Settings(); _settingsWin = new Settings();
@ -44,16 +45,18 @@ namespace unison
if (_mpd.IsConnected()) if (_mpd.IsConnected())
{ {
Snapcast.IsEnabled = true; Snapcast.IsEnabled = true;
Connection.Text = "✔️"; ConnectionOkIcon.Visibility = Visibility.Visible;
ConnectionFailIcon.Visibility = Visibility.Collapsed;
} }
else else
{ {
_timer.Stop(); _timer.Stop();
DefaultState(); DefaultState(true);
Connection.Text = "❌"; ConnectionOkIcon.Visibility = Visibility.Collapsed;
ConnectionFailIcon.Visibility = Visibility.Visible;
} }
_settingsWin.UpdateConnectionStatus(); _settingsWin.UpdateConnectionStatus();
Connection.Text += $"{Properties.Settings.Default.mpd_host}:{Properties.Settings.Default.mpd_port}"; Connection.Text = $"{Properties.Settings.Default.mpd_host}:{Properties.Settings.Default.mpd_port}";
} }
public void OnSongChanged(object sender, EventArgs e) public void OnSongChanged(object sender, EventArgs e)
@ -120,10 +123,10 @@ namespace unison
UpdateButton(ref BorderConsume, _mpd.GetStatus().Consume); UpdateButton(ref BorderConsume, _mpd.GetStatus().Consume);
if (_mpd.IsPlaying()) if (_mpd.IsPlaying())
PlayPause.Text = "\xedb4"; PlayPause.Text = (string)Application.Current.FindResource("playButton");
else else
{ {
PlayPause.Text = "\xedb5"; PlayPause.Text = (string)Application.Current.FindResource("pauseButton");
if (_mpd.GetStatus().State == MpcNET.MpdState.Stop) if (_mpd.GetStatus().State == MpcNET.MpdState.Stop)
{ {
DefaultState(); DefaultState();
@ -131,7 +134,7 @@ namespace unison
} }
} }
private void DefaultState() private void DefaultState(bool LostConnection = false)
{ {
SongTitle.Text = ""; SongTitle.Text = "";
SongArtist.Text = ""; SongArtist.Text = "";
@ -141,11 +144,18 @@ namespace unison
SongFormat.Text = ""; SongFormat.Text = "";
CurrentTime.Text = ""; CurrentTime.Text = "";
EndTime.Text = ""; EndTime.Text = "";
PlayPause.Text = "\xedb5"; PlayPause.Text = (string)Application.Current.FindResource("pauseButton");
TimeSlider.Value = 50; TimeSlider.Value = 50;
TimeSlider.IsEnabled = false; TimeSlider.IsEnabled = false;
NoCover.Visibility = Visibility.Visible; NoCover.Visibility = Visibility.Visible;
Cover.Visibility = Visibility.Collapsed; Cover.Visibility = Visibility.Collapsed;
if (LostConnection)
{
ConnectionOkIcon.Visibility = Visibility.Collapsed;
ConnectionFailIcon.Visibility = Visibility.Visible;
}
Connection.Text = $"{Properties.Settings.Default.mpd_host}:{Properties.Settings.Default.mpd_port}";
} }
public void OnCoverChanged(object sender, EventArgs e) public void OnCoverChanged(object sender, EventArgs e)
@ -167,9 +177,9 @@ namespace unison
{ {
SnapcastHandler snapcast = (SnapcastHandler)Application.Current.Properties["snapcast"]; SnapcastHandler snapcast = (SnapcastHandler)Application.Current.Properties["snapcast"];
if (snapcast.HasStarted) if (snapcast.HasStarted)
SnapcastText.Text = "Stop Snapcast"; SnapcastText.Text = unison.Resources.Resources.StopSnapcast;
else else
SnapcastText.Text = "Start Snapcast"; SnapcastText.Text = unison.Resources.Resources.StartSnapcast;
} }
public void UpdateButton(ref Border border, bool b) public void UpdateButton(ref Border border, bool b)

View File

@ -4,8 +4,9 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:emoji="clr-namespace:Emoji.Wpf;assembly=Emoji.Wpf" xmlns:emoji="clr-namespace:Emoji.Wpf;assembly=Emoji.Wpf"
xmlns:properties="clr-namespace:unison.Resources"
mc:Ignorable="d" mc:Ignorable="d"
Closing="Window_Closing" Title="Settings" ResizeMode="CanMinimize" Icon="/Ressources/icon-full.ico" WindowStyle="ToolWindow" SizeToContent="WidthAndHeight"> Closing="Window_Closing" Title="{x:Static properties:Resources.Settings}" ResizeMode="CanMinimize" Icon="/Resources/icon-full.ico" WindowStyle="ToolWindow" SizeToContent="WidthAndHeight">
<Grid> <Grid>
<StackPanel Orientation="Vertical"> <StackPanel Orientation="Vertical">
<TabControl Margin="10"> <TabControl Margin="10">
@ -14,18 +15,21 @@
<GroupBox DockPanel.Dock="Top" Padding="0,4,0,0"> <GroupBox DockPanel.Dock="Top" Padding="0,4,0,0">
<GroupBox.Header> <GroupBox.Header>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<emoji:TextBlock Text="📶 Connection"/> <TextBlock>
<emoji:EmojiInline Text="📶"/>
<Run Text="{x:Static properties:Resources.Settings_Connection}"/>
</TextBlock>
</StackPanel> </StackPanel>
</GroupBox.Header> </GroupBox.Header>
<Grid VerticalAlignment="Top"> <Grid VerticalAlignment="Top">
<StackPanel> <StackPanel>
<StackPanel> <StackPanel>
<TextBlock Text="Host" TextWrapping="Wrap" Margin="5,0,0,0"/> <TextBlock Text="{x:Static properties:Resources.Settings_Host}" TextWrapping="Wrap" Margin="5,0,0,0"/>
<TextBox x:Name="MpdHost" TextWrapping="Wrap" Width="250" Margin="10,2,0,0"/> <TextBox x:Name="MpdHost" TextWrapping="Wrap" Width="250" Margin="10,2,0,0"/>
</StackPanel> </StackPanel>
<StackPanel Margin="0,5,0,0"> <StackPanel Margin="0,5,0,0">
<TextBlock Text="Port" TextWrapping="Wrap" Margin="5,0,0,0"/> <TextBlock Text="{x:Static properties:Resources.Settings_Port}" TextWrapping="Wrap" Margin="5,0,0,0"/>
<TextBox x:Name="MpdPort" MaxLength="5" PreviewTextInput="NumberValidationTextBox" TextWrapping="Wrap" Width="250" Margin="10,2,0,0"/> <TextBox x:Name="MpdPort" MaxLength="5" PreviewTextInput="NumberValidationTextBox" TextWrapping="Wrap" Width="250" Margin="10,2,0,0"/>
</StackPanel> </StackPanel>
@ -34,8 +38,8 @@
<TextBox x:Name="MpdPassword" TextWrapping="Wrap" Width="250" Margin="10,2,0,0"/> <TextBox x:Name="MpdPassword" TextWrapping="Wrap" Width="250" Margin="10,2,0,0"/>
</StackPanel>--> </StackPanel>-->
<TextBlock x:Name="ConnectionStatus" Text="Not connected." TextWrapping="Wrap" Margin="5,10,0,0"/> <TextBlock x:Name="ConnectionStatus" Text="{x:Static properties:Resources.Settings_ConnectionStatusOffline}" TextWrapping="Wrap" Margin="5,10,0,0"/>
<Button x:Name="ConnectButton" Content="Connect" Margin="0,10,0,0" Width="120" Click="MPDConnect_Clicked"/> <Button x:Name="ConnectButton" Content="{x:Static properties:Resources.Settings_ConnectButton}" Margin="0,10,0,0" Width="120" Click="MPDConnect_Clicked"/>
</StackPanel> </StackPanel>
</Grid> </Grid>
</GroupBox> </GroupBox>
@ -54,19 +58,19 @@
<StackPanel> <StackPanel>
<StackPanel> <StackPanel>
<CheckBox x:Name="SnapcastStartup" Margin="5, 5, 0, 0"> <CheckBox x:Name="SnapcastStartup" Margin="5, 5, 0, 0">
<TextBlock Text="Launch at startup" TextWrapping="Wrap"/> <TextBlock Text="{x:Static properties:Resources.Settings_SnapcastLauch}" TextWrapping="Wrap"/>
</CheckBox> </CheckBox>
<CheckBox x:Name="SnapcastWindow" Margin="5,2.5,0,0"> <CheckBox x:Name="SnapcastWindow" Margin="5,2.5,0,0">
<TextBlock Text="Show Snapcast window" TextWrapping="Wrap"/> <TextBlock Text="{x:Static properties:Resources.Settings_SnapcastWindow}" TextWrapping="Wrap"/>
</CheckBox> </CheckBox>
<TextBlock Text="Port" TextWrapping="Wrap" Margin="5,5,0,0"/> <TextBlock Text="{x:Static properties:Resources.Settings_SnapcastPort}" TextWrapping="Wrap" Margin="5,5,0,0"/>
<TextBox x:Name="SnapcastPort" MaxLength="5" PreviewTextInput="NumberValidationTextBox" TextWrapping="Wrap" Width="250" Margin="10,2,5,0" HorizontalAlignment="Left"/> <TextBox x:Name="SnapcastPort" MaxLength="5" PreviewTextInput="NumberValidationTextBox" TextWrapping="Wrap" Width="250" Margin="10,2,5,0" HorizontalAlignment="Left"/>
<TextBlock Text="Executable path" TextWrapping="Wrap" Margin="5,5,0,0"/> <TextBlock Text="{x:Static properties:Resources.Settings_SnapcastPath}" TextWrapping="Wrap" Margin="5,5,0,0"/>
<TextBox x:Name="SnapcastPath" TextWrapping="Wrap" Width="250" Margin="10,2,5,0" HorizontalAlignment="Left"/> <TextBox x:Name="SnapcastPath" TextWrapping="Wrap" Width="250" Margin="10,2,5,0" HorizontalAlignment="Left"/>
<TextBlock TextWrapping="Wrap" Margin="5,5,0,0" TextAlignment="Left" Width="250"> <TextBlock TextWrapping="Wrap" Margin="5,5,0,0" TextAlignment="Left" Width="250">
You can change to your own locally installed version of the Snapcast client with an <Run FontStyle="Italic" FontWeight="DemiBold">absolute</Run> path. <Run Text="{x:Static properties:Resources.Settings_SnapcastInfo1}" /><Run Text="{x:Static properties:Resources.Settings_SnapcastInfo2}" FontStyle="Italic" FontWeight="DemiBold" /><Run Text="{x:Static properties:Resources.Settings_SnapcastInfo3}" />
</TextBlock> </TextBlock>
<Button Content="Reset" Margin="0,10,0,0" Width="120" Click="SnapcastReset_Clicked"/> <Button Content="{x:Static properties:Resources.Settings_SnapcastResetButton}" Margin="0,10,0,0" Width="120" Click="SnapcastReset_Clicked"/>
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
</Grid> </Grid>
@ -74,21 +78,24 @@
</DockPanel> </DockPanel>
</TabItem> </TabItem>
<TabItem Header="Shortcuts"> <TabItem Header="{x:Static properties:Resources.Settings_Shortcuts}">
<DockPanel Margin="8"> <DockPanel Margin="8">
<GroupBox DockPanel.Dock="Top" Padding="0,4,0,0"> <GroupBox DockPanel.Dock="Top" Padding="0,4,0,0">
<GroupBox.Header> <GroupBox.Header>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<emoji:TextBlock Text="⌨️ Shortcuts"/> <TextBlock>
<emoji:EmojiInline Text="⌨️ "/>
<Run Text="{x:Static properties:Resources.Settings_Shortcuts}"></Run>
</TextBlock>
</StackPanel> </StackPanel>
</GroupBox.Header> </GroupBox.Header>
<Grid> <Grid>
<StackPanel> <StackPanel>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<TextBlock Text="Volume offset" TextWrapping="Wrap"/> <TextBlock Text="{x:Static properties:Resources.Settings_VolumeOffset}" TextWrapping="Wrap"/>
<TextBox x:Name="VolumeOffset" TextWrapping="Wrap" Width="25" PreviewTextInput="NumberValidationTextBox" Margin="8,2,0,0"/> <TextBox x:Name="VolumeOffset" TextWrapping="Wrap" Width="25" PreviewTextInput="NumberValidationTextBox" Margin="8,2,0,0"/>
</StackPanel> </StackPanel>
<Grid MinWidth="220" Margin="0,5,0,0"> <Grid MinWidth="300" Margin="0,5,0,0">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition/> <ColumnDefinition/>
<ColumnDefinition/> <ColumnDefinition/>
@ -101,12 +108,12 @@
<RowDefinition/> <RowDefinition/>
<RowDefinition/> <RowDefinition/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Text="Next track" TextWrapping="Wrap" Grid.Column="0" Grid.Row="0" Margin="1"/> <TextBlock Text="{x:Static properties:Resources.Settings_NextTrack}" TextWrapping="Wrap" Grid.Column="0" Grid.Row="0" Margin="1"/>
<TextBlock Text="Previous track" TextWrapping="Wrap" Grid.Column="0" Grid.Row="1" Margin="1"/> <TextBlock Text="{x:Static properties:Resources.Settings_PreviousTrack}" TextWrapping="Wrap" Grid.Column="0" Grid.Row="1" Margin="1"/>
<TextBlock Text="Play / Pause" TextWrapping="Wrap" Grid.Column="0" Grid.Row="2" Margin="1"/> <TextBlock Text="{x:Static properties:Resources.Settings_PlayPause}" TextWrapping="Wrap" Grid.Column="0" Grid.Row="2" Margin="1"/>
<TextBlock Text="Volume up" TextWrapping="Wrap" Grid.Column="0" Grid.Row="3" Margin="1"/> <TextBlock Text="{x:Static properties:Resources.Settings_VolumeUp}" TextWrapping="Wrap" Grid.Column="0" Grid.Row="3" Margin="1"/>
<TextBlock Text="Volume down" TextWrapping="Wrap" Grid.Column="0" Grid.Row="4" Margin="1"/> <TextBlock Text="{x:Static properties:Resources.Settings_VolumeDown}" TextWrapping="Wrap" Grid.Column="0" Grid.Row="4" Margin="1"/>
<TextBlock Text="Show window" TextWrapping="Wrap" Grid.Column="0" Grid.Row="5" Margin="1"/> <TextBlock Text="{x:Static properties:Resources.Settings_ShowWindow}" TextWrapping="Wrap" Grid.Column="0" Grid.Row="5" Margin="1"/>
<TextBlock Text="ctrl + media_next" TextWrapping="Wrap" Grid.Column="1" Grid.Row="0" Margin="1" HorizontalAlignment="Right" FontWeight="Bold"/> <TextBlock Text="ctrl + media_next" TextWrapping="Wrap" Grid.Column="1" Grid.Row="0" Margin="1" HorizontalAlignment="Right" FontWeight="Bold"/>
<TextBlock Text="ctrl + media_prev" TextWrapping="Wrap" Grid.Column="1" Grid.Row="1" Margin="1" HorizontalAlignment="Right" FontWeight="Bold"/> <TextBlock Text="ctrl + media_prev" TextWrapping="Wrap" Grid.Column="1" Grid.Row="1" Margin="1" HorizontalAlignment="Right" FontWeight="Bold"/>
@ -121,7 +128,7 @@
</DockPanel> </DockPanel>
</TabItem> </TabItem>
<TabItem Header="About" Height="20" VerticalAlignment="Bottom"> <TabItem Header="{x:Static properties:Resources.Settings_About}" Height="20" VerticalAlignment="Bottom">
<DockPanel Margin="8"> <DockPanel Margin="8">
<GroupBox DockPanel.Dock="Top" Padding="0,4,0,0"> <GroupBox DockPanel.Dock="Top" Padding="0,4,0,0">
<GroupBox.Header> <GroupBox.Header>
@ -130,23 +137,23 @@
<Grid VerticalAlignment="Top"> <Grid VerticalAlignment="Top">
<StackPanel Orientation="Vertical"> <StackPanel Orientation="Vertical">
<TextBlock TextWrapping="Wrap" Margin="0,0,0,10" VerticalAlignment="Top"> <TextBlock TextWrapping="Wrap" Margin="0,0,0,10" VerticalAlignment="Top">
<Run Text="Version:"/> <Run Text="{x:Static properties:Resources.Settings_Version}"/>
<Run Text="{Binding GetVersion, Mode = OneWay}"/> <Run Text="{Binding GetVersion, Mode = OneWay}"/>
</TextBlock> </TextBlock>
<TextBlock TextWrapping="Wrap" VerticalAlignment="Top"> <TextBlock TextWrapping="Wrap" VerticalAlignment="Top">
unison is free software. It is built with the following technologies:<LineBreak/> <Run Text="{x:Static properties:Resources.Settings_AboutInfo}" /><LineBreak/>
※ <Hyperlink NavigateUri="https://github.com/Difegue/Stylophone" RequestNavigate="Hyperlink_RequestNavigate">Stylophone</Hyperlink>'s updated MpcNET<LineBreak/> ※ <Hyperlink NavigateUri="https://github.com/Difegue/Stylophone" RequestNavigate="Hyperlink_RequestNavigate">Stylophone</Hyperlink><Run Text="{x:Static properties:Resources.Settings_MpcNET}" /><LineBreak/>
※ <Hyperlink NavigateUri="https://github.com/hardcodet/wpf-notifyicon" RequestNavigate="Hyperlink_RequestNavigate">wpf-notifyicon</Hyperlink><LineBreak/> ※ <Hyperlink NavigateUri="https://github.com/hardcodet/wpf-notifyicon" RequestNavigate="Hyperlink_RequestNavigate">wpf-notifyicon</Hyperlink><LineBreak/>
※ <Hyperlink NavigateUri="https://github.com/samhocevar/emoji.wpf" RequestNavigate="Hyperlink_RequestNavigate">Emoji.WPF</Hyperlink> ※ <Hyperlink NavigateUri="https://github.com/samhocevar/emoji.wpf" RequestNavigate="Hyperlink_RequestNavigate">Emoji.WPF</Hyperlink>
</TextBlock> </TextBlock>
<TextBlock Margin="0,10,0,0"> <TextBlock Margin="0,10,0,0">
Source code freely available <Run Text="{x:Static properties:Resources.Settings_SourceCode1}" />
<Hyperlink NavigateUri="https://git.n700.ovh/keb/unison" RequestNavigate="Hyperlink_RequestNavigate"> <Hyperlink NavigateUri="https://git.n700.ovh/keb/unison" RequestNavigate="Hyperlink_RequestNavigate">
here <Run Text="{x:Static properties:Resources.Settings_SourceCode2}" />
</Hyperlink>. </Hyperlink>.
</TextBlock> </TextBlock>
<TextBlock Margin="0,10,0,0"> <TextBlock Margin="0,10,0,0">
Made by <Run Text="{x:Static properties:Resources.Settings_MadeBy}" />
<Hyperlink NavigateUri="https://marchal.dev" RequestNavigate="Hyperlink_RequestNavigate"> <Hyperlink NavigateUri="https://marchal.dev" RequestNavigate="Hyperlink_RequestNavigate">
Théo Marchal Théo Marchal
</Hyperlink>. </Hyperlink>.
@ -157,7 +164,10 @@
<GroupBox DockPanel.Dock="Top" Padding="0,4,0,0" Margin="0,10,0,0"> <GroupBox DockPanel.Dock="Top" Padding="0,4,0,0" Margin="0,10,0,0">
<GroupBox.Header> <GroupBox.Header>
<emoji:TextBlock Text="📝 License"/> <TextBlock>
<emoji:EmojiInline Text="📝 "/>
<Run Text="{x:Static properties:Resources.Settings_License}" />
</TextBlock>
</GroupBox.Header> </GroupBox.Header>
<Grid VerticalAlignment="Top"> <Grid VerticalAlignment="Top">
<TextBlock Text="{Binding GetLicense, Mode = OneWay}" TextWrapping="Wrap" Width="500" TextAlignment="Justify" /> <TextBlock Text="{Binding GetLicense, Mode = OneWay}" TextWrapping="Wrap" Width="500" TextAlignment="Justify" />

View File

@ -13,9 +13,6 @@ namespace unison
{ {
public partial class Settings : Window public partial class Settings : Window
{ {
private readonly string defaultSnapcastPath = "snapclient_0.25.0-1_win64";
private readonly string defaultSnapcastPort = "1704";
public static string GetVersion => Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion; public static string GetVersion => Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
public static string GetLicense public static string GetLicense
@ -72,23 +69,23 @@ namespace unison
{ {
MPDHandler mpd = (MPDHandler)Application.Current.Properties["mpd"]; MPDHandler mpd = (MPDHandler)Application.Current.Properties["mpd"];
if (mpd.IsConnected()) if (mpd.IsConnected())
ConnectionStatus.Text = "Connected to MPD " + mpd.GetVersion() + "."; ConnectionStatus.Text = $"{unison.Resources.Resources.Settings_ConnectionStatusConnected} {mpd.GetVersion()}.";
else else
ConnectionStatus.Text = "Not connected."; ConnectionStatus.Text = unison.Resources.Resources.Settings_ConnectionStatusOffline;
} }
private void MPDConnect_Clicked(object sender, RoutedEventArgs e) private void MPDConnect_Clicked(object sender, RoutedEventArgs e)
{ {
SaveSettings(); SaveSettings();
ConnectionStatus.Text = "Connecting..."; ConnectionStatus.Text = unison.Resources.Resources.Settings_ConnectionStatusConnecting;
MPDHandler mpd = (MPDHandler)Application.Current.Properties["mpd"]; MPDHandler mpd = (MPDHandler)Application.Current.Properties["mpd"];
mpd.Connect(); mpd.Connect();
} }
private void SnapcastReset_Clicked(object sender, RoutedEventArgs e) private void SnapcastReset_Clicked(object sender, RoutedEventArgs e)
{ {
SnapcastPath.Text = defaultSnapcastPath; SnapcastPath.Text = (string)Application.Current.FindResource("snapcastPath");
SnapcastPort.Text = defaultSnapcastPort; SnapcastPort.Text = (string)Application.Current.FindResource("snapcastPort");
} }
public void SaveSettings() public void SaveSettings()

View File

@ -2,24 +2,25 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tb="http://www.hardcodet.net/taskbar" xmlns:tb="http://www.hardcodet.net/taskbar"
xmlns:emoji="clr-namespace:Emoji.Wpf;assembly=Emoji.Wpf" xmlns:emoji="clr-namespace:Emoji.Wpf;assembly=Emoji.Wpf"
xmlns:properties="clr-namespace:unison.Resources"
xmlns:local="clr-namespace:unison"> xmlns:local="clr-namespace:unison">
<ContextMenu x:Shared="false" x:Key="SystrayMenu"> <ContextMenu x:Shared="false" x:Key="SystrayMenu">
<MenuItem IsEnabled="False"> <MenuItem IsEnabled="False">
<MenuItem.Icon> <MenuItem.Icon>
<Image Source="/Ressources/icon-full.ico" Width="16" Height="16"/> <Image Source="/Resources/icon-full.ico" Width="16" Height="16"/>
</MenuItem.Icon> </MenuItem.Icon>
<MenuItem.Header> <MenuItem.Header>
<TextBlock Text="{Binding GetAppText}" /> <TextBlock Text="{Binding GetAppText}" />
</MenuItem.Header> </MenuItem.Header>
</MenuItem> </MenuItem>
<Separator /> <Separator />
<MenuItem Header="Show window" Command="{Binding ShowWindowCommand}"> <MenuItem Header="{x:Static properties:Resources.ShowWindow}" Command="{Binding ShowWindowCommand}">
<MenuItem.Icon> <MenuItem.Icon>
<Image Width="16" Height="16" emoji:Image.Source="▶️" /> <Image Width="16" Height="16" emoji:Image.Source="▶️" />
</MenuItem.Icon> </MenuItem.Icon>
</MenuItem> </MenuItem>
<MenuItem Name="test_snapcast_item" Header="{Binding SnapcastText}" Command="{Binding Snapcast}"> <MenuItem Header="{Binding SnapcastText}" Command="{Binding Snapcast}">
<MenuItem.Icon> <MenuItem.Icon>
<Image Width="16" Height="16" emoji:Image.Source="🔊" /> <Image Width="16" Height="16" emoji:Image.Source="🔊" />
</MenuItem.Icon> </MenuItem.Icon>
@ -29,20 +30,20 @@
<Image Width="16" Height="16" emoji:Image.Source="🔀" /> <Image Width="16" Height="16" emoji:Image.Source="🔀" />
</MenuItem.Icon> </MenuItem.Icon>
</MenuItem>--> </MenuItem>-->
<MenuItem Header="Settings" Command="{Binding Settings}"> <MenuItem Header="{x:Static properties:Resources.Settings}" Command="{Binding Settings}">
<MenuItem.Icon> <MenuItem.Icon>
<Image Width="16" Height="16" emoji:Image.Source="🛠️" /> <Image Width="16" Height="16" emoji:Image.Source="🛠️" />
</MenuItem.Icon> </MenuItem.Icon>
</MenuItem> </MenuItem>
<Separator /> <Separator />
<MenuItem Header="Exit" Command="{Binding ExitApplicationCommand}"> <MenuItem Header="{x:Static properties:Resources.Exit}" Command="{Binding ExitApplicationCommand}">
<MenuItem.Icon> <MenuItem.Icon>
<Image Width="16" Height="16" emoji:Image.Source="❌" /> <Image Width="16" Height="16" emoji:Image.Source="❌" />
</MenuItem.Icon> </MenuItem.Icon>
</MenuItem> </MenuItem>
</ContextMenu> </ContextMenu>
<tb:TaskbarIcon x:Key="SystrayTaskbar" IconSource="/Ressources/icon-mini.ico" ToolTipText="{Binding GetAppText}" DoubleClickCommand="{Binding ShowWindowCommand}" ContextMenu="{StaticResource SystrayMenu}"> <tb:TaskbarIcon x:Key="SystrayTaskbar" IconSource="/Resources/icon-mini.ico" ToolTipText="{Binding GetAppText}" DoubleClickCommand="{Binding ShowWindowCommand}" ContextMenu="{StaticResource SystrayMenu}">
<tb:TaskbarIcon.DataContext> <tb:TaskbarIcon.DataContext>
<local:SystrayViewModel /> <local:SystrayViewModel />
</tb:TaskbarIcon.DataContext> </tb:TaskbarIcon.DataContext>

View File

@ -37,7 +37,7 @@ namespace unison
get get
{ {
SnapcastHandler snapcast = (SnapcastHandler)Application.Current.Properties["snapcast"]; SnapcastHandler snapcast = (SnapcastHandler)Application.Current.Properties["snapcast"];
return snapcast.HasStarted ? "Stop Snapcast" : "Start Snapcast"; return snapcast.HasStarted ? unison.Resources.Resources.StopSnapcast : unison.Resources.Resources.StartSnapcast;
} }
} }

View File

@ -4,7 +4,7 @@
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework> <TargetFramework>net5.0-windows</TargetFramework>
<UseWPF>true</UseWPF> <UseWPF>true</UseWPF>
<ApplicationIcon>Ressources\icon-full.ico</ApplicationIcon> <ApplicationIcon>Resources\icon-full.ico</ApplicationIcon>
<Win32Resource></Win32Resource> <Win32Resource></Win32Resource>
<StartupObject>unison.App</StartupObject> <StartupObject>unison.App</StartupObject>
<Version>0.0.1</Version> <Version>0.0.1</Version>
@ -18,9 +18,9 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Remove="Ressources\icon-full.ico" /> <None Remove="Resources\icon-full.ico" />
<None Remove="Ressources\icon-mini.ico" /> <None Remove="Resources\icon-mini.ico" />
<None Remove="Ressources\nocover.png" /> <None Remove="Resources\nocover.png" />
<None Remove="LICENSE" /> <None Remove="LICENSE" />
<None Remove="snapclient_0.25.0-1_win64\FLAC.dll" /> <None Remove="snapclient_0.25.0-1_win64\FLAC.dll" />
<None Remove="snapclient_0.25.0-1_win64\ogg.dll" /> <None Remove="snapclient_0.25.0-1_win64\ogg.dll" />
@ -36,13 +36,13 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="Ressources\icon-full.ico"> <Resource Include="Resources\icon-full.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource> </Resource>
<Resource Include="Ressources\icon-mini.ico"> <Resource Include="Resources\icon-mini.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource> </Resource>
<Resource Include="Ressources\nocover.png"> <Resource Include="Resources\nocover.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource> </Resource>
<Content Include="LICENSE"> <Content Include="LICENSE">
@ -86,6 +86,21 @@
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon> <DependentUpon>Settings.settings</DependentUpon>
</Compile> </Compile>
<Compile Update="Resources\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Resources\Resources.fr-FR.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Resources\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>