Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Taskplay/Icons/BackwardDark.ico
Binary file not shown.
Binary file added Taskplay/Icons/ForwardDark.ico
Binary file not shown.
Binary file added Taskplay/Icons/PauseDark.ico
Binary file not shown.
Binary file added Taskplay/Icons/PlayDark.ico
Binary file not shown.
Binary file added Taskplay/Icons/StopDark.ico
Binary file not shown.
37 changes: 29 additions & 8 deletions Taskplay/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ static class Program
{
static bool _isMusicPlaying = false; // Bool to keep in check if the user is playing music

static bool IsDarkModeOn => GetSettingState("DarkMode");
static bool AreChangeSongButtonsShown => GetSettingState("ShowChangeSongButtons");

static readonly Action<bool> restartAction = (b) => Application.Restart();

/// <summary>
/// The main entry point for the application.
/// </summary>
Expand All @@ -33,21 +38,21 @@ static void Main()
contextMenu.MenuItems.Add(contextItemSettings);
contextMenu.MenuItems.Add(contextItemExit);
//Setup nextIcon
nextIcon.Icon = Properties.Resources.Forward;
nextIcon.Icon = IsDarkModeOn ? Properties.Resources.ForwardDark : Properties.Resources.Forward;
nextIcon.Text = "Next";
nextIcon.Visible = true;
nextIcon.Visible = AreChangeSongButtonsShown;
nextIcon.MouseClick += new MouseEventHandler(nextIcon_MouseClick);
nextIcon.ContextMenu = contextMenu;
//Setup playIcon
playIcon.Icon = Properties.Resources.Play;
playIcon.Icon = IsDarkModeOn ? Properties.Resources.PlayDark : Properties.Resources.Play;
playIcon.Text = "Play / Pause";
playIcon.Visible = true;
playIcon.MouseClick += new MouseEventHandler(playIcon_MouseClick);
playIcon.ContextMenu = contextMenu;
//Setup previousIcon
previousIcon.Icon = Properties.Resources.Backward;
previousIcon.Icon = IsDarkModeOn ? Properties.Resources.BackwardDark : Properties.Resources.Backward;
previousIcon.Text = "Previous";
previousIcon.Visible = true;
previousIcon.Visible = AreChangeSongButtonsShown;
previousIcon.MouseClick += new MouseEventHandler(previousIcon_MouseClick);
previousIcon.ContextMenu = contextMenu;

Expand Down Expand Up @@ -79,13 +84,13 @@ private static void playIcon_MouseClick(object sender, MouseEventArgs e)
if (_isMusicPlaying == false)
{
// Start playing music and show the pause-icon
playIcon.Icon = Properties.Resources.Pause;
playIcon.Icon = IsDarkModeOn ? Properties.Resources.PauseDark : Properties.Resources.Pause;
_isMusicPlaying = true;
}
else
{
// Pause the music and display the Play-icon
playIcon.Icon = Properties.Resources.Play;
playIcon.Icon = IsDarkModeOn ? Properties.Resources.PlayDark : Properties.Resources.Play;
_isMusicPlaying = false;
}
}
Expand All @@ -108,7 +113,8 @@ private static void nextIcon_MouseClick(object sender, MouseEventArgs e)
private static void contextMenuSettings_Click(object sender, System.EventArgs e)
{
//Show Settings form
new SettingsForm().ShowDialog();
var settingsForm = new SettingsForm(IsDarkModeOn, AreChangeSongButtonsShown, restartAction);
settingsForm.ShowDialog();
}

private static void contextMenuExit_Click(object sender, System.EventArgs e)
Expand All @@ -117,6 +123,21 @@ private static void contextMenuExit_Click(object sender, System.EventArgs e)
Application.Exit();
}

private static bool GetSettingState(string settingName)
{
var subKey = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Taskplay");

var keyValue = subKey.GetValue(settingName);

if (keyValue == null)
{
subKey.SetValue(settingName, 0);
return false;
}

return (int)keyValue == 1;
}

[DllImport("user32.dll", SetLastError = true)]
public static extern void keybd_event(byte virtualKey, byte scanCode, uint flags, IntPtr extraInfo);
}
Expand Down
4 changes: 2 additions & 2 deletions Taskplay/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]
52 changes: 51 additions & 1 deletion Taskplay/Properties/Resources.Designer.cs

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

15 changes: 15 additions & 0 deletions Taskplay/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,19 @@
<data name="Stop" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\stop.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="BackwardDark" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Icons\BackwardDark.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ForwardDark" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Icons\ForwardDark.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="PauseDark" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Icons\PauseDark.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="PlayDark" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Icons\PlayDark.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="StopDark" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Icons\StopDark.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
65 changes: 39 additions & 26 deletions Taskplay/SettingsForm.Designer.cs

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

Loading