Exemplo n.º 1
0
        /// <summary>
        /// Callback of the asynchronous receive thread.
        /// </summary>
        /// <param name="ar"></param>
        private void HttpFileListeningCallback(IAsyncResult ar)
        {
            StartHttpFileListeningDelegate worker =
                (StartHttpFileListeningDelegate)((AsyncResult)ar).AsyncDelegate;

            try
            {
                // Finish the asynchronous operation
                worker.EndInvoke(ar);
            }
            catch
            {
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Intizializes the <see cref="ILogProvider"/>.
        /// </summary>
        /// <param name="logHandler">The <see cref="ILogHandler"/> that may handle incoming <see cref="LogMessage"/>s.</param>
        public override void Initialize(ILogHandler logHandler)
        {
            base.Initialize(logHandler);

            if (mHttpClient == null || !mConnected)
            {
                mHttpClient         = new HttpClient();
                mHttpClient.Timeout = new TimeSpan(0, 0, Properties.Settings.Default.PnlCustomHttpSettingsTimeout);
            }

            StartHttpFileListeningDelegate worker = HttpFileListeningWorker;
            AsyncCallback completedCallback       = HttpFileListeningCallback;

            mConnected = true;

            worker.BeginInvoke(
                mHttpClient
                , mUrl
                , completedCallback
                , AsyncOperationManager.CreateOperation(null));
        }