Beispiel #1
0
        /// <summary>
        /// Multiple threads are required in order to send and receive streamed data if the user interface is going to be responsive.
        /// The best way I could seperate the visual content from the multiple threads required to send and receive streamed data was via the use
        /// of delegates. I could have passed the classes in such as MainWindow or mP2P, however this would have greatly increased the dependencies.
        /// By using delegates this class can stand on it's own without using MainWindow or mP2P.
        /// </summary>
        /// <param name="nodeName">This Node's name</param>
        /// <param name="threadFinishedDelegate">The delegate to respond when the Thread has finished (this will only happen when it is canceled via </param>
        public StreamingHttpListener(String uniqueStreamName, WorkerThreadFinished threadFinishedDelegate,
                                     LogMessage msg, StartStream startStream, SendStream sendStream)
        {
            mLogMessage       = msg;
            mUniqueStreamName = uniqueStreamName;
            mStartStream      = startStream;
            mSendStream       = sendStream;

            //start the audioHttpListenerThread. This thread contains the AudioHttpServer and responds to requests from
            //the mAudioPlayer
            mHttpListenerThread                            = new System.ComponentModel.BackgroundWorker();
            mHttpListenerThread.DoWork                    += new System.ComponentModel.DoWorkEventHandler(PseudoHttpServer);
            mHttpListenerThread.RunWorkerCompleted        += new System.ComponentModel.RunWorkerCompletedEventHandler(threadFinishedDelegate);
            mHttpListenerThread.WorkerSupportsCancellation = true;
            mHttpListenerThread.RunWorkerAsync(null);

            //initialize the audio parameters.
            mIncommingStream          = false;
            mSyncStreamLastWrittenPos = 0;
            mPseudoStream             = new MemoryStream();
            mSyncStream = Stream.Synchronized(mPseudoStream);
            mHashTable  = new System.Collections.Hashtable();

            mTimer = new Timer(new TimerCallback(TimerCallback));
            mTimer.Change(0, 3500);//every 3500ms get a callback
        }
Beispiel #2
0
        private void StartComparing()
        {
            WorkerThreadFinished reportDelegate
                = new WorkerThreadFinished(this.WorkerThreadFinishedImpl);

            try
            {
                // Assume they are not equal
                this.areEqual = false;
                this.areEqual = sqlCompare.Start(this.paramUrn1.ToString(),
                                                 this.paramUrn2.ToString());

                reportDelegate(null);
            }
            catch (ApplicationException ex)
            {
                reportDelegate(ex);
            }
            catch (SmoException ex)
            {
                reportDelegate(ex);
            }
        }
Beispiel #3
0
        private void StartComparing()
        {
            WorkerThreadFinished reportDelegate
                = new WorkerThreadFinished(this.WorkerThreadFinishedImpl);

            try
            {
                // Assume they are not equal
                this.areEqual = false;
                this.areEqual = sqlCompare.Start(this.paramUrn1.ToString(),
                    this.paramUrn2.ToString());

                reportDelegate(null);
            }
            catch (ApplicationException ex)
            {
                reportDelegate(ex);
            }
            catch (SmoException ex)
            {
                reportDelegate(ex);
            }
        }