-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDeskband.cs
43 lines (38 loc) · 1.34 KB
/
Deskband.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Windows;
using CSDeskBand;
using CSDeskBand.ContextMenu;
namespace GlobalMediaControl
{
[ComVisible(true)]
[Guid("515F2CAA-73E3-41C3-B224-178DCC7CCA4A")]
[CSDeskBandRegistration(Name = "GlobalMediaControl")]
public class Deskband : CSDeskBandWpf
{
public Deskband()
{
Options.ContextMenuItems = ContextMenuItems;
Microsoft.Win32.SystemEvents.UserPreferenceChanged += SystemEvents_UserPreferenceChanged; ;
}
private void SystemEvents_UserPreferenceChanged(object sender, Microsoft.Win32.UserPreferenceChangedEventArgs e)
{
AcrylicWindowHelper.SwitchTheme();
}
protected override UIElement UIElement => new MediaControlBar();
private List<DeskBandMenuItem> ContextMenuItems
{
get
{
var action = new DeskBandMenuAction("Night Mode");
action.Clicked += Action_Clicked;
return new List<DeskBandMenuItem>() { action, };
}
}
private void Action_Clicked(object sender, EventArgs e)
{
Properties.Settings.Default.NightMode = !Properties.Settings.Default.NightMode;
}
}
}