# LunaWin LunaWin is a small systray utility displaying the current moon phase. It's written in .NET C# using WinForms. The actual lunar phase calculation credit goes to [this blog post](https://minkukel.com/en/various/calculating-moon-phase/) *([archive](https://archive.ph/hjXlv))*, which details the rationale behind the calculations and presents a PHP implementation. This project demonstrates a number of concepts, some more advanced than others. **Introductory** * Programmatically creating and updating a system tray icon * Programmatically creating and updating the icon's context menu * Setting a program to run at user login (startup) **Advanced** * Using [`DllImport`](https://learn.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.dllimportattribute?view=net-8.0) to access the current Windows 10+ theme (light or dark) natively * Overloading [`WndProc`](https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.control.wndproc?view=windowsdesktop-8.0) to handle system-wide messaging, to detect Windows 10+ theme changes * Accessing memory directly through pointers and [`unsafe`](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/unsafe) code handling