Skip to content

Commit

Permalink
Fix up linter suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
rgwood committed Mar 4, 2022
1 parent f01c12e commit 75334f8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 8 additions & 6 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ static int Main(string[] args)

fixed (char* classNamePtr = "MinimalWebView")
{
WNDCLASSW wc = new WNDCLASSW();
wc.lpfnWndProc = WndProc;
wc.lpszClassName = classNamePtr;
wc.hInstance = hInstance;
wc.hbrBackground = backgroundBrush;
wc.style = WNDCLASS_STYLES.CS_VREDRAW | WNDCLASS_STYLES.CS_HREDRAW;
WNDCLASSW wc = new()
{
lpfnWndProc = WndProc,
lpszClassName = classNamePtr,
hInstance = hInstance,
hbrBackground = backgroundBrush,
style = WNDCLASS_STYLES.CS_VREDRAW | WNDCLASS_STYLES.CS_HREDRAW
};
classId = PInvoke.RegisterClass(wc);

if (classId == 0)
Expand Down
6 changes: 2 additions & 4 deletions UiThreadSynchronizationContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace MinimalWebView;
// based on this very good Stephen Toub article: https://devblogs.microsoft.com/pfxteam/await-synchronizationcontext-and-console-apps/
internal sealed class UiThreadSynchronizationContext : SynchronizationContext
{
private readonly BlockingCollection<KeyValuePair<SendOrPostCallback, object>> m_queue = new BlockingCollection<KeyValuePair<SendOrPostCallback, object>>();
private readonly BlockingCollection<KeyValuePair<SendOrPostCallback, object>> m_queue = new();
private readonly HWND hwnd;

public UiThreadSynchronizationContext(HWND hwnd) : base()
Expand All @@ -29,9 +29,7 @@ public override void Send(SendOrPostCallback d, object state)

public void RunAvailableWorkOnCurrentThread()
{
KeyValuePair<SendOrPostCallback, object> workItem;

while (m_queue.TryTake(out workItem))
while (m_queue.TryTake(out KeyValuePair<SendOrPostCallback, object> workItem))
workItem.Key(workItem.Value);
}

Expand Down

0 comments on commit 75334f8

Please sign in to comment.