# HG changeset patch # User moel.mich # Date 1290342511 0 # Node ID 99f16e21cdc85803bb3bfecd593e23c9346f1121 # Parent 07a9329cd87c7ec6dc9b7cbdf7c6c1b567919b46 Fixed Issue 137. diff -r 07a9329cd87c -r 99f16e21cdc8 GUI/Gadget.cs --- a/GUI/Gadget.cs Tue Nov 16 21:48:26 2010 +0000 +++ b/GUI/Gadget.cs Sun Nov 21 12:28:31 2010 +0000 @@ -137,7 +137,16 @@ remove { window.HitTest -= value; } - } + } + + public event MouseEventHandler MouseDoubleClick { + add { + window.MouseDoubleClick += value; + } + remove { + window.MouseDoubleClick -= value; + } + } private void CreateBuffer() { this.buffer = new Bitmap(window.Size.Width, window.Size.Height, diff -r 07a9329cd87c -r 99f16e21cdc8 GUI/GadgetWindow.cs --- a/GUI/GadgetWindow.cs Tue Nov 16 21:48:26 2010 +0000 +++ b/GUI/GadgetWindow.cs Sun Nov 21 12:28:31 2010 +0000 @@ -132,6 +132,11 @@ } } break; case WM_NCLBUTTONDBLCLK: { + if (MouseDoubleClick != null) { + MouseDoubleClick(this, new MouseEventArgs(MouseButtons.Left, 2, + Macros.GET_X_LPARAM(message.LParam) - location.X, + Macros.GET_Y_LPARAM(message.LParam) - location.Y, 0)); + } message.Result = IntPtr.Zero; } break; case WM_NCRBUTTONDOWN: { @@ -360,6 +365,8 @@ public event HitTestEventHandler HitTest; + public event MouseEventHandler MouseDoubleClick; + [StructLayout(LayoutKind.Sequential, Pack = 1)] private struct BlendFunction { public byte BlendOp; diff -r 07a9329cd87c -r 99f16e21cdc8 GUI/MainForm.cs --- a/GUI/MainForm.cs Tue Nov 16 21:48:26 2010 +0000 +++ b/GUI/MainForm.cs Sun Nov 21 12:28:31 2010 +0000 @@ -129,6 +129,8 @@ minCloseMenuItem.Visible = false; } else { // Windows gadget = new SensorGadget(computer, settings, unitManager); + gadget.HideShowCommand += hideShowClick; + wmiProvider = new WmiProvider(computer); } diff -r 07a9329cd87c -r 99f16e21cdc8 GUI/SensorGadget.cs --- a/GUI/SensorGadget.cs Tue Nov 16 21:48:26 2010 +0000 +++ b/GUI/SensorGadget.cs Sun Nov 21 12:28:31 2010 +0000 @@ -194,6 +194,10 @@ settings.SetValue("sensorGadget.Width", Size.Width); Redraw(); }; + + MouseDoubleClick += delegate(object obj, MouseEventArgs args) { + SendHideShowCommand(); + }; } public override void Dispose() { @@ -304,6 +308,13 @@ Resize(); } + public event EventHandler HideShowCommand; + + public void SendHideShowCommand() { + if (HideShowCommand != null) + HideShowCommand(this, null); + } + private Font CreateFont(float size, FontStyle style) { try { return new Font(SystemFonts.MessageBoxFont.FontFamily, size, style);