mirror of
https://github.com/Maassoft/ColorControl.git
synced 2026-10-21 08:09:49 -05:00
27 lines
1018 B
C#
27 lines
1018 B
C#
namespace ColorControl.Shared.EventDispatcher;
|
|
|
|
public class DisplayChangedEventArgs : EventArgs
|
|
{
|
|
public uint Width { get; set; }
|
|
public uint Height { get; set; }
|
|
public uint BitsPerPixel { get; set; }
|
|
}
|
|
|
|
public class DisplayChangeEventDispatcher : EventDispatcher<DisplayChangedEventArgs>
|
|
{
|
|
public const string Event_DisplayChanged = "DisplayChanged";
|
|
public DisplayChangeEventDispatcher(WindowMessageDispatcher windowMessageDispatcher)
|
|
{
|
|
windowMessageDispatcher.RegisterEventHandler(WindowMessageDispatcher.Event_WindowMessageDisplayChange, OnWindowMessageDisplayChange);
|
|
}
|
|
|
|
private async void OnWindowMessageDisplayChange(object sender, WindowMessageEventArgs e)
|
|
{
|
|
uint width = (uint)(e.Message.LParam & 0xffff);
|
|
uint height = (uint)(e.Message.LParam >> 16);
|
|
uint bpp = (uint)e.Message.WParam;
|
|
await DispatchEventAsync(Event_DisplayChanged, new DisplayChangedEventArgs { Width = width, Height = height, BitsPerPixel = bpp });
|
|
}
|
|
}
|
|
|