コード例 #1
0
        public NetworkWatcher()
        {
            _buffer = new Timer(BufferCallback);

            _manager = new NetworkListManager();

            // init current connections
            _connections = GetCurrentConnections();

            // prep for networkevents
            _container = (IConnectionPointContainer)_manager;
            _container.FindConnectionPoint(ref IID_INetworkEvents, out _connectionPoint);

            // wire up sink object
            _sink.Added += NetworkAdded;
            _sink.ConnectivityChanged += NetworkConnectivityChanged;
            _sink.Deleted += NetworkDeleted;
            _sink.PropertyChanged += NetworkPropertyChanged;

            // enable raising events
            _connectionPoint.Advise(_sink, out _cookie);
        }
コード例 #2
0
 public NetworkWatcher(Action<string> networkChangedCall)
 {
     _networkListManager = new NetworkListManager();
     _networkChangedCall = networkChangedCall;
 }