Skip to content

Commit

Permalink
Add configurable commands, resolves #16
Browse files Browse the repository at this point in the history
  • Loading branch information
datasone committed May 13, 2024
1 parent af9695f commit 972d219
Show file tree
Hide file tree
Showing 9 changed files with 575 additions and 22 deletions.
21 changes: 21 additions & 0 deletions MPVMediaControl/App.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>

<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="MPVMediaControl.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<userSettings>
<MPVMediaControl.Properties.Settings>
<setting name="PlayCommand" serializeAs="String">
<value>set_property pause false</value>
</setting>
<setting name="PauseCommand" serializeAs="String">
<value>set_property pause true</value>
</setting>
<setting name="PrevCommand" serializeAs="String">
<value>playlist-prev weak</value>
</setting>
<setting name="NextCommand" serializeAs="String">
<value>playlist-next weak</value>
</setting>
</MPVMediaControl.Properties.Settings>
</userSettings>
</configuration>
232 changes: 232 additions & 0 deletions MPVMediaControl/CommandEditor.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 66 additions & 0 deletions MPVMediaControl/CommandEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MPVMediaControl
{
public partial class CommandEditor : Form
{
private static readonly string[] _defaultCommands = { "set_property pause false", "set_property pause true", "playlist-prev weak", "playlist-next weak" };

public CommandEditor()
{
InitializeComponent();
}

private void CommandEditor_Load(object sender, EventArgs e)
{
playCmdText.Text = Properties.Settings.Default.PlayCommand;
pauseCmdText.Text = Properties.Settings.Default.PauseCommand;
prevCmdText.Text = Properties.Settings.Default.PrevCommand;
nextCmdText.Text = Properties.Settings.Default.NextCommand;
}

private void button1_Click(object sender, EventArgs e)
{
playCmdText.Text = _defaultCommands[0];
}

private void button4_Click(object sender, EventArgs e)
{
pauseCmdText.Text = _defaultCommands[1];
}

private void button5_Click(object sender, EventArgs e)
{
prevCmdText.Text = _defaultCommands[2];
}

private void button6_Click(object sender, EventArgs e)
{
nextCmdText.Text = _defaultCommands[3];
}

private void button2_Click(object sender, EventArgs e)
{
Properties.Settings.Default.PlayCommand = playCmdText.Text;
Properties.Settings.Default.PauseCommand = pauseCmdText.Text;
Properties.Settings.Default.PrevCommand = prevCmdText.Text;
Properties.Settings.Default.NextCommand = nextCmdText.Text;

Properties.Settings.Default.Save();
Close();
}

private void button3_Click(object sender, EventArgs e)
{
Close();
}
}
}
Loading

0 comments on commit 972d219

Please sign in to comment.