├── .gitignore ├── BandObjectLib ├── Attributes.cs ├── BandObject.cs ├── BandObject.resx ├── BandObjectLib.csproj ├── BandObjects.snk ├── ComInterop.cs └── RegisterLib │ ├── RegisterLib.vcproj │ ├── RegisterLib.vcxproj │ └── RegisterLib.vcxproj.filters ├── ChDCStatMenus.sln ├── ChDCStatMenus ├── AssemblyInfo.cs ├── ChDCStatMenus.csproj ├── ChDCStatMenus.csproj.user ├── ChDCStatMenus.snk ├── DeskBand.cs ├── DeskBand.resx ├── FrmCPU.Designer.cs ├── FrmCPU.cs ├── FrmDisks.Designer.cs ├── FrmDisks.cs ├── FrmInfo.Designer.cs ├── FrmInfo.cs ├── FrmInfo.resx ├── FrmMemory.Designer.cs ├── FrmMemory.cs ├── FrmMemory.resx ├── FrmNetwork.Designer.cs ├── FrmNetwork.cs ├── FrmNetwork.resx ├── FrmPanel.Designer.cs ├── FrmPanel.cs ├── FrmPanel.resx ├── Program.cs ├── Properties │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── Register │ ├── Register.vcproj │ ├── Register.vcxproj │ └── Register.vcxproj.filters └── app.config ├── ChDCStatMenusLibrary ├── ChDCStatMenusLibrary.csproj ├── ChDCStatMenusLibrary.snk ├── NetworkInfo.cs ├── NetworkSpeed.cs ├── ProcessInfo.cs ├── Properties │ └── AssemblyInfo.cs └── TimeInfo.cs ├── ChDCStatMenusLibraryTests ├── ChDCStatMenusLibraryTests.csproj ├── NetworkInfoTests.cs ├── NetworkSpeedInfoTests.cs ├── NetworkSpeedTests.cs ├── ProcessInfoTests.cs ├── Properties │ └── AssemblyInfo.cs └── TimeInfoTests.cs ├── LICENSE ├── README.md ├── Screenshots ├── Screenshot_20170405103515.png ├── Screenshot_20170405103852.png ├── Screenshot_20170405104620.png └── install.png └── Tools └── installDesktopband.bat /.gitignore: -------------------------------------------------------------------------------- 1 | .vs/ 2 | **/obj/ 3 | **/bin/ 4 | -------------------------------------------------------------------------------- /BandObjectLib/Attributes.cs: -------------------------------------------------------------------------------- 1 | // Copyright Pavel Zolnikov, 2002 2 | // 3 | 4 | using System; 5 | 6 | namespace BandObjectLib 7 | { 8 | /// 9 | /// Represents different styles of a band object. 10 | /// 11 | [Flags] 12 | [Serializable] 13 | public enum BandObjectStyle : uint 14 | { 15 | Vertical = 1, 16 | Horizontal = 2, 17 | ExplorerToolbar = 4, 18 | TaskbarToolBar = 8 19 | } 20 | 21 | /// 22 | /// Specifies Style of the band object, its Name(displayed in explorer menu) and HelpText(displayed in status bar when menu command selected). 23 | /// 24 | [AttributeUsage(AttributeTargets.Class)] 25 | public class BandObjectAttribute : System.Attribute 26 | { 27 | public BandObjectAttribute(){} 28 | 29 | public BandObjectAttribute(string name, BandObjectStyle style) 30 | { 31 | Name = name; 32 | Style = style; 33 | } 34 | public BandObjectStyle Style; 35 | public string Name; 36 | public string HelpText; 37 | } 38 | } -------------------------------------------------------------------------------- /BandObjectLib/BandObject.cs: -------------------------------------------------------------------------------- 1 | // Copyright Pavel Zolnikov, 2002 2 | // 3 | // BandObject - implements generic Band Object functionality. 4 | 5 | using System; 6 | using System.Windows.Forms; 7 | using System.Runtime.InteropServices; 8 | //using SHDocVw; 9 | using System.Reflection; 10 | using System.Drawing; 11 | using System.ComponentModel; 12 | using Microsoft.Win32; 13 | 14 | [assembly: AssemblyVersion("1.0.0.0")] 15 | [assembly: AssemblyKeyFile(@"..\..\..\BandObjects.snk")] 16 | 17 | namespace BandObjectLib 18 | { 19 | /// 20 | /// Implements generic Band Object functionality. 21 | /// 22 | /// 23 | /// [Guid("YOURGUID-GOES-HERE-YOUR-GUIDGOESHERE")] 24 | /// [BandObject("Hello World Bar", BandObjectStyle.Horizontal | BandObjectStyle.ExplorerToolbar , HelpText = "Shows bar that says hello.")] 25 | /// public class HelloWorldBar : BandObject 26 | /// { /*...*/ } 27 | /// 28 | public class BandObject : UserControl, IObjectWithSite, IDeskBand2, IDockingWindow, IOleWindow, IInputObject 29 | { 30 | public const int E_NOTIMPL = unchecked((int)0x80004001); 31 | public const int S_OK = 0; 32 | 33 | 34 | /// 35 | /// Reference to the host explorer. 36 | /// 37 | //protected WebBrowserClass Explorer; 38 | protected IInputObjectSite BandObjectSite; 39 | /// 40 | /// This event is fired after reference to hosting explorer is retreived and stored in Explorer property. 41 | /// 42 | public event EventHandler ExplorerAttached; 43 | 44 | public BandObject() 45 | { 46 | InitializeComponent(); 47 | } 48 | 49 | private void InitializeComponent() 50 | { 51 | // 52 | // ExplorerBar 53 | // 54 | this.Name = "BandObject"; 55 | } 56 | 57 | 58 | /// 59 | /// Title of band object. Displayed at the left or on top of the band object. 60 | /// 61 | [Browsable(true)] 62 | [DefaultValue("")] 63 | public String Title 64 | { 65 | get 66 | { 67 | return _title; 68 | } 69 | set 70 | { 71 | _title = value; 72 | } 73 | }String _title; 74 | 75 | 76 | /// 77 | /// Minimum size of the band object. Default value of -1 sets no minimum constraint. 78 | /// 79 | [Browsable(true)] 80 | [DefaultValue(typeof(Size),"-1,-1")] 81 | public Size MinSize 82 | { 83 | get 84 | { 85 | return _minSize; 86 | } 87 | set 88 | { 89 | _minSize = value; 90 | } 91 | }Size _minSize = new Size(-1,-1); 92 | 93 | /// 94 | /// Maximum size of the band object. Default value of -1 sets no maximum constraint. 95 | /// 96 | [Browsable(true)] 97 | [DefaultValue(typeof(Size),"-1,-1")] 98 | public Size MaxSize 99 | { 100 | get 101 | { 102 | return _maxSize; 103 | } 104 | set 105 | { 106 | _maxSize = value; 107 | } 108 | }Size _maxSize = new Size(-1,-1); 109 | 110 | /// 111 | /// Says that band object's size must be multiple of this size. Defauilt value of -1 does not set this constraint. 112 | /// 113 | [Browsable(true)] 114 | [DefaultValue(typeof(Size),"-1,-1")] 115 | public Size IntegralSize 116 | { 117 | get 118 | { 119 | return _integralSize; 120 | } 121 | set 122 | { 123 | _integralSize = value; 124 | } 125 | }Size _integralSize = new Size(-1,-1); 126 | 127 | 128 | public virtual void GetBandInfo( 129 | UInt32 dwBandID, 130 | UInt32 dwViewMode, 131 | ref DESKBANDINFO dbi) 132 | { 133 | dbi.wszTitle = this.Title; 134 | 135 | dbi.ptActual.X = this.Size.Width; 136 | dbi.ptActual.Y = this.Size.Height; 137 | 138 | dbi.ptMaxSize.X = this.MaxSize.Width; 139 | dbi.ptMaxSize.Y = this.MaxSize.Height; 140 | 141 | dbi.ptMinSize.X = this.MinSize.Width; 142 | dbi.ptMinSize.Y = this.MinSize.Height; 143 | 144 | dbi.ptIntegral.X = this.IntegralSize.Width; 145 | dbi.ptIntegral.Y = this.IntegralSize.Height; 146 | 147 | dbi.dwModeFlags = DBIM.TITLE | DBIM.ACTUAL | DBIM.MAXSIZE | DBIM.MINSIZE | DBIM.INTEGRAL; 148 | } 149 | 150 | 151 | 152 | public virtual int CanRenderComposited(out bool pfCanRenderComposited) 153 | { 154 | pfCanRenderComposited = true; 155 | return S_OK; 156 | 157 | } 158 | 159 | public virtual int GetCompositionState(out bool pfCompositionEnabled) 160 | { 161 | pfCompositionEnabled = false; 162 | return S_OK; 163 | 164 | } 165 | 166 | /// 167 | /// Not used. 168 | /// 169 | public virtual int ResizeBorderDW(IntPtr prcBorder, Object punkToolbarSite, bool fReserved) 170 | { 171 | return E_NOTIMPL; 172 | } 173 | 174 | public virtual void SetSite(Object pUnkSite) 175 | { 176 | if( BandObjectSite != null ) 177 | Marshal.ReleaseComObject( BandObjectSite ); 178 | 179 | //if (Explorer != null) 180 | //{ 181 | // Marshal.ReleaseComObject(Explorer); 182 | // Explorer = null; 183 | //} 184 | 185 | BandObjectSite = (IInputObjectSite)pUnkSite; 186 | if( BandObjectSite != null ) 187 | { 188 | //pUnkSite is a pointer to object that implements IOleWindowSite or something similar 189 | //we need to get access to the top level object - explorer itself 190 | //to allows this explorer objects also implement IServiceProvider interface 191 | //(don't mix it with System.IServiceProvider!) 192 | //we get this interface and ask it to find WebBrowserApp 193 | _IServiceProvider sp = BandObjectSite as _IServiceProvider; 194 | Guid guid = ExplorerGUIDs.IID_IWebBrowserApp; 195 | Guid riid = ExplorerGUIDs.IID_IUnknown; 196 | 197 | try 198 | { 199 | object w; 200 | sp.QueryService( 201 | ref guid, 202 | ref riid, 203 | out w ); 204 | 205 | //once we have interface to the COM object we can create RCW from it 206 | //Explorer = (WebBrowserClass)Marshal.CreateWrapperOfType( 207 | // w as IWebBrowser, 208 | // typeof(WebBrowserClass) 209 | // ); 210 | 211 | OnExplorerAttached(EventArgs.Empty); 212 | } 213 | catch( COMException ) 214 | { 215 | //we anticipate this exception in case our object instantiated 216 | //as a Desk Band. There is no web browser service available. 217 | } 218 | } 219 | 220 | } 221 | 222 | public virtual void GetSite(ref Guid riid, out Object ppvSite) 223 | { 224 | ppvSite = BandObjectSite; 225 | } 226 | 227 | /// 228 | /// Called explorer when focus has to be chenged. 229 | /// 230 | public virtual void UIActivateIO(Int32 fActivate, ref MSG Msg) 231 | { 232 | if( fActivate != 0 ) 233 | { 234 | Control ctrl = GetNextControl(this,true);//first 235 | if( ModifierKeys == Keys.Shift ) 236 | ctrl = GetNextControl(ctrl,false );//last 237 | 238 | if( ctrl != null ) ctrl.Select(); 239 | this.Focus(); 240 | } 241 | } 242 | 243 | public virtual Int32 HasFocusIO() 244 | { 245 | return this.ContainsFocus ? 0 : 1; //S_OK : S_FALSE; 246 | } 247 | 248 | /// 249 | /// Called by explorer to process keyboard events. Undersatands Tab and F6. 250 | /// 251 | /// 252 | /// S_OK if message was processed, S_FALSE otherwise. 253 | public virtual Int32 TranslateAcceleratorIO(ref MSG msg) 254 | { 255 | if( msg.message == 0x100 )//WM_KEYDOWN 256 | if( msg.wParam == (uint)Keys.Tab || msg.wParam == (uint)Keys.F6 )//keys used by explorer to navigate from control to control 257 | if( SelectNextControl( 258 | ActiveControl, 259 | ModifierKeys == Keys.Shift ? false : true, 260 | true, 261 | true, 262 | false ) 263 | ) 264 | return 0;//S_OK 265 | 266 | return 1;//S_FALSE 267 | } 268 | 269 | /// 270 | /// Override this method to handle ExplorerAttached event. 271 | /// 272 | /// 273 | protected virtual void OnExplorerAttached(EventArgs ea) 274 | { 275 | if ( ExplorerAttached != null ) 276 | ExplorerAttached(this, ea); 277 | } 278 | 279 | /// 280 | /// Notifies explorer of focus change. 281 | /// 282 | protected override void OnGotFocus(System.EventArgs e) 283 | { 284 | base.OnGotFocus(e); 285 | BandObjectSite.OnFocusChangeIS(this as IInputObject, 1); 286 | } 287 | /// 288 | /// Notifies explorer of focus change. 289 | /// 290 | protected override void OnLostFocus(System.EventArgs e) 291 | { 292 | base.OnLostFocus(e); 293 | if( ActiveControl == null ) 294 | BandObjectSite.OnFocusChangeIS(this as IInputObject, 0); 295 | } 296 | 297 | 298 | /// 299 | /// Called when derived class is registered as a COM server. 300 | /// 301 | [ComRegisterFunctionAttribute] 302 | public static void Register(Type t) 303 | { 304 | string guid = t.GUID.ToString("B"); 305 | 306 | RegistryKey rkClass = Registry.ClassesRoot.CreateSubKey(@"CLSID\"+guid ); 307 | RegistryKey rkCat = rkClass.CreateSubKey("Implemented Categories"); 308 | 309 | BandObjectAttribute[] boa = (BandObjectAttribute[])t.GetCustomAttributes( 310 | typeof(BandObjectAttribute), 311 | false ); 312 | 313 | string name = t.Name; 314 | string help = t.Name; 315 | BandObjectStyle style = 0; 316 | if( boa.Length == 1 ) 317 | { 318 | if( boa[0].Name != null ) 319 | name = boa[0].Name; 320 | 321 | if( boa[0].HelpText != null ) 322 | help = boa[0].HelpText; 323 | 324 | style = boa[0].Style; 325 | } 326 | 327 | rkClass.SetValue(null, name ); 328 | rkClass.SetValue("MenuText", name ); 329 | rkClass.SetValue("HelpText", help ); 330 | 331 | if( 0 != (style & BandObjectStyle.Vertical) ) 332 | rkCat.CreateSubKey("{00021493-0000-0000-C000-000000000046}"); 333 | 334 | if( 0 != (style & BandObjectStyle.Horizontal) ) 335 | rkCat.CreateSubKey("{00021494-0000-0000-C000-000000000046}"); 336 | 337 | if( 0 != (style & BandObjectStyle.TaskbarToolBar) ) 338 | rkCat.CreateSubKey("{00021492-0000-0000-C000-000000000046}"); 339 | 340 | if( 0 != (style & BandObjectStyle.ExplorerToolbar) ) 341 | Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Microsoft\Internet Explorer\Toolbar").SetValue(guid,name); 342 | 343 | } 344 | 345 | /// 346 | /// Called when derived class is unregistered as a COM server. 347 | /// 348 | [ComUnregisterFunctionAttribute] 349 | public static void Unregister(Type t) 350 | { 351 | string guid = t.GUID.ToString("B"); 352 | BandObjectAttribute[] boa = (BandObjectAttribute[])t.GetCustomAttributes( 353 | typeof(BandObjectAttribute), 354 | false ); 355 | 356 | BandObjectStyle style = 0; 357 | if( boa.Length == 1 ) style = boa[0].Style; 358 | 359 | if( 0 != (style & BandObjectStyle.ExplorerToolbar) ) 360 | Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Microsoft\Internet Explorer\Toolbar").DeleteValue(guid,false); 361 | 362 | Registry.ClassesRoot.CreateSubKey(@"CLSID").DeleteSubKeyTree(guid); 363 | } 364 | 365 | public int GetWindow(out IntPtr phwnd) 366 | { 367 | phwnd = Handle; 368 | return S_OK; 369 | 370 | } 371 | 372 | public int ContextSensitiveHelp(bool fEnterMode) 373 | { 374 | return S_OK; 375 | } 376 | 377 | public int ShowDW(bool bShow) 378 | { 379 | if (bShow) 380 | Show(); 381 | else 382 | Hide(); 383 | 384 | return S_OK; 385 | } 386 | 387 | public int CloseDW(uint dwReserved) 388 | { 389 | Dispose(true); 390 | return S_OK; 391 | } 392 | 393 | public int ResizeBorderDW(RECT rcBorder, IntPtr punkToolbarSite, bool fReserved) 394 | { 395 | return E_NOTIMPL; 396 | } 397 | 398 | public int GetBandInfo(uint dwBandID, DESKBANDINFO.DBIF dwViewMode, ref DESKBANDINFO pdbi) 399 | { 400 | pdbi.wszTitle = this.Title; 401 | 402 | pdbi.ptActual.X = this.Size.Width; 403 | pdbi.ptActual.Y = this.Size.Height; 404 | 405 | pdbi.ptMaxSize.X = this.MaxSize.Width; 406 | pdbi.ptMaxSize.Y = this.MaxSize.Height; 407 | 408 | pdbi.ptMinSize.X = this.MinSize.Width; 409 | pdbi.ptMinSize.Y = this.MinSize.Height; 410 | 411 | pdbi.ptIntegral.X = this.IntegralSize.Width; 412 | pdbi.ptIntegral.Y = this.IntegralSize.Height; 413 | 414 | pdbi.dwModeFlags = DBIM.TITLE | DBIM.ACTUAL | DBIM.MAXSIZE | DBIM.MINSIZE | DBIM.INTEGRAL; 415 | 416 | return S_OK; 417 | } 418 | 419 | public int SetCompositionState(bool fCompositionEnabled) 420 | { 421 | fCompositionEnabled = true; 422 | return S_OK; 423 | } 424 | 425 | } 426 | } -------------------------------------------------------------------------------- /BandObjectLib/BandObject.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | text/microsoft-resx 89 | 90 | 91 | 1.3 92 | 93 | 94 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 95 | 96 | 97 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 98 | 99 | 100 | ExplorerBarForm 101 | 102 | -------------------------------------------------------------------------------- /BandObjectLib/BandObjectLib.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Local 5 | 7.0.9466 6 | 1.0 7 | {BDB3B670-A17B-483E-954C-52FC2B6FF9D3} 8 | Debug 9 | AnyCPU 10 | 11 | 12 | BandObjectLib 13 | BandObjects.snk 14 | JScript 15 | Grid 16 | IE50 17 | false 18 | Library 19 | BandObjectLib 20 | 21 | 22 | 23 | v4.6 24 | 25 | 26 | 0.0 27 | 28 | 29 | 30 | bin\Debug\ 31 | false 32 | 285212672 33 | false 34 | 35 | DEBUG;TRACE 36 | 37 | true 38 | 4096 39 | false 40 | false 41 | false 42 | false 43 | 4 44 | full 45 | prompt 46 | false 47 | 48 | 49 | bin\Release\ 50 | false 51 | 285212672 52 | false 53 | 54 | TRACE 55 | 56 | false 57 | 4096 58 | true 59 | false 60 | false 61 | false 62 | 4 63 | none 64 | prompt 65 | false 66 | 67 | 68 | true 69 | 70 | 71 | 72 | System 73 | 74 | 75 | System.Drawing 76 | 77 | 78 | System.Windows.Forms 79 | 80 | 81 | 82 | 83 | Code 84 | 85 | 86 | UserControl 87 | 88 | 89 | Code 90 | 91 | 92 | BandObject.cs 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /BandObjectLib/BandObjects.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChDC/ChDCStatMenus/0ba28a883800a0ff9ee096d0154578ebf6f5d9de/BandObjectLib/BandObjects.snk -------------------------------------------------------------------------------- /BandObjectLib/ComInterop.cs: -------------------------------------------------------------------------------- 1 | // This file is a part of the Command Prompt Explorer Bar project. 2 | // 3 | // Copyright Pavel Zolnikov, 2002 4 | // 5 | // declarations of some COM interfaces and structues 6 | 7 | using System; 8 | using System.Drawing; 9 | using System.Runtime.InteropServices; 10 | 11 | namespace BandObjectLib 12 | { 13 | 14 | abstract class ExplorerGUIDs 15 | { 16 | public static readonly Guid IID_IWebBrowserApp = new Guid("{0002DF05-0000-0000-C000-000000000046}"); 17 | public static readonly Guid IID_IUnknown = new Guid("{00000000-0000-0000-C000-000000000046}"); 18 | } 19 | 20 | 21 | 22 | [Flags] 23 | public enum DBIM : uint 24 | { 25 | MINSIZE =0x0001, 26 | MAXSIZE =0x0002, 27 | INTEGRAL =0x0004, 28 | ACTUAL =0x0008, 29 | TITLE =0x0010, 30 | MODEFLAGS =0x0020, 31 | BKCOLOR =0x0040 32 | } 33 | 34 | 35 | [StructLayout(LayoutKind.Sequential,CharSet=CharSet.Unicode)] 36 | public struct DESKBANDINFO 37 | { 38 | public UInt32 dwMask; 39 | public Point ptMinSize; 40 | public Point ptMaxSize; 41 | public Point ptIntegral; 42 | public Point ptActual; 43 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst=255)] 44 | public String wszTitle; 45 | public DBIM dwModeFlags; 46 | public Int32 crBkgnd; 47 | 48 | /// 49 | /// The view mode of the band object. This is one of the following values. 50 | /// 51 | [Flags] 52 | public enum DBIF : uint 53 | { 54 | /// 55 | /// Band object is displayed in a horizontal band. 56 | /// 57 | DBIF_VIEWMODE_NORMAL = 0x0000, 58 | 59 | /// 60 | /// Band object is displayed in a vertical band. 61 | /// 62 | DBIF_VIEWMODE_VERTICAL = 0x0001, 63 | 64 | /// 65 | /// Band object is displayed in a floating band. 66 | /// 67 | DBIF_VIEWMODE_FLOATING = 0x0002, 68 | 69 | /// 70 | /// Band object is displayed in a transparent band. 71 | /// 72 | DBIF_VIEWMODE_TRANSPARENT = 0x0004 73 | } 74 | 75 | }; 76 | 77 | [ComImport] 78 | [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 79 | [Guid("FC4801A3-2BA9-11CF-A229-00AA003D7352")] 80 | public interface IObjectWithSite 81 | { 82 | void SetSite([In ,MarshalAs(UnmanagedType.IUnknown)] Object pUnkSite); 83 | void GetSite(ref Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out Object ppvSite); 84 | } 85 | 86 | /// 87 | /// The IOleWindow interface provides methods that allow an application to obtain the handle to the various windows that participate in in-place activation, and also to enter and exit context-sensitive help mode. 88 | /// 89 | [ComImport] 90 | [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 91 | [Guid("00000114-0000-0000-C000-000000000046")] 92 | public interface IOleWindow 93 | { 94 | /// 95 | /// Retrieves a handle to one of the windows participating in in-place activation (frame, document, parent, or in-place object window). 96 | /// 97 | /// A pointer to a variable that receives the window handle. 98 | /// This method returns S_OK on success. 99 | [PreserveSig] 100 | int GetWindow(out IntPtr phwnd); 101 | 102 | /// 103 | /// Determines whether context-sensitive help mode should be entered during an in-place activation session. 104 | /// 105 | /// TRUE if help mode should be entered; FALSE if it should be exited. 106 | /// This method returns S_OK if the help mode was entered or exited successfully, depending on the value passed in fEnterMode. 107 | [PreserveSig] 108 | int ContextSensitiveHelp(bool fEnterMode); 109 | }; 110 | 111 | [ComImport] 112 | [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 113 | [Guid("012dd920-7b26-11d0-8ca9-00a0c92dbfe8")] 114 | public interface IDockingWindow 115 | { 116 | int GetWindow(out System.IntPtr phwnd); 117 | int ContextSensitiveHelp([In] bool fEnterMode); 118 | 119 | int ShowDW([In] bool fShow); 120 | int CloseDW([In] UInt32 dwReserved); 121 | int ResizeBorderDW( 122 | IntPtr prcBorder, 123 | [In, MarshalAs(UnmanagedType.IUnknown)] Object punkToolbarSite, 124 | bool fReserved); 125 | } 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | /// 152 | /// Gets information about a band object. 153 | /// 154 | [ComImport] 155 | [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 156 | [Guid("EB0FE172-1A3A-11D0-89B3-00A0C90A90AC")] 157 | public interface IDeskBand : IDockingWindow 158 | { 159 | #region IOleWindow Overrides 160 | 161 | [PreserveSig] 162 | new int GetWindow(out IntPtr phwnd); 163 | 164 | [PreserveSig] 165 | new int ContextSensitiveHelp(bool fEnterMode); 166 | 167 | #endregion 168 | 169 | #region Overrides of IDockingWindow 170 | 171 | [PreserveSig] 172 | new int ShowDW(bool bShow); 173 | 174 | [PreserveSig] 175 | new int CloseDW(UInt32 dwReserved); 176 | 177 | [PreserveSig] 178 | int ResizeBorderDW(RECT rcBorder, IntPtr punkToolbarSite, bool fReserved); 179 | 180 | #endregion 181 | 182 | /// 183 | /// Gets state information for a band object. 184 | /// 185 | /// The identifier of the band, assigned by the container. The band object can retain this value if it is required. 186 | /// The view mode of the band object. One of the following values: DBIF_VIEWMODE_NORMAL, DBIF_VIEWMODE_VERTICAL, DBIF_VIEWMODE_FLOATING, DBIF_VIEWMODE_TRANSPARENT. 187 | /// The pdbi. 188 | /// 189 | [PreserveSig] 190 | int GetBandInfo(UInt32 dwBandID, DESKBANDINFO.DBIF dwViewMode, ref DESKBANDINFO pdbi); 191 | } 192 | 193 | /// 194 | /// Exposes methods to enable and query translucency effects in a deskband object. 195 | /// 196 | [ComImport] 197 | [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 198 | [Guid("79D16DE4-ABEE-4021-8D9D-9169B261D657")] 199 | public interface IDeskBand2 : IDeskBand 200 | { 201 | #region IOleWindow Overrides 202 | 203 | [PreserveSig] 204 | new int GetWindow(out IntPtr phwnd); 205 | 206 | [PreserveSig] 207 | new int ContextSensitiveHelp(bool fEnterMode); 208 | 209 | #endregion 210 | 211 | #region Overrides of IDockingWindow 212 | 213 | [PreserveSig] 214 | new int ShowDW(bool bShow); 215 | 216 | [PreserveSig] 217 | new int CloseDW(UInt32 dwReserved); 218 | 219 | [PreserveSig] 220 | new int ResizeBorderDW(RECT rcBorder, IntPtr punkToolbarSite, bool fReserved); 221 | 222 | #endregion 223 | 224 | #region IDeskBand Overrides 225 | 226 | [PreserveSig] 227 | new int GetBandInfo(UInt32 dwBandID, DESKBANDINFO.DBIF dwViewMode, ref DESKBANDINFO pdbi); 228 | 229 | #endregion 230 | 231 | /// 232 | /// Indicates the deskband's ability to be displayed as translucent. 233 | /// 234 | /// When this method returns, contains a BOOL indicating ability. 235 | /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. 236 | [PreserveSig] 237 | int CanRenderComposited(out bool pfCanRenderComposited); 238 | 239 | /// 240 | /// Sets the composition state. 241 | /// 242 | /// TRUE to enable the composition state; otherwise, FALSE. 243 | /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. 244 | [PreserveSig] 245 | int SetCompositionState(bool fCompositionEnabled); 246 | 247 | /// 248 | /// Gets the composition state. 249 | /// 250 | /// When this method returns, contains a BOOL that indicates state. 251 | /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. 252 | [PreserveSig] 253 | int GetCompositionState(out bool pfCompositionEnabled); 254 | } 255 | 256 | [ComImport] 257 | [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 258 | [Guid("0000010c-0000-0000-C000-000000000046")] 259 | public interface IPersist 260 | { 261 | void GetClassID(out Guid pClassID); 262 | } 263 | 264 | 265 | [ComImport] 266 | [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 267 | [Guid("00000109-0000-0000-C000-000000000046")] 268 | public interface IPersistStream 269 | { 270 | void GetClassID(out Guid pClassID); 271 | 272 | void IsDirty (); 273 | 274 | void Load ([In, MarshalAs(UnmanagedType.Interface)] Object pStm); 275 | 276 | void Save ([In, MarshalAs(UnmanagedType.Interface)] Object pStm, 277 | [In] bool fClearDirty); 278 | 279 | void GetSizeMax ([Out] out UInt64 pcbSize); 280 | } 281 | 282 | 283 | [ComImport] 284 | [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 285 | [Guid("6d5140c1-7436-11ce-8034-00aa006009fa")] 286 | public interface _IServiceProvider 287 | { 288 | void QueryService( 289 | ref Guid guid, 290 | ref Guid riid, 291 | [MarshalAs(UnmanagedType.Interface)] out Object Obj); 292 | } 293 | 294 | 295 | [ComImport] 296 | [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 297 | [Guid("68284faa-6a48-11d0-8c78-00c04fd918b4")] 298 | public interface IInputObject 299 | { 300 | void UIActivateIO(Int32 fActivate, ref MSG msg); 301 | 302 | [PreserveSig] 303 | //[return:MarshalAs(UnmanagedType.Error)] 304 | Int32 HasFocusIO(); 305 | 306 | [PreserveSig] 307 | Int32 TranslateAcceleratorIO(ref MSG msg); 308 | } 309 | 310 | [ComImport] 311 | [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 312 | [Guid("f1db8392-7331-11d0-8c99-00a0c92dbfe8")] 313 | public interface IInputObjectSite 314 | { 315 | [PreserveSig] 316 | Int32 OnFocusChangeIS( [MarshalAs(UnmanagedType.IUnknown)] Object punkObj, Int32 fSetFocus); 317 | } 318 | 319 | public struct POINT 320 | { 321 | public Int32 x; 322 | public Int32 y; 323 | } 324 | 325 | public struct MSG 326 | { 327 | public IntPtr hwnd; 328 | public UInt32 message; 329 | public UInt32 wParam; 330 | public Int32 lParam; 331 | public UInt32 time; 332 | public POINT pt; 333 | } 334 | 335 | [StructLayout(LayoutKind.Sequential)] 336 | public struct RECT 337 | { 338 | public RECT(int left, int top, int right, int bottom) 339 | { 340 | this.left = left; 341 | this.top = top; 342 | this.right = right; 343 | this.bottom = bottom; 344 | } 345 | 346 | 347 | public int left, top, right, bottom; 348 | 349 | public int Width() 350 | { 351 | return right - left; 352 | } 353 | 354 | public int Height() 355 | { 356 | return bottom - top; 357 | } 358 | 359 | public void Offset(int x, int y) 360 | { 361 | left += x; 362 | right += x; 363 | top += y; 364 | bottom += y; 365 | } 366 | 367 | public void Set(int left, int top, int right, int bottom) 368 | { 369 | this.left = left; 370 | this.top = top; 371 | this.right = right; 372 | this.bottom = bottom; 373 | } 374 | 375 | public bool IsEmpty() 376 | { 377 | return Width() == 0 && Height() == 0; 378 | } 379 | } 380 | 381 | } -------------------------------------------------------------------------------- /BandObjectLib/RegisterLib/RegisterLib.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 11 | 12 | 13 | 19 | 21 | 23 | 31 | 33 | 34 | 40 | 42 | 44 | 51 | 53 | 54 | 55 | 56 | 59 | 60 | 63 | 64 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /BandObjectLib/RegisterLib/RegisterLib.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {E35915FE-ED91-4AE5-B566-F269CD854498} 15 | Win32Proj 16 | 17 | 18 | 19 | Utility 20 | v140 21 | MultiByte 22 | 23 | 24 | Utility 25 | v140 26 | MultiByte 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | <_ProjectFileVersion>14.0.25431.1 40 | 41 | 42 | Debug\ 43 | Debug\ 44 | 45 | 46 | Release\ 47 | Release\ 48 | 49 | 50 | 51 | cd $(ProjectDir)..\bin\Debug 52 | 53 | "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\x64\gacutil.exe" /if BandObjectLib.dll 54 | "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\x64\gacutil.exe" /if Interop.SHDocVw.dll 55 | 56 | 57 | 58 | 59 | 60 | 61 | cd $(ProjectDir)..\bin\Release 62 | 63 | gacutil /if BandObjectLib.dll 64 | gacutil /if Interop.SHDocVw.dll 65 | 66 | 67 | 68 | 69 | 70 | {bdb3b670-a17b-483e-954c-52fc2b6ff9d3} 71 | false 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /BandObjectLib/RegisterLib/RegisterLib.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {d0b10932-bd24-4f26-b97a-e1d7dc88978a} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm 7 | 8 | 9 | {4f0814e1-0498-4762-88ee-0843e01e38f4} 10 | h;hpp;hxx;hm;inl;inc 11 | 12 | 13 | {a0d34d64-d01b-4671-b7b0-d49ca1806e7d} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | -------------------------------------------------------------------------------- /ChDCStatMenus.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BandObjectLib", "BandObjectLib\BandObjectLib.csproj", "{BDB3B670-A17B-483E-954C-52FC2B6FF9D3}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChDCStatMenusLibrary", "ChDCStatMenusLibrary\ChDCStatMenusLibrary.csproj", "{8736D2C0-4FF9-4885-BD9B-AA35088EA480}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChDCStatMenus", "ChDCStatMenus\ChDCStatMenus.csproj", "{ACCDA683-C6AC-43DD-819F-4C3DE36E6BD7}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChDCStatMenusLibraryTests", "ChDCStatMenusLibraryTests\ChDCStatMenusLibraryTests.csproj", "{C8F77292-4CD6-43FC-AE1F-ACFE71534EE5}" 13 | EndProject 14 | Global 15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 16 | Debug|Any CPU = Debug|Any CPU 17 | Release|Any CPU = Release|Any CPU 18 | Test|Any CPU = Test|Any CPU 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {BDB3B670-A17B-483E-954C-52FC2B6FF9D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {BDB3B670-A17B-483E-954C-52FC2B6FF9D3}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {BDB3B670-A17B-483E-954C-52FC2B6FF9D3}.Release|Any CPU.ActiveCfg = Release|Any CPU 24 | {BDB3B670-A17B-483E-954C-52FC2B6FF9D3}.Release|Any CPU.Build.0 = Release|Any CPU 25 | {BDB3B670-A17B-483E-954C-52FC2B6FF9D3}.Test|Any CPU.ActiveCfg = Release|Any CPU 26 | {BDB3B670-A17B-483E-954C-52FC2B6FF9D3}.Test|Any CPU.Build.0 = Release|Any CPU 27 | {8736D2C0-4FF9-4885-BD9B-AA35088EA480}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 28 | {8736D2C0-4FF9-4885-BD9B-AA35088EA480}.Debug|Any CPU.Build.0 = Debug|Any CPU 29 | {8736D2C0-4FF9-4885-BD9B-AA35088EA480}.Release|Any CPU.ActiveCfg = Release|Any CPU 30 | {8736D2C0-4FF9-4885-BD9B-AA35088EA480}.Release|Any CPU.Build.0 = Release|Any CPU 31 | {8736D2C0-4FF9-4885-BD9B-AA35088EA480}.Test|Any CPU.ActiveCfg = Release|Any CPU 32 | {8736D2C0-4FF9-4885-BD9B-AA35088EA480}.Test|Any CPU.Build.0 = Release|Any CPU 33 | {ACCDA683-C6AC-43DD-819F-4C3DE36E6BD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 34 | {ACCDA683-C6AC-43DD-819F-4C3DE36E6BD7}.Debug|Any CPU.Build.0 = Debug|Any CPU 35 | {ACCDA683-C6AC-43DD-819F-4C3DE36E6BD7}.Release|Any CPU.ActiveCfg = Release|Any CPU 36 | {ACCDA683-C6AC-43DD-819F-4C3DE36E6BD7}.Release|Any CPU.Build.0 = Release|Any CPU 37 | {ACCDA683-C6AC-43DD-819F-4C3DE36E6BD7}.Test|Any CPU.ActiveCfg = Release|Any CPU 38 | {ACCDA683-C6AC-43DD-819F-4C3DE36E6BD7}.Test|Any CPU.Build.0 = Release|Any CPU 39 | {C8F77292-4CD6-43FC-AE1F-ACFE71534EE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 40 | {C8F77292-4CD6-43FC-AE1F-ACFE71534EE5}.Debug|Any CPU.Build.0 = Debug|Any CPU 41 | {C8F77292-4CD6-43FC-AE1F-ACFE71534EE5}.Release|Any CPU.ActiveCfg = Release|Any CPU 42 | {C8F77292-4CD6-43FC-AE1F-ACFE71534EE5}.Release|Any CPU.Build.0 = Release|Any CPU 43 | {C8F77292-4CD6-43FC-AE1F-ACFE71534EE5}.Test|Any CPU.ActiveCfg = Release|Any CPU 44 | {C8F77292-4CD6-43FC-AE1F-ACFE71534EE5}.Test|Any CPU.Build.0 = Release|Any CPU 45 | EndGlobalSection 46 | GlobalSection(SolutionProperties) = preSolution 47 | HideSolutionNode = FALSE 48 | EndGlobalSection 49 | EndGlobal 50 | -------------------------------------------------------------------------------- /ChDCStatMenus/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | // 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | // 8 | [assembly: AssemblyTitle("")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("")] 13 | [assembly: AssemblyCopyright("")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 18 | // Version information for an assembly consists of the following four values: 19 | // 20 | // Major Version 21 | // Minor Version 22 | // Build Number 23 | // Revision 24 | // 25 | // You can specify all the values or you can default the Revision and Build Numbers 26 | // by using the '*' as shown below: 27 | 28 | [assembly: AssemblyVersion("1.0.0.0")] 29 | 30 | // 31 | // In order to sign your assembly you must specify a key to use. Refer to the 32 | // Microsoft .NET Framework documentation for more information on assembly signing. 33 | // 34 | // Use the attributes below to control which key is used for signing. 35 | // 36 | // Notes: 37 | // (*) If no key is specified, the assembly is not signed. 38 | // (*) KeyName refers to a key that has been installed in the Crypto Service 39 | // Provider (CSP) on your machine. KeyFile refers to a file which contains 40 | // a key. 41 | // (*) If the KeyFile and the KeyName values are both specified, the 42 | // following processing occurs: 43 | // (1) If the KeyName can be found in the CSP, that key is used. 44 | // (2) If the KeyName does not exist and the KeyFile does exist, the key 45 | // in the KeyFile is installed into the CSP and used. 46 | // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. 47 | // When specifying the KeyFile, the location of the KeyFile should be 48 | // relative to the project output directory which is 49 | // %Project Directory%\obj\. For example, if your KeyFile is 50 | // located in the project directory, you would specify the AssemblyKeyFile 51 | // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] 52 | // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework 53 | // documentation for more information on this. 54 | // 55 | [assembly: AssemblyDelaySign(false)] 56 | [assembly: AssemblyKeyName("")] 57 | -------------------------------------------------------------------------------- /ChDCStatMenus/ChDCStatMenus.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Local 5 | 7.0.9466 6 | 1.0 7 | {ACCDA683-C6AC-43DD-819F-4C3DE36E6BD7} 8 | Debug 9 | AnyCPU 10 | 11 | 12 | ChDCStatMenus 13 | ChDCStatMenus.snk 14 | JScript 15 | Grid 16 | IE50 17 | false 18 | Library 19 | ChDCStatMenus 20 | 21 | 22 | 23 | 24 | v4.6 25 | 26 | 27 | 0.0 28 | false 29 | 30 | publish\ 31 | true 32 | Disk 33 | false 34 | Foreground 35 | 7 36 | Days 37 | false 38 | false 39 | true 40 | 0 41 | 1.0.0.%2a 42 | false 43 | true 44 | 45 | 46 | bin\Debug\ 47 | false 48 | 285212672 49 | false 50 | 51 | DEBUG;TRACE 52 | 53 | true 54 | 4096 55 | false 56 | false 57 | false 58 | false 59 | 4 60 | full 61 | prompt 62 | false 63 | 64 | 65 | bin\Release\ 66 | false 67 | 285212672 68 | false 69 | 70 | TRACE 71 | 72 | false 73 | 4096 74 | true 75 | false 76 | false 77 | false 78 | 4 79 | none 80 | prompt 81 | false 82 | 83 | 84 | true 85 | 86 | 87 | 88 | 89 | System 90 | 91 | 92 | System.Data 93 | 94 | 95 | System.Drawing 96 | 97 | 98 | System.Windows.Forms 99 | 100 | 101 | System.XML 102 | 103 | 104 | 105 | 106 | Code 107 | 108 | 109 | UserControl 110 | 111 | 112 | Form 113 | 114 | 115 | FrmCPU.cs 116 | 117 | 118 | Form 119 | 120 | 121 | FrmDisks.cs 122 | 123 | 124 | Form 125 | 126 | 127 | FrmInfo.cs 128 | 129 | 130 | Form 131 | 132 | 133 | FrmMemory.cs 134 | 135 | 136 | Form 137 | 138 | 139 | FrmNetwork.cs 140 | 141 | 142 | Form 143 | 144 | 145 | FrmPanel.cs 146 | 147 | 148 | 149 | True 150 | True 151 | Resources.resx 152 | 153 | 154 | True 155 | True 156 | Settings.settings 157 | 158 | 159 | DeskBand.cs 160 | 161 | 162 | FrmInfo.cs 163 | 164 | 165 | FrmMemory.cs 166 | 167 | 168 | FrmNetwork.cs 169 | 170 | 171 | FrmPanel.cs 172 | 173 | 174 | ResXFileCodeGenerator 175 | Resources.Designer.cs 176 | 177 | 178 | 179 | 180 | False 181 | .NET Framework 3.5 SP1 182 | true 183 | 184 | 185 | 186 | 187 | {bdb3b670-a17b-483e-954c-52fc2b6ff9d3} 188 | BandObjectLib 189 | 190 | 191 | {8736d2c0-4ff9-4885-bd9b-aa35088ea480} 192 | ChDCStatMenusLibrary 193 | 194 | 195 | 196 | 197 | 198 | 199 | SettingsSingleFileGenerator 200 | Settings.Designer.cs 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | -------------------------------------------------------------------------------- /ChDCStatMenus/ChDCStatMenus.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | publish\ 5 | 6 | 7 | 8 | 9 | 10 | zh-CN 11 | false 12 | 13 | -------------------------------------------------------------------------------- /ChDCStatMenus/ChDCStatMenus.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChDC/ChDCStatMenus/0ba28a883800a0ff9ee096d0154578ebf6f5d9de/ChDCStatMenus/ChDCStatMenus.snk -------------------------------------------------------------------------------- /ChDCStatMenus/DeskBand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Windows.Forms; 4 | 5 | using BandObjectLib; 6 | using System.Runtime.InteropServices; 7 | using ChDCStatMenusLibrary; 8 | 9 | namespace ChDCStatMenus 10 | { 11 | [Guid("AE07101B-46D4-4a98-AF68-0333EA26E113")] 12 | [BandObject("ChDC Stat Meuns", BandObjectStyle.Horizontal | BandObjectStyle.ExplorerToolbar | BandObjectStyle.TaskbarToolBar, HelpText = "")] 13 | public class DeskBand : BandObject 14 | { 15 | private TableLayoutPanel tableLayoutPanel1; 16 | private Label lblDownloadSpeed; 17 | private Label lblUploadSpeed; 18 | private Label label1; 19 | private Label label2; 20 | private IContainer components; 21 | private bool showFrmInfo = true; 22 | 23 | public DeskBand() 24 | { 25 | InitializeComponent(); 26 | } 27 | 28 | protected override void Dispose(bool disposing) 29 | { 30 | if (disposing) 31 | { 32 | if (components != null) 33 | components.Dispose(); 34 | } 35 | base.Dispose(disposing); 36 | } 37 | 38 | #region Component Designer generated code 39 | private void InitializeComponent() 40 | { 41 | this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); 42 | this.label2 = new System.Windows.Forms.Label(); 43 | this.lblDownloadSpeed = new System.Windows.Forms.Label(); 44 | this.lblUploadSpeed = new System.Windows.Forms.Label(); 45 | this.label1 = new System.Windows.Forms.Label(); 46 | this.tableLayoutPanel1.SuspendLayout(); 47 | this.SuspendLayout(); 48 | // 49 | // tableLayoutPanel1 50 | // 51 | this.tableLayoutPanel1.BackColor = System.Drawing.Color.Black; 52 | this.tableLayoutPanel1.ColumnCount = 2; 53 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); 54 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); 55 | this.tableLayoutPanel1.Controls.Add(this.label2, 0, 0); 56 | this.tableLayoutPanel1.Controls.Add(this.lblDownloadSpeed, 1, 1); 57 | this.tableLayoutPanel1.Controls.Add(this.lblUploadSpeed, 1, 0); 58 | this.tableLayoutPanel1.Controls.Add(this.label1, 0, 1); 59 | this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; 60 | this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); 61 | this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); 62 | this.tableLayoutPanel1.Name = "tableLayoutPanel1"; 63 | this.tableLayoutPanel1.RowCount = 2; 64 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); 65 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); 66 | this.tableLayoutPanel1.Size = new System.Drawing.Size(80, 30); 67 | this.tableLayoutPanel1.TabIndex = 1; 68 | // 69 | // label2 70 | // 71 | this.label2.AutoSize = true; 72 | this.label2.Font = new System.Drawing.Font("Wingdings", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 73 | this.label2.ForeColor = System.Drawing.Color.White; 74 | this.label2.Location = new System.Drawing.Point(3, 0); 75 | this.label2.Name = "label2"; 76 | this.label2.Size = new System.Drawing.Size(17, 12); 77 | this.label2.TabIndex = 6; 78 | this.label2.Text = ""; 79 | // 80 | // lblDownloadSpeed 81 | // 82 | this.lblDownloadSpeed.BackColor = System.Drawing.Color.Black; 83 | this.lblDownloadSpeed.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 84 | this.lblDownloadSpeed.ForeColor = System.Drawing.Color.White; 85 | this.lblDownloadSpeed.Location = new System.Drawing.Point(23, 15); 86 | this.lblDownloadSpeed.Margin = new System.Windows.Forms.Padding(0); 87 | this.lblDownloadSpeed.Name = "lblDownloadSpeed"; 88 | this.lblDownloadSpeed.Size = new System.Drawing.Size(54, 15); 89 | this.lblDownloadSpeed.TabIndex = 3; 90 | this.lblDownloadSpeed.Text = "254KB/s"; 91 | this.lblDownloadSpeed.TextAlign = System.Drawing.ContentAlignment.MiddleRight; 92 | this.lblDownloadSpeed.Click += new System.EventHandler(this.info_click); 93 | // 94 | // lblUploadSpeed 95 | // 96 | this.lblUploadSpeed.BackColor = System.Drawing.Color.Black; 97 | this.lblUploadSpeed.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 98 | this.lblUploadSpeed.ForeColor = System.Drawing.Color.White; 99 | this.lblUploadSpeed.Location = new System.Drawing.Point(23, 0); 100 | this.lblUploadSpeed.Margin = new System.Windows.Forms.Padding(0); 101 | this.lblUploadSpeed.Name = "lblUploadSpeed"; 102 | this.lblUploadSpeed.Size = new System.Drawing.Size(54, 15); 103 | this.lblUploadSpeed.TabIndex = 1; 104 | this.lblUploadSpeed.Text = "128KB/s"; 105 | this.lblUploadSpeed.TextAlign = System.Drawing.ContentAlignment.MiddleRight; 106 | this.lblUploadSpeed.Click += new System.EventHandler(this.info_click); 107 | // 108 | // label1 109 | // 110 | this.label1.AutoSize = true; 111 | this.label1.Font = new System.Drawing.Font("Wingdings", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 112 | this.label1.ForeColor = System.Drawing.Color.White; 113 | this.label1.Location = new System.Drawing.Point(3, 15); 114 | this.label1.Name = "label1"; 115 | this.label1.Size = new System.Drawing.Size(17, 12); 116 | this.label1.TabIndex = 5; 117 | this.label1.Text = ""; 118 | // 119 | // DeskBand 120 | // 121 | this.Controls.Add(this.tableLayoutPanel1); 122 | this.MinSize = new System.Drawing.Size(80, 30); 123 | this.Name = "DeskBand"; 124 | this.Size = new System.Drawing.Size(80, 30); 125 | this.Title = ""; 126 | this.Load += new System.EventHandler(this.DeskBand_Load); 127 | this.tableLayoutPanel1.ResumeLayout(false); 128 | this.tableLayoutPanel1.PerformLayout(); 129 | this.ResumeLayout(false); 130 | 131 | } 132 | #endregion 133 | 134 | 135 | private void DeskBand_Load(object sender, EventArgs e) 136 | { 137 | showFrmInfo = ChDCStatMenus.Properties.Settings.Default.ShowInfoForm; 138 | TotalNetworkSpeed networkSpeed = new TotalNetworkSpeed(); 139 | networkSpeed.Start(); 140 | networkSpeed.NotityInfoEvent += NetworkSpeed_NotityInfoEvent; 141 | } 142 | 143 | private void NetworkSpeed_NotityInfoEvent(object sender, NetworkSpeedInfo e) 144 | { 145 | this.BeginInvoke(new Action(() => { 146 | lblDownloadSpeed.Text = e.BytesReceivedSpeedString; 147 | lblUploadSpeed.Text = e.BytesSentSpeedString; 148 | })); 149 | } 150 | 151 | private void info_click(object sender, EventArgs e) 152 | { 153 | if (!showFrmInfo) 154 | return; 155 | if(frmInfo == null || frmInfo.IsDisposed) 156 | frmInfo = new FrmInfo(); 157 | frmInfo.Visible = !frmInfo.Visible; 158 | // frmInfo.Show(); 159 | //frm.Left = Control.MousePosition.X; 160 | //frm.Top = Control.MousePosition.Y; 161 | frmInfo.Top = this.Top + this.Height + 10; 162 | frmInfo.Left = this.Left; 163 | } 164 | 165 | FrmInfo frmInfo = null; 166 | 167 | //private void info_hover(object sender, EventArgs e) 168 | //{ 169 | // if(showFrmInfo && (frmInfo == null || frmInfo.IsDisposed)) 170 | // { 171 | // frmInfo = new FrmInfo(); 172 | // frmInfo.Show(); 173 | // frmInfo.Top = this.Top + this.Height + 10; 174 | // frmInfo.Left = this.Left; 175 | // } 176 | //} 177 | } 178 | } 179 | -------------------------------------------------------------------------------- /ChDCStatMenus/DeskBand.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /ChDCStatMenus/FrmCPU.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace ChDCStatMenus 2 | { 3 | partial class FrmCPU 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 33 | this.Text = "FrmCPU"; 34 | } 35 | 36 | #endregion 37 | } 38 | } -------------------------------------------------------------------------------- /ChDCStatMenus/FrmCPU.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | namespace ChDCStatMenus 12 | { 13 | public partial class FrmCPU : FrmPanel 14 | { 15 | public FrmCPU() 16 | { 17 | InitializeComponent(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ChDCStatMenus/FrmDisks.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace ChDCStatMenus 2 | { 3 | partial class FrmDisks 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 33 | this.Text = "FrmDisks"; 34 | } 35 | 36 | #endregion 37 | } 38 | } -------------------------------------------------------------------------------- /ChDCStatMenus/FrmDisks.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | namespace ChDCStatMenus 12 | { 13 | public partial class FrmDisks : FrmPanel 14 | { 15 | public FrmDisks() 16 | { 17 | InitializeComponent(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ChDCStatMenus/FrmInfo.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace ChDCStatMenus 2 | { 3 | partial class FrmInfo 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); 32 | this.label3 = new System.Windows.Forms.Label(); 33 | this.label1 = new System.Windows.Forms.Label(); 34 | this.label2 = new System.Windows.Forms.Label(); 35 | this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); 36 | this.label4 = new System.Windows.Forms.Label(); 37 | this.label6 = new System.Windows.Forms.Label(); 38 | this.lblUploadSpeed = new System.Windows.Forms.Label(); 39 | this.lblDownloadSpeed = new System.Windows.Forms.Label(); 40 | this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); 41 | this.lblLunisolar = new System.Windows.Forms.Label(); 42 | this.lblTime = new System.Windows.Forms.Label(); 43 | this.lblMemory = new System.Windows.Forms.Label(); 44 | this.tableLayoutPanel1.SuspendLayout(); 45 | this.tableLayoutPanel2.SuspendLayout(); 46 | this.tableLayoutPanel3.SuspendLayout(); 47 | this.SuspendLayout(); 48 | // 49 | // tableLayoutPanel1 50 | // 51 | this.tableLayoutPanel1.ColumnCount = 1; 52 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); 53 | this.tableLayoutPanel1.Controls.Add(this.label3, 0, 4); 54 | this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0); 55 | this.tableLayoutPanel1.Controls.Add(this.label2, 0, 2); 56 | this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 3); 57 | this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel3, 0, 1); 58 | this.tableLayoutPanel1.Controls.Add(this.lblMemory, 0, 5); 59 | this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Top; 60 | this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); 61 | this.tableLayoutPanel1.Name = "tableLayoutPanel1"; 62 | this.tableLayoutPanel1.RowCount = 6; 63 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 64 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F)); 65 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 66 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F)); 67 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 68 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F)); 69 | this.tableLayoutPanel1.Size = new System.Drawing.Size(205, 181); 70 | this.tableLayoutPanel1.TabIndex = 0; 71 | // 72 | // label3 73 | // 74 | this.label3.AutoSize = true; 75 | this.label3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230))))); 76 | this.label3.Dock = System.Windows.Forms.DockStyle.Fill; 77 | this.label3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 78 | this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); 79 | this.label3.Location = new System.Drawing.Point(3, 120); 80 | this.label3.Name = "label3"; 81 | this.label3.Size = new System.Drawing.Size(199, 20); 82 | this.label3.TabIndex = 3; 83 | this.label3.Text = "MEMORY"; 84 | this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 85 | // 86 | // label1 87 | // 88 | this.label1.AutoSize = true; 89 | this.label1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230))))); 90 | this.label1.Dock = System.Windows.Forms.DockStyle.Fill; 91 | this.label1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 92 | this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); 93 | this.label1.Location = new System.Drawing.Point(3, 0); 94 | this.label1.Name = "label1"; 95 | this.label1.Size = new System.Drawing.Size(199, 20); 96 | this.label1.TabIndex = 0; 97 | this.label1.Text = "TIME"; 98 | this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 99 | // 100 | // label2 101 | // 102 | this.label2.AutoSize = true; 103 | this.label2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230))))); 104 | this.label2.Dock = System.Windows.Forms.DockStyle.Fill; 105 | this.label2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 106 | this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); 107 | this.label2.Location = new System.Drawing.Point(3, 60); 108 | this.label2.Name = "label2"; 109 | this.label2.Size = new System.Drawing.Size(199, 20); 110 | this.label2.TabIndex = 12; 111 | this.label2.Text = "NETWORK"; 112 | this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 113 | // 114 | // tableLayoutPanel2 115 | // 116 | this.tableLayoutPanel2.ColumnCount = 2; 117 | this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); 118 | this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); 119 | this.tableLayoutPanel2.Controls.Add(this.label4, 0, 0); 120 | this.tableLayoutPanel2.Controls.Add(this.label6, 0, 1); 121 | this.tableLayoutPanel2.Controls.Add(this.lblUploadSpeed, 1, 0); 122 | this.tableLayoutPanel2.Controls.Add(this.lblDownloadSpeed, 1, 1); 123 | this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; 124 | this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 83); 125 | this.tableLayoutPanel2.Name = "tableLayoutPanel2"; 126 | this.tableLayoutPanel2.RowCount = 2; 127 | this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); 128 | this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); 129 | this.tableLayoutPanel2.Size = new System.Drawing.Size(199, 34); 130 | this.tableLayoutPanel2.TabIndex = 13; 131 | // 132 | // label4 133 | // 134 | this.label4.AutoSize = true; 135 | this.label4.Dock = System.Windows.Forms.DockStyle.Fill; 136 | this.label4.Location = new System.Drawing.Point(3, 0); 137 | this.label4.Name = "label4"; 138 | this.label4.Size = new System.Drawing.Size(93, 17); 139 | this.label4.TabIndex = 0; 140 | this.label4.Text = "Upload"; 141 | this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; 142 | this.label4.MouseHover += new System.EventHandler(this.lblNetwork_MouseHover); 143 | // 144 | // label6 145 | // 146 | this.label6.AutoSize = true; 147 | this.label6.Dock = System.Windows.Forms.DockStyle.Fill; 148 | this.label6.Location = new System.Drawing.Point(3, 17); 149 | this.label6.Name = "label6"; 150 | this.label6.Size = new System.Drawing.Size(93, 17); 151 | this.label6.TabIndex = 1; 152 | this.label6.Text = "Download"; 153 | this.label6.MouseHover += new System.EventHandler(this.lblNetwork_MouseHover); 154 | // 155 | // lblUploadSpeed 156 | // 157 | this.lblUploadSpeed.AutoSize = true; 158 | this.lblUploadSpeed.Dock = System.Windows.Forms.DockStyle.Fill; 159 | this.lblUploadSpeed.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 160 | this.lblUploadSpeed.Location = new System.Drawing.Point(102, 0); 161 | this.lblUploadSpeed.Name = "lblUploadSpeed"; 162 | this.lblUploadSpeed.Size = new System.Drawing.Size(94, 17); 163 | this.lblUploadSpeed.TabIndex = 2; 164 | this.lblUploadSpeed.Text = "125KB/s"; 165 | this.lblUploadSpeed.TextAlign = System.Drawing.ContentAlignment.MiddleRight; 166 | this.lblUploadSpeed.MouseHover += new System.EventHandler(this.lblNetwork_MouseHover); 167 | // 168 | // lblDownloadSpeed 169 | // 170 | this.lblDownloadSpeed.AutoSize = true; 171 | this.lblDownloadSpeed.Dock = System.Windows.Forms.DockStyle.Fill; 172 | this.lblDownloadSpeed.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 173 | this.lblDownloadSpeed.Location = new System.Drawing.Point(102, 17); 174 | this.lblDownloadSpeed.Name = "lblDownloadSpeed"; 175 | this.lblDownloadSpeed.Size = new System.Drawing.Size(94, 17); 176 | this.lblDownloadSpeed.TabIndex = 3; 177 | this.lblDownloadSpeed.Text = "125KB/s"; 178 | this.lblDownloadSpeed.TextAlign = System.Drawing.ContentAlignment.MiddleRight; 179 | this.lblDownloadSpeed.MouseHover += new System.EventHandler(this.lblNetwork_MouseHover); 180 | // 181 | // tableLayoutPanel3 182 | // 183 | this.tableLayoutPanel3.ColumnCount = 1; 184 | this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); 185 | this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 186 | this.tableLayoutPanel3.Controls.Add(this.lblLunisolar, 0, 1); 187 | this.tableLayoutPanel3.Controls.Add(this.lblTime, 0, 0); 188 | this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill; 189 | this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 23); 190 | this.tableLayoutPanel3.Name = "tableLayoutPanel3"; 191 | this.tableLayoutPanel3.RowCount = 2; 192 | this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); 193 | this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); 194 | this.tableLayoutPanel3.Size = new System.Drawing.Size(199, 34); 195 | this.tableLayoutPanel3.TabIndex = 14; 196 | // 197 | // lblLunisolar 198 | // 199 | this.lblLunisolar.AutoSize = true; 200 | this.lblLunisolar.Dock = System.Windows.Forms.DockStyle.Fill; 201 | this.lblLunisolar.Location = new System.Drawing.Point(3, 17); 202 | this.lblLunisolar.Name = "lblLunisolar"; 203 | this.lblLunisolar.Size = new System.Drawing.Size(193, 17); 204 | this.lblLunisolar.TabIndex = 10; 205 | this.lblLunisolar.Text = "2017年4月4日 星期二"; 206 | this.lblLunisolar.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 207 | // 208 | // lblTime 209 | // 210 | this.lblTime.AutoSize = true; 211 | this.lblTime.Dock = System.Windows.Forms.DockStyle.Fill; 212 | this.lblTime.Location = new System.Drawing.Point(3, 0); 213 | this.lblTime.Name = "lblTime"; 214 | this.lblTime.Size = new System.Drawing.Size(193, 17); 215 | this.lblTime.TabIndex = 9; 216 | this.lblTime.Text = "2017年4月4日 星期二"; 217 | this.lblTime.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 218 | // 219 | // lblMemory 220 | // 221 | this.lblMemory.AutoSize = true; 222 | this.lblMemory.Dock = System.Windows.Forms.DockStyle.Fill; 223 | this.lblMemory.ForeColor = System.Drawing.Color.White; 224 | this.lblMemory.Location = new System.Drawing.Point(3, 140); 225 | this.lblMemory.Name = "lblMemory"; 226 | this.lblMemory.Size = new System.Drawing.Size(199, 41); 227 | this.lblMemory.TabIndex = 15; 228 | this.lblMemory.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 229 | this.lblMemory.MouseHover += new System.EventHandler(this.lblMemory_MouseHover); 230 | // 231 | // FrmInfo 232 | // 233 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 234 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 235 | this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(250)))), ((int)(((byte)(250)))), ((int)(((byte)(250))))); 236 | this.ClientSize = new System.Drawing.Size(205, 193); 237 | this.Controls.Add(this.tableLayoutPanel1); 238 | this.Name = "FrmInfo"; 239 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 240 | this.Text = "FrmInfo"; 241 | this.Load += new System.EventHandler(this.FrmInfo_Load); 242 | this.tableLayoutPanel1.ResumeLayout(false); 243 | this.tableLayoutPanel1.PerformLayout(); 244 | this.tableLayoutPanel2.ResumeLayout(false); 245 | this.tableLayoutPanel2.PerformLayout(); 246 | this.tableLayoutPanel3.ResumeLayout(false); 247 | this.tableLayoutPanel3.PerformLayout(); 248 | this.ResumeLayout(false); 249 | 250 | } 251 | 252 | #endregion 253 | 254 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; 255 | private System.Windows.Forms.Label label1; 256 | private System.Windows.Forms.Label label3; 257 | private System.Windows.Forms.Label label2; 258 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; 259 | private System.Windows.Forms.Label label4; 260 | private System.Windows.Forms.Label label6; 261 | private System.Windows.Forms.Label lblUploadSpeed; 262 | private System.Windows.Forms.Label lblDownloadSpeed; 263 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3; 264 | private System.Windows.Forms.Label lblTime; 265 | private System.Windows.Forms.Label lblLunisolar; 266 | private System.Windows.Forms.Label lblMemory; 267 | } 268 | } -------------------------------------------------------------------------------- /ChDCStatMenus/FrmInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Windows.Forms; 4 | using System.Drawing; 5 | using ChDCStatMenusLibrary; 6 | using Microsoft.VisualBasic.Devices; 7 | 8 | namespace ChDCStatMenus 9 | { 10 | public partial class FrmInfo : FrmPanel 11 | { 12 | System.Timers.Timer timer = new System.Timers.Timer(); 13 | 14 | public FrmInfo() 15 | { 16 | InitializeComponent(); 17 | } 18 | 19 | 20 | private void lblMemory_MouseHover(object sender, EventArgs e) 21 | { 22 | this.ShowChild(new FrmMemory(), sender as Control); 23 | } 24 | 25 | private void lblNetwork_MouseHover(object sender, EventArgs e) 26 | { 27 | this.ShowChild(new FrmNetwork(), (sender as Control).Parent); 28 | } 29 | 30 | private void FrmInfo_Load(object sender, EventArgs e) 31 | { 32 | timer.Interval = 1000; 33 | timer.Elapsed += (s, e1) => this.BeginInvoke(new Action(Timer_Elapsed)); 34 | 35 | TotalNetworkSpeed networkSpeed = new TotalNetworkSpeed(timer); 36 | networkSpeed.Start(); 37 | networkSpeed.NotityInfoEvent += NetworkSpeed_NotityInfoEvent; 38 | 39 | 40 | Timer_Elapsed(); 41 | lblTime.Text = DateTime.Now.ToString("D") + " " + DateTime.Now.ToString("dddd"); 42 | lblLunisolar.Text = TimeInfo.GetChineseDateTime(DateTime.Now); 43 | } 44 | 45 | //PerformanceCounter cpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total"); 46 | //float cpuUsage = 0; 47 | 48 | 49 | private void Timer_Elapsed() 50 | { 51 | ComputerInfo ci = new ComputerInfo(); 52 | PerformanceCounter ramCounter = new PerformanceCounter("Memory", "Available MBytes", true); 53 | // 内存使用比例 54 | float totalMB = ci.TotalPhysicalMemory / 1024 / 1024; 55 | float usedMB = totalMB - ramCounter.NextValue(); 56 | float memoryUsage = usedMB / totalMB; 57 | 58 | //picMemory.dr 59 | 60 | //cpuUsage = cpuCounter.NextValue() - cpuUsage; 61 | //MessageBox.Show(cpuUsage + "%"); 62 | drawMemoryUsage(memoryUsage); 63 | lblMemory.Text = String.Format("{0:G2}GB/{1:G2}GB", usedMB / 1024, totalMB/1024); 64 | } 65 | 66 | private void drawMemoryUsage(float value) 67 | { 68 | 69 | Control control = lblMemory; 70 | Bitmap b = new Bitmap(control.Width, control.Height); 71 | Graphics g = Graphics.FromImage(b); 72 | 73 | //draw background 74 | g.FillRectangle(new SolidBrush(Color.FromArgb(28, 28, 29)), 0, 0, control.Width, control.Height); 75 | 76 | // draw usage rect 77 | int width = (int)(control.Width * value); 78 | Rectangle rect = new Rectangle(0, 0, width, control.Height); 79 | 80 | //LinearGradientBrush brush = new LinearGradientBrush(control.ClientRectangle, Color.FromArgb(17, 160, 255), Color.FromArgb(23,174,254), LinearGradientMode.Vertical); 81 | //brush.SetSigmaBellShape(0.5f); 82 | //g.FillRectangle(brush, rect); 83 | g.FillRectangle(new SolidBrush(Color.FromArgb(0, 186, 255)), rect); 84 | 85 | // border 86 | g.DrawRectangle(new Pen(Color.FromArgb(28, 28, 29), 3), 0, 0, control.Width-2, control.Height-2); 87 | 88 | g.Dispose(); 89 | control.BackgroundImage = b; 90 | } 91 | 92 | private void NetworkSpeed_NotityInfoEvent(object sender, NetworkSpeedInfo e) 93 | { 94 | this.BeginInvoke(new Action(() => { 95 | 96 | lblDownloadSpeed.Text = e.BytesReceivedSpeedString; 97 | lblUploadSpeed.Text = e.BytesSentSpeedString; 98 | })); 99 | } 100 | 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /ChDCStatMenus/FrmInfo.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /ChDCStatMenus/FrmMemory.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace ChDCStatMenus 2 | { 3 | partial class FrmMemory 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.timerProcesses = new System.Windows.Forms.Timer(this.components); 33 | this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); 34 | this.label3 = new System.Windows.Forms.Label(); 35 | this.listProcessUsage = new System.Windows.Forms.ListView(); 36 | this.columnProcessName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 37 | this.columnUsage = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 38 | this.tableLayoutPanel1.SuspendLayout(); 39 | this.SuspendLayout(); 40 | // 41 | // timerProcesses 42 | // 43 | this.timerProcesses.Enabled = true; 44 | this.timerProcesses.Interval = 3000; 45 | this.timerProcesses.Tick += new System.EventHandler(this.timerProcesses_Tick); 46 | // 47 | // tableLayoutPanel1 48 | // 49 | this.tableLayoutPanel1.ColumnCount = 1; 50 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); 51 | this.tableLayoutPanel1.Controls.Add(this.label3, 0, 0); 52 | this.tableLayoutPanel1.Controls.Add(this.listProcessUsage, 0, 1); 53 | this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; 54 | this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); 55 | this.tableLayoutPanel1.Name = "tableLayoutPanel1"; 56 | this.tableLayoutPanel1.RowCount = 2; 57 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 58 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 120F)); 59 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 60 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 61 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 62 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 63 | this.tableLayoutPanel1.Size = new System.Drawing.Size(256, 307); 64 | this.tableLayoutPanel1.TabIndex = 1; 65 | // 66 | // label3 67 | // 68 | this.label3.AutoSize = true; 69 | this.label3.Dock = System.Windows.Forms.DockStyle.Fill; 70 | this.label3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 71 | this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); 72 | this.label3.Location = new System.Drawing.Point(3, 0); 73 | this.label3.Name = "label3"; 74 | this.label3.Size = new System.Drawing.Size(250, 20); 75 | this.label3.TabIndex = 3; 76 | this.label3.Text = "PROCESSES"; 77 | this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 78 | // 79 | // listProcessUsage 80 | // 81 | this.listProcessUsage.BorderStyle = System.Windows.Forms.BorderStyle.None; 82 | this.listProcessUsage.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { 83 | this.columnProcessName, 84 | this.columnUsage}); 85 | this.listProcessUsage.Dock = System.Windows.Forms.DockStyle.Fill; 86 | this.listProcessUsage.Location = new System.Drawing.Point(3, 23); 87 | this.listProcessUsage.Name = "listProcessUsage"; 88 | this.listProcessUsage.Size = new System.Drawing.Size(250, 281); 89 | this.listProcessUsage.TabIndex = 12; 90 | this.listProcessUsage.UseCompatibleStateImageBehavior = false; 91 | this.listProcessUsage.View = System.Windows.Forms.View.Details; 92 | // 93 | // columnProcessName 94 | // 95 | this.columnProcessName.Text = "ProcessName"; 96 | this.columnProcessName.Width = 125; 97 | // 98 | // columnUsage 99 | // 100 | this.columnUsage.Text = "Working Set"; 101 | this.columnUsage.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; 102 | this.columnUsage.Width = 103; 103 | // 104 | // FrmMemory 105 | // 106 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 107 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 108 | this.ClientSize = new System.Drawing.Size(256, 307); 109 | this.Controls.Add(this.tableLayoutPanel1); 110 | this.Name = "FrmMemory"; 111 | this.Text = "FrmMemory"; 112 | this.tableLayoutPanel1.ResumeLayout(false); 113 | this.tableLayoutPanel1.PerformLayout(); 114 | this.ResumeLayout(false); 115 | 116 | } 117 | 118 | #endregion 119 | 120 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; 121 | private System.Windows.Forms.Label label3; 122 | private System.Windows.Forms.Timer timerProcesses; 123 | private System.Windows.Forms.ListView listProcessUsage; 124 | private System.Windows.Forms.ColumnHeader columnProcessName; 125 | private System.Windows.Forms.ColumnHeader columnUsage; 126 | } 127 | } -------------------------------------------------------------------------------- /ChDCStatMenus/FrmMemory.cs: -------------------------------------------------------------------------------- 1 | using ChDCStatMenusLibrary; 2 | using System; 3 | using System.Windows.Forms; 4 | 5 | namespace ChDCStatMenus 6 | { 7 | public partial class FrmMemory : FrmPanel 8 | { 9 | public FrmMemory() 10 | { 11 | InitializeComponent(); 12 | 13 | timerProcesses_Tick(null, null); 14 | } 15 | 16 | private void timerProcesses_Tick(object sender, EventArgs e) 17 | { 18 | listProcessUsage.Items.Clear(); 19 | ProcessInfo.SimpleMemoryUsage[] gu = ProcessInfo.GetMemeoryUsage(); 20 | foreach(ProcessInfo.SimpleMemoryUsage item in gu) 21 | { 22 | ListViewItem li = listProcessUsage.Items.Add(item.ProcessName); 23 | li.SubItems.Add( ProcessInfo.GetStorageSizeString(item.Usage)); 24 | } 25 | } 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ChDCStatMenus/FrmMemory.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | -------------------------------------------------------------------------------- /ChDCStatMenus/FrmNetwork.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace ChDCStatMenus 2 | { 3 | partial class FrmNetwork 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); 32 | this.lblPublicIP = new System.Windows.Forms.Label(); 33 | this.label5 = new System.Windows.Forms.Label(); 34 | this.label2 = new System.Windows.Forms.Label(); 35 | this.label3 = new System.Windows.Forms.Label(); 36 | this.listNICSpeed = new System.Windows.Forms.ListView(); 37 | this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 38 | this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 39 | this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 40 | this.listProcessSpeed = new System.Windows.Forms.ListView(); 41 | this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 42 | this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 43 | this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 44 | this.tableLayoutPanel1.SuspendLayout(); 45 | this.SuspendLayout(); 46 | // 47 | // tableLayoutPanel1 48 | // 49 | this.tableLayoutPanel1.ColumnCount = 1; 50 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); 51 | this.tableLayoutPanel1.Controls.Add(this.listProcessSpeed, 0, 5); 52 | this.tableLayoutPanel1.Controls.Add(this.lblPublicIP, 0, 1); 53 | this.tableLayoutPanel1.Controls.Add(this.label5, 0, 4); 54 | this.tableLayoutPanel1.Controls.Add(this.label2, 0, 2); 55 | this.tableLayoutPanel1.Controls.Add(this.label3, 0, 0); 56 | this.tableLayoutPanel1.Controls.Add(this.listNICSpeed, 0, 3); 57 | this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; 58 | this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); 59 | this.tableLayoutPanel1.Name = "tableLayoutPanel1"; 60 | this.tableLayoutPanel1.RowCount = 6; 61 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 62 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 63 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 64 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 100F)); 65 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 66 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 80F)); 67 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 68 | this.tableLayoutPanel1.Size = new System.Drawing.Size(264, 337); 69 | this.tableLayoutPanel1.TabIndex = 0; 70 | // 71 | // lblPublicIP 72 | // 73 | this.lblPublicIP.AutoSize = true; 74 | this.lblPublicIP.Dock = System.Windows.Forms.DockStyle.Fill; 75 | this.lblPublicIP.Location = new System.Drawing.Point(3, 20); 76 | this.lblPublicIP.Name = "lblPublicIP"; 77 | this.lblPublicIP.Size = new System.Drawing.Size(258, 20); 78 | this.lblPublicIP.TabIndex = 13; 79 | this.lblPublicIP.Text = "0.0.0.0"; 80 | this.lblPublicIP.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 81 | // 82 | // label5 83 | // 84 | this.label5.AutoSize = true; 85 | this.label5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230))))); 86 | this.label5.Dock = System.Windows.Forms.DockStyle.Fill; 87 | this.label5.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 88 | this.label5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); 89 | this.label5.Location = new System.Drawing.Point(3, 160); 90 | this.label5.Name = "label5"; 91 | this.label5.Size = new System.Drawing.Size(258, 20); 92 | this.label5.TabIndex = 8; 93 | this.label5.Text = "SPEED OF PROCESSES"; 94 | this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 95 | // 96 | // label2 97 | // 98 | this.label2.AutoSize = true; 99 | this.label2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230))))); 100 | this.label2.Dock = System.Windows.Forms.DockStyle.Fill; 101 | this.label2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 102 | this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); 103 | this.label2.Location = new System.Drawing.Point(3, 40); 104 | this.label2.Name = "label2"; 105 | this.label2.Size = new System.Drawing.Size(258, 20); 106 | this.label2.TabIndex = 6; 107 | this.label2.Text = "SPEED OF NICS"; 108 | this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 109 | // 110 | // label3 111 | // 112 | this.label3.AutoSize = true; 113 | this.label3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230))))); 114 | this.label3.Dock = System.Windows.Forms.DockStyle.Fill; 115 | this.label3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 116 | this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); 117 | this.label3.Location = new System.Drawing.Point(3, 0); 118 | this.label3.Name = "label3"; 119 | this.label3.Size = new System.Drawing.Size(258, 20); 120 | this.label3.TabIndex = 4; 121 | this.label3.Text = "PUBLIC IP"; 122 | this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 123 | // 124 | // listNICSpeed 125 | // 126 | this.listNICSpeed.BorderStyle = System.Windows.Forms.BorderStyle.None; 127 | this.listNICSpeed.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { 128 | this.columnHeader1, 129 | this.columnHeader2, 130 | this.columnHeader3}); 131 | this.listNICSpeed.Dock = System.Windows.Forms.DockStyle.Fill; 132 | this.listNICSpeed.Location = new System.Drawing.Point(3, 63); 133 | this.listNICSpeed.Name = "listNICSpeed"; 134 | this.listNICSpeed.Size = new System.Drawing.Size(258, 94); 135 | this.listNICSpeed.TabIndex = 14; 136 | this.listNICSpeed.UseCompatibleStateImageBehavior = false; 137 | this.listNICSpeed.View = System.Windows.Forms.View.Details; 138 | // 139 | // columnHeader1 140 | // 141 | this.columnHeader1.Text = "NIC"; 142 | this.columnHeader1.Width = 107; 143 | // 144 | // columnHeader2 145 | // 146 | this.columnHeader2.Text = "Upload"; 147 | this.columnHeader2.Width = 80; 148 | // 149 | // columnHeader3 150 | // 151 | this.columnHeader3.Text = "Download"; 152 | // 153 | // listProcessSpeed 154 | // 155 | this.listProcessSpeed.BorderStyle = System.Windows.Forms.BorderStyle.None; 156 | this.listProcessSpeed.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { 157 | this.columnHeader4, 158 | this.columnHeader5, 159 | this.columnHeader6}); 160 | this.listProcessSpeed.Dock = System.Windows.Forms.DockStyle.Fill; 161 | this.listProcessSpeed.Location = new System.Drawing.Point(3, 183); 162 | this.listProcessSpeed.Name = "listProcessSpeed"; 163 | this.listProcessSpeed.Size = new System.Drawing.Size(258, 151); 164 | this.listProcessSpeed.TabIndex = 15; 165 | this.listProcessSpeed.UseCompatibleStateImageBehavior = false; 166 | this.listProcessSpeed.View = System.Windows.Forms.View.Details; 167 | // 168 | // columnHeader4 169 | // 170 | this.columnHeader4.Text = "Process"; 171 | this.columnHeader4.Width = 107; 172 | // 173 | // columnHeader5 174 | // 175 | this.columnHeader5.Text = "Upload"; 176 | this.columnHeader5.Width = 80; 177 | // 178 | // columnHeader6 179 | // 180 | this.columnHeader6.Text = "Download"; 181 | // 182 | // FrmNetwork 183 | // 184 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 185 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 186 | this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(250)))), ((int)(((byte)(250)))), ((int)(((byte)(250))))); 187 | this.ClientSize = new System.Drawing.Size(264, 337); 188 | this.Controls.Add(this.tableLayoutPanel1); 189 | this.Name = "FrmNetwork"; 190 | this.Text = "FrmNetwork"; 191 | this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FrmNetwork_FormClosed); 192 | this.Load += new System.EventHandler(this.FrmNetwork_Load); 193 | this.tableLayoutPanel1.ResumeLayout(false); 194 | this.tableLayoutPanel1.PerformLayout(); 195 | this.ResumeLayout(false); 196 | 197 | } 198 | 199 | #endregion 200 | 201 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; 202 | private System.Windows.Forms.Label label5; 203 | private System.Windows.Forms.Label label2; 204 | private System.Windows.Forms.Label label3; 205 | private System.Windows.Forms.Label lblPublicIP; 206 | private System.Windows.Forms.ListView listNICSpeed; 207 | private System.Windows.Forms.ColumnHeader columnHeader1; 208 | private System.Windows.Forms.ColumnHeader columnHeader2; 209 | private System.Windows.Forms.ColumnHeader columnHeader3; 210 | private System.Windows.Forms.ListView listProcessSpeed; 211 | private System.Windows.Forms.ColumnHeader columnHeader4; 212 | private System.Windows.Forms.ColumnHeader columnHeader5; 213 | private System.Windows.Forms.ColumnHeader columnHeader6; 214 | } 215 | } -------------------------------------------------------------------------------- /ChDCStatMenus/FrmNetwork.cs: -------------------------------------------------------------------------------- 1 | using ChDCStatMenusLibrary; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Data; 6 | using System.Drawing; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using System.Windows.Forms; 11 | 12 | namespace ChDCStatMenus 13 | { 14 | 15 | public partial class FrmNetwork : FrmPanel 16 | { 17 | NetworkSpeed ns; 18 | 19 | public FrmNetwork() 20 | { 21 | InitializeComponent(); 22 | } 23 | 24 | private void FrmNetwork_Load(object sender, EventArgs e) 25 | { 26 | ns = new NetworkSpeed(); 27 | ns.NotityInfoEvent += Ns_NotityInfoEvent; 28 | ns.Start(); 29 | 30 | lblPublicIP.Text = NetworkInfo.GetPublicIP(); 31 | } 32 | 33 | private void Ns_NotityInfoEvent(object sender, NetworkSpeedInfo[] infos) 34 | { 35 | this.BeginInvoke(new Action(() => { 36 | listNICSpeed.Items.Clear(); 37 | foreach(NetworkSpeedInfo info in infos) 38 | { 39 | ListViewItem si = listNICSpeed.Items.Add(info.NIC.Name); 40 | Console.WriteLine(info.NIC.GetIPProperties().GetType()); 41 | si.SubItems.Add(info.BytesSentSpeedString); 42 | si.SubItems.Add(info.BytesReceivedSpeedString); 43 | } 44 | })); 45 | } 46 | 47 | private void FrmNetwork_FormClosed(object sender, FormClosedEventArgs e) 48 | { 49 | ns.Stop(); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /ChDCStatMenus/FrmNetwork.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /ChDCStatMenus/FrmPanel.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace ChDCStatMenus 2 | { 3 | partial class FrmPanel 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.timerCloseAll = new System.Windows.Forms.Timer(this.components); 33 | this.SuspendLayout(); 34 | // 35 | // timerCloseAll 36 | // 37 | this.timerCloseAll.Interval = 1000; 38 | this.timerCloseAll.Tick += new System.EventHandler(this.timerCloseAll_Tick); 39 | // 40 | // FrmPanel 41 | // 42 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 43 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 44 | this.ClientSize = new System.Drawing.Size(304, 274); 45 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; 46 | this.Name = "FrmPanel"; 47 | this.ShowInTaskbar = false; 48 | this.Text = "FrmParent"; 49 | this.ResumeLayout(false); 50 | 51 | } 52 | 53 | #endregion 54 | 55 | private System.Windows.Forms.Timer timerCloseAll; 56 | } 57 | } -------------------------------------------------------------------------------- /ChDCStatMenus/FrmPanel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using System.Drawing; 4 | 5 | namespace ChDCStatMenus 6 | { 7 | public partial class FrmPanel : Form 8 | { 9 | public FrmPanel MyParent 10 | { 11 | get; 12 | set; 13 | } 14 | 15 | public FrmPanel MyChild 16 | { 17 | get; 18 | set; 19 | } 20 | 21 | public FrmPanel() 22 | { 23 | InitializeComponent(); 24 | 25 | this.Deactivate += FrmPanel_Deactivate; 26 | this.FormClosed += FrmPanel_FormClosed; 27 | 28 | timerCloseAll.Enabled = true; 29 | } 30 | 31 | private void FrmPanel_Deactivate(object sender, EventArgs e) 32 | { 33 | if (MyChild == null) 34 | { 35 | this.Close(); 36 | } 37 | } 38 | 39 | private void CloseAll() 40 | { 41 | FrmPanel parent = this; 42 | for (; parent.MyParent != null; parent = parent.MyParent) 43 | { 44 | 45 | } 46 | parent.Close(); 47 | } 48 | 49 | private void FrmPanel_FormClosed(object sender, FormClosedEventArgs e) 50 | { 51 | if (MyParent != null) 52 | MyParent.MyChild = null; 53 | } 54 | 55 | public void ShowChild(FrmPanel frmChild, Control sender=null) 56 | { 57 | frmChild.MyParent = this; 58 | 59 | MyChild?.Close(); 60 | MyChild = frmChild; 61 | 62 | frmChild.Show(this); 63 | 64 | if(sender != null) 65 | frmChild.Location = new Point(this.Left - frmChild.Width, sender.Top + this.Top); 66 | } 67 | 68 | private void timerCloseAll_Tick(object sender, EventArgs e) 69 | { 70 | bool allDeactivated = true; 71 | for(FrmPanel frm = this.MyParent; frm != null; frm = frm.MyParent) 72 | { 73 | if (frm.Focused || frm.ContainsFocus) 74 | { 75 | allDeactivated = false; 76 | break; 77 | } 78 | } 79 | 80 | for (FrmPanel frm = this; frm != null; frm = frm.MyChild) 81 | { 82 | if (frm.Focused || frm.ContainsFocus) 83 | { 84 | allDeactivated = false; 85 | break; 86 | } 87 | } 88 | 89 | if (allDeactivated) 90 | { 91 | CloseAll(); 92 | } 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /ChDCStatMenus/FrmPanel.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | -------------------------------------------------------------------------------- /ChDCStatMenus/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace ChDCStatMenus 5 | { 6 | static class Program 7 | { 8 | /// 9 | /// 应用程序的主入口点。 10 | /// 11 | [STAThread] 12 | static void Main() 13 | { 14 | Application.EnableVisualStyles(); 15 | Application.SetCompatibleTextRenderingDefault(false); 16 | Application.Run(new FrmInfo()); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ChDCStatMenus/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace ChDCStatMenus.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// 一个强类型的资源类,用于查找本地化的字符串等。 17 | /// 18 | // 此类是由 StronglyTypedResourceBuilder 19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen 21 | // (以 /str 作为命令选项),或重新生成 VS 项目。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// 返回此类使用的缓存的 ResourceManager 实例。 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ChDCStatMenus.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// 使用此强类型资源类,为所有资源查找 51 | /// 重写当前线程的 CurrentUICulture 属性。 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /ChDCStatMenus/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | text/microsoft-resx 91 | 92 | 93 | 1.3 94 | 95 | 96 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 97 | 98 | 99 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 100 | 101 | -------------------------------------------------------------------------------- /ChDCStatMenus/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace ChDCStatMenus.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | 26 | [global::System.Configuration.ApplicationScopedSettingAttribute()] 27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 28 | [global::System.Configuration.DefaultSettingValueAttribute("True")] 29 | public bool ShowInfoForm { 30 | get { 31 | return ((bool)(this["ShowInfoForm"])); 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ChDCStatMenus/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | True 7 | 8 | 9 | -------------------------------------------------------------------------------- /ChDCStatMenus/Register/Register.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 11 | 12 | 13 | 20 | 22 | 24 | 33 | 35 | 36 | 43 | 45 | 47 | 54 | 56 | 57 | 58 | 59 | 62 | 63 | 66 | 67 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /ChDCStatMenus/Register/Register.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {E35915FE-ED91-4AE5-B566-F269CD854498} 15 | Win32Proj 16 | 17 | 18 | 19 | Utility 20 | v140 21 | MultiByte 22 | OldSyntax 23 | 24 | 25 | Utility 26 | v140 27 | MultiByte 28 | OldSyntax 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | <_ProjectFileVersion>14.0.25431.1 42 | 43 | 44 | Debug\ 45 | Debug\ 46 | 47 | 48 | Release\ 49 | Release\ 50 | 51 | 52 | 53 | cd $(ProjectDir)..\bin\Debug 54 | 55 | gacutil /if SampleBars.dll 56 | regasm SampleBars.dll 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | cd $(ProjectDir)..\bin\Release 65 | 66 | gacutil /if SampleBars.dll 67 | regasm SampleBars.dll 68 | 69 | 70 | 71 | 72 | 73 | {accda683-c6ac-43dd-819f-4c3de36e6bd7} 74 | false 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /ChDCStatMenus/Register/Register.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {42d5f52a-aa44-472c-8298-a99faf25d8a1} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm 7 | 8 | 9 | {0091c3ed-442a-4403-a5cc-7d8e5f8a3920} 10 | h;hpp;hxx;hm;inl;inc 11 | 12 | 13 | {abbe1886-6062-486f-8ce0-4c9d7ce51ede} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | -------------------------------------------------------------------------------- /ChDCStatMenus/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | True 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /ChDCStatMenusLibrary/ChDCStatMenusLibrary.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {8736D2C0-4FF9-4885-BD9B-AA35088EA480} 8 | Library 9 | Properties 10 | ChDCStatMenusLibrary 11 | ChDCStatMenusLibrary 12 | v4.6 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | true 34 | 35 | 36 | ChDCStatMenusLibrary.snk 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 66 | -------------------------------------------------------------------------------- /ChDCStatMenusLibrary/ChDCStatMenusLibrary.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChDC/ChDCStatMenus/0ba28a883800a0ff9ee096d0154578ebf6f5d9de/ChDCStatMenusLibrary/ChDCStatMenusLibrary.snk -------------------------------------------------------------------------------- /ChDCStatMenusLibrary/NetworkInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Net; 4 | 5 | namespace ChDCStatMenusLibrary 6 | { 7 | public class NetworkInfo 8 | { 9 | public static string GetPublicIP() 10 | { 11 | try 12 | { 13 | string uri = "http://ip.bjango.com/"; 14 | HttpWebRequest request = HttpWebRequest.Create(uri) as HttpWebRequest; 15 | request.Method = "GET"; 16 | request.ProtocolVersion = new Version(1, 1); 17 | HttpWebResponse response = request.GetResponse() as HttpWebResponse; 18 | using (Stream stream = response.GetResponseStream()) 19 | { 20 | StreamReader sr = new StreamReader(stream); 21 | return sr.ReadToEnd(); 22 | } 23 | } 24 | catch 25 | { 26 | return null; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ChDCStatMenusLibrary/NetworkSpeed.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Timers; 5 | using System.Net.NetworkInformation; 6 | 7 | namespace ChDCStatMenusLibrary 8 | { 9 | public class NetworkSpeedInfo 10 | { 11 | /// 12 | /// 发送的字节数 13 | /// 14 | public long BytesSent { get; set; } 15 | /// 16 | /// 接收的字节数 17 | /// 18 | public long BytesReceived { get; set; } 19 | /// 20 | /// 发送的速度(单位 B/s) 21 | /// 22 | public long BytesSentSpeed { get; set; } 23 | /// 24 | /// 接收的速度(单位 B/s) 25 | /// 26 | public long BytesReceivedSpeed { get; set; } 27 | 28 | public string BytesSentSpeedString 29 | { 30 | get 31 | { 32 | return NetworkSpeedInfo.GetSpeedString(BytesSentSpeed); 33 | } 34 | } 35 | public string BytesReceivedSpeedString 36 | { 37 | get 38 | { 39 | return NetworkSpeedInfo.GetSpeedString(BytesReceivedSpeed); 40 | } 41 | } 42 | 43 | public NetworkInterface NIC; 44 | 45 | public NetworkSpeedInfo() 46 | { 47 | BytesSent = 0L; 48 | BytesReceived = 0L; 49 | BytesReceivedSpeed = 0; 50 | BytesSentSpeed = 0; 51 | } 52 | 53 | /// 54 | /// 获取指定网卡的网速信息 55 | /// 56 | /// 57 | /// 58 | /// 59 | /// 60 | public static NetworkSpeedInfo GetNetworkSpeedInfo(NetworkInterface nic, NetworkSpeedInfo oldNetworkSpeedInfo = null, double interval = 1000) 61 | { 62 | NetworkSpeedInfo info = new NetworkSpeedInfo(); 63 | info.NIC = nic; 64 | 65 | IPv4InterfaceStatistics interfaceStats = nic.GetIPv4Statistics(); 66 | 67 | info.BytesSent = interfaceStats.BytesSent; 68 | info.BytesReceived = interfaceStats.BytesReceived; 69 | info.BytesSentSpeed = oldNetworkSpeedInfo == null ? 0 : (long)((info.BytesSent - oldNetworkSpeedInfo.BytesSent) / (interval / 1000)); 70 | info.BytesReceivedSpeed = oldNetworkSpeedInfo == null ? 0 : (long)((info.BytesReceived - oldNetworkSpeedInfo.BytesReceived) / (interval / 1000)); 71 | if (info.BytesSentSpeed < 0) 72 | info.BytesSentSpeed = 0; 73 | if (info.BytesReceivedSpeed < 0) 74 | info.BytesReceivedSpeed = 0; 75 | return info; 76 | } 77 | 78 | /// 79 | /// 获取所有网卡综合的网速信息 80 | /// 81 | /// 82 | /// 83 | /// 84 | /// 85 | public static NetworkSpeedInfo GetTotalNetworkSpeedInfo(NetworkInterface[] nics, NetworkSpeedInfo oldNetworkSpeedInfo = null, double interval = 1000) 86 | { 87 | NetworkSpeedInfo info = new NetworkSpeedInfo(); 88 | 89 | info.NIC = null; 90 | 91 | foreach (NetworkInterface nic in nics) 92 | { 93 | IPv4InterfaceStatistics interfaceStats = nic.GetIPv4Statistics(); 94 | info.BytesSent += interfaceStats.BytesSent; 95 | info.BytesReceived += interfaceStats.BytesReceived; 96 | } 97 | 98 | info.BytesSentSpeed += oldNetworkSpeedInfo == null ? 0 : (long)((info.BytesSent - oldNetworkSpeedInfo.BytesSent) / (interval / 1000)); 99 | info.BytesReceivedSpeed += oldNetworkSpeedInfo == null ? 0 : (long)((info.BytesReceived - oldNetworkSpeedInfo.BytesReceived) / (interval / 1000)); 100 | if (info.BytesSentSpeed < 0) 101 | info.BytesSentSpeed = 0; 102 | if (info.BytesReceivedSpeed < 0) 103 | info.BytesReceivedSpeed = 0; 104 | 105 | return info; 106 | } 107 | 108 | /// 109 | /// 将速度(单位 B/s)转换为字符串表示 110 | /// 111 | /// 112 | /// 113 | public static string GetSpeedString(long speed) 114 | { 115 | return ProcessInfo.GetStorageSizeString(speed) + "/s"; 116 | } 117 | } 118 | 119 | public class TotalNetworkSpeed 120 | { 121 | 122 | public event EventHandler NotityInfoEvent; 123 | 124 | Timer timer; 125 | NetworkSpeedInfo networkSpeedInfo = null; 126 | 127 | public TotalNetworkSpeed(double interval=1000) : this(new Timer(interval)) 128 | { 129 | 130 | } 131 | 132 | public TotalNetworkSpeed(Timer timer) 133 | { 134 | this.timer = timer; 135 | timer.Elapsed += Timer_Elapsed; 136 | } 137 | 138 | ~TotalNetworkSpeed() 139 | { 140 | this.timer?.Stop(); 141 | } 142 | 143 | private void Timer_Elapsed(object sender, ElapsedEventArgs e) 144 | { 145 | // get network speed 146 | if (NotityInfoEvent != null) 147 | { 148 | NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces() 149 | .Where(n => n.OperationalStatus == OperationalStatus.Up) 150 | .ToArray(); 151 | networkSpeedInfo = NetworkSpeedInfo.GetTotalNetworkSpeedInfo(nics, networkSpeedInfo, timer.Interval); 152 | Notify(networkSpeedInfo); 153 | } 154 | } 155 | 156 | /// 157 | /// 开启获取 158 | /// 159 | public void Start() 160 | { 161 | timer.Start(); 162 | Timer_Elapsed(null, null); 163 | } 164 | 165 | public void Stop() 166 | { 167 | timer.Stop(); 168 | } 169 | 170 | public void Notify(NetworkSpeedInfo info) 171 | { 172 | NotityInfoEvent?.Invoke(this, info); 173 | } 174 | 175 | } 176 | 177 | public class NetworkSpeed 178 | { 179 | 180 | public event EventHandler NotityInfoEvent; 181 | 182 | Timer timer; 183 | Dictionary networkSpeedInfos = new Dictionary(); 184 | 185 | public NetworkSpeed(double interval = 1000) : this(new Timer(interval)) 186 | { 187 | 188 | } 189 | 190 | public NetworkSpeed(Timer timer) 191 | { 192 | this.timer = timer; 193 | timer.Elapsed += Timer_Elapsed; 194 | } 195 | 196 | ~NetworkSpeed() 197 | { 198 | this.timer?.Stop(); 199 | } 200 | 201 | private void Timer_Elapsed(object sender, ElapsedEventArgs e) 202 | { 203 | // get network speed 204 | if (NotityInfoEvent != null) 205 | { 206 | NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces() 207 | .Where(n => n.OperationalStatus == OperationalStatus.Up && 208 | (n.GetIPStatistics().BytesReceived != 0 || 209 | n.GetIPStatistics().BytesSent != 0)) 210 | .ToArray(); 211 | foreach(NetworkInterface nic in nics) 212 | { 213 | NetworkSpeedInfo ni = null; 214 | if(networkSpeedInfos.ContainsKey(nic.Id)) 215 | ni = networkSpeedInfos[nic.Id]; 216 | ni = NetworkSpeedInfo.GetNetworkSpeedInfo(nic, ni, timer.Interval); 217 | networkSpeedInfos[nic.Id] = ni; 218 | } 219 | Notify(networkSpeedInfos.Values.OrderByDescending(n => n.BytesReceivedSpeed).ToArray()); 220 | } 221 | } 222 | 223 | /// 224 | /// 开启获取 225 | /// 226 | public void Start() 227 | { 228 | timer.Start(); 229 | Timer_Elapsed(null, null); 230 | } 231 | 232 | public void Stop() 233 | { 234 | timer.Stop(); 235 | } 236 | 237 | public void Notify(NetworkSpeedInfo[] infos) 238 | { 239 | NotityInfoEvent?.Invoke(this, infos); 240 | } 241 | 242 | } 243 | } 244 | -------------------------------------------------------------------------------- /ChDCStatMenusLibrary/ProcessInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | 6 | namespace ChDCStatMenusLibrary 7 | { 8 | public class ProcessInfo 9 | { 10 | public struct SimpleMemoryUsage 11 | { 12 | public string ProcessName; 13 | public long Usage; 14 | 15 | public SimpleMemoryUsage(string ProcessName, long Usage) 16 | { 17 | this.ProcessName = ProcessName; 18 | this.Usage = Usage; 19 | } 20 | } 21 | 22 | /// 23 | /// 获取所有进程内存的使用情况 24 | /// 结果按使用大小排序 25 | /// 26 | /// 是否把同名进程的内存大小加在一起 27 | public static SimpleMemoryUsage[] GetMemeoryUsage(bool gatherSameNameProcess=true) 28 | { 29 | List infos = new List(); 30 | foreach (Process pro in Process.GetProcesses()) 31 | { 32 | SimpleMemoryUsage item = new SimpleMemoryUsage(); 33 | 34 | item.ProcessName = pro.ProcessName; 35 | item.Usage = pro.WorkingSet64; 36 | // item.Usage = pro.PrivateMemorySize64; 37 | infos.Add(item); 38 | } 39 | 40 | SimpleMemoryUsage[] result; 41 | if (gatherSameNameProcess) 42 | { 43 | var r = from n in infos 44 | group n by n.ProcessName into ng 45 | select new SimpleMemoryUsage(ng.Key, ng.Sum(i => i.Usage)) into mm 46 | orderby -mm.Usage 47 | select mm; 48 | result = r.ToArray(); 49 | } 50 | else 51 | { 52 | result = infos.OrderByDescending(e => e.Usage).ToArray(); 53 | } 54 | return result; 55 | } 56 | 57 | public static string GetStorageSizeString(long storageSize) 58 | { 59 | const int MAX_LENTH = 3; 60 | 61 | string[] units = { "K", "M", "G", "T", "P" }; 62 | string unit = " "; 63 | double s = storageSize; 64 | foreach (string u in units) 65 | { 66 | if ((int)s / 1000 != 0) 67 | { 68 | unit = u; 69 | s /= 1024; 70 | } 71 | else 72 | break; 73 | } 74 | 75 | String ss = s.ToString(); 76 | int i = ss.IndexOf('.'); 77 | if(i >= MAX_LENTH - 1) 78 | { 79 | ss = ss.Substring(0, i); 80 | } 81 | else if(i >= 0) 82 | { 83 | ss = ss.Substring(0, MAX_LENTH); 84 | if(ss.Substring(i + 1).All(c => c == '0')) 85 | ss = ss.Substring(0, i); 86 | } 87 | return String.Format("{0}{1}B", ss, unit.ToString()); 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /ChDCStatMenusLibrary/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("ChDCStatMenusLibrary")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ChDCStatMenusLibrary")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | //将 ComVisible 设置为 false 将使此程序集中的类型 18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("8736d2c0-4ff9-4885-bd9b-aa35088ea480")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: : 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ChDCStatMenusLibrary/TimeInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Globalization; 4 | 5 | namespace ChDCStatMenusLibrary 6 | { 7 | public class TimeInfo 8 | { 9 | 10 | //C# 获取农历日期 11 | 12 | /// 13 | /// 实例化一个 ChineseLunisolarCalendar 14 | /// 15 | private static ChineseLunisolarCalendar ChineseCalendar = new ChineseLunisolarCalendar(); 16 | 17 | /// 18 | /// 十天干 19 | /// 20 | private static string[] tg = { "甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸" }; 21 | 22 | /// 23 | /// 十二地支 24 | /// 25 | private static string[] dz = { "子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥" }; 26 | 27 | /// 28 | /// 十二生肖 29 | /// 30 | private static string[] sx = { "鼠", "牛", "虎", "免", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪" }; 31 | 32 | /// 33 | /// 农历月 34 | /// 35 | 36 | /// 37 | private static string[] months = { "正", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "腊" }; 38 | 39 | /// 40 | /// 农历日 41 | /// 42 | private static string[] decadeDays = { "初", "十", "廿", "三" }; 43 | /// 44 | /// 农历日 45 | /// 46 | private static string[] days = { "一", "二", "三", "四", "五", "六", "七", "八", "九", "十" }; 47 | 48 | /// 49 | /// 返回农历天干地支年 50 | /// 51 | ///农历年 52 | /// 53 | public static string GetLunisolarYear(int year) 54 | { 55 | Trace.Assert(year > 0, "Illegal Year"); 56 | int tgIndex = (year + 6) % 10; 57 | int dzIndex = (year + 8) % 12; 58 | 59 | return string.Concat(tg[tgIndex], dz[dzIndex]); 60 | } 61 | 62 | /// 63 | /// 获取指定年份的属相 64 | /// 65 | /// 66 | /// 67 | public static string GetChineseZodiac(int year) 68 | { 69 | Trace.Assert(year > 0, "Illegal Year"); 70 | int dzIndex = (year + 8) % 12; 71 | return sx[dzIndex]; 72 | } 73 | 74 | /// 75 | /// 返回农历月 76 | /// 77 | ///月份 78 | /// 79 | public static string GetLunisolarMonth(int month) 80 | { 81 | Trace.Assert(month < 13 && month > 0, "Illegal Month"); 82 | return months[month - 1]; 83 | } 84 | 85 | /// 86 | /// 返回农历日 87 | /// 88 | ///天 89 | /// 90 | public static string GetLunisolarDay(int day) 91 | { 92 | Trace.Assert(day > 0 && day < 32, "Illegal Day"); 93 | 94 | if (day == 20 || day == 30) 95 | { 96 | // 二十 三十 97 | return string.Concat(days[(day - 1) / 10], decadeDays[1]); 98 | } 99 | else 100 | { 101 | return string.Concat(decadeDays[(day - 1) / 10], days[(day - 1) % 10]); 102 | } 103 | } 104 | 105 | 106 | 107 | /// 108 | /// 根据公历获取农历日期 109 | /// 110 | ///公历日期 111 | /// 112 | public static string GetChineseDateTime(DateTime datetime) 113 | { 114 | int year = ChineseCalendar.GetYear(datetime); 115 | int month = ChineseCalendar.GetMonth(datetime); 116 | int day = ChineseCalendar.GetDayOfMonth(datetime); 117 | 118 | //获取闰月, 0 则表示没有闰月 119 | int leapMonth = ChineseCalendar.GetLeapMonth(year); 120 | 121 | bool isleap = false; 122 | 123 | if (leapMonth > 0) 124 | { 125 | if (leapMonth == month) 126 | { 127 | //闰月 128 | isleap = true; 129 | month--; 130 | } 131 | else if (month > leapMonth) 132 | { 133 | month--; 134 | } 135 | } 136 | 137 | return String.Format("{0}[{1}]年{2}{3}月{4}", 138 | GetLunisolarYear(year), 139 | GetChineseZodiac(year), 140 | isleap ? "闰" : string.Empty, GetLunisolarMonth(month), 141 | GetLunisolarDay(day) 142 | ); 143 | } 144 | 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /ChDCStatMenusLibraryTests/ChDCStatMenusLibraryTests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | {C8F77292-4CD6-43FC-AE1F-ACFE71534EE5} 7 | Library 8 | Properties 9 | ChDCStatMenusLibraryTests 10 | ChDCStatMenusLibraryTests 11 | v4.6 12 | 512 13 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 14 | 10.0 15 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 16 | $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages 17 | False 18 | UnitTest 19 | 20 | 21 | 22 | true 23 | full 24 | false 25 | bin\Debug\ 26 | DEBUG;TRACE 27 | prompt 28 | 4 29 | 30 | 31 | pdbonly 32 | true 33 | bin\Release\ 34 | TRACE 35 | prompt 36 | 4 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | {8736D2C0-4FF9-4885-BD9B-AA35088EA480} 64 | ChDCStatMenusLibrary 65 | 66 | 67 | 68 | 69 | 70 | 71 | False 72 | 73 | 74 | False 75 | 76 | 77 | False 78 | 79 | 80 | False 81 | 82 | 83 | 84 | 85 | 86 | 87 | 94 | -------------------------------------------------------------------------------- /ChDCStatMenusLibraryTests/NetworkInfoTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | 3 | namespace ChDCStatMenusLibrary.Tests 4 | { 5 | [TestClass()] 6 | public class NetworkInfoTests 7 | { 8 | [TestMethod()] 9 | public void GetPublicIPTest() 10 | { 11 | Assert.AreEqual("59.46.127.59", NetworkInfo.GetPublicIP()); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /ChDCStatMenusLibraryTests/NetworkSpeedInfoTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | 3 | namespace ChDCStatMenusLibrary.Tests 4 | { 5 | [TestClass()] 6 | public class NetworkSpeedInfoTests 7 | { 8 | [TestMethod()] 9 | public void GetSpeedStringTest() 10 | { 11 | Assert.AreEqual("1KB/s", NetworkSpeedInfo.GetSpeedString(1024)); 12 | Assert.AreEqual("0 B/s", NetworkSpeedInfo.GetSpeedString(0)); 13 | Assert.AreEqual("-1KB/s", NetworkSpeedInfo.GetSpeedString(-1024)); 14 | Assert.AreEqual("1KB/s", NetworkSpeedInfo.GetSpeedString(1025)); 15 | Assert.AreEqual("128 B/s", NetworkSpeedInfo.GetSpeedString(128)); 16 | Assert.AreEqual("1.9KB/s", NetworkSpeedInfo.GetSpeedString(2000)); 17 | Assert.AreEqual("0.9KB/s", NetworkSpeedInfo.GetSpeedString(1023)); 18 | 19 | Assert.AreEqual("0.9GB/s", NetworkSpeedInfo.GetSpeedString(1063700000)); 20 | Assert.AreEqual("1KB/s", NetworkSpeedInfo.GetSpeedString(1025)); 21 | Assert.AreEqual("1KB/s", NetworkSpeedInfo.GetSpeedString(1116)); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /ChDCStatMenusLibraryTests/NetworkSpeedTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using ChDCStatMenusLibrary; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace ChDCStatMenusLibrary.Tests 10 | { 11 | [TestClass()] 12 | public class NetworkSpeedTests 13 | { 14 | [TestMethod()] 15 | public void NetworkSpeedTest() 16 | { 17 | Assert.Fail(); 18 | } 19 | 20 | [TestMethod()] 21 | public void NetworkSpeedTest1() 22 | { 23 | Assert.Fail(); 24 | } 25 | 26 | [TestMethod()] 27 | public void StartTest() 28 | { 29 | Assert.Fail(); 30 | } 31 | 32 | [TestMethod()] 33 | public void NotifyTest() 34 | { 35 | Assert.Fail(); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /ChDCStatMenusLibraryTests/ProcessInfoTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | 3 | namespace ChDCStatMenusLibrary.Tests 4 | { 5 | [TestClass()] 6 | public class ProcessInfoTests 7 | { 8 | [TestMethod()] 9 | public void GetStorageSizeStringTest() 10 | { 11 | Assert.AreEqual("1KB", ProcessInfo.GetStorageSizeString(1024)); 12 | Assert.AreEqual("0 B", ProcessInfo.GetStorageSizeString(0)); 13 | Assert.AreEqual("-1KB", ProcessInfo.GetStorageSizeString(-1024)); 14 | Assert.AreEqual("1KB", ProcessInfo.GetStorageSizeString(1025)); 15 | Assert.AreEqual("128 B", ProcessInfo.GetStorageSizeString(128)); 16 | Assert.AreEqual("1.9KB", ProcessInfo.GetStorageSizeString(2000)); 17 | Assert.AreEqual("0.9KB", ProcessInfo.GetStorageSizeString(1023)); 18 | 19 | Assert.AreEqual("0.9GB", ProcessInfo.GetStorageSizeString(1063700000)); 20 | Assert.AreEqual("1KB", ProcessInfo.GetStorageSizeString(1025)); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /ChDCStatMenusLibraryTests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("ChDCStatMenusLibraryTests")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ChDCStatMenusLibraryTests")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | //将 ComVisible 设置为 false 将使此程序集中的类型 18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("c8f77292-4cd6-43fc-ae1f-acfe71534ee5")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: : 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ChDCStatMenusLibraryTests/TimeInfoTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using System; 3 | 4 | namespace ChDCStatMenusLibrary.Tests 5 | { 6 | [TestClass()] 7 | public class TimeInfoTests 8 | { 9 | [TestMethod()] 10 | public void GetLunisolarYearTest() 11 | { 12 | Assert.AreEqual("丁酉", TimeInfo.GetLunisolarYear(2017)); 13 | } 14 | 15 | [TestMethod()] 16 | public void GetLunisolarMonthTest() 17 | { 18 | Assert.AreEqual("腊", TimeInfo.GetLunisolarMonth(12)); 19 | Assert.AreEqual("十一", TimeInfo.GetLunisolarMonth(11)); 20 | } 21 | 22 | [TestMethod()] 23 | public void GetLunisolarDayTest() 24 | { 25 | Assert.AreEqual("十二", TimeInfo.GetLunisolarDay(12)); 26 | Assert.AreEqual("廿一", TimeInfo.GetLunisolarDay(21)); 27 | Assert.AreEqual("二十", TimeInfo.GetLunisolarDay(20)); 28 | Assert.AreEqual("初一", TimeInfo.GetLunisolarDay(1)); 29 | 30 | } 31 | 32 | [TestMethod()] 33 | public void GetChineseDateTimeTest() 34 | { 35 | Assert.AreEqual("丁酉[鸡]年三月初九", TimeInfo.GetChineseDateTime(new DateTime(2017, 4, 5))); 36 | } 37 | 38 | [TestMethod()] 39 | public void GetChineseZodiacTest() 40 | { 41 | Assert.AreEqual("鸡", TimeInfo.GetChineseZodiac(2017)); 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Chen Dacai 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ChDCStatMenus 2 | 用于Windows任务栏的实时网速显示程序。A desk band for Windows to show network speed continually. 3 | 4 | ## 功能 5 | 6 | * 实时网速 7 | 8 | * 实时物理内存使用情况等 9 | 10 | * 每个进程的物理内存占用 11 | 12 | 合并同名进程或父子进程内存 13 | 14 | ## 平台及环境 15 | 16 | | 项目 | 项目 | 17 | | ---- | --------------- | 18 | | 操作系统 | Windows 10 64 位 | 19 | | 框架 | .NET 4.6 | 20 | 21 | ## 使用方法 22 | 23 | ### 安装 24 | 25 | 1. 下载发布包; 26 | 27 | 2. 解压发布包; 28 | 29 | 3. 用管理员权限运行发布包中的 `install.bat` 脚本。 30 | 31 | 4. 等待桌面刷新完毕之后,`在任务栏处右击` -> `工具栏(Toolbars)` -> `ChDC Stat Menus` 32 | 33 | ![install](Screenshots/install.png) 34 | 35 | 注意:我电脑上任务栏是放在顶部的。 36 | 37 | 说明:安装过程就是把发布包中的 DLL 发布到 GAC 中去。 38 | 39 | ### 卸载 40 | 41 | 1. 用管理员权限运行发布包中的 `uninstall.bat` 脚本。 42 | 43 | ## 截图 44 | 45 | ### 实时网速显示效果 46 | 47 | ![Screenshot_20170405103515](Screenshots/Screenshot_20170405103515.png) 48 | 49 | ### 其他信息显示效果 50 | 51 | ![Screenshot_20170405103852](Screenshots/Screenshot_20170405103852.png) 52 | 53 | ### 进程内存占用情况显示效果 54 | 55 | ![Screenshot_20170405104620](Screenshots/Screenshot_20170405104620.png) -------------------------------------------------------------------------------- /Screenshots/Screenshot_20170405103515.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChDC/ChDCStatMenus/0ba28a883800a0ff9ee096d0154578ebf6f5d9de/Screenshots/Screenshot_20170405103515.png -------------------------------------------------------------------------------- /Screenshots/Screenshot_20170405103852.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChDC/ChDCStatMenus/0ba28a883800a0ff9ee096d0154578ebf6f5d9de/Screenshots/Screenshot_20170405103852.png -------------------------------------------------------------------------------- /Screenshots/Screenshot_20170405104620.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChDC/ChDCStatMenus/0ba28a883800a0ff9ee096d0154578ebf6f5d9de/Screenshots/Screenshot_20170405104620.png -------------------------------------------------------------------------------- /Screenshots/install.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChDC/ChDCStatMenus/0ba28a883800a0ff9ee096d0154578ebf6f5d9de/Screenshots/install.png -------------------------------------------------------------------------------- /Tools/installDesktopband.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | %1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit 3 | 4 | set gacutil="C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\x64\gacutil.exe" 5 | set RegAsm="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe" 6 | 7 | cd /d %~dp0 8 | cd .. 9 | cd .\ChDCStatMenus\bin\Release 10 | %gacutil% /if BandObjectLib.dll 11 | %gacutil% /if ChDCStatMenusLibrary.dll 12 | %gacutil% /if ChDCStatMenus.dll 13 | %regasm% ChDCStatMenus.dll 14 | taskkill.exe /im explorer.exe /f 15 | explorer.exe 16 | rem pause 17 | --------------------------------------------------------------------------------