This commit is contained in:
Stephan Maier
2024-08-27 08:10:27 +02:00
parent eb5c2fa502
commit 647f938eee
617 changed files with 73086 additions and 7137 deletions

View File

@@ -0,0 +1,34 @@
// <copyright file="App.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using System;
using Microsoft.Win32;
using FSI.BT.Tools.TimeStampToClipboard.Business;
using FSI.BT.Tools.Global.Utilities;
namespace FSI.BT.Tools.TimeStampToClipboard
{
/// <summary>
/// App contains the notifyicon, the taskbarform and the menus.
/// </summary>
internal class App : IDisposable
{
private readonly Main menus = new();
public App()
{
AppRestart.BeforeRestarting += Dispose;
SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged;
}
public void Dispose()
{
}
private void SystemEvents_DisplaySettingsChanged(object sender, EventArgs e)
{
}
}
}

View File

@@ -0,0 +1,56 @@
// <copyright file="KeyboardInput.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using FSI.BT.Tools.TimeStampToClipboard.Helper;
using System;
namespace FSI.BT.Tools.TimeStampToClipboard.Handler
{
internal class KeyboardInput : IDisposable
{
private readonly KeyboardHook hook = new();
private int iRowKey = -1;
private int iMenuKey;
public KeyboardInput()
{
}
public event Action HotKeyPressed;
public void Dispose()
{
hook.KeyPressed -= Hook_KeyPressed;
hook.Dispose();
}
public void RegisterHotKey()
{
if (!string.IsNullOrEmpty(Global.Vars.TimeStampSettings.HotKey))
{
try
{
hook.RegisterHotKey();
hook.KeyPressed += Hook_KeyPressed;
}
catch (InvalidOperationException ex)
{
//Log.Warn($"key:'{Properties.Settings.Default.HotKey}'", ex);
Global.Vars.TimeStampSettings.HotKey = string.Empty;
//Properties.Settings.Default.Save();
}
}
}
private void Hook_KeyPressed(object sender, FSI.BT.Tools.TimeStampToClipboard.Helper.KeyPressedEventArgs e)
{
HotKeyPressed?.Invoke();
}
}
}

View File

@@ -0,0 +1,57 @@
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();
}
}
}