From: <nic...@us...> - 2014-01-14 15:44:22
|
Revision: 4727 http://sourceforge.net/p/mp-plugins/code/4727 Author: nicsergio Date: 2014-01-14 15:44:20 +0000 (Tue, 14 Jan 2014) Log Message: ----------- Modified Paths: -------------- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuter.csproj trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterKeyConfig.Designer.cs trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterKeyConfig.cs trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterKeyConfig.resx Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuter.csproj =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuter.csproj 2014-01-13 19:33:33 UTC (rev 4726) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuter.csproj 2014-01-14 15:44:20 UTC (rev 4727) @@ -6,7 +6,7 @@ <ProductVersion>8.0.30703</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{20CEBE32-A39E-4A61-B2BD-90BF16E2AEE8}</ProjectGuid> - <OutputType>Library</OutputType> + <OutputType>WinExe</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>ProcessPlugins.ShortCuter</RootNamespace> <AssemblyName>ShortCuter</AssemblyName> Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterKeyConfig.Designer.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterKeyConfig.Designer.cs 2014-01-13 19:33:33 UTC (rev 4726) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterKeyConfig.Designer.cs 2014-01-14 15:44:20 UTC (rev 4727) @@ -52,7 +52,7 @@ this.keyLabel.Name = "keyLabel"; this.keyLabel.Size = new System.Drawing.Size(163, 23); this.keyLabel.TabIndex = 0; - this.keyLabel.Text = "W"; + this.keyLabel.Text = "?"; this.keyLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // okPictureBox @@ -81,6 +81,8 @@ this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; this.Text = "ShortCut\'s Key"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ShortCuterKeyConfig_FormClosing); + this.Load += new System.EventHandler(this.ShortCuterKeyConfig_Load); this.keyGroupBox.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.okPictureBox)).EndInit(); this.ResumeLayout(false); Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterKeyConfig.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterKeyConfig.cs 2014-01-13 19:33:33 UTC (rev 4726) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterKeyConfig.cs 2014-01-14 15:44:20 UTC (rev 4727) @@ -8,6 +8,9 @@ { #region Dati private ShortCut mySc; + + private KeyboardHook keyboardHook; //Istanza classe KeyboardHook (gestione hook di tastiera) + #endregion #region Costruttore @@ -18,17 +21,45 @@ mySc = currentShortCut; Text = "'" + mySc.Caption + "' ShortCut"; keyLabel.Text = mySc.Key; + + keyboardHook = new KeyboardHook(); //--> creazione hook di tastiera + keyboardHook.KeyDown += new KeyEventHandler(keyboardHook_KeyDown); //--> sottoscrizione evento di KeyDown + + } #endregion #region Consumazione Eventi private void okPictureBox_Click(object sender, EventArgs e) { - mySc.Key = "X"; + mySc.Key = keyLabel.Text; this.Close(); } + + private void keyboardHook_KeyDown(object sender, KeyEventArgs e) //Evento KeyDown intercettato dall'hook + { //[esecuzione su thread secondario] + if (ShortCut.ModifierKeys.Contains(e.KeyCode)) + e.Handled = true; //Se il tasto premuto corrisponde ad un modificatore, viene ignorato + else + { + keyLabel.Text = e.KeyCode.ToString(); + e.Handled = true; + } + + } #endregion + private void ShortCuterKeyConfig_Load(object sender, EventArgs e) + { + } + + private void ShortCuterKeyConfig_FormClosing(object sender, FormClosingEventArgs e) + { + if (keyboardHook != null) + keyboardHook = null; + } + + } } Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterKeyConfig.resx =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterKeyConfig.resx 2014-01-13 19:33:33 UTC (rev 4726) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterKeyConfig.resx 2014-01-14 15:44:20 UTC (rev 4727) @@ -123,6 +123,9 @@ <metadata name="keyLabel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </metadata> + <metadata name="keyLabel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> <metadata name="okPictureBox.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </metadata> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |