using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using Microsoft.VisualStudio.PlatformUI;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Formatting;
...are likely/possibly numbered in the order they are detected - not necessarily in the order they appear in Settings or their physical order on your desk.
So, for example, it might seem natural to number your displays from top left to bottom right - just like reading a book.
This function GetDisplayByConvention()
maps a number to a screen based on the Convention described above.
It gets AllScreens
, orders them by Top
, then by Left
, skips the required number and returns the requested screen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Text.Json; | |
using System.Text.Json.Serialization; | |
/* Setup */ | |
Thing[] someThings = { new("1"), new("2") }; | |
var myThings = new Things(someThings); | |
/* Staying in dotnet - this all works as expected */ | |
var asInterfaces = myThings as IThings; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"runtimeOptions": { | |
"tfm": "net7.0", | |
"framework": { | |
"name": "Microsoft.NETCore.App", | |
"version": "7.0.8" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.NET SDK: | |
Version: 7.0.101 | |
Commit: bb24aafa11 | |
Runtime Environment: | |
OS Name: Windows | |
OS Version: 10.0.25267 | |
OS Platform: Windows | |
RID: win10-x64 | |
Base Path: C:\Program Files\dotnet\sdk\7.0.101\ |
This goes into your msbuild config (normally csproj
) and runs before the Publish
Task, before files are copied to the final destination.
<!-- 2022 @SQL-MisterMagoo containing some code from (c) .NET Foundation. All rights reserved. -->
<PropertyGroup Condition="'$(_BlazorWebAssemblySdkToolAssembly)'==''">
<_SDKRoot>$(NetCoreRoot)sdk\$(NETCoreSDKVersion)\Sdks</_SDKRoot>
from TheLaughingMan on gitter June 17, 2021 10:24 AM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-Type -AssemblyName PresentationFramework, System.Drawing, System.Windows.Forms | |
$icon = New-Object System.Windows.Forms.NotifyIcon | |
$icon.icon = New-Object System.Drawing.Icon("someicon.ico") | |
$icon.Visible = $true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class CssHelper | |
{ | |
public static string GenerateScope(string targetName, string relativePath) | |
{ | |
using var hash = SHA256.Create(); | |
var bytes = Encoding.UTF8.GetBytes(relativePath.ToLowerInvariant().Replace("\\", "//") + targetName); | |
var hashBytes = hash.ComputeHash(bytes); | |
var builder = new StringBuilder(); | |
builder.Append("b-"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyBase : ComponentBase | |
{ | |
string someValue = "test"; | |
public MyBase() | |
{ | |
var rf = typeof(ComponentBase).GetField("_renderFragment", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); | |
var pqr= typeof(ComponentBase).GetField("_hasPendingQueuedRender", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); | |
var nr= typeof(ComponentBase).GetField("_hasNeverRendered", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); | |
rf.SetValue(this, (RenderFragment)(builder => | |
{ |
NewerOlder