mirror of
https://github.com/kangyu-california/PersistentWindows.git
synced 2025-05-11 13:05:38 +02:00
add Capture and Restore menu item to allow manual operation
This commit is contained in:
parent
e68e0184aa
commit
dbf0e782fc
4 changed files with 70 additions and 12 deletions
|
@ -469,7 +469,7 @@ namespace Ninjacrab.PersistentWindows.Common
|
|||
restoreFinishedTimer.Change(Timeout.Infinite, Timeout.Infinite);
|
||||
}
|
||||
|
||||
private void BeginCaptureApplicationsOnCurrentDisplays()
|
||||
public void BeginCaptureApplicationsOnCurrentDisplays()
|
||||
{
|
||||
var thread = new Thread(() =>
|
||||
{
|
||||
|
@ -700,7 +700,7 @@ namespace Ninjacrab.PersistentWindows.Common
|
|||
return moved;
|
||||
}
|
||||
|
||||
private void BeginRestoreApplicationsOnCurrentDisplays()
|
||||
public void BeginRestoreApplicationsOnCurrentDisplays()
|
||||
{
|
||||
lock (controlLock)
|
||||
{
|
||||
|
|
|
@ -71,9 +71,20 @@ namespace Ninjacrab.PersistentWindows.SystrayShell
|
|||
thread.Abort();
|
||||
}
|
||||
|
||||
static public void Capture()
|
||||
{
|
||||
pwp.BeginCaptureApplicationsOnCurrentDisplays();
|
||||
}
|
||||
|
||||
static public void Restore()
|
||||
{
|
||||
pwp.BeginRestoreApplicationsOnCurrentDisplays();
|
||||
}
|
||||
|
||||
static public void Stop()
|
||||
{
|
||||
pwp.Stop();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,16 @@ namespace Ninjacrab.PersistentWindows.SystrayShell
|
|||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
private System.Windows.Forms.NotifyIcon notifyIconMain;
|
||||
private System.Windows.Forms.ContextMenuStrip contextMenuStripSysTray;
|
||||
|
||||
private System.Windows.Forms.ToolStripMenuItem captureToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem restoreToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem diagnosticsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem0;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
|
@ -41,6 +51,10 @@ namespace Ninjacrab.PersistentWindows.SystrayShell
|
|||
this.notifyIconMain = new System.Windows.Forms.NotifyIcon(this.components);
|
||||
this.contextMenuStripSysTray = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.diagnosticsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.captureToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.restoreToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem0 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.contextMenuStripSysTray.SuspendLayout();
|
||||
|
@ -56,11 +70,40 @@ namespace Ninjacrab.PersistentWindows.SystrayShell
|
|||
// contextMenuStripSysTray
|
||||
//
|
||||
this.contextMenuStripSysTray.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.diagnosticsToolStripMenuItem,
|
||||
this.toolStripMenuItem2,
|
||||
this.exitToolStripMenuItem});
|
||||
this.captureToolStripMenuItem,
|
||||
this.toolStripMenuItem0,
|
||||
this.restoreToolStripMenuItem,
|
||||
this.toolStripMenuItem1,
|
||||
this.diagnosticsToolStripMenuItem,
|
||||
this.toolStripMenuItem2,
|
||||
this.exitToolStripMenuItem});
|
||||
this.contextMenuStripSysTray.Name = "contextMenuStripSysTray";
|
||||
this.contextMenuStripSysTray.Size = new System.Drawing.Size(136, 54);
|
||||
this.contextMenuStripSysTray.Size = new System.Drawing.Size(136, 108);
|
||||
|
||||
// capture
|
||||
//
|
||||
this.captureToolStripMenuItem.Name = "capture";
|
||||
this.captureToolStripMenuItem.Size = new System.Drawing.Size(135, 22);
|
||||
this.captureToolStripMenuItem.Text = "&Capture windows";
|
||||
this.captureToolStripMenuItem.Click += new System.EventHandler(this.CaptureWindowClickHandler);
|
||||
//
|
||||
// toolStripMenuItem
|
||||
//
|
||||
this.toolStripMenuItem0.Name = "toolStripMenuItem0";
|
||||
this.toolStripMenuItem0.Size = new System.Drawing.Size(132, 6);
|
||||
|
||||
// restore
|
||||
//
|
||||
this.restoreToolStripMenuItem.Name = "restore";
|
||||
this.restoreToolStripMenuItem.Size = new System.Drawing.Size(135, 22);
|
||||
this.restoreToolStripMenuItem.Text = "&Restore windows";
|
||||
this.restoreToolStripMenuItem.Click += new System.EventHandler(this.RestoreWindowClickHandler);
|
||||
//
|
||||
// toolStripMenuItem
|
||||
//
|
||||
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
|
||||
this.toolStripMenuItem1.Size = new System.Drawing.Size(132, 6);
|
||||
|
||||
//
|
||||
// diagnosticsToolStripMenuItem
|
||||
//
|
||||
|
@ -95,12 +138,6 @@ namespace Ninjacrab.PersistentWindows.SystrayShell
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.NotifyIcon notifyIconMain;
|
||||
private System.Windows.Forms.ContextMenuStrip contextMenuStripSysTray;
|
||||
private System.Windows.Forms.ToolStripMenuItem diagnosticsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,16 @@ namespace Ninjacrab.PersistentWindows.SystrayShell
|
|||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void CaptureWindowClickHandler(object sender, EventArgs e)
|
||||
{
|
||||
Program.Capture();
|
||||
}
|
||||
|
||||
private void RestoreWindowClickHandler(object sender, EventArgs e)
|
||||
{
|
||||
Program.Restore();
|
||||
}
|
||||
|
||||
private void DiagnosticsToolStripMenuItemClickHandler(object sender, EventArgs e)
|
||||
{
|
||||
bool shouldShow = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue