Click here to Skip to main content
12,449,325 members (58,300 online)
Click here to Skip to main content

Stats

44.6K views
1.4K downloads
126 bookmarked
Posted

Clipz - A Friendly Introduction to the Windows 7 Taskbar Features

, 17 Dec 2009 CPOL
An overview of the Windows 7 taskbar features, and how to use then in your own applications.
Clipz
bin
Debug
Clipz.csproj.user
CopyIcon.ico
DeleteIcon.ico
Model
Native Methods
Properties
Resources
Audio.png
Clipboard.png
NextIcon.ico
PreviousIcon.ico
Utility
Core
AppRestartRecovery
Dialogs
Common
TaskDialogs
Interop
AppRestartRecovery
Dialogs
NetworkList
PowerManagement
TaskDialogs
NetworkList
PowerManagement
Properties
PropertySystem
SafeHandles
Libraries
StructureMap.dll
Shell
Common
CommonFileDialogs
Controls
Design
ShellObjects.cd
ShellThumbnailClassDiagram.cd
DesktopWindowManager
ExplorerBrowser
ExplorerBrowserDiagram.cd
Interop
Common
Dialogs
ExplorerBrowser
KnownFolders
PropertySystem
StockIcons
Taskbar
KnownFolders
Properties
PropertySystem
StockIcons
Taskbar
//Copyright (c) Microsoft Corporation.  All rights reserved.

using System;

namespace Microsoft.WindowsAPICodePack.Net
{
    /// <summary>
    /// Represents a network on the local machine. 
    /// It can also represent a collection of network 
    /// connections with a similar network signature.
    /// </summary>
    /// <remarks>
    /// Instances of this class are obtained by calling 
    /// methods on the <see cref="NetworkListManager"/> class.
    /// </remarks>
    public class Network
    {
        #region Private Fields

        INetwork network;

        #endregion // Private Fields

        internal Network(INetwork network)
        {
            this.network = network;
        }

        /// <summary>
        /// Gets or sets the category of a network. The 
        /// categories are trusted, untrusted, or 
        /// authenticated.
        /// </summary>
        /// <value>A <see cref="NetworkCategory"/> value.</value>
        public NetworkCategory Category
        {
            get
            {
                return network.GetCategory();
            }

            set
            {
                network.SetCategory(value);
            }
        }

        /// <summary>
        /// Gets the local date and time when the network 
        /// was connected.
        /// </summary>
        /// <value>A <see cref="System.DateTime"/> object.</value>
        public DateTime ConnectedTime
        {
            get
            {
                uint low, high, dummy1, dummy2;
                network.GetTimeCreatedAndConnected(out dummy1, out dummy2, out low, out high);
                long time = high;
                // Shift the day info into the high order bits.
                time <<= 32;
                time |= low;
                return DateTime.FromFileTimeUtc(time);
            }
        }

        /// <summary>
        /// Gets the network connections for the network.
        /// </summary>
        /// <value>A <see cref="NetworkConnectionCollection"/> object.</value>
        public NetworkConnectionCollection Connections
        {
            get
            {
                return new NetworkConnectionCollection(network.GetNetworkConnections());
            }
        }

        /// <summary>
        /// Gets the connectivity state of the network.
        /// </summary>
        /// <value>A <see cref="Connectivity"/> value.</value>
        /// <remarks>Connectivity provides information on whether
        /// the network is connected, and the protocols
        /// in use for network traffic.</remarks>
        public Connectivity Connectivity
        {
            get
            {
                return network.GetConnectivity();
            }
        }

        /// <summary>
        /// Gets the local date and time when the 
        /// network was created.
        /// </summary>
        /// <value>A <see cref="System.DateTime"/> object.</value>
        public DateTime CreatedTime
        {
            get
            {
                uint low, high, dummy1, dummy2;
                network.GetTimeCreatedAndConnected(out low, out high, out dummy1, out dummy2);
                long time = high;
                //Shift the value into the high order bits.
                time <<= 32;
                time |= low;
                return DateTime.FromFileTimeUtc(time);
            }
        }

        /// <summary>
        /// Gets or sets a description for the network.
        /// </summary>
        /// <value>A <see cref="System.String"/> value.</value>
        public string Description
        {
            get
            {
                return network.GetDescription();
            }

            set
            {
                network.SetDescription(value);
            }
        }

        /// <summary>
        /// Gets the domain type of the network. 
        /// </summary>
        /// <value>A <see cref="DomainType"/> value.</value>
        /// <remarks>The domain
        /// indictates whether the network is an Active
        /// Directory Network, and whether the machine
        /// has been authenticated by Active Directory.</remarks>
        public DomainType DomainType
        {
            get
            {
                return network.GetDomainType();
            }
        }

        /// <summary>
        /// Gets a value that indicates whether there is
        /// network connectivity.
        /// </summary>
        /// <value>A <see cref="System.Boolean"/> value.</value>
        public bool IsConnected
        {
            get
            {
                return network.IsConnected;
            }
        }

        /// <summary>
        /// Gets a value that indicates whether there is 
        /// Internet connectivity.
        /// </summary>
        /// <value>A <see cref="System.Boolean"/> value.</value>
        public bool IsConnectedToInternet
        {
            get
            {
                return network.IsConnectedToInternet;
            }
        }

        /// <summary>
        /// Gets or sets the name of the network.
        /// </summary>
        /// <value>A <see cref="System.String"/> value.</value>
        public string Name
        {
            get
            {
                return network.GetName();
            }

            set
            {
                network.SetName(value);
            }
        }

        /// <summary>
        /// Gets a unique identifier for the network.
        /// </summary>
        /// <value>A <see cref="System.Guid"/> value.</value>
        public Guid NetworkId
        {
            get
            {
                return network.GetNetworkId();
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

TylerBrinks
Web Developer PageLabs
United States United States
I'm the founder of PageLabs, a web-based performance and SEO optimization site.

Give your site a boost in performance, even take a free speed test!

http://www.pagelabs.com

You may also be interested in...

Pro
Pro
| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.160811.3 | Last Updated 17 Dec 2009
Article Copyright 2009 by TylerBrinks
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid