Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gus33000 committed Oct 17, 2021
1 parent f9210eb commit 562906f
Show file tree
Hide file tree
Showing 446 changed files with 29,698 additions and 31,551 deletions.
514 changes: 461 additions & 53 deletions InteropTools.sln

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion InteropTools/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
</Application>
16 changes: 4 additions & 12 deletions InteropTools/Classes/AsyncHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static T RunSync<T>(Func<Task<T>> task)
private class ExclusiveSynchronizationContext : SynchronizationContext
{
private readonly Queue<Tuple<SendOrPostCallback, object>> items =
new();
new();

private readonly AutoResetEvent workItemsWaiting = new(false);
private bool done;
Expand Down Expand Up @@ -111,15 +111,9 @@ public void BeginMessageLoop()
}
}

public override SynchronizationContext CreateCopy()
{
return this;
}
public override SynchronizationContext CreateCopy() => this;

public void EndMessageLoop()
{
Post(_ => done = true, null);
}
public void EndMessageLoop() => Post(_ => done = true, null);

public override void Post(SendOrPostCallback d, object state)
{
Expand All @@ -131,10 +125,8 @@ public override void Post(SendOrPostCallback d, object state)
workItemsWaiting.Set();
}

public override void Send(SendOrPostCallback d, object state)
{
public override void Send(SendOrPostCallback d, object state) =>
throw new NotSupportedException("We cannot send to our same thread");
}
}
}
}
2 changes: 1 addition & 1 deletion InteropTools/Classes/DeviceFamilyAssetHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ public static string GetTileAssetPath(string Type)
return $"ms-appx:///Assets/{Type}/{tileimg}.png";
}
}
}
}
17 changes: 7 additions & 10 deletions InteropTools/Classes/DeviceInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,12 @@ private DeviceInfo()
}
catch
{
CollectionLevel = ResourceManager.Current.MainResourceMap.GetValue("Resources/Unknown", ResourceContext.GetForCurrentView()).ValueAsString;
CollectionLevel = ResourceManager.Current.MainResourceMap
.GetValue("Resources/Unknown", ResourceContext.GetForCurrentView()).ValueAsString;
}
}

public static DeviceInfo Instance
{
get
{
return _Instance ??= new DeviceInfo();
}
}
public static DeviceInfo Instance => _Instance ??= new DeviceInfo();

public string CollectionLevel { get; }
public string DeviceFamily { get; }
Expand All @@ -78,8 +73,9 @@ private static string ByteArrayToHexViaLookup32(byte[] bytes)
{
uint val = lookup32[bytes[i]];
result[2 * i] = (char)val;
result[(2 * i) + 1] = (char)(val >> 16);
result[2 * i + 1] = (char)(val >> 16);
}

return new string(result);
}

Expand All @@ -91,6 +87,7 @@ private static uint[] CreateLookup32()
string s = i.ToString("X2");
result[i] = s[0] + ((uint)s[1] << 16);
}

return result;
}

Expand All @@ -109,4 +106,4 @@ private static string GetId()
return "";
}
}
}
}
Loading

0 comments on commit 562906f

Please sign in to comment.