From 29b3e6eb6007ac15b7a1ddd81a0217957865f797 Mon Sep 17 00:00:00 2001 From: LONELY-WOLF Date: Sun, 29 Apr 2018 10:08:13 +0300 Subject: [PATCH] Add sync option in context menu --- WatchDogeSync/Form1.Designer.cs | 18 ++++++++++++++---- WatchDogeSync/Form1.cs | 5 +++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/WatchDogeSync/Form1.Designer.cs b/WatchDogeSync/Form1.Designer.cs index d8bb85c..d43b0e2 100644 --- a/WatchDogeSync/Form1.Designer.cs +++ b/WatchDogeSync/Form1.Designer.cs @@ -46,6 +46,7 @@ private void InitializeComponent() this.labelStatus = new System.Windows.Forms.ToolStripStatusLabel(); this.textPort = new System.Windows.Forms.TextBox(); this.checkBoxSync = new System.Windows.Forms.CheckBox(); + this.syncToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.contextMenuStripTray.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numH)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numM)).BeginInit(); @@ -65,28 +66,29 @@ private void InitializeComponent() // this.contextMenuStripTray.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripMenuItem1, + this.syncToolStripMenuItem, this.toolStripSeparator1, this.toolStripMenuItem2}); this.contextMenuStripTray.Name = "contextMenuStripTray"; this.contextMenuStripTray.ShowImageMargin = false; - this.contextMenuStripTray.Size = new System.Drawing.Size(79, 54); + this.contextMenuStripTray.Size = new System.Drawing.Size(128, 98); // // toolStripMenuItem1 // this.toolStripMenuItem1.Name = "toolStripMenuItem1"; - this.toolStripMenuItem1.Size = new System.Drawing.Size(78, 22); + this.toolStripMenuItem1.Size = new System.Drawing.Size(127, 22); this.toolStripMenuItem1.Text = "Open"; this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(75, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(124, 6); // // toolStripMenuItem2 // this.toolStripMenuItem2.Name = "toolStripMenuItem2"; - this.toolStripMenuItem2.Size = new System.Drawing.Size(78, 22); + this.toolStripMenuItem2.Size = new System.Drawing.Size(127, 22); this.toolStripMenuItem2.Text = "Exit"; this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click); // @@ -187,6 +189,13 @@ private void InitializeComponent() this.checkBoxSync.UseVisualStyleBackColor = true; this.checkBoxSync.CheckedChanged += new System.EventHandler(this.checkBoxSync_CheckedChanged); // + // syncToolStripMenuItem + // + this.syncToolStripMenuItem.Name = "syncToolStripMenuItem"; + this.syncToolStripMenuItem.Size = new System.Drawing.Size(127, 22); + this.syncToolStripMenuItem.Text = "Sync"; + this.syncToolStripMenuItem.Click += new System.EventHandler(this.syncToolStripMenuItem_Click); + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -238,6 +247,7 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2; + private System.Windows.Forms.ToolStripMenuItem syncToolStripMenuItem; } } diff --git a/WatchDogeSync/Form1.cs b/WatchDogeSync/Form1.cs index 90beca5..e0530f1 100644 --- a/WatchDogeSync/Form1.cs +++ b/WatchDogeSync/Form1.cs @@ -144,6 +144,11 @@ private void Form1_Shown(object sender, EventArgs e) } } + private void syncToolStripMenuItem_Click(object sender, EventArgs e) + { + SetTime(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second); + } + private void Form1_Load(object sender, EventArgs e) { string[] args = Environment.GetCommandLineArgs();