Files
FSI.BT.IR.Tools/FSI.BT.Tools/TimeStampToClipboard/Business/Menus.cs
Stephan Maier 647f938eee v1.2
2024-08-27 08:10:27 +02:00

58 lines
1.8 KiB
C#

namespace FSI.BT.Tools.TimeStampToClipboard.Business
{
using System;
using System.Drawing;
using System.Threading;
using System.Windows;
using FSI.BT.Tools.TimeStampToClipboard.Handler;
using Tulpep.NotificationWindow;
using Windows.Data.Xml.Dom;
using Windows.UI.Notifications;
internal class Main : IDisposable
{
private readonly KeyboardInput keyboardInput;
public Main()
{
keyboardInput = new();
keyboardInput.RegisterHotKey();
keyboardInput.HotKeyPressed += KeyboardInput_HotKeyPressed;
}
public event Action LoadStarted;
public event Action LoadStopped;
public void Dispose()
{
keyboardInput.HotKeyPressed -= KeyboardInput_HotKeyPressed;
keyboardInput.Dispose();
}
private void KeyboardInput_HotKeyPressed()
{
var timeStampFormat = Global.Vars.TimeStampSettings.Format;
System.Windows.Forms.Clipboard.SetDataObject(DateTime.Now.ToString(timeStampFormat));
//Global.Log.Debug("Zeitstempel \"{0}\" wurde in die Zwischenablage kopiert.", DateTime.Now.ToString(timeStampFormat));
PopupNotifier popup = new PopupNotifier();
popup.BodyColor = Color.FromArgb(40, 167, 69);
popup.Image = SystemTrayMenu.Properties.Resources.SystemTrayMenu.ToBitmap();
popup.TitleText = "Zeitstempel";
popup.TitleColor = Color.White;
popup.TitleFont = new Font("Century Gothic", 15, System.Drawing.FontStyle.Bold);
popup.ContentText = "Zeitstempel wurde in die Zwischenablage kopiert";
popup.ContentColor = Color.White;
popup.ContentFont = new Font("Century Gothic", 12);
popup.Popup();
}
}
}