2022-10-23 11:02:31 +13:00
|
|
|
|
// <copyright file="AppContextMenu.cs" company="PlaceholderCompany">
|
|
|
|
|
// Copyright (c) PlaceholderCompany. All rights reserved.
|
|
|
|
|
// </copyright>
|
|
|
|
|
|
2023-05-10 09:33:56 +12:00
|
|
|
|
namespace SystemTrayMenu.UserInterface
|
2022-10-23 11:02:31 +13:00
|
|
|
|
{
|
|
|
|
|
using System;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Windows;
|
2023-05-01 07:10:55 +12:00
|
|
|
|
using System.Windows.Threading;
|
|
|
|
|
using H.NotifyIcon.Core;
|
2023-04-17 00:17:33 +12:00
|
|
|
|
using SystemTrayMenu.Helpers.Updater;
|
2022-10-23 11:02:31 +13:00
|
|
|
|
using SystemTrayMenu.Utilities;
|
|
|
|
|
|
|
|
|
|
internal class AppContextMenu
|
|
|
|
|
{
|
2023-05-01 07:10:55 +12:00
|
|
|
|
public PopupMenu Create()
|
2022-10-23 11:02:31 +13:00
|
|
|
|
{
|
2023-05-01 07:10:55 +12:00
|
|
|
|
PopupMenu menu = new();
|
2022-10-23 11:02:31 +13:00
|
|
|
|
|
|
|
|
|
AddItem(menu, "Settings", () => SettingsWindow.ShowSingleInstance());
|
|
|
|
|
AddSeperator(menu);
|
2022-12-06 09:46:53 +13:00
|
|
|
|
AddItem(menu, "Log File", Log.OpenLogFile);
|
2022-10-23 11:02:31 +13:00
|
|
|
|
AddSeperator(menu);
|
|
|
|
|
AddItem(menu, "Frequently Asked Questions", Config.ShowHelpFAQ);
|
|
|
|
|
AddItem(menu, "Support SystemTrayMenu", Config.ShowSupportSystemTrayMenu);
|
|
|
|
|
AddItem(menu, "About SystemTrayMenu", About);
|
|
|
|
|
AddItem(menu, "Check for updates", () => GitHubUpdate.ActivateNewVersionFormOrCheckForUpdates(showWhenUpToDate: true));
|
|
|
|
|
AddSeperator(menu);
|
|
|
|
|
AddItem(menu, "Restart", AppRestart.ByAppContextMenu);
|
|
|
|
|
AddItem(menu, "Exit app", () => Application.Current.Shutdown());
|
|
|
|
|
|
|
|
|
|
return menu;
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-01 07:10:55 +12:00
|
|
|
|
private static void AddSeperator(PopupMenu menu)
|
2022-10-23 11:02:31 +13:00
|
|
|
|
{
|
2023-05-01 07:10:55 +12:00
|
|
|
|
menu.Items.Add(new PopupMenuSeparator());
|
2022-10-23 11:02:31 +13:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void AddItem(
|
2023-05-01 07:10:55 +12:00
|
|
|
|
PopupMenu menu,
|
2022-10-23 11:02:31 +13:00
|
|
|
|
string text,
|
|
|
|
|
Action actionClick)
|
|
|
|
|
{
|
2023-05-01 07:10:55 +12:00
|
|
|
|
Dispatcher dispatcher = Dispatcher.CurrentDispatcher;
|
|
|
|
|
menu.Items.Add(new PopupMenuItem(
|
|
|
|
|
text, new ((_, _) => dispatcher.Invoke(actionClick))));
|
2022-10-23 11:02:31 +13:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void About()
|
|
|
|
|
{
|
2022-12-06 09:46:53 +13:00
|
|
|
|
string copyright = string.Empty;
|
|
|
|
|
string productName = string.Empty;
|
|
|
|
|
string fileDescription = string.Empty;
|
|
|
|
|
string fileVersion = string.Empty;
|
|
|
|
|
string? location = Assembly.GetEntryAssembly()?.Location;
|
|
|
|
|
if (location != null)
|
|
|
|
|
{
|
|
|
|
|
FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(location);
|
|
|
|
|
if (versionInfo.LegalCopyright != null)
|
|
|
|
|
{
|
|
|
|
|
copyright = versionInfo.LegalCopyright;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (versionInfo.ProductName != null)
|
|
|
|
|
{
|
|
|
|
|
productName = versionInfo.ProductName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (versionInfo.FileDescription != null)
|
|
|
|
|
{
|
|
|
|
|
fileDescription = versionInfo.FileDescription;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (versionInfo.FileVersion != null)
|
|
|
|
|
{
|
|
|
|
|
fileVersion = versionInfo.FileVersion;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-10-23 11:02:31 +13:00
|
|
|
|
|
2022-12-06 09:46:53 +13:00
|
|
|
|
string moreInfo = copyright + Environment.NewLine;
|
2022-10-23 11:02:31 +13:00
|
|
|
|
moreInfo += "Markus Hofknecht (mailto:Markus@Hofknecht.eu)" + Environment.NewLine;
|
|
|
|
|
|
|
|
|
|
// Thanks for letting me being part of this project and that I am allowed to be listed here :-)
|
|
|
|
|
moreInfo += "Peter Kirmeier (https://github.com/topeterk/)" + Environment.NewLine;
|
|
|
|
|
|
|
|
|
|
moreInfo += "http://www.hofknecht.eu/systemtraymenu/" + Environment.NewLine;
|
|
|
|
|
moreInfo += "https://github.com/Hofknecht/SystemTrayMenu" + Environment.NewLine;
|
|
|
|
|
moreInfo += Environment.NewLine;
|
|
|
|
|
moreInfo += "GNU GENERAL PUBLIC LICENSE" + Environment.NewLine;
|
|
|
|
|
moreInfo += "(Version 3, 29 June 2007)" + Environment.NewLine;
|
|
|
|
|
|
2022-12-06 09:46:53 +13:00
|
|
|
|
moreInfo += "Thanks for ideas, reporting issues and contributing!" + Environment.NewLine;
|
2023-08-25 21:55:55 +12:00
|
|
|
|
moreInfo +=
|
|
|
|
|
"#123 Mordecai00, " +
|
|
|
|
|
"#125 Holgermh, " +
|
|
|
|
|
"#135 #153 #154 #164 jakkaas, " +
|
|
|
|
|
"#145 Pascal Aloy, " +
|
|
|
|
|
"#153 #158 #160 blackcrack, " +
|
|
|
|
|
"#162 HansieNL, " +
|
|
|
|
|
"#163 igorruckert, " +
|
|
|
|
|
"#171 kehoen, " +
|
|
|
|
|
"#186 Dtrieb, " +
|
|
|
|
|
"#188 #189 #191 #195 iJahangard, " +
|
|
|
|
|
"#195 #197 #225 #238 the-phuctran, " +
|
|
|
|
|
"#205 kristofzerbe, " +
|
|
|
|
|
"#209 jonaskohl, " +
|
|
|
|
|
"#211 blacksparrow15, " +
|
|
|
|
|
"#220 #403 Yavuz E., " +
|
|
|
|
|
"#229 #230 #239 Peter O., " +
|
|
|
|
|
"#231 Ryonez, " +
|
|
|
|
|
"#235 #242 243 #247, #271 Tom, " +
|
|
|
|
|
"#237 Torsten S., " +
|
|
|
|
|
"#240 video Patrick, " +
|
|
|
|
|
"#244 Gunter D., " +
|
|
|
|
|
"#246 #329 MACE4GITHUB, " +
|
|
|
|
|
"#259 #310 vanjac, " +
|
|
|
|
|
"#262 terencemcdonnell, " +
|
|
|
|
|
"#269 petersnows25, " +
|
|
|
|
|
"#272 Peter M., " +
|
|
|
|
|
"#273 #274 ParasiteDelta, " +
|
|
|
|
|
"#275 #276 #278 donaldaken, " +
|
|
|
|
|
"#277 Jan S., " +
|
|
|
|
|
"#282 akuznets, " +
|
|
|
|
|
"#283 #284 #289 RuSieg, " +
|
|
|
|
|
"#285 #286 dao-net, " +
|
|
|
|
|
"#288 William P., " +
|
|
|
|
|
"#294 #295 #296 Stefan Mahrer, " +
|
|
|
|
|
"#225 #297 #299 #317 #321 #324 #330 #386 #390 #401 #402 #407 #409 #414 #416 #418 #428 #430 #443 chip33, " +
|
|
|
|
|
"#298 phanirithvij, " +
|
|
|
|
|
"#306 wini2, " +
|
|
|
|
|
"#370 dna5589, " +
|
|
|
|
|
"#372 not-nef, " +
|
|
|
|
|
"#376 Michelle H., " +
|
|
|
|
|
"#377 SoenkeHob, " +
|
|
|
|
|
"#380 #394 TransLucida, " +
|
|
|
|
|
"#384 #434 #435 boydfields, " +
|
|
|
|
|
"#386 visusys, " +
|
|
|
|
|
"#387 #411 #444 yrctw, " +
|
|
|
|
|
"#446 timinformatica, " +
|
|
|
|
|
"#450 ppt-oldoerp, " +
|
|
|
|
|
"#453 fubaWoW, " +
|
|
|
|
|
"#454 WouterVanGoey, " +
|
|
|
|
|
"#462 verdammt89x, " +
|
|
|
|
|
"#463 Dirk S., " +
|
|
|
|
|
"#466 Dean-Corso, " +
|
|
|
|
|
"#488 DailenG, " +
|
|
|
|
|
"#490 TrampiPW, " +
|
|
|
|
|
"#497 Aziz, " +
|
2023-08-29 00:35:21 +12:00
|
|
|
|
"#499 spitzlbergerj, " +
|
2023-08-25 21:55:55 +12:00
|
|
|
|
Environment.NewLine +
|
|
|
|
|
Environment.NewLine;
|
|
|
|
|
moreInfo += "Sponsors - Thank you!" + Environment.NewLine;
|
|
|
|
|
moreInfo +=
|
|
|
|
|
"Stefan Mahrer, " +
|
|
|
|
|
"boydfields, " +
|
|
|
|
|
"RuSieg, " +
|
|
|
|
|
"igor-davidov, " +
|
|
|
|
|
"Ralf K., " +
|
|
|
|
|
"Tim K., " +
|
|
|
|
|
"Georg W., " +
|
|
|
|
|
"donaldaken, " +
|
|
|
|
|
"Marc Speer, " +
|
|
|
|
|
"Cito, " +
|
|
|
|
|
"Peter G., " +
|
|
|
|
|
"Traditional_Tap3954, " +
|
|
|
|
|
"Maximilian H., " +
|
2023-08-25 22:25:19 +12:00
|
|
|
|
"Jens B., " +
|
2023-08-29 00:35:21 +12:00
|
|
|
|
"spitzlbergerj, " +
|
2023-08-25 21:55:55 +12:00
|
|
|
|
Environment.NewLine;
|
2022-10-23 11:02:31 +13:00
|
|
|
|
AboutBox aboutBox = new()
|
|
|
|
|
{
|
2022-12-06 09:46:53 +13:00
|
|
|
|
AppTitle = productName,
|
|
|
|
|
AppDescription = fileDescription,
|
|
|
|
|
AppVersion = $"Version {fileVersion}",
|
|
|
|
|
AppCopyright = copyright,
|
2022-10-23 11:02:31 +13:00
|
|
|
|
AppMoreInfo = moreInfo,
|
|
|
|
|
};
|
|
|
|
|
aboutBox.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-07-05 05:04:14 +12:00
|
|
|
|
}
|