diff --git a/Nacollector/Resources/html_res/assets/app.css b/Nacollector/Resources/html_res/assets/app.css
index 2627589..8109305 100644
--- a/Nacollector/Resources/html_res/assets/app.css
+++ b/Nacollector/Resources/html_res/assets/app.css
@@ -33,19 +33,24 @@ button, input, select, textarea {
}
.wrap {
+ position: fixed;
+ top: 65px;
+ left: 0;
+ right: 0;
overflow-x: hidden;
overflow-y: auto;
- width: 100%;
- height: 100%;
+ height: calc(100vh - 75px);
+ width: 100vw;
opacity: 0;
transition: opacity .4s cubic-bezier(0.65, 0.05, 0.36, 1), background .4s cubic-bezier(0.65, 0.05, 0.36, 1);
+ background: #333333;
}
.container {
overflow: hidden;
padding-right: 15px;
padding-left: 15px;
- padding-top: 75px;
+ padding-top: 35px;
padding-bottom: 35px;
margin-right: auto;
margin-left: auto;
@@ -180,7 +185,7 @@ button, input, select, textarea {
}
/* user-select disable */
-.top-nav-bar, .big-header, .app-select, .app-form label, ::-webkit-input-placeholder {
+.title-bar, .top-nav-bar, .big-header, .app-select, .app-form label, ::-webkit-input-placeholder {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
@@ -261,16 +266,95 @@ button, input, select, textarea {
}
}
+/* Title Bar */
+.title-bar {
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ height: 25px;
+ width: 100vw;
+ background: #1565c0;
+ z-index: 99999;
+}
+
+.title-bar.blur {
+ /* background: #1565c0; */
+}
+
+.title-bar-inner {
+ height: 100%;
+ width: 100%;
+ -webkit-app-region: drag;
+ user-select: none;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ position: relative;
+}
+
+.title-bar .controls {
+ display: flex;
+ width: 120px;
+ height: 100%;
+ justify-content: space-between;
+ position: absolute;
+ right: 7px;
+}
+
+.title-bar .controls .window-icon-bg {
+ display: inline-block;
+ -webkit-app-region: no-drag;
+ height: 100%;
+ width: 33.34%;
+ transition: background .2s ease-in-out;
+}
+
+.title-bar .controls .window-icon {
+ height: 100%;
+ width: 100%;
+ -webkit-mask-size: 23.1%;
+ background-color: #ffffff;
+}
+
+.title-bar .controls .window-minimize {
+ -webkit-mask: url(./icons/minimize.svg) no-repeat 50% 50%;
+}
+
+.title-bar .controls .window-maximize {
+ -webkit-mask: url(./icons/maximize.svg) no-repeat 50% 50%;
+}
+
+.title-bar .controls .window-unmaximize {
+ -webkit-mask: url(./icons/unmaximize.svg) no-repeat 50% 50%;
+}
+
+.title-bar .controls .window-close {
+ -webkit-mask: url(./icons/close.svg) no-repeat 50% 50%;
+}
+
+.title-bar .controls .window-icon-bg:hover {
+ background-color: hsla(0,0%,100%,.1);
+}
+
+.title-bar .controls .window-icon-bg.red:hover {
+ background-color: rgba(232,17,35,.9);
+}
+
/* Nav Bar */
.top-nav-bar {
z-index: 999;
position: fixed;
height: 40px;
- width: 100%;
+ left: 0;
+ right: 0;
+ width: 100vw;
+ top: 25px;
background: #1565c0;
display: flex;
align-items: center;
box-shadow: rgba(0, 0, 0, 0.12) 0px 1px 6px, rgba(0, 0, 0, 0.12) 0px 1px 4px;
+ -webkit-app-region: drag;
}
.top-nav-bar .left-items, .top-nav-bar .right-items {
@@ -303,6 +387,7 @@ button, input, select, textarea {
float: right;
overflow: hidden;
border-radius: 0;
+ -webkit-app-region: no-drag;
}
.top-nav-bar .right-items .nav-btns .btn-group {
@@ -310,6 +395,7 @@ button, input, select, textarea {
padding-right: 15px;
margin-right: 15px;
border-right: 1px solid rgba(255, 255, 255, 0.08);
+ -webkit-app-region: no-drag;
}
.top-nav-bar .right-items .nav-btns .btn-group:last-child {
@@ -1034,16 +1120,16 @@ button, input, select, textarea {
.sidebar-layer .sidebar-block {
position: fixed;
z-index: 998;
- height: 100%;
width: 360px;
- top: 0px;
+ top: 65px;
+ height: calc(100vh - 65px);
right: 0px;
color: rgba(0, 0, 0, 0.87);
background: rgb(255, 255, 255);
transition: transform 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms;
box-shadow: rgba(0, 0, 0, 0.16) 0px 3px 10px, rgba(0, 0, 0, 0.23) 0px 3px 10px;
border-radius: 0px;
- padding: 40px 0 0 0;
+ padding: 0;
transform: translate(370px, 0px);
/* 360px + 10px */
}
@@ -1313,7 +1399,7 @@ button, input, select, textarea {
max-width: 600px;
width: 100%;
padding-right: 60px;
- z-index: 1001;
+ z-index: 99999;
}
.notify-layer .notify-item {
diff --git a/Nacollector/Resources/html_res/assets/app.js b/Nacollector/Resources/html_res/assets/app.js
index 0954662..fe5df29 100644
--- a/Nacollector/Resources/html_res/assets/app.js
+++ b/Nacollector/Resources/html_res/assets/app.js
@@ -1,6 +1,6 @@
/**
- * Created by Zneiat on 2017/7/15.
- * https://github.com/Zneiat/Nacollector
+ * Created by qwqcode on 2017/7/15.
+ * https://github.com/qwqcode/Nacollector
*/
/**
@@ -432,7 +432,7 @@ window.TaskGen = {
// 取消显示 dropdown-option
dropdownOptionHide();
// 当前 li 置顶
- $(this).insertBefore(dropdownOptionDom.find('li:first-child'));
+ // $(this).insertBefore(dropdownOptionDom.find('li:first-child'));
});
li.appendTo(dropdownOptionDom);
});
@@ -1113,10 +1113,10 @@ AppNavbar.panel = {
};
// 自动调整位置
panelObj.setPosition = function () {
- var position = $.getPosition(btnDom);
+ var position = btnDom[0].getBoundingClientRect();
var panelWidth = $(panelSel).outerWidth();
$(panelSel)
- .css('top', position['top'] + 'px')
+ .css('top', position['top'] - 25 + 'px')
.css('left', position['right'] - panelWidth + 'px');
};
// 显示
@@ -1634,12 +1634,12 @@ window.setting = {
AppAction.getVersion().then(function (version) {
infoAppVersion.text(version);
});
- itemAt(groupAbout).infoShow('作者', '
ZNEIAT');
+ itemAt(groupAbout).infoShow('作者', '
qwqcode');
itemAt(groupAbout).infoShow('联系', '1149527164@qq.com');
- itemAt(groupAbout).infoShow('博客', '
http://www.qwqaq.com');
- itemAt(groupAbout).infoShow('GitHub', '
Zneiat/Nacollector');
- itemAt(groupAbout).infoShow('', '
您使用 Nacollector 即视为您已阅读并同意本《Nacollector 用户使用许可协议》的约束');
- itemAt(groupAbout).infoShow('', '
Nacollector Copyright (C) 2018
Zneiat');
+ itemAt(groupAbout).infoShow('博客', '
qwqaq.com');
+ itemAt(groupAbout).infoShow('GitHub', '
qwqcode/Nacollector');
+ itemAt(groupAbout).infoShow('', '
您使用 Nacollector 即视为您已阅读并同意本《Nacollector 用户使用许可协议》的约束');
+ itemAt(groupAbout).infoShow('', '
Nacollector Copyright (C) 2018
qwqaq.com');
}
};
diff --git a/Nacollector/Resources/html_res/assets/icons/close.svg b/Nacollector/Resources/html_res/assets/icons/close.svg
new file mode 100644
index 0000000..3b02b08
--- /dev/null
+++ b/Nacollector/Resources/html_res/assets/icons/close.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/Nacollector/Resources/html_res/assets/icons/maximize.svg b/Nacollector/Resources/html_res/assets/icons/maximize.svg
new file mode 100644
index 0000000..6f76d58
--- /dev/null
+++ b/Nacollector/Resources/html_res/assets/icons/maximize.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/Nacollector/Resources/html_res/assets/icons/minimize.svg b/Nacollector/Resources/html_res/assets/icons/minimize.svg
new file mode 100644
index 0000000..869a1c1
--- /dev/null
+++ b/Nacollector/Resources/html_res/assets/icons/minimize.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/Nacollector/Resources/html_res/assets/icons/unmaximize.svg b/Nacollector/Resources/html_res/assets/icons/unmaximize.svg
new file mode 100644
index 0000000..0ac7922
--- /dev/null
+++ b/Nacollector/Resources/html_res/assets/icons/unmaximize.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/Nacollector/Ui/FormBase.cs b/Nacollector/Ui/FormBase.cs
new file mode 100644
index 0000000..51c58d1
--- /dev/null
+++ b/Nacollector/Ui/FormBase.cs
@@ -0,0 +1,321 @@
+using CefSharp;
+using CefSharp.WinForms;
+using Nacollector.Browser;
+using Nacollector.Browser.Handler;
+using Nacollector.JsActions;
+using Nacollector.Spiders;
+using Nacollector.Ui;
+using Nacollector.Util;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Diagnostics;
+using System.Drawing;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+
+namespace Nacollector.Ui
+{
+ ///
+ /// Based on http://customerborderform.codeplex.com/
+ ///
+ public partial class FormBase : Form
+ {
+ public void DecorationMouseDown(HitTestValues hit, Point p)
+ {
+ NativeMethods.ReleaseCapture();
+ var pt = new POINTS { X = (short)p.X, Y = (short)p.Y };
+ NativeMethods.SendMessage(Handle, (int)WindowMessages.WM_NCLBUTTONDOWN, (int)hit, pt);
+ }
+
+ public void DecorationMouseDown(HitTestValues hit)
+ {
+ DecorationMouseDown(hit, MousePosition);
+ }
+
+ public void DecorationMouseUp(HitTestValues hit, Point p)
+ {
+ NativeMethods.ReleaseCapture();
+ var pt = new POINTS { X = (short)p.X, Y = (short)p.Y };
+ NativeMethods.SendMessage(Handle, (int)WindowMessages.WM_NCLBUTTONUP, (int)hit, pt);
+ }
+
+ public void DecorationMouseUp(HitTestValues hit)
+ {
+ DecorationMouseUp(hit, MousePosition);
+ }
+
+ protected override void OnHandleCreated(EventArgs e)
+ {
+ base.OnHandleCreated(e);
+
+ if (!DesignMode)
+ SetWindowRegion(Handle, 0, 0, Width, Height);
+ }
+
+ protected static int MakeLong(short lowPart, short highPart)
+ {
+ return (int)(((ushort)lowPart) | (uint)(highPart << 16));
+ }
+
+ public void ShowSystemMenu(Point pos)
+ {
+ NativeMethods.SendMessage(Handle, (int)WindowMessages.WM_SYSMENU, 0, MakeLong((short)pos.X, (short)pos.Y));
+ }
+
+ protected override void WndProc(ref Message m)
+ {
+ if (DesignMode)
+ {
+ base.WndProc(ref m);
+ return;
+ }
+
+ switch (m.Msg)
+ {
+ case (int)WindowMessages.WM_NCCALCSIZE:
+ {
+ // Provides new coordinates for the window client area.
+ WmNCCalcSize(ref m);
+ break;
+ }
+ case (int)WindowMessages.WM_NCPAINT:
+ {
+ // Here should all our painting occur, but...
+ WmNCPaint(ref m);
+ break;
+ }
+ case (int)WindowMessages.WM_NCACTIVATE:
+ {
+ // ... WM_NCACTIVATE does some painting directly
+ // without bothering with WM_NCPAINT ...
+ WmNCActivate(ref m);
+ break;
+ }
+ case (int)WindowMessages.WM_SETTEXT:
+ {
+ // ... and some painting is required in here as well
+ WmSetText(ref m);
+ break;
+ }
+ case (int)WindowMessages.WM_WINDOWPOSCHANGED:
+ {
+ WmWindowPosChanged(ref m);
+ break;
+ }
+ case 174: // ignore magic message number
+ {
+ break;
+ }
+ default:
+ {
+ base.WndProc(ref m);
+ break;
+ }
+ }
+ }
+
+ private void SetWindowRegion(IntPtr hwnd, int left, int top, int right, int bottom)
+ {
+ var hrg = new HandleRef((object)this, NativeMethods.CreateRectRgn(0, 0, 0, 0));
+ var r = NativeMethods.GetWindowRgn(hwnd, hrg.Handle);
+ RECT box;
+ NativeMethods.GetRgnBox(hrg.Handle, out box);
+ if (box.left != left || box.top != top || box.right != right || box.bottom != bottom)
+ {
+ var hr = new HandleRef((object)this, NativeMethods.CreateRectRgn(left, top, right, bottom));
+ NativeMethods.SetWindowRgn(hwnd, hr.Handle, NativeMethods.IsWindowVisible(hwnd));
+ }
+ }
+
+ public FormWindowState MinMaxState
+ {
+ get
+ {
+ var s = NativeMethods.GetWindowLong(Handle, NativeConstants.GWL_STYLE);
+ var max = (s & (int)WindowStyle.WS_MAXIMIZE) > 0;
+ if (max) return FormWindowState.Maximized;
+ var min = (s & (int)WindowStyle.WS_MINIMIZE) > 0;
+ if (min) return FormWindowState.Minimized;
+ return FormWindowState.Normal;
+ }
+ }
+
+ private void WmWindowPosChanged(ref Message m)
+ {
+ DefWndProc(ref m);
+ UpdateBounds();
+ var pos = (WINDOWPOS)Marshal.PtrToStructure(m.LParam, typeof(WINDOWPOS));
+ SetWindowRegion(m.HWnd, 0, 0, pos.cx, pos.cy);
+ m.Result = NativeConstants.TRUE;
+ }
+
+ private void WmNCCalcSize(ref Message m)
+ {
+ // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowmessages/wm_nccalcsize.asp
+ // http://groups.google.pl/groups?selm=OnRNaGfDEHA.1600%40tk2msftngp13.phx.gbl
+
+ var r = (RECT)Marshal.PtrToStructure(m.LParam, typeof(RECT));
+ var max = MinMaxState == FormWindowState.Maximized;
+
+ if (max)
+ {
+ var x = NativeMethods.GetSystemMetrics(NativeConstants.SM_CXSIZEFRAME);
+ var y = NativeMethods.GetSystemMetrics(NativeConstants.SM_CYSIZEFRAME);
+ var p = NativeMethods.GetSystemMetrics(NativeConstants.SM_CXPADDEDBORDER);
+ var w = x + p;
+ var h = y + p;
+
+ r.left += w;
+ r.top += h;
+ r.right -= w;
+ r.bottom -= h;
+
+ var appBarData = new APPBARDATA();
+ appBarData.cbSize = Marshal.SizeOf(typeof(APPBARDATA));
+ var autohide = (NativeMethods.SHAppBarMessage(NativeConstants.ABM_GETSTATE, ref appBarData) & NativeConstants.ABS_AUTOHIDE) != 0;
+ if (autohide) r.bottom -= 1;
+
+ Marshal.StructureToPtr(r, m.LParam, true);
+ }
+
+ m.Result = IntPtr.Zero;
+ }
+
+ private void WmNCPaint(ref Message msg)
+ {
+ // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/pantdraw_8gdw.asp
+ // example in q. 2.9 on http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c41c.aspx#q1026q
+
+ // The WParam contains handle to clipRegion or 1 if entire window should be repainted
+ //PaintNonClientArea(msg.HWnd, (IntPtr)msg.WParam);
+
+ // we handled everything
+ msg.Result = NativeConstants.TRUE;
+ }
+
+ private void WmSetText(ref Message msg)
+ {
+ // allow the system to receive the new window title
+ DefWndProc(ref msg);
+
+ // repaint title bar
+ //PaintNonClientArea(msg.HWnd, (IntPtr)1);
+ }
+
+ private void WmNCActivate(ref Message msg)
+ {
+ // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowmessages/wm_ncactivate.asp
+
+ bool active = (msg.WParam == NativeConstants.TRUE);
+
+ if (MinMaxState == FormWindowState.Minimized)
+ DefWndProc(ref msg);
+ else
+ {
+ // repaint title bar
+ //PaintNonClientArea(msg.HWnd, (IntPtr)1);
+
+ // allow to deactivate window
+ msg.Result = NativeConstants.TRUE;
+ }
+ }
+ }
+
+ public partial class FormBase : Form
+ {
+ public FormWindowState ToggleMaximize()
+ {
+ return WindowState = WindowState == FormWindowState.Maximized ? FormWindowState.Normal : FormWindowState.Maximized;
+ }
+ }
+
+ public partial class FormBase : Form {
+ /**
+ * 模拟 操作系统的标准标题栏 拖动
+ */
+
+ [System.Runtime.InteropServices.DllImportAttribute("user32.dll")]
+ public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
+ [System.Runtime.InteropServices.DllImportAttribute("user32.dll")]
+ public static extern bool ReleaseCapture();
+
+ public const int WM_NCLBUTTONDOWN = 0xA1;
+ public const int HT_CAPTION = 0x2;
+
+ // 界面线程执行拖动操作
+ public void SendHandleMessage()
+ {
+ if (InvokeRequired) { Invoke(new SendHandleMessageDelegate(SendHandleMessage), new object[] { }); return; }
+
+ SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
+ }
+ public delegate void SendHandleMessageDelegate();
+ }
+
+ public partial class FormBase : Form
+ {
+ protected Form startingForm;
+
+ ///
+ /// 设置程序启动画面
+ ///
+ protected void SetIsStarting(bool isStarting)
+ {
+ if (this.InvokeRequired) { this.Invoke(new SetIsStartingDelegate(SetIsStarting), new object[] { isStarting }); return; }
+
+ if (isStarting)
+ {
+ startingForm = new Form
+ {
+ Size = new Size(640, 400),
+ TopMost = true,
+ ControlBox = false,
+ ShowInTaskbar = false,
+ AutoSizeMode = AutoSizeMode.GrowAndShrink,
+ FormBorderStyle = FormBorderStyle.None,
+ StartPosition = FormStartPosition.CenterScreen,
+ BackgroundImageLayout = ImageLayout.Zoom,
+ BackgroundImage = Properties.Resources.StartingImg,
+ BackColor = ColorTranslator.FromHtml("#282c34")
+ };
+ startingForm.Show();
+ this.Opacity = 0;
+ }
+ else
+ {
+ startingForm.Hide();
+ this.Opacity = 1;
+ }
+
+ }
+ protected delegate void SetIsStartingDelegate(bool isStarting);
+
+ protected void SplashScreen_MainForm_Load(object sender, EventArgs e)
+ {
+ // 程序启动画面
+ SetIsStarting(true);
+ }
+
+ protected void SplashScreen_Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e)
+ {
+ // 关闭程序启动画面
+ SetIsStarting(false);
+ }
+ }
+
+ public partial class FormBase : Form
+ {
+
+ }
+}
diff --git a/Nacollector/Util/Native.cs b/Nacollector/Util/Native.cs
new file mode 100644
index 0000000..01ffd6f
--- /dev/null
+++ b/Nacollector/Util/Native.cs
@@ -0,0 +1,396 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace Nacollector.Util
+{
+ public enum GetWindow_Cmd : uint
+ {
+ GW_HWNDFIRST = 0,
+ GW_HWNDLAST = 1,
+ GW_HWNDNEXT = 2,
+ GW_HWNDPREV = 3,
+ GW_OWNER = 4,
+ GW_CHILD = 5,
+ GW_ENABLEDPOPUP = 6
+ }
+
+ public enum HitTestValues
+ {
+ HTERROR = -2,
+ HTTRANSPARENT = -1,
+ HTNOWHERE = 0,
+ HTCLIENT = 1,
+ HTCAPTION = 2,
+ HTSYSMENU = 3,
+ HTGROWBOX = 4,
+ HTMENU = 5,
+ HTHSCROLL = 6,
+ HTVSCROLL = 7,
+ HTMINBUTTON = 8,
+ HTMAXBUTTON = 9,
+ HTLEFT = 10,
+ HTRIGHT = 11,
+ HTTOP = 12,
+ HTTOPLEFT = 13,
+ HTTOPRIGHT = 14,
+ HTBOTTOM = 15,
+ HTBOTTOMLEFT = 16,
+ HTBOTTOMRIGHT = 17,
+ HTBORDER = 18,
+ HTOBJECT = 19,
+ HTCLOSE = 20,
+ HTHELP = 21
+ }
+
+ public enum WindowMessages
+ {
+ WM_NULL = 0x0000,
+ WM_CREATE = 0x0001,
+ WM_DESTROY = 0x0002,
+ WM_MOVE = 0x0003,
+ WM_SIZE = 0x0005,
+ WM_ACTIVATE = 0x0006,
+ WM_SETFOCUS = 0x0007,
+ WM_KILLFOCUS = 0x0008,
+ WM_ENABLE = 0x000A,
+ WM_SETREDRAW = 0x000B,
+ WM_SETTEXT = 0x000C,
+ WM_GETTEXT = 0x000D,
+ WM_GETTEXTLENGTH = 0x000E,
+ WM_PAINT = 0x000F,
+ WM_CLOSE = 0x0010,
+
+ WM_QUIT = 0x0012,
+ WM_ERASEBKGND = 0x0014,
+ WM_SYSCOLORCHANGE = 0x0015,
+ WM_SHOWWINDOW = 0x0018,
+
+ WM_ACTIVATEAPP = 0x001C,
+
+ WM_SETCURSOR = 0x0020,
+ WM_MOUSEACTIVATE = 0x0021,
+ WM_GETMINMAXINFO = 0x24,
+ WM_WINDOWPOSCHANGING = 0x0046,
+ WM_WINDOWPOSCHANGED = 0x0047,
+
+ WM_CONTEXTMENU = 0x007B,
+ WM_STYLECHANGING = 0x007C,
+ WM_STYLECHANGED = 0x007D,
+ WM_DISPLAYCHANGE = 0x007E,
+ WM_GETICON = 0x007F,
+ WM_SETICON = 0x0080,
+
+ // non client area
+ WM_NCCREATE = 0x0081,
+ WM_NCDESTROY = 0x0082,
+ WM_NCCALCSIZE = 0x0083,
+ WM_NCHITTEST = 0x84,
+ WM_NCPAINT = 0x0085,
+ WM_NCACTIVATE = 0x0086,
+
+ WM_GETDLGCODE = 0x0087,
+
+ WM_SYNCPAINT = 0x0088,
+
+ // non client mouse
+ WM_NCMOUSEMOVE = 0x00A0,
+ WM_NCLBUTTONDOWN = 0x00A1,
+ WM_NCLBUTTONUP = 0x00A2,
+ WM_NCLBUTTONDBLCLK = 0x00A3,
+ WM_NCRBUTTONDOWN = 0x00A4,
+ WM_NCRBUTTONUP = 0x00A5,
+ WM_NCRBUTTONDBLCLK = 0x00A6,
+ WM_NCMBUTTONDOWN = 0x00A7,
+ WM_NCMBUTTONUP = 0x00A8,
+ WM_NCMBUTTONDBLCLK = 0x00A9,
+
+ // keyboard
+ WM_KEYDOWN = 0x0100,
+ WM_KEYUP = 0x0101,
+ WM_CHAR = 0x0102,
+
+ WM_SYSCOMMAND = 0x0112,
+
+ // menu
+ WM_INITMENU = 0x0116,
+ WM_INITMENUPOPUP = 0x0117,
+ WM_MENUSELECT = 0x011F,
+ WM_MENUCHAR = 0x0120,
+ WM_ENTERIDLE = 0x0121,
+ WM_MENURBUTTONUP = 0x0122,
+ WM_MENUDRAG = 0x0123,
+ WM_MENUGETOBJECT = 0x0124,
+ WM_UNINITMENUPOPUP = 0x0125,
+ WM_MENUCOMMAND = 0x0126,
+
+ WM_CHANGEUISTATE = 0x0127,
+ WM_UPDATEUISTATE = 0x0128,
+ WM_QUERYUISTATE = 0x0129,
+
+ // mouse
+ WM_MOUSEFIRST = 0x0200,
+ WM_MOUSEMOVE = 0x0200,
+ WM_LBUTTONDOWN = 0x0201,
+ WM_LBUTTONUP = 0x0202,
+ WM_LBUTTONDBLCLK = 0x0203,
+ WM_RBUTTONDOWN = 0x0204,
+ WM_RBUTTONUP = 0x0205,
+ WM_RBUTTONDBLCLK = 0x0206,
+ WM_MBUTTONDOWN = 0x0207,
+ WM_MBUTTONUP = 0x0208,
+ WM_MBUTTONDBLCLK = 0x0209,
+ WM_MOUSEWHEEL = 0x020A,
+ WM_MOUSELAST = 0x020D,
+
+ WM_PARENTNOTIFY = 0x0210,
+ WM_ENTERMENULOOP = 0x0211,
+ WM_EXITMENULOOP = 0x0212,
+
+ WM_NEXTMENU = 0x0213,
+ WM_SIZING = 0x0214,
+ WM_CAPTURECHANGED = 0x0215,
+ WM_MOVING = 0x0216,
+
+ WM_ENTERSIZEMOVE = 0x0231,
+ WM_EXITSIZEMOVE = 0x0232,
+
+ WM_MOUSELEAVE = 0x02A3,
+ WM_MOUSEHOVER = 0x02A1,
+ WM_NCMOUSEHOVER = 0x02A0,
+ WM_NCMOUSELEAVE = 0x02A2,
+
+ WM_MDIACTIVATE = 0x0222,
+ WM_HSCROLL = 0x0114,
+ WM_VSCROLL = 0x0115,
+
+ WM_SYSMENU = 0x313,
+
+ WM_PRINT = 0x0317,
+ WM_PRINTCLIENT = 0x0318,
+ }
+
+ public enum SystemCommands
+ {
+ SC_SIZE = 0xF000,
+ SC_MOVE = 0xF010,
+ SC_MINIMIZE = 0xF020,
+ SC_MAXIMIZE = 0xF030,
+ SC_MAXIMIZE2 = 0xF032, // fired from double-click on caption
+ SC_NEXTWINDOW = 0xF040,
+ SC_PREVWINDOW = 0xF050,
+ SC_CLOSE = 0xF060,
+ SC_VSCROLL = 0xF070,
+ SC_HSCROLL = 0xF080,
+ SC_MOUSEMENU = 0xF090,
+ SC_KEYMENU = 0xF100,
+ SC_ARRANGE = 0xF110,
+ SC_RESTORE = 0xF120,
+ SC_RESTORE2 = 0xF122, // fired from double-click on caption
+ SC_TASKLIST = 0xF130,
+ SC_SCREENSAVE = 0xF140,
+ SC_HOTKEY = 0xF150,
+
+ SC_DEFAULT = 0xF160,
+ SC_MONITORPOWER = 0xF170,
+ SC_CONTEXTHELP = 0xF180,
+ SC_SEPARATOR = 0xF00F
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct RECT
+ {
+ public int left;
+ public int top;
+ public int right;
+ public int bottom;
+
+ public RECT(int left, int top, int right, int bottom)
+ {
+ this.left = left;
+ this.top = top;
+ this.right = right;
+ this.bottom = bottom;
+ }
+
+ public static RECT FromXYWH(int x, int y, int width, int height)
+ {
+ return new RECT(x,
+ y,
+ x + width,
+ y + height);
+ }
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct WINDOWPOS
+ {
+ internal IntPtr hwnd;
+ internal IntPtr hWndInsertAfter;
+ internal int x;
+ internal int y;
+ internal int cx;
+ internal int cy;
+ internal uint flags;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct POINTS
+ {
+ public short X;
+ public short Y;
+ }
+
+ [Flags]
+ public enum WindowStyle
+ {
+ WS_OVERLAPPED = 0x00000000,
+ WS_POPUP = -2147483648, //0x80000000,
+ WS_CHILD = 0x40000000,
+ WS_MINIMIZE = 0x20000000,
+ WS_VISIBLE = 0x10000000,
+ WS_DISABLED = 0x08000000,
+ WS_CLIPSIBLINGS = 0x04000000,
+ WS_CLIPCHILDREN = 0x02000000,
+ WS_MAXIMIZE = 0x01000000,
+ WS_CAPTION = 0x00C00000,
+ WS_BORDER = 0x00800000,
+ WS_DLGFRAME = 0x00400000,
+ WS_VSCROLL = 0x00200000,
+ WS_HSCROLL = 0x00100000,
+ WS_SYSMENU = 0x00080000,
+ WS_THICKFRAME = 0x00040000,
+ WS_GROUP = 0x00020000,
+ WS_TABSTOP = 0x00010000,
+ WS_MINIMIZEBOX = 0x00020000,
+ WS_MAXIMIZEBOX = 0x00010000,
+ WS_TILED = WS_OVERLAPPED,
+ WS_ICONIC = WS_MINIMIZE,
+ WS_SIZEBOX = WS_THICKFRAME,
+ WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW,
+ WS_OVERLAPPEDWINDOW = (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU |
+ WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX),
+ WS_POPUPWINDOW = (WS_POPUP | WS_BORDER | WS_SYSMENU),
+ WS_CHILDWINDOW = (WS_CHILD)
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct NativeMessage
+ {
+ public IntPtr handle;
+ public uint msg;
+ public IntPtr wParam;
+ public IntPtr lParam;
+ public uint time;
+ public System.Drawing.Point p;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct APPBARDATA
+ {
+ public int cbSize; // initialize this field using: Marshal.SizeOf(typeof(APPBARDATA));
+ public IntPtr hWnd;
+ public uint uCallbackMessage;
+ public uint uEdge;
+ public RECT rc;
+ public int lParam;
+ }
+
+ public static class NativeMethods
+ {
+ [DllImport("user32.dll")]
+ public static extern bool ReleaseCapture();
+
+ [DllImport("user32.dll")]
+ public static extern IntPtr SetCapture(IntPtr hWnd);
+
+ [DllImport("user32.dll")]
+ public static extern IntPtr GetCapture();
+
+ [DllImport("user32.dll")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ public static extern bool SetForegroundWindow(IntPtr hWnd);
+
+ [DllImport("user32.dll", SetLastError = true)]
+ public static extern IntPtr SetActiveWindow(IntPtr hWnd);
+
+ [DllImport("user32.dll")]
+ public static extern int SendMessage(IntPtr hwnd, int msg, int wparam, int lparam);
+
+ [DllImport("user32.dll")]
+ public static extern int PostMessage(IntPtr hwnd, int msg, int wparam, int lparam);
+
+ [DllImport("user32.dll")]
+ public static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);
+
+ [DllImport("user32.dll")]
+ public static extern int TrackPopupMenuEx(IntPtr hmenu, uint fuFlags, int x, int y,
+ IntPtr hwnd, IntPtr lptpm);
+
+ [DllImport("user32.dll")]
+ public static extern int SendMessage(IntPtr hwnd, int wMsg, IntPtr wParam, IntPtr lParam);
+
+ [DllImport("user32.dll")]
+ public static extern int SendMessage(IntPtr hwnd, int msg, int wparam, POINTS pos);
+
+ [DllImport("user32.dll")]
+ public static extern int PostMessage(IntPtr hwnd, int wMsg, IntPtr wParam, IntPtr lParam);
+
+ [DllImport("user32.dll")]
+ public static extern int PostMessage(IntPtr hwnd, int msg, int wparam, POINTS pos);
+
+ [DllImport("user32.dll")]
+ public static extern int SetWindowRgn(IntPtr hWnd, IntPtr hRgn, bool bRedraw);
+
+ [DllImport("user32.dll")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ public static extern bool IsWindowVisible(IntPtr hWnd);
+
+ [DllImport("gdi32.dll")]
+ public static extern IntPtr CreateRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);
+
+ [DllImport("user32.dll")]
+ public static extern int GetWindowRgn(IntPtr hWnd, IntPtr hRgn);
+
+ [DllImport("gdi32.dll")]
+ public static extern int GetRgnBox(IntPtr hrgn, out RECT lprc);
+
+ [DllImport("user32.dll")]
+ public static extern Int32 GetWindowLong(IntPtr hWnd, Int32 Offset);
+
+ [DllImport("user32.dll")]
+ public static extern int GetSystemMetrics(int smIndex);
+
+ [DllImport("user32.dll", SetLastError = true)]
+ public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string className, string windowTitle);
+
+ [DllImport("shell32.dll")]
+ public static extern int SHAppBarMessage(uint dwMessage, [In] ref APPBARDATA pData);
+ }
+
+ public static class NativeConstants
+ {
+ public const int SM_CXSIZEFRAME = 32;
+ public const int SM_CYSIZEFRAME = 33;
+ public const int SM_CXPADDEDBORDER = 92;
+
+ public const int GWL_ID = (-12);
+ public const int GWL_STYLE = (-16);
+ public const int GWL_EXSTYLE = (-20);
+
+ public const int WM_NCLBUTTONDOWN = 0x00A1;
+ public const int WM_NCRBUTTONUP = 0x00A5;
+
+ public const uint TPM_LEFTBUTTON = 0x0000;
+ public const uint TPM_RIGHTBUTTON = 0x0002;
+ public const uint TPM_RETURNCMD = 0x0100;
+
+ public static readonly IntPtr TRUE = new IntPtr(1);
+ public static readonly IntPtr FALSE = new IntPtr(0);
+
+ public const uint ABM_GETSTATE = 0x4;
+ public const int ABS_AUTOHIDE = 0x1;
+ }
+}
diff --git a/Nacollector/packages.config b/Nacollector/packages.config
index ebd170b..f0a74c4 100644
--- a/Nacollector/packages.config
+++ b/Nacollector/packages.config
@@ -4,7 +4,6 @@
-