Example #1
0
        // <Snippet2>
        // Initializes the provider.
        public SampleEventProvider() : base()
        {
            // Initialize the local path of the file
            // that holds event information.
            logFilePath = "C:/test/log.doc";

            // Clear the message buffer.
            msgBuffer.Clear();

            // Initialize the max number of messages
            // to buffer.
            maxMsgNumber = 10;

            // More custom initialization goes here.
        }
        public void Reset(Stream stream)
        {
            TraceOutput(TraceBits.Session, "-------------------------------------------------------");
            TraceOutput(TraceBits.Session, "Reset {0:X8} firstDone({1})", this.GetHashCode(), _firstWriteDone);

            if (!_firstWriteDone)
            {
                return;
            }

            // reset all status
            _toWrite.Clear();
            _toFill.Clear();
            foreach (var workitem in _pool)
            {
                _toFill.Enqueue(workitem.index);
                workitem.ordinal = -1;
            }

            _firstWriteDone      = false;
            _totalBytesProcessed = 0L;
            _runningCrc          = new Ionic.Crc.CRC32();
            _isClosed            = false;
            _currentlyFilling    = -1;
            _lastFilled          = -1;
            _lastWritten         = -1;
            _latestCompressed    = -1;
            _outStream           = stream;
        }
Example #3
0
        // To be called once the track is terminated
        public void TerminateTarget()
        {
            LabelOffset      = new Point(25, 25);
            ModeA_CI_STRING  = "---- -";
            CALLSIGN_STRING  = "--------";
            ModeC_STRING     = "---";
            CFL_STRING       = " ---";
            A_HDG_STRING     = "h---";
            A_SPD_STRING     = "s---";
            A_ROC_STRING     = "R---";
            CALC_HDG_STRING  = "---";
            CALC_GSPD_STRING = " ---";
            MyTargetIndex    = -1;
            HistoryPoints.Clear();
            TargetToMonitor   = -1;
            TargetMonitoredBy = -1;
            STCA_List.Clear();

            Mode_S_Addr = "N/A";
            TAS         = "N/A";
            IAS         = "N/A";
            MACH        = "N/A";
            DAP_HDG     = "N/A";
            DAP_GSPD    = "N/A";
            TRK         = "N/A";
            Roll_Angle  = "N/A";
            SelectedAltitude_ShortTerm = "N/A";
            SelectedAltitude_LongTerm  = "N/A";
            Rate_Of_Climb      = "N/A";
            Barometric_Setting = "N/A";
        }
 /// <summary></summary>
 public void Clear()
 {
     lock (_Locker)
     {
         _Queue.Clear();
     }
 }
        public void ClearQueue()
        {
            lock (this)
            {
                // List of tasks that should be re-add after the queue is cleared.
                // This are tasks that are not allowed to be cancelled.
                List <FFmpegTask> addAgainAfterClear = new List <FFmpegTask>();

                // Clear all task references and empty queue.
                while (_queue.Count > 0)
                {
                    FFmpegTask task = _queue.Dequeue();

                    if (task.ForceCompletion)
                    {
                        addAgainAfterClear.Add(task);
                    }
                }
                _queue.Clear();

                // Add the "forced to complete" items again to the queue.
                foreach (FFmpegTask task in addAgainAfterClear)
                {
                    _queue.Enqueue(task);
                }
            }
        }
Example #6
0
 public static void ClearResource()
 {
     if (queError != null)
     {
         queError.Clear();
     }
 }
Example #7
0
        public static IEnumerable <(GraphNode node, int distance)> FindPaths(GraphNode startGraphNode)
        {
            var queue   = new System.Collections.Generic.Queue <GraphNode>();
            var visited = new HashSet <GraphNode>();
            var result  = new List <(GraphNode, int)>();

            queue.Enqueue(startGraphNode);
            var distance = 1;

            while (queue.Count != 0)
            {
                var nodes = queue.ToList();
                queue.Clear();
                foreach (var node in nodes)
                {
                    visited.Add(node);
                    foreach (var incidentNode in node.Edges.Where(x => !visited.Contains(x)))
                    {
                        queue.Enqueue(incidentNode);
                        result.Add((incidentNode, distance));
                    }
                }

                distance++;
            }

            return(result);
        }
Example #8
0
            protected override void Dispose(bool disposing)
            {
                _ReceiveQueue.Clear();
                var data = _DataAvailableSignal;

                _DataAvailableSignal = null;
                data.Dispose();
            }
Example #9
0
        /// <summary>
        /// This function is called when Logger finishes writing the log to disk.
        /// It sets writingToDisk = false and then moves any LogEntries in the overflow
        /// queue to the logEntries queue.  Upon completion it clears the overflow queue
        /// </summary>
        public static void setWritingFinished()
        {
            writingToDisk = false;
            IEnumerator <LogEntry> queueEnum = overFlow.GetEnumerator();

            while (queueEnum.MoveNext())
            {
                logEntries.Enqueue(queueEnum.Current);
            }
            overFlow.Clear();
        }
Example #10
0
        public void OnAfterDeserialize()
        {
            queue.Clear();

            for (var i = 0; i < values.Count && i < values.Count; i++)
            {
                if (!queue.Contains(values[i]))
                {
                    queue.Enqueue(values[i]);
                }
            }
        }
Example #11
0
 public void Dispose()
 {
     if (m_FileWatcher != null)
     {
         m_FileWatcher.EnableRaisingEvents = false;
         m_FileWatcher.Dispose();
     }
     if (m_Event != null)
     {
         m_Event.Dispose();
     }
     if (m_Queue != null)
     {
         m_Queue.Clear();
         m_Queue = null;
     }
 }
Example #12
0
 /// <summary>
 /// load recent file list from file
 /// </summary>
 private void LoadRecentList()
 {//try to load file. If file isn't found, do nothing
     MRUlist.Clear();
     try
     {
         StreamReader listToRead = new StreamReader(System.Environment.CurrentDirectory + "\\Recent.txt"); //read file stream
         string       line;
         while ((line = listToRead.ReadLine()) != null)                                                    //read each line until end of file
         {
             MRUlist.Enqueue(line);                                                                        //insert to list
         }
         listToRead.Close();                                                                               //close the stream
     }
     catch (Exception)
     {
         //throw;
     }
 }
Example #13
0
        public T[] DequeueAll()
        {
            bool gotLock = false;

            T[] all;

            try
            {
                _Lock.Enter(ref gotLock);
                all = _Set.ToArray();
                _Set.Clear();
            }
            finally
            {
                if (gotLock)
                {
                    _Lock.Exit();
                }
            }
            return(all);
        }
Example #14
0
    /// <summary>
    /// 执行下一个粒子效果展示
    /// </summary>
    private void DoNextParticalDisplayEffect()
    {
        if (!CanShowDisPlayEffect())
        {
            m_cacheDisplayDatas.Clear();
            return;
        }

        if (m_isDoingDisplayEffect)
        {
            return;
        }

        if (m_cacheDisplayDatas.Count == 0)
        {
            return;
        }

        EffectDisplayData data = null;
        bool success           = false;

        while (m_cacheDisplayDatas.Count > 0)
        {
            data = m_cacheDisplayDatas.Dequeue();
            if (Time.time - data.CacheStartTime <= CenterDisplayEffectCacheLT)
            {
                //是否超过缓存最大时间
                success = true;
                break;
            }
        }
        if (success)
        {
            m_isDoingDisplayEffect = true;
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.UIEVENTPlayDISPLAYEFFECT, data);
        }
    }
Example #15
0
 public void ClearEvents()
 {
     events.Clear();
 }
Example #16
0
 public void Clear()
 {
     using (locker.Using()) {
         queue.Clear();
     }
 }
Example #17
0
 public void Clear()
 {
     Lock(false);
     queue.Clear();
     UnLock();
 }
Example #18
0
 public void StopListeningForResponses()
 {
     _ReceivedMessageQueue.Clear();
     _MessageAvailableSignal.Dispose();
     _MessageAvailableSignal = new System.Threading.ManualResetEvent(false);
 }
Example #19
0
 public void StopListeningForBroadcasts()
 {
     _ReceivedBroadcastsQueue.Clear();
     _BroadcastAvailableSignal.Dispose();
     _BroadcastAvailableSignal = new System.Threading.ManualResetEvent(false);
 }
Example #20
0
 public void Clear()
 {
     times.Clear();
 }
 /// <summary>
 /// Stop
 /// </summary>
 public void Stop()
 {
     m_Timer.Stop();
     m_Buffer.Clear();
 }
Example #22
0
 public void Clear()
 {
     _queue.Clear();
 }
Example #23
0
 public void Clear()
 {
     lock (listLock) {
         queue.Clear();
     }
 }
Example #24
0
 public void Reset()
 {
     timer.Reset();
     VelocityX = VelocityY = 0.0f;
     history.Clear();
 }
Example #25
0
 internal void reset()
 {
     hand.Clear();
 }