Added functionality to hide the program into a system tray.
This commit is contained in:
1 parent
8b65435924
commit
a95ec8e22f
7 files changed
+450
-22
No files matched your search
Generated
+77
-5
@@ -28,17 +28,27 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
|
components = new System.ComponentModel.Container();
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CountdownForm));
|
||||||
countdown = new Label();
|
countdown = new Label();
|
||||||
cancel = new Button();
|
cancel = new Button();
|
||||||
execNow = new Button();
|
execNow = new Button();
|
||||||
tableLayoutPanel1 = new TableLayoutPanel();
|
tableLayoutPanel1 = new TableLayoutPanel();
|
||||||
|
HideToSystemTray = new Button();
|
||||||
|
trayIcon = new NotifyIcon(components);
|
||||||
|
notificationMenu = new ContextMenuStrip(components);
|
||||||
|
actionPHToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
cDPHToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
executeToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
cancelToolStripMenuItem = new ToolStripMenuItem();
|
||||||
tableLayoutPanel1.SuspendLayout();
|
tableLayoutPanel1.SuspendLayout();
|
||||||
|
notificationMenu.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// countdown
|
// countdown
|
||||||
//
|
//
|
||||||
countdown.AutoSize = true;
|
countdown.AutoSize = true;
|
||||||
tableLayoutPanel1.SetColumnSpan(countdown, 2);
|
tableLayoutPanel1.SetColumnSpan(countdown, 3);
|
||||||
countdown.Dock = DockStyle.Fill;
|
countdown.Dock = DockStyle.Fill;
|
||||||
countdown.Font = new Font("Segoe UI", 27.75F, FontStyle.Regular, GraphicsUnit.Point, 238);
|
countdown.Font = new Font("Segoe UI", 27.75F, FontStyle.Regular, GraphicsUnit.Point, 238);
|
||||||
countdown.Location = new Point(3, 0);
|
countdown.Location = new Point(3, 0);
|
||||||
@@ -52,7 +62,7 @@
|
|||||||
// cancel
|
// cancel
|
||||||
//
|
//
|
||||||
cancel.Anchor = AnchorStyles.Left;
|
cancel.Anchor = AnchorStyles.Left;
|
||||||
cancel.Location = new Point(245, 68);
|
cancel.Location = new Point(285, 68);
|
||||||
cancel.Name = "cancel";
|
cancel.Name = "cancel";
|
||||||
cancel.Size = new Size(75, 23);
|
cancel.Size = new Size(75, 23);
|
||||||
cancel.TabIndex = 1;
|
cancel.TabIndex = 1;
|
||||||
@@ -63,7 +73,7 @@
|
|||||||
// execNow
|
// execNow
|
||||||
//
|
//
|
||||||
execNow.Anchor = AnchorStyles.Right;
|
execNow.Anchor = AnchorStyles.Right;
|
||||||
execNow.Location = new Point(164, 68);
|
execNow.Location = new Point(123, 68);
|
||||||
execNow.Name = "execNow";
|
execNow.Name = "execNow";
|
||||||
execNow.Size = new Size(75, 23);
|
execNow.Size = new Size(75, 23);
|
||||||
execNow.TabIndex = 2;
|
execNow.TabIndex = 2;
|
||||||
@@ -73,12 +83,14 @@
|
|||||||
//
|
//
|
||||||
// tableLayoutPanel1
|
// tableLayoutPanel1
|
||||||
//
|
//
|
||||||
tableLayoutPanel1.ColumnCount = 2;
|
tableLayoutPanel1.ColumnCount = 3;
|
||||||
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
|
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
|
||||||
|
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 81F));
|
||||||
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
|
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
|
||||||
|
tableLayoutPanel1.Controls.Add(HideToSystemTray, 1, 1);
|
||||||
tableLayoutPanel1.Controls.Add(countdown, 0, 0);
|
tableLayoutPanel1.Controls.Add(countdown, 0, 0);
|
||||||
tableLayoutPanel1.Controls.Add(cancel, 1, 1);
|
|
||||||
tableLayoutPanel1.Controls.Add(execNow, 0, 1);
|
tableLayoutPanel1.Controls.Add(execNow, 0, 1);
|
||||||
|
tableLayoutPanel1.Controls.Add(cancel, 2, 1);
|
||||||
tableLayoutPanel1.Dock = DockStyle.Fill;
|
tableLayoutPanel1.Dock = DockStyle.Fill;
|
||||||
tableLayoutPanel1.Location = new Point(0, 0);
|
tableLayoutPanel1.Location = new Point(0, 0);
|
||||||
tableLayoutPanel1.Name = "tableLayoutPanel1";
|
tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||||
@@ -88,6 +100,57 @@
|
|||||||
tableLayoutPanel1.Size = new Size(484, 96);
|
tableLayoutPanel1.Size = new Size(484, 96);
|
||||||
tableLayoutPanel1.TabIndex = 3;
|
tableLayoutPanel1.TabIndex = 3;
|
||||||
//
|
//
|
||||||
|
// HideToSystemTray
|
||||||
|
//
|
||||||
|
HideToSystemTray.Anchor = AnchorStyles.Right;
|
||||||
|
HideToSystemTray.Location = new Point(204, 68);
|
||||||
|
HideToSystemTray.Name = "HideToSystemTray";
|
||||||
|
HideToSystemTray.Size = new Size(75, 23);
|
||||||
|
HideToSystemTray.TabIndex = 3;
|
||||||
|
HideToSystemTray.Text = "Hide";
|
||||||
|
HideToSystemTray.UseVisualStyleBackColor = true;
|
||||||
|
HideToSystemTray.Click += hideToSystemTray;
|
||||||
|
//
|
||||||
|
// trayIcon
|
||||||
|
//
|
||||||
|
trayIcon.ContextMenuStrip = notificationMenu;
|
||||||
|
trayIcon.Icon = (Icon)resources.GetObject("trayIcon.Icon");
|
||||||
|
trayIcon.Text = "notifyIcon1";
|
||||||
|
trayIcon.DoubleClick += restoreFromSystemTray;
|
||||||
|
//
|
||||||
|
// notificationMenu
|
||||||
|
//
|
||||||
|
notificationMenu.Items.AddRange(new ToolStripItem[] { actionPHToolStripMenuItem, cDPHToolStripMenuItem, executeToolStripMenuItem, cancelToolStripMenuItem });
|
||||||
|
notificationMenu.Name = "contextMenuStrip1";
|
||||||
|
notificationMenu.Size = new Size(137, 92);
|
||||||
|
//
|
||||||
|
// actionPHToolStripMenuItem
|
||||||
|
//
|
||||||
|
actionPHToolStripMenuItem.Enabled = false;
|
||||||
|
actionPHToolStripMenuItem.Name = "actionPHToolStripMenuItem";
|
||||||
|
actionPHToolStripMenuItem.Size = new Size(136, 22);
|
||||||
|
actionPHToolStripMenuItem.Text = "Placeholder";
|
||||||
|
//
|
||||||
|
// cDPHToolStripMenuItem
|
||||||
|
//
|
||||||
|
cDPHToolStripMenuItem.Name = "cDPHToolStripMenuItem";
|
||||||
|
cDPHToolStripMenuItem.Size = new Size(136, 22);
|
||||||
|
cDPHToolStripMenuItem.Text = "Placeholder";
|
||||||
|
//
|
||||||
|
// executeToolStripMenuItem
|
||||||
|
//
|
||||||
|
executeToolStripMenuItem.Name = "executeToolStripMenuItem";
|
||||||
|
executeToolStripMenuItem.Size = new Size(136, 22);
|
||||||
|
executeToolStripMenuItem.Text = "Execute";
|
||||||
|
executeToolStripMenuItem.Click += execNowTray_Click;
|
||||||
|
//
|
||||||
|
// cancelToolStripMenuItem
|
||||||
|
//
|
||||||
|
cancelToolStripMenuItem.Name = "cancelToolStripMenuItem";
|
||||||
|
cancelToolStripMenuItem.Size = new Size(136, 22);
|
||||||
|
cancelToolStripMenuItem.Text = "Cancel";
|
||||||
|
cancelToolStripMenuItem.Click += cancelTray_Click;
|
||||||
|
//
|
||||||
// CountdownForm
|
// CountdownForm
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
@@ -97,8 +160,10 @@
|
|||||||
MinimumSize = new Size(500, 135);
|
MinimumSize = new Size(500, 135);
|
||||||
Name = "CountdownForm";
|
Name = "CountdownForm";
|
||||||
Text = "CountdownForm";
|
Text = "CountdownForm";
|
||||||
|
Resize += onResize;
|
||||||
tableLayoutPanel1.ResumeLayout(false);
|
tableLayoutPanel1.ResumeLayout(false);
|
||||||
tableLayoutPanel1.PerformLayout();
|
tableLayoutPanel1.PerformLayout();
|
||||||
|
notificationMenu.ResumeLayout(false);
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,5 +173,12 @@
|
|||||||
private Button cancel;
|
private Button cancel;
|
||||||
private Button execNow;
|
private Button execNow;
|
||||||
private TableLayoutPanel tableLayoutPanel1;
|
private TableLayoutPanel tableLayoutPanel1;
|
||||||
|
private Button HideToSystemTray;
|
||||||
|
private NotifyIcon trayIcon;
|
||||||
|
private ContextMenuStrip notificationMenu;
|
||||||
|
private ToolStripMenuItem actionPHToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem cDPHToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem executeToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem cancelToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@ using System.Drawing;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
namespace GoToSleep
|
namespace GoToSleep
|
||||||
{
|
{
|
||||||
@@ -15,14 +16,39 @@ namespace GoToSleep
|
|||||||
public bool active = true;
|
public bool active = true;
|
||||||
private PowerDownData task;
|
private PowerDownData task;
|
||||||
private Thread taskThread;
|
private Thread taskThread;
|
||||||
public CountdownForm(PowerDownData taskData)
|
|
||||||
|
private FormCollection windowsToRestore;
|
||||||
|
|
||||||
|
private Form parent;
|
||||||
|
|
||||||
|
|
||||||
|
public CountdownForm(PowerDownData taskData, Form parent)
|
||||||
{
|
{
|
||||||
|
this.parent = parent;
|
||||||
|
|
||||||
task = taskData;
|
task = taskData;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.Text = task.actionType.ToString() + " Countdown";
|
this.Text = task.actionType.ToString() + " Countdown";
|
||||||
countdown.Text = getTimerText();
|
countdown.Text = getTimerText();
|
||||||
taskThread = new Thread(threadFunction);
|
taskThread = new Thread(threadFunction);
|
||||||
taskThread.Start();
|
taskThread.Start();
|
||||||
|
windowsToRestore = Application.OpenForms;
|
||||||
|
|
||||||
|
// Remove placeholders and replace with labels because the editor
|
||||||
|
// doesn't let you add the lables directly.
|
||||||
|
notificationMenu.Items.RemoveAt(0);
|
||||||
|
notificationMenu.Items.RemoveAt(0);
|
||||||
|
notificationMenu.Items.Insert(0, new ToolStripLabel());
|
||||||
|
notificationMenu.Items.Insert(0, new ToolStripLabel());
|
||||||
|
|
||||||
|
notificationMenu.Items[0].Text = task.actionType.ToString();
|
||||||
|
notificationMenu.Items[0].Padding = new Padding { Top = 1, Bottom = 1 };
|
||||||
|
|
||||||
|
notificationMenu.Items[1].Text = countdown.Text;
|
||||||
|
notificationMenu.Items[1].Padding = new Padding { Top = 1, Bottom = 1 };
|
||||||
|
|
||||||
|
trayIcon.Text = task.actionType.ToString() + "\n" + countdown.Text;
|
||||||
|
|
||||||
}
|
}
|
||||||
string getTimerText()
|
string getTimerText()
|
||||||
{
|
{
|
||||||
@@ -37,7 +63,10 @@ namespace GoToSleep
|
|||||||
{
|
{
|
||||||
countdown.Invoke((MethodInvoker)delegate
|
countdown.Invoke((MethodInvoker)delegate
|
||||||
{
|
{
|
||||||
|
// both controls should be owned by same thread
|
||||||
countdown.Text = getTimerText();
|
countdown.Text = getTimerText();
|
||||||
|
notificationMenu.Items[1].Text = countdown.Text;
|
||||||
|
trayIcon.Text = task.actionType.ToString() + "\n" + countdown.Text;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
@@ -87,6 +116,14 @@ namespace GoToSleep
|
|||||||
|
|
||||||
protected override void OnFormClosing(FormClosingEventArgs e)
|
protected override void OnFormClosing(FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (e.CloseReason == CloseReason.None && this.Visible == false)
|
||||||
|
{
|
||||||
|
// the window has been minimzed to tray, do not destroy it
|
||||||
|
e.Cancel = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
parent.Enabled = true;
|
||||||
|
trayIcon.Visible = false;
|
||||||
base.OnFormClosing(e);
|
base.OnFormClosing(e);
|
||||||
active = false;
|
active = false;
|
||||||
}
|
}
|
||||||
@@ -95,5 +132,48 @@ namespace GoToSleep
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onResize(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
// do we even want this behavior?
|
||||||
|
//if (this.WindowState == FormWindowState.Minimized)
|
||||||
|
//{
|
||||||
|
// hideToSystemTray(sender, e);
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void hideToSystemTray(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
foreach (Form form in Application.OpenForms)
|
||||||
|
{
|
||||||
|
form.Visible = false;
|
||||||
|
}
|
||||||
|
trayIcon.Visible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void restoreFromSystemTray(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
foreach (Form form in this.windowsToRestore)
|
||||||
|
{
|
||||||
|
form.Show();
|
||||||
|
}
|
||||||
|
this.Activate();
|
||||||
|
trayIcon.Visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void execNowTray_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
parent.Visible = true;
|
||||||
|
trayIcon.Visible = false;
|
||||||
|
execNow_Click(sender, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cancelTray_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
parent.Visible = true;
|
||||||
|
trayIcon.Visible = false;
|
||||||
|
cancel_Click(sender, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -117,4 +117,87 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
|
<metadata name="trayIcon.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="notificationMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>131, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<data name="trayIcon.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>
|
||||||
|
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAgBAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAP///////////////wAAAP8AAAD///////////////////////////8AAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAA//////////8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP//////////////
|
||||||
|
////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAA
|
||||||
|
AP8AAAD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///////////////wAAAP8AAAD/////////
|
||||||
|
//8AAAD/AAAA/wAAAP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////////AAAA/wAA
|
||||||
|
AP//////AAAAAP//////////////////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////////////////wAAAAAAAAAA////////
|
||||||
|
//8AAAD/AAAA/wAAAP//////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////////////////////////
|
||||||
|
//////////////////8AAAD/AAAA////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////wAAAP8AAAD/AAAA/wAA
|
||||||
|
AP///////////////////////////wAAAP8AAAD/AAAA//////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////AAAA/wAA
|
||||||
|
AP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP///////////wAAAP8AAAD///////////8AAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAD/////AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP//////AAAA/wAAAP8AAAD/////////
|
||||||
|
//8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAP////8AAAD/AAAA/wAAAP////////////////8AAAD/AAAA////////////AAAA/wAA
|
||||||
|
AP8AAAD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////8AAAD/AAAA/wAAAP////////////////8AAAD/AAAA/wAA
|
||||||
|
AP8AAAD/AAAA/wAAAP8AAAD//////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//
|
||||||
|
////////////////////////AAAAAAAAAAAAAAAA//////////8AAAD/AAAA/wAAAP///////////wAA
|
||||||
|
AP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP//////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAA//////////8AAAD/AAAA//////////////////////////////////////8AAAD/AAAA////
|
||||||
|
//////////////////////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAD/////AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD//////////////////////wAA
|
||||||
|
AP8AAAD/AAAA////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAA
|
||||||
|
AP///////////wAAAP8AAAD/AAAA////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////wAAAP8AAAD/AAAA////////////AAAA/wAA
|
||||||
|
AP8AAAD/AAAA/////////////////wAAAP8AAAD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////wAAAP8AAAD/AAAA////
|
||||||
|
////////////////////////////////////////AAAA/wAAAP8AAAD///////////8AAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////AAAA/wAA
|
||||||
|
AP8AAAD/////////////////AAAA/wAAAP8AAAD/AAAA/wAAAP//////AAAA/wAAAP8AAAD//////wAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAD/////AAAA/wAAAP8AAAD///////////8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAA
|
||||||
|
AP//////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAP//////////AAAA/wAAAP8AAAD///////////////////////////8AAAD/AAAA/wAA
|
||||||
|
AP8AAAD/AAAA//////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////AAAA/wAAAP8AAAD//////wAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////////AAAA/wAAAP8AAAD//////wAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAP////////////////////////////////////8AAAAA////////////////AAAA/wAA
|
||||||
|
AP8AAAD//////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAA/////wAAAP8AAAD/AAAA////////////////////////////////////
|
||||||
|
////////AAAA/wAAAP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAA
|
||||||
|
AP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP//////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///////////////wAAAP8AAAD/AAAA/wAA
|
||||||
|
AP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA//////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAD//////////////////////////////////////////////////////////wAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
|
||||||
|
</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -30,6 +30,11 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Update="Properties\Resources.Designer.cs">
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Update="Properties\Settings.Designer.cs">
|
<Compile Update="Properties\Settings.Designer.cs">
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
@@ -37,6 +42,13 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Update="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="Properties\Settings.settings">
|
<None Update="Properties\Settings.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
|||||||
+63
@@ -0,0 +1,63 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace GoToSleep.Properties {
|
||||||
|
using System;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||||
|
/// </summary>
|
||||||
|
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||||
|
// class via a tool like ResGen or Visual Studio.
|
||||||
|
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||||
|
// with the /str option, or rebuild your VS project.
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
internal class Resources {
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal Resources() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the cached ResourceManager instance used by this class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||||
|
get {
|
||||||
|
if (object.ReferenceEquals(resourceMan, null)) {
|
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GoToSleep.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Overrides the current thread's CurrentUICulture property for all
|
||||||
|
/// resource lookups using this strongly typed resource class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture {
|
||||||
|
get {
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
@@ -43,6 +43,8 @@ namespace GoToSleep
|
|||||||
}
|
}
|
||||||
Form parentForm;
|
Form parentForm;
|
||||||
|
|
||||||
|
CountdownForm? progressPopup;
|
||||||
|
|
||||||
string prepareTimeString(string s)
|
string prepareTimeString(string s)
|
||||||
{
|
{
|
||||||
// make sure there are spaces between numbers and units, for the parser
|
// make sure there are spaces between numbers and units, for the parser
|
||||||
@@ -139,10 +141,9 @@ namespace GoToSleep
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var progressPopup = new CountdownForm(PowerDownData.Shutdown(target)))
|
progressPopup = new CountdownForm(PowerDownData.Shutdown(target), parentForm);
|
||||||
{
|
progressPopup.Show();
|
||||||
progressPopup.ShowDialog(parentForm);
|
parentForm.Enabled = false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void suspend(string timeString)
|
public void suspend(string timeString)
|
||||||
@@ -162,10 +163,9 @@ namespace GoToSleep
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var progressPopup = new CountdownForm(PowerDownData.Suspend(target)))
|
progressPopup = new CountdownForm(PowerDownData.Suspend(target), parentForm);
|
||||||
{
|
progressPopup.Show();
|
||||||
progressPopup.ShowDialog(parentForm);
|
parentForm.Enabled = false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hibernate(string timeString)
|
public void hibernate(string timeString)
|
||||||
@@ -185,10 +185,9 @@ namespace GoToSleep
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var progressPopup = new CountdownForm(PowerDownData.Hibernate(target)))
|
progressPopup = new CountdownForm(PowerDownData.Hibernate(target), parentForm);
|
||||||
{
|
progressPopup.Show();
|
||||||
progressPopup.ShowDialog(parentForm);
|
parentForm.Enabled = false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void restart(string timeString)
|
public void restart(string timeString)
|
||||||
@@ -208,10 +207,9 @@ namespace GoToSleep
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var progressPopup = new CountdownForm(PowerDownData.Restart(target)))
|
progressPopup = new CountdownForm(PowerDownData.Restart(target), parentForm);
|
||||||
{
|
progressPopup.Show();
|
||||||
progressPopup.ShowDialog(parentForm);
|
parentForm.Enabled = false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user