GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - grantwinney/Surviving-WinForms: WinForms ain't going away anytime soon. A lot of us have to deal with it. Let's make the most of it, shall we? 😎

BranchesTags
Open more actions menu

Latest commit

 

History

103 Commits
103 Commits

Folders and files

NameName
Last commit message
Last commit date
.NET 05
.NET 05
 
 
.NET 08/GetStockIcon
.NET 08/GetStockIcon
 
 
.NET 09/FolderBrowserDialogMultiSelect
.NET 09/FolderBrowserDialogMultiSelect
 
 
.github/workflows
.github/workflows
 
 
AntiPatterns/MagicStrings/NameOfVersusMagicStrings
AntiPatterns/MagicStrings/NameOfVersusMagicStrings
 
 
ClarityConciseness
ClarityConciseness
 
 
Debugging
Debugging
 
 
Presentation/Native/AlternativesToMessageBox
Presentation/Native/AlternativesToMessageBox
 
 
Testing
Testing
 
 
Threading
Threading
 
 
Time/TimeAbstraction
Time/TimeAbstraction
 
 
Web/CEFSharp
Web/CEFSharp
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

CI Build License: MIT Language Twitter

Surviving WinForms

Let's face it, WinForms is here to stay. Whatever new hotness comes and goes in the world of web, many developers will find themselves supporting the desktop apps of yesteryear (or yesterdecade).

The apps work, representing thousands of hours of effort and business rules, fine-tuning and bug fixes, and companies won't needlessly convert anytime soon. In truth, it might not even be wise... an app converted to a new platform could very well introduce dozens or hundreds of new bugs.

So to all my fellow devs that find themselves supporting the old coldness, let's make the best of it...

(p.s. I have other repos for C# / .NET code and misc topics, and some shorter snippets hosted on Gist and JsFiddle.)

.NET Additions

.NET 5

  • TaskDialog, a new message box for WinForms (blog post, source code)
  • WebView2, an Edge/Chromium based browser (blog post, source code)

.NET 8

  • GetStockIcon to get Windows icons (blog post, source code)

.NET 9

  • Selecting multiple directories with FolderBrowserDialog (blog post, source code)

Avoiding Anti-Patterns

  • Using nameof to avoid magic strings (blog post, source code)

Clarity / Conciseness

  • Checking for null using the null-conditional and null-coalescing operators (blog post, source code)
  • Local functions in C# (aka nested methods) (blog post, source code)
  • Named arguments in C# - pass what you want and forget the rest (blog post, source code)
  • String interpolation to craft readable strings (blog post, source code)
  • Tuples and deconstruction for quickly returning multiple values (blog post, source code)

Debugging / Logging

  • A dev-friendly error box with links to the docs (blog post, source code)

NLog

  • Logging errors in WinForms using NLog (blog post, source code) (part 1)
  • How to log messages to multiple targets with NLog (blog post, source code) (part 2)

Presentation

  • Alternative ways to send notifications besides using a MessageBox (blog post, source code)

Testing

  • Mocking the MessageBox (blog post, source code)
  • Using MVP to test a WinForms app (blog post, source code)

Threading

  • Async, CancellationToken, and IProgress in 5 Short Examples (blog post, source code)
  • Calling an async method from a synchronous one (blog post, source code)
  • Turning a BackgroundWorker into a Task with TaskCompletionSource (blog post, source code)
  • Using Async, Await, and Task to keep the WinForms UI responsive (blog post, source code)

Time

  • Using TimeProvider and FakeTimeProvider in WinForms (blog post, source code)

Web

CEFSharp

  • Hosting a simple webpage in WinForms with CEFSharp (blog post, source code) (part 1)
  • Displaying an IIS hosted site in CEFSharp (blog post, source code) (part 2)

Other Resources

Other interesting and helpful links, in no particular order:

  • WinForms source code for .NET Core
  • Top WinForms open source projects on GitHub
  • What's new in Windows Forms in .NET 6.0 - .NET Blog (Igor Velikorossov)

About

WinForms ain't going away anytime soon. A lot of us have to deal with it. Let's make the most of it, shall we? 😎

Topics

c-sharpcsharpdotnetsoftware-designsoftware-developmenttutorialswinforms

Resources

Readme
MIT license
Activity

Stars

103 stars

Watchers

4 watching

Forks

34 forks
Report repository

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.