Skip to content

Instantly share code, notes, and snippets.

View luojunyuan's full-sized avatar
🏠
have a good day

k1mlka luojunyuan

🏠
have a good day
View GitHub Profile
@luojunyuan
luojunyuan / App1.csproj
Last active February 19, 2025 04:56
the minimal request csproj properties for creating an unpackage desktop winui app
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
<UseWinUI>true</UseWinUI>
<Nullable>enable</Nullable>
<ImplicitUsings>true</ImplicitUsings>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
@luojunyuan
luojunyuan / SplashScreen.cs
Last active January 17, 2025 03:19
SplashScreen with System.Drawing.Common + CSWin32
public class SplashScreen
{
public static SplashScreen Show(string imagePath)
{
using var image = Image.FromFile(imagePath);
return InternalShow(image);
}
public static SplashScreen Show(Stream stream)
{

in m1 parallels desktop

/ms net472 net8 net8-aot
console 8-29 45
wpf-Loaded 90-120 260 -
console(cold) 21 200
wpf-Loaded(cold) 250 342 -
@luojunyuan
luojunyuan / XmlSerializer.cs
Created March 31, 2023 15:17
csharp .net xml serializer
public static T? XmlDeserializer<T>(string text)
{
var serializer = new XmlSerializer(typeof(T));
using var reader = new StringReader(text);
var result = (T?)serializer.Deserialize(reader);
return result;
}
using System.Windows.Threading;
using System.Windows;
using System.Windows.Interop;
namespace MagnifierWpf;
public class MagWindow : Window
{
private float magnification;
private int _sourceWidth = 400;
@luojunyuan
luojunyuan / Program.cs
Created February 15, 2022 08:50
启动器备份
using Microsoft.Win32;
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
namespace Installer
{
public class Installer
@luojunyuan
luojunyuan / test.txt
Created January 11, 2022 07:53
dotnet core wpf 6.0 startup time test
SSD HDD 没有显著区别
cHECK Window Name, Alt + F4
ms
WinUI3 with some simple controller Publish win-x64 release R2R SSD i5
0.3279
0.3317
0.3152
0.3150
0.3295
@luojunyuan
luojunyuan / example.xaml
Created January 2, 2022 11:27
ModernWpf Button FlyoutService
<ui:FlyoutService.Flyout>
<ui:CommandBarFlyout x:Name="AssistiveTouchFlyout" ShowMode="Standard">
<ui:AppBarButton Click="VolumeDownOnClick" ToolTip="{x:Static resx:Strings.GameView_VolumeDecreaseTip}">
<ui:AppBarButton.Icon>
<ui:FontIcon Glyph="{x:Static contract:CommonGlyphs.Volume1}" />
</ui:AppBarButton.Icon>
</ui:AppBarButton>
<ui:AppBarButton Click="VolumeUpOnClick" Icon="Volume" ToolTip="{x:Static resx:Strings.GameView_VolumeIncreaseTip}" />
<ui:AppBarButton x:Name="FullScreenSwitcher" Click="FullScreenSwitcherOnClick" />
<ui:AppBarToggleButton x:Name="LoseFocusToggle" Icon="Trim" ToolTip="{x:Static resx:Strings.GameView_FocusTip}" />
@luojunyuan
luojunyuan / events.cs
Created November 12, 2021 07:33
WinEventObjects
class events
{
internal const int EventObjectCreate = 0x8000;
private const uint EventObjectDestroy = 0x8001;
private const uint EventObjectShow = 0x8002;
private const uint EventObjectHide = 0x8003;
private const uint EventObjectReorder = 0x8004;
private const uint EventObjectFocus = 0x8005;
internal const int EventObjectSelection = 0x8006;
internal const int EventObjectSelectionAdd = 0x8007;
@luojunyuan
luojunyuan / brightness.cpp
Last active September 18, 2021 05:50
adjust laptop brightness
// From https://blog.csdn.net/ONE_SIX_MIX/article/details/80286421
#include <iostream>
#include <string>
#include <windows.h>
#include <objbase.h>
#include <wbemidl.h>
#include <comdef.h>
#include <mutex>