Beispiel #1
0
        /// <summary>
        /// Called by our worker thread to avoid inordinate pauses in the UI while the Internet
        /// is pinged to determine its status.
        /// </summary>
        private void CheckInternetStatusAndUpdateUI()
        {
            // Check Internet status
            string buttonLabel, message, tooltip, diagnostics;

            Monitor.Enter(_model);
            bool result = _model.GetInternetStatusLink(out buttonLabel, out message, out tooltip,
                                                       out diagnostics);

            Monitor.Exit(_model);

            // Using a callback and Invoke ensures that we avoid cross-threading updates.
            var callback = new UpdateInternetUICallback(UpdateInternetUI);

            Monitor.Enter(this);
            if (!_exiting)
            {
                this.Invoke(callback, new object[] { result, buttonLabel, message, tooltip, diagnostics });
            }
            Monitor.Exit(this);
        }
        /// <summary>
        /// Called by our worker thread to avoid inordinate pauses in the UI while the Internet
        /// is pinged to determine its status.
        /// </summary>
        private void CheckInternetStatusAndUpdateUI()
        {
            // Check Internet status
            string buttonLabel, message, tooltip, diagnostics;
            Monitor.Enter(_model);
            bool result = _model.GetInternetStatusLink(out buttonLabel, out message, out tooltip,
                                                       out diagnostics);
            Monitor.Exit(_model);

            // Using a callback and Invoke ensures that we avoid cross-threading updates.
            var callback = new UpdateInternetUICallback(UpdateInternetUI);
            Monitor.Enter(this);
            if(!_exiting)
                this.Invoke(callback, new object[] { result, buttonLabel, message, tooltip, diagnostics });
            Monitor.Exit(this);
        }