A Windows systray application that displays the current lunar phase.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
1.7 KiB

1 year ago
# LunaWin
1 year ago
1 year ago
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**
1 year ago
* Programmatically creating and updating a system tray icon using [`NotifyIcon`](https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.notifyicon?view=windowsdesktop-8.0)
* Programmatically creating and updating the icon's context menu using [`ContextMenuStrip`](https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.contextmenustrip?view=windowsdesktop-8.0) and [`ToolStripMenuItem`](https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.toolstripmenuitem?view=windowsdesktop-8.0)
1 year ago
* Setting a program to run at user login (startup)
**Advanced**
1 year ago
* Using [`Mutex`](https://learn.microsoft.com/en-us/dotnet/api/system.threading.mutex?view=netframework-4.7.2) to find existing instance of application
* Using [`DllImport`](https://learn.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.dllimportattribute?view=netframework-4.7.2) to access the current Windows 10+ theme (light or dark) natively
1 year ago
* 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