#347, show notifications when webpage commander is invoked for the first time

This commit is contained in:
Kang Yu 2024-08-14 16:22:25 -07:00
parent 05dec2e6dd
commit ae75d66172
4 changed files with 20 additions and 7 deletions

View file

@ -6,7 +6,6 @@ using System.Data;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -632,7 +631,6 @@ namespace PersistentWindows.Common
active = false; active = false;
} }
} }
} }

View file

@ -1,6 +1,8 @@
using System; using System;
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
using PersistentWindows.Common; using PersistentWindows.Common;
using PersistentWindows.Common.WinApiBridge; using PersistentWindows.Common.WinApiBridge;
@ -10,6 +12,7 @@ namespace PersistentWindows.SystrayShell
{ {
public class HotKeyForm : Form public class HotKeyForm : Form
{ {
static bool init = true;
static HotKeyWindow hkwin = null; static HotKeyWindow hkwin = null;
static Thread messageLoop; static Thread messageLoop;
@ -63,6 +66,18 @@ namespace PersistentWindows.SystrayShell
Program.HideRestoreTip(false); //hide icon Program.HideRestoreTip(false); //hide icon
Program.HideRestoreTip(); //show icon Program.HideRestoreTip(); //show icon
hkwin.HotKeyPressed(from_menu : false); hkwin.HotKeyPressed(from_menu : false);
if (init)
{
init = false;
string webpage_commander_notification = Path.Combine(Program.AppdataFolder, "webpage_commander_notification");
if (!File.Exists(webpage_commander_notification))
{
File.Create(webpage_commander_notification);
Process.Start(Program.ProjectUrl + "/blob/master/webpage_commander.md");
}
Program.systrayForm.notifyIconMain.ShowBalloonTip(5000, $"webpage commander is invoked via hotkey", "Press the hotkey (Alt + W) again to revoke", ToolTipIcon.Info);
}
return; return;
} }
else if (m.Msg == 0x0010 || m.Msg == 0x0002) else if (m.Msg == 0x0010 || m.Msg == 0x0002)

View file

@ -29,7 +29,7 @@ namespace PersistentWindows.SystrayShell
private const int MaxSnapshots = 38; // 0-9, a-z, ` and final one for undo private const int MaxSnapshots = 38; // 0-9, a-z, ` and final one for undo
static PersistentWindowProcessor pwp = null; static PersistentWindowProcessor pwp = null;
static SystrayForm systrayForm = null; public static SystrayForm systrayForm = null;
static bool silent = false; //suppress all balloon tip & sound prompt static bool silent = false; //suppress all balloon tip & sound prompt
static bool notification = false; //pop balloon when auto restore static bool notification = false; //pop balloon when auto restore
static int delay_manual_capture = 5000; //in millisecond static int delay_manual_capture = 5000; //in millisecond

View file

@ -1,5 +1,5 @@
### Webpage commander window is activated via hotkey (Alt + W) ### Webpage commander window is invoked via hotkey (Alt + W)
* If the activation is unintentional, press the hotkey again to deactivate webpage commander. This feature can be disabled via PW menu or command line. * If the invocation is unintentional, press the hotkey again to revoke webpage commander. The hotkey can be disabled via PW menu or command line.
* Webpage commander improves the efficiency of web browsing using single-letter command shortcut * Webpage commander improves the efficiency of web browsing using single-letter command shortcut.
* Check out online help for more details * Check out [Online Help](https://www.github.com/kangyu-california/PersistentWindows/blob/master/Help.md) for detailed instructions.