lindexi

林德熙 - Windows 10 App Developer

林德熙

WPF 使用 HandyControl 给 ListView 添加漂亮的表头效果

本文将来安利大家一个很好用的 UI 控件库,著名的 HandyControl 库。在想要给 ListView 添加一个表头,同时想要这个 ListView 在没有美工小姐姐的帮助下也能看起来比较好看,此时就特别适合使用 HandyControl 库

命令行参数使用 json 有哪些坑

本文和大家聊聊在命令行参数里面使用 json 会遇到的坑

WPF 获取屏幕某个点的颜色

我在做一个笔迹性能测试工具,想要在笔迹绘制到某个点的时候输出绘制的速度,通过判断屏幕颜色修改判断笔迹绘制到哪。此时需要在不截图屏幕获取屏幕某个点的颜色

NuGet 命令行上传找不到 snupkg 文件

在 NuGet 提供符号 NuGet 库的支持,在默认上传将会同时上传符号库。在 NuGet 上传文件将会默认将 snupkg 符号文件上传

读书笔记 dotnet 大对象堆和小对象堆

本文是读还没出版的伟民哥翻译的 .NET内存管理宝典 - 提高代码质量、性能和可扩展性 这本书的笔记

dotnet 找不到 PostAsJsonAsync 方法

在网络编程可以使用 PostAsJsonAsync 这个方便的方法将一个对象作为 json 推送到服务器,这个方法是一个扩展方法,在之前的框架,可以在 System.Net.Http.dll 找到这个好用的扩展方法,但是在 4.5 的时候就被移除了。本文告诉大家如何安装这个扩展方法

win10 edge 打开闪退问题

本文记录我找网上找到 edge 打不开问题的记录和修复方法

C# dotnet 使用 OpenXml 解析 Word 文件

本文聊的 Word 是 docx 格式,这个格式遵循 ECAM 376 全球标准,使用的格式是 OpenXML 格式,在 2013 微软开源了 OpenXml 解析库。这个库里面包含了海量代码,可以使用 MB 计算的代码量,通过这个解析库,咱可以使用几行代码完成对 Word 文件的解析,从文件到内存模型

dotnet core 发布只有一个 exe 的方法

在 dotnet core 发布的时候,会使用很多文件,这样发给小伙伴使用的时候不是很清真,本文告诉大家一个非官方的方法通过 warp 将多个文件打包为一个文件

[Net.ServicePointManager]::SecurityProtocol = “tls12, tls11, tls” ; Invoke-WebRequest https://github.com/dgiagio/warp/releases/download/v0.3.0/windows-x64.warp-packer.exe -OutFile warp-packer.exe

WPF 创建空白图片

本文告诉大家如何在 WPF 创建空白图片,可以创建1像素图片

Roslyn 使用 Target 替换占位符方式生成 nuget 打包

本文告诉大家如何编写在编译过程修改打包文件

C# dotnet 使用 OpenXml 解析 PPT 文件

在 2013 微软开源了 OpenXml 解析库,在微软的 PPTX 文档,使用的文档格式就是国际规范的 OpenXml 格式。这个格式有很多版本,详细请看百度。因为演示文稿使用的是 OpenXml 在 .NET 开发可以非常简单将 PowerPoint 文档进行解析,大概只需要两句话

dotnet 动态代理魔法书

看到标题的小伙伴是不是想知道什么是魔法书,如果你需要写一段代码,这段代码是在做神奇的业务,只有你查询到了魔法书你才能找到这个对象,同时你还需要实现自己的接口,通过自己实现的接口调用才能用到有趣的方法

Roslyn 理解 msbuild 的清理过程

在开发的时候,小伙伴会使用右击解决方案,点击清理解决方案。在这个按钮点击的背后 msbuild 做了什么?为什么很多时候的清理之后还存在一堆文件?如何让自己想的 Target 也支持清理

dotnet 获取指定进程的输入命令行

本文告诉大家如何在 dotnet 获取指定的进程的命令行参数

dotnet 新项目格式与对应框架预定义的宏

在 sdk style 的项目格式支持使用多框架开发,此时需要在代码里面通过宏判断,在编译的时候执行不同的代码。本文告诉大家在框架里面对应的预定义的条件编译符有哪些

win10 uwp win2d 特效

本文告诉大家 win2d 里面的特效

dotnet 给MatterMost订阅RSS博客

其实MatterMost是有插件可以用来订阅RSS博客的,但是这个订阅插件需要一个个网址输入,而不是一次性输入很多个,于是我去就自己写了一个控制台程序做订阅

dotnet OpenXML 文本 ParagraphProperties 的属性作用

本文收集 a:pPr 段落属性 ParagraphProperties 的属性的作用

WPF 延迟加载

参见:http://www.cnblogs.com/wpfworld/p/3181014.html

WPF shows that some windows in multithreading will be locked in the PenThreadWorker constructor when the application starts

Problem description: WPF will initialize pen thread when the window initializing. But I find the window may be locked in PenThreadWorker constructor. The UnsafeNativeMethods.CreateResetEvent will lock the thread.

Actual behavior: I use multithreading to create some windows by this code and maybe the thread be locked in PenThreadWorker constructor. The Demo code

    public partial class App : Application
    {
        /// <inheritdoc />
        protected override void OnStartup(StartupEventArgs e)
        {
            var thread = new Thread(() =>
            {
                var mainWindow = new MainWindow();
                mainWindow.Show();
                Dispatcher.Run();
            });
            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();
            base.OnStartup(e);
        }
    }

The step

  1. Run the code
  2. Use the VisualStudio to suspend the application Maybe you can find the application only create a Stylus Input thread and show only a main window and the other main window and the thread be locked in PenThreadWorker constructor and the window can not show Why I need multithreading to show the windows? I need the splash window to show the welcome page and then I should show the main window in other thread to do the bussiness code and I should close the splash window when the main window showed. But I found some users could not show the main window and the main window be lock in PenThreadWorker constructor. I use dnspy to suspend the application and find the code run in PenThreadWorker constructor and the UnsafeNativeMethods.CreateResetEvent will lock the thread.
     PenThreadWorker..ctor()  
     PenThread..ctor()  
     PenThreadPool.GetPenThreadForPenContextHelper(PenContext penContext)  
     PenThreadPool.GetPenThreadForPenContext(PenContext penContext)  
     WispTabletDeviceCollection.UpdateTabletsImpl()  
     WispTabletDeviceCollection.UpdateTablets()  
     WispTabletDeviceCollection..ctor()  
     WispLogic.get_WispTabletDevices()  
     WispLogic.RegisterHwndForInput(InputManager inputManager, PresentationSource inputSource)  
     HwndStylusInputProvider..ctor(HwndSource source)  
     HwndSource.Initialize(HwndSourceParameters parameters)  
     HwndSource..ctor(HwndSourceParameters parameters)  
     PresentationFramework.dll!System.Windows.Window.CreateSourceWindow(bool duringShow)  
     PresentationFramework.dll!System.Windows.Window.CreateSourceWindowDuringShow()  
     PresentationFramework.dll!System.Windows.Window.ShowHelper(object booleanBox)  
    

    Expected behavior: The UnsafeNativeMethods.CreateResetEvent do not lock the thread

Minimal repro:

Create a empty WPF application and then change the app.xaml.cs code

    public partial class App : Application
    {
        /// <inheritdoc />
        protected override void OnStartup(StartupEventArgs e)
        {
            var thread = new Thread(() =>
            {
                var mainWindow = new MainWindow();
                mainWindow.Show();
                Dispatcher.Run();
            });
            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();
            base.OnStartup(e);
        }
    }

Run the code and maybe you can find one of the main window can not show and it stop in UnsafeNativeMethods.CreateResetEvent and I wait for a hour but it can not run.

高效率工具

本文分享一些提高效率工具

win10 uwp 商业游戏

本文告诉大家去做一个商业游戏,游戏很简单,几乎没有什么技术。

如何在 UWP 使用 wpf 的 Trigger

本文需要告诉大家,如何使用 Behaviors 做出 WPF 的 Trigger ,需要知道 UWP 不支持 WPF 的 Trigger 。

在 Gitlab 开启 MatterMost 机器人

在 Gitlab 上有 MatterMost 插件可以用于订阅 Gitlab 上的事件,本文告诉大家如何使用插件只需要三步就可以关联 Gitlab 和 MatterMost 使用机器人订阅事件

WPF 绑定密码

我们发现我们无法绑定密码框的密码,PasswordBox 的 Password 不能绑定。 我们想做 MVVM ,我们需要绑定密码,不能使用前台 xaml.cs 监听 密码改变得到密码的值,传到 ViewModel 。 本文提供一个简单方法来绑定 WPF 的 PasswordBox 的 Password 。这种方法不仅在 WPF 可以使用,在 UWP 也可以使用。关于 UWP 绑定密码,可以在我博客 win10 uwp 绑定密码 查看。

WPF 解决 ListView 的滚动条不显示

本文告诉大家如何解决一个诡异的问题,如果有一个 ListView 同时里面的元素的高度很长,但是滚动条就是不显示,怎么让这个滚动条显示

wpf 绑定 TextLength

我看到朋友的代码出现绑定了 一个 TextBlock 的 Text 的 length ,那时候我觉得 length 不是依赖属性,绑定了是无法通知的。最后我做了实验才发现,原因有 Text 可以通知。

WPF 如何调试 binding

如果是写在 xaml 的绑定,很难看到是那里出错。本文告诉大家如何在 vs 调试 binding 是否绑定上?

WPF 依赖属性绑定不上调试方法

在写 WPF 程序的时候会遇到依赖属性绑定了,但是值没有更新或者没有绑定上的问题,本文告诉大家可以如何调试

WPF 使用RPC调用其他进程

如果在 WPF 需要用多进程通信,一个推荐的方法是 WCF ,因为 WCF 是 RPC 计算。先来讲下 RPC (Remote Procedure Call) 远程过程调用,他是通过特定协议,包括 tcp 、http 等对其他进程进行调用的技术。详细请看百度

WPF 从零开始开发 dotnet Remoting 程序

本文告诉大家如何不使用框架,从零开始开发一个 dotnet remoting 程序