System.Collections.Generic.Queue.Clear()

Here are the examples of the csharp api System.Collections.Generic.Queue.Clear() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

852 Examples 7

19 Source : RequestQueue.cs
with MIT License
from 0ffffffffh

public static void Shutdown()
        {
            //obtain lock to make sure there
            //is nobody in the enq/deq op

            Log.Info("request queue shutting down");

            lock (synchObj)
            {
                cancelled = true;
                Log.Info("Signalling waiter events to finish");

                mre.Set();
                
                Requests.Clear();
            }

        }

19 Source : DialogueManagerController.cs
with MIT License
from 0xbustos

public void StartDialogue()
        {
            Dialogue dialogue = this.Model.DialogueToShow;
            this.Model.DialogueToShow = null;
            this.Model.Animator.SetBool( "IsOpen", true );
            voices.Clear();
            sprites.Clear();
            sentences.Clear();

            foreach (Sentence sentence in dialogue.Sentences)
            {
                expression = sentence.Character.Expressions[sentence.ExpressionIndex];
                sprites.Enqueue( expression.Image );
                sentences.Enqueue( sentence.Paragraph );
                voices.Enqueue( sentence.Character.Voice );
            }
        }

19 Source : DbContext.cs
with MIT License
from 2881099

public void Dispose() {
			if (_isdisposed) return;
			try {
				_actions.Clear();

				foreach (var set in _dicSet)
					try {
						set.Value.Dispose();
					} catch { }

				_dicSet.Clear();
				AllSets.Clear();
				
				_uow?.Rollback();
			} finally {
				_isdisposed = true;
				GC.SuppressFinalize(this);
			}
		}

19 Source : TransactTracking.cs
with MIT License
from 3F

private void Reset()
        {
            queries.Clear();
        }

19 Source : ETTask.cs
with MIT License
from 404Lcc

public void Recycle()
        {
            if (!_fromPool) return;
            _awaiterStatus = AwaiterStatus.Pending;
            _callback = null;
            _value = default;
            _etTaskQueue.Enqueue(this);
            if (_etTaskQueue.Count > 1000)
            {
                _etTaskQueue.Clear();
            }
        }

19 Source : ETTask.cs
with MIT License
from 404Lcc

public void Recycle()
        {
            if (!_fromPool) return;
            _awaiterStatus = AwaiterStatus.Pending;
            _callback = null;
            _etTaskQueue.Enqueue(this);
            if (_etTaskQueue.Count > 1000)
            {
                _etTaskQueue.Clear();
            }
        }

19 Source : ExpressionTree.Linq.cs
with MIT License
from 71

public void Dispose() => queue.Clear();

19 Source : ExpressionTree.Linq.cs
with MIT License
from 71

public void Reset()
            {
                queue.Clear();
                Visit(root);
            }

19 Source : ActionQueue.cs
with MIT License
from 7Bytes-Studio

public void Clear()
        {
           s_Queue.Clear();
        }

19 Source : MicroVM.CPU.cs
with MIT License
from a-downing

public void Reset() {
            Array.Clear(registers, 0, registers.Length);
            memory = null;
            instructions = null;
            flags = (uint)Flag.INTERRUPTS_ENABLED;
            pendingInterrupts.Clear();
        }

19 Source : Program.cs
with MIT License
from abanu-org

[MethodImpl(MethodImplOptions.Synchronized)]
        private static void Start()
        {
            while (true)
            {
                try
                {
                    stream?.Dispose();
                }
                catch
                {
                }
                try
                {
                    client?.Dispose();
                }
                catch
                {
                }
                try
                {
                    thRead?.Abort();
                }
                catch
                {
                }
                try
                {
                    thWrite?.Abort();
                }
                catch
                {
                }
                thRead = null;
                thWrite = null;

                ms.SetLength(0);
                WriteQueue.Clear();

                try
                {
                    client = new TcpClient();
                    Console.WriteLine("Connecting...");
                    client.Connect("localhost", 2244);
                    Console.WriteLine("Connected");
                    receiveBufSize = client.ReceiveBufferSize;
                    stream = client.GetStream();

                    thRead = new Thread(ReadThread);
                    thRead.Start();

                    thWrite = new Thread(WriteThread);
                    thWrite.Start();

                    IsConnecting = false;

                    break;
                }
                catch (SocketException ex)
                {
                    Console.WriteLine(ex);
                    Thread.Sleep(3000);
                }
            }
        }

19 Source : CommitLogServer.cs
with MIT License
from abdullin

async Task ScheduleStore() {
            var next = TimeSpan.FromSeconds(Math.Ceiling(_env.Time.TotalSeconds * 2) / 2);
            if (_scheduled != next) {
                _scheduled = next;
                await _env.Delay(_scheduled - _env.Time);
                if (_buffer.Count > 0) {
                    await _env.SimulateWork((5 * _buffer.Count + 10).Ms());
                    _stored.AddRange(_buffer);

                    _env.Debug($"Store {_buffer.Count} events");
                    _buffer.Clear();
                }
            }
        }

19 Source : GenericXRSDKSpatialMeshObserver.cs
with Apache License 2.0
from abist-co-ltd

public override void Suspend()
        {
            if (!IsRunning)
            {
                Debug.LogWarning("The XR SDK spatial observer is currently stopped.");
                return;
            }

            using (SuspendPerfMarker.Auto())
            {
                // UpdateObserver keys off of this value to stop observing.
                IsRunning = false;

                // Clear any pending work.
                meshWorkQueue.Clear();
            }
        }

19 Source : GameObjectPool.cs
with Apache License 2.0
from abist-co-ltd

public void EmptyPool(string objectIdentifier)
        {
            EnsureListForObjectID(objectIdentifier);

            Queue<GameObject> objects = _pool[objectIdentifier];
            foreach (GameObject obj in objects)
            {
                GameObject.Destroy(obj);
            }
            objects.Clear();
        }

19 Source : HololensLaserPointerDetection.cs
with Apache License 2.0
from abist-co-ltd

public void OnWebCamTextureToMatHelperDisposed()
        {
            Debug.Log("OnWebCamTextureToMatHelperDisposed");

            lock (ExecuteOnMainThread)
            {
                ExecuteOnMainThread.Clear();
            }
        }

19 Source : ChessMatch.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void Finish(int winner)
        {
            if (State != ChessState.WaitingForPlayers && State != ChessState.InProgress)
                return;

            foreach (var side in Sides)
            {
                if (side == null)
                    continue;

                if (side.IsAi())
                    continue;

                var player = PlayerManager.FindByGuid(side.PlayerGuid, out bool isOnline);
                Player onlinePlayer = null;
                if (isOnline)
                {
                    onlinePlayer = PlayerManager.GetOnlinePlayer(side.PlayerGuid);
                    SendGameOver(onlinePlayer, winner);
                }

                if (winner != Chess.ChessWinnerEndGame)
                {
                    var totalGames = (player.GetProperty(PropertyInt.ChessTotalGames) ?? 0) + 1;
                    player.SetProperty(PropertyInt.ChessTotalGames, totalGames);

                    if (isOnline)
                        onlinePlayer.Session.Network.EnqueueSend(new GameMessagePrivateUpdatePropertyInt(onlinePlayer, PropertyInt.ChessTotalGames, totalGames));
                }

                if (winner >= 0)
                {
                    var winnerColor = (ChessColor)winner;
                    if (winnerColor == side.Color)
                    {
                        var won = (player.GetProperty(PropertyInt.ChessGamesWon) ?? 0) + 1;
                        player.SetProperty(PropertyInt.ChessGamesWon, won);

                        if (isOnline)
                            onlinePlayer.Session.Network.EnqueueSend(new GameMessagePrivateUpdatePropertyInt(onlinePlayer, PropertyInt.ChessGamesWon, won));
                    }
                    else
                    {
                        var lost = (player.GetProperty(PropertyInt.ChessGamesLost) ?? 0) + 1;
                        player.SetProperty(PropertyInt.ChessGamesLost, lost);

                        if (isOnline)
                            onlinePlayer.Session.Network.EnqueueSend(new GameMessagePrivateUpdatePropertyInt(onlinePlayer, PropertyInt.ChessGamesLost, lost));
                    }
                }

                if (isOnline)
                    onlinePlayer.ChessMatch = null;
            }

            if (winner >= 0)
            {
                // adjust player ranks
                var playerGuid = Sides[0].PlayerGuid;
                var opponentGuid = Sides[1].PlayerGuid;
                var winnerGuid = winner == 0 ? playerGuid : opponentGuid;

                AdjustPlayerRanks(playerGuid, opponentGuid, winnerGuid);
            }

            Actions.Clear();

            Logic.WalkPieces((piece) =>
            {
                RemoveWeeniePiece(piece);
            });

            State = ChessState.Finished;
            NextRangeCheck = null;

            ChessBoard.ChessMatch = null;
        }

19 Source : AttackQueue.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void Clear()
        {
            PowerAccuracy.Clear();
        }

19 Source : InterpolationManager.cs
with GNU General Public License v3.0
from ACEmulator

public void StopInterpolating()
        {
            PositionQueue.Clear();
            OriginalDistance = LargeDistance;
            FrameCounter = 0;
            ProgressQuantum = 0.0f;
            NodeFailCounter = 0;
        }

19 Source : EventOSR.cs
with GNU General Public License v3.0
from aelariane

public bool CheckData(EventData data, PhotonPlayer sender, out string reason)
        {
            reason = "";
            this.sender = sender;
            Hashtable hash = data[245] as Hashtable;
            if (hash == null)
            {
                reason += UI.Log.GetString("notHashOrNull");
                return false;
            }
            if (hash.Count < 1)
            {
                reason += UI.Log.GetString("invalidParamsCount", hash.Count.ToString());
                return false;
            }
            if (!CheckKey(hash, 0, out sentTime))
            {
                reason += UI.Log.GetString("missOrInvalidKey", "0");
                return false;
            }
            short index = 2;
            if (!CheckKey(hash, 1, out correctPrefix, true))
            {
                reason += UI.Log.GetString("invalidKey", "1");
                return false;
            }
            if (!hash.ContainsKey((byte)1))
            {
                index--;
                correctPrefix = -1;
            }
            hashViews.Clear();
            hashData.Clear();
            for (short i = index; i < hash.Count; i++)
            {
                if (hash[(short)i] is Hashtable add && add != null)
                {
                    if (add.Count != 2)
                    {
                        reason += UI.Log.GetString("invalidKeyArgd", i.ToString(), UI.Log.GetString("invalidParamsCount", add.Count.ToString()));
                        return false;
                    }
                    if (!CheckKey(add, 0, out int view))
                    {
                        reason += UI.Log.GetString("missOrInvalidKeyArgd", i.ToString(), UI.Log.GetString("byteKey", "0"));
                        return false;
                    }
                    if (!CheckKey(add, 1, out object[] store))
                    {
                        reason += UI.Log.GetString("missOrInvalidKeyArgd", i.ToString(), UI.Log.GetString("byteKey", "1"));
                        return false;
                    }
                    hashViews.Enqueue(view);
                    hashData.Enqueue(store);
                    continue;
                }
                reason += UI.Log.GetString("invalidKeyArgd", i.ToString(), UI.Log.GetString("notHashOrNull"));
                return false;
            }
            return true;
        }

19 Source : FengGameManagerMKII.cs
with GNU General Public License v3.0
from aelariane

public void RestartGame(bool masterclientSwitched, bool restartManually)
    {
        if (gameTimesUp || logic.Restarting)
        {
            return;
        }

        GameModes.OnRestart();
        checkpoint = null;
        logic.Restarting = true;
        logic.RoundTime = 0f;
        logic.MyRespawnTime = 0f;
        foreach (var info in killInfoList)
        {
            info.destroy();
        }

        killInfoList.Clear();
        racingResult = new ArrayList();
        RCManager.ClearVariables();
        ShowHUDInfoCenter(string.Empty);
        DestroyAllExistingCloths();
        GameModes.SendRpc();
        PhotonNetwork.DestroyAll();
        BasePV.RPC("RPCLoadLevel", PhotonTargets.All);
        if (masterclientSwitched)
        {
            SendChatContentInfo(User.MasterClientSwitch);
        }
        else
        {
            if (!restartManually && User.MsgRestart.Length > 0)
            {
                SendChatContentInfo(User.MsgRestart);
            }
        }
    }

19 Source : Client.cs
with Apache License 2.0
from aequabit

public void Disconnect()
    {
        if (Processing[0])
        {
            return;
        }
        else
        {
            Processing[0] = true;
        }

        bool Raise = _Connected;
        _Connected = false;

        if (Handle != null)
        {
            Handle.Close();
        }

        if (SendQueue != null)
        {
            SendQueue.Clear();
        }

        SendBuffer = new byte[-1 + 1];
        ReadBuffer = new byte[-1 + 1];

        if (Raise)
        {
            O.Post(state => OnStateChanged(false), null);
        }

        if (Items != null)
        {
            Items[0].Dispose();
            Items[1].Dispose();
        }

        _UserState = null;
        _EndPoint = null;
    }

19 Source : Server.cs
with Apache License 2.0
from aequabit

public void Disconnect()
    {
        if (Processing[0])
        {
            return;
        }
        else
        {
            Processing[0] = true;
        }

        bool Raise = _Connected;
        _Connected = false;

        if (Handle != null)
        {
            Handle.Close();
        }

        if (SendQueue != null)
        {
            SendQueue.Clear();
        }

        SendBuffer = new byte[-1 + 1];
        ReadBuffer = new byte[-1 + 1];

        if (Raise)
        {
            OnStateChanged(false);
        }

        if (Items != null)
        {
            Items[0].Dispose();
            Items[1].Dispose();
        }

        _UserState = null;
        _EndPoint = null;
    }

19 Source : DeactivationManager.cs
with The Unlicense
from aeroson

private bool TryToSplit(SimulationIslandMember member1, SimulationIslandMember member2)
        {
            //Can't split if they aren't even in the same island.
            //This also covers the case where the connection involves a kinematic enreplacedy that has no 
            //simulation island at all.
            if (member1.SimulationIsland != member2.SimulationIsland ||
                member1.SimulationIsland == null ||
                member2.SimulationIsland == null)
                return false;


            //By now, we know the members belong to the same island and are not null.
            //Start a BFS starting from each member.
            //Two-way can complete the search quicker.

            member1Friends.Enqueue(member1);
            member2Friends.Enqueue(member2);
            searchedMembers1.Add(member1);
            searchedMembers2.Add(member2);
            member1.searchState = SimulationIslandSearchState.OwnedByFirst;
            member2.searchState = SimulationIslandSearchState.OwnedBySecond;

            while (member1Friends.Count > 0 && member2Friends.Count > 0)
            {


                SimulationIslandMember currentNode = member1Friends.Dequeue();
                for (int i = 0; i < currentNode.connections.Count; i++)
                {
                    for (int j = 0; j < currentNode.connections.Elements[i].entries.Count; j++)
                    {
                        SimulationIslandMember connectedNode;
                        if ((connectedNode = currentNode.connections.Elements[i].entries.Elements[j].Member) != currentNode &&
                            connectedNode.SimulationIsland != null) //The connection could be connected to something that isn't in the Space and has no island, or it's not dynamic.
                        {
                            switch (connectedNode.searchState)
                            {
                                case SimulationIslandSearchState.Unclaimed:
                                    //Found a new friend :)
                                    member1Friends.Enqueue(connectedNode);
                                    connectedNode.searchState = SimulationIslandSearchState.OwnedByFirst;
                                    searchedMembers1.Add(connectedNode);
                                    break;
                                case SimulationIslandSearchState.OwnedBySecond:
                                    //Found our way to member2Friends set; cannot split!
                                    member1Friends.Clear();
                                    member2Friends.Clear();
                                    goto ResetSearchStates;
                            }

                        }
                    }
                }

                currentNode = member2Friends.Dequeue();
                for (int i = 0; i < currentNode.connections.Count; i++)
                {
                    for (int j = 0; j < currentNode.connections.Elements[i].entries.Count; j++)
                    {
                        SimulationIslandMember connectedNode;
                        if ((connectedNode = currentNode.connections.Elements[i].entries.Elements[j].Member) != currentNode &&
                            connectedNode.SimulationIsland != null) //The connection could be connected to something that isn't in the Space and has no island, or it's not dynamic.
                        {
                            switch (connectedNode.searchState)
                            {
                                case SimulationIslandSearchState.Unclaimed:
                                    //Found a new friend :)
                                    member2Friends.Enqueue(connectedNode);
                                    connectedNode.searchState = SimulationIslandSearchState.OwnedBySecond;
                                    searchedMembers2.Add(connectedNode);
                                    break;
                                case SimulationIslandSearchState.OwnedByFirst:
                                    //Found our way to member1Friends set; cannot split!
                                    member1Friends.Clear();
                                    member2Friends.Clear();
                                    goto ResetSearchStates;
                            }

                        }
                    }
                }
            }
            //If one of the queues empties out without finding anything, it means it's isolated.  The other one will never find it.
            //Now we can do a split.  Grab a new Island, fill it with the isolated search stuff.  Remove the isolated search stuff from the old Island.


            SimulationIsland newIsland = islandPool.Take();
            simulationIslands.Add(newIsland);
            if (member1Friends.Count == 0)
            {

                //Member 1 is isolated, give it its own simulation island!
                for (int i = 0; i < searchedMembers1.Count; i++)
                {
                    searchedMembers1[i].simulationIsland.Remove(searchedMembers1[i]);
                    newIsland.Add(searchedMembers1[i]);
                }
                member2Friends.Clear();
            }
            else if (member2Friends.Count == 0)
            {

                //Member 2 is isolated, give it its own simulation island!
                for (int i = 0; i < searchedMembers2.Count; i++)
                {
                    searchedMembers2[i].simulationIsland.Remove(searchedMembers2[i]);
                    newIsland.Add(searchedMembers2[i]);
                }
                member1Friends.Clear();
            }

            //Force the system awake.
            //Technically, the members should already be awake.
            //However, calling Activate on them resets the members'
            //deactivation candidacy timers.  This prevents the island
            //from instantly going back to sleep, which could leave
            //objects hanging in mid-air.
            member1.Activate();
            member2.Activate();


        ResetSearchStates:
            for (int i = 0; i < searchedMembers1.Count; i++)
            {
                searchedMembers1[i].searchState = SimulationIslandSearchState.Unclaimed;
            }
            for (int i = 0; i < searchedMembers2.Count; i++)
            {
                searchedMembers2[i].searchState = SimulationIslandSearchState.Unclaimed;
            }
            searchedMembers1.Clear();
            searchedMembers2.Clear();
            return true;

        }

19 Source : KDTree.cs
with MIT License
from aillieo

public void Rebuild()
        {
            if(managed.Count == 0)
            {
                return;
            }

            int count = managed.Count;
            for(int i = 0; i < count; i++) {
                if (permutation.Count <= i)
                {
                    permutation.Add(i);
                }
                else
                {
                    permutation[i] = i;
                }
            }

            nodePool.Reset();

            root = nodePool.GetNew();
            root.startIndex = 0;
            root.endIndex = count;
            FindBounds(out root.min, out root.max);

            
            processingQueue.Clear();
            processingQueue.Enqueue(root);

            while (processingQueue.Count > 0)
            {
                KDNode node = processingQueue.Dequeue();
                Split(node);
            }
        }

19 Source : KDTree.cs
with MIT License
from aillieo

public void QueryInRange(Vector2 center, float radius, ICollection<T> toFill)
        {
            if (managed.Count == 0)
            {
                return;
            }

            processingQueue.Clear();
            toFill.Clear();

            float radiusSq = radius * radius;
            
            processingQueue.Enqueue(root);

            while (processingQueue.Count > 0)
            {
                KDNode node = processingQueue.Dequeue();
                if (node.leftLeaf == null && node.rightLeaf == null)
                {
                    // leaf
                    for (int i = node.startIndex; i < node.endIndex; ++i)
                    {
                        int index = permutation[i];
                        if (Vector2.SqrMagnitude(managed[index].position - center) <= radiusSq)
                        {
                            toFill.Add(managed[index]);
                        }
                    }
                }
                else
                {
                    // todo 可以缓存更多信息 加速叶节点的查找
                    if (IsKDNodeInRange(node.leftLeaf, center, radiusSq))
                    {
                        processingQueue.Enqueue(node.leftLeaf);
                    }
                    if (IsKDNodeInRange(node.rightLeaf, center, radiusSq))
                    {
                        processingQueue.Enqueue(node.rightLeaf);
                    }
                }
            }
        }

19 Source : ObservableSourceBuffer.cs
with Apache License 2.0
from akarnokd

public void OnCompleted()
            {
                if (done)
                {
                    return;
                }

                var buffers = this.buffers;

                while (buffers.Count != 0)
                {
                    if (Volatile.Read(ref disposed))
                    {
                        buffers.Clear();
                        return;
                    }
                    downstream.OnNext(buffers.Dequeue());
                }
                downstream.OnCompleted();
            }

19 Source : ObservableSourceBuffer.cs
with Apache License 2.0
from akarnokd

public void OnError(Exception ex)
            {
                if (done)
                {
                    return;
                }
                done = true;
                buffers.Clear();
                downstream.OnError(ex);
            }

19 Source : ObservableSourceTakeLast.cs
with Apache License 2.0
from akarnokd

public void Clear()
            {
                if (Volatile.Read(ref state) == StateReady)
                {
                    queue.Clear();
                }
            }

19 Source : ObservableSourceTakeLast.cs
with Apache License 2.0
from akarnokd

public void OnError(Exception ex)
            {
                queue.Clear();
                downstream.OnError(ex);
            }

19 Source : ObservableSourceSkipLast.cs
with Apache License 2.0
from akarnokd

public void OnCompleted()
            {
                queue.Clear();
                downstream.OnCompleted();
            }

19 Source : TCPServerEnd.cs
with MIT License
from alchemz

void Update()
	{
		Queue<DataPointViewModel> tempqueue;

		lock (queueLock) {
			tempqueue = dataPointsQueue;
			dataPointsQueue = new Queue<DataPointViewModel> ();
		}

		foreach (var point in dataPointsQueue) {
//			var viewModel = new DataPointViewModel ();
//			viewModel.rightAscendsion = UnityEngine.Random.value;
//			viewModel.declination = UnityEngine.Random.Range (-1f, 1f);
//			viewModel.color = Color.cyan;
//			SendMessage ("Data received", viewModel);
			Debug.Log("Read Message");
			SendMessage ("Data Received", point);
		}
		dataPointsQueue.Clear();
	}

19 Source : AbstractMapVisualizer.cs
with MIT License
from alen-smajic

public virtual void Destroy()
		{
			if (Factories != null)
			{
				_counter = Factories.Count;
				for (int i = 0; i < _counter; i++)
				{
					if (Factories[i] != null)
					{
						UnregisterEvents(Factories[i]);
					}
				}
			}

			// Inform all downstream nodes that we no longer need to process these tiles.
			// This scriptable object may be re-used, but it's gameobjects are likely
			// to be destroyed by a scene change, for example.
			foreach (var tileId in _activeTiles.Keys.ToList())
			{
				DisposeTile(tileId);
			}

			_activeTiles.Clear();
			_inactiveTiles.Clear();
		}

19 Source : AbstractMapVisualizer.cs
with MIT License
from alen-smajic

public void ClearMap()
		{
			UnregisterAllTiles();
			if (Factories != null)
			{
				foreach (var tileFactory in Factories)
				{
					if (tileFactory != null)
					{
						tileFactory.Clear();
						DestroyImmediate(tileFactory);
					}
				}
			}
			foreach (var tileId in _activeTiles.Keys.ToList())
			{
				_activeTiles[tileId].Clearreplacedets();
				DisposeTile(tileId);
			}

			foreach (var tile in _inactiveTiles)
			{
				tile.Clearreplacedets();
				DestroyImmediate(tile.gameObject);
			}

			_inactiveTiles.Clear();
			State = ModuleState.Initialized;
		}

19 Source : ObjectPool.cs
with MIT License
from alen-smajic

public void Clear()
		{
			_objects.Clear();
		}

19 Source : SpawnInsideModifier.cs
with MIT License
from alen-smajic

public override void Clear()
		{
			foreach (var go in _pool)
			{
				go.Destroy();
			}
			_pool.Clear();
			foreach (var tileObject in _objects)
			{
				foreach (var go in tileObject.Value)
				{
					if (Application.isEditor && !Application.isPlaying)
					{
						DestroyImmediate(go);
					}
					else
					{
						Destroy(go);
					}
				}
			}
			_objects.Clear();
		}

19 Source : CommandsQueu.cs
with MIT License
from alerdenisov

public void Flush()
        {
            commands.Clear();
        }

19 Source : TileMapAnnotation.cs
with MIT License
from AlexGyver

private void DownloadCompleted(string uri, Stream result)
        {
            if (result == null)
            {
                return;
            }

            var ms = new MemoryStream();
            result.CopyTo(ms);
            var buffer = ms.ToArray();

            var img = new OxyImage(buffer);
            this.images[uri] = img;

            lock (this.queue)
            {
                // Clear old items in the queue, new ones will be added when the plot is refreshed
                foreach (var queuedUri in this.queue)
                {
                    // Remove the 'reserved' image
                    this.images.Remove(queuedUri);
                }

                this.queue.Clear();
            }

            this.PlotModel.InvalidatePlot(false);
            if (this.queue.Count > 0)
            {
                this.BeginDownload();
            }
        }

19 Source : GenericMessage.cs
with MIT License
from alexismorin

public void CleanUpMessageStack()
		{
			m_displayingMessage = false;
			m_messageQueue.Clear();
		}

19 Source : GenericMessage.cs
with MIT License
from alexismorin

public void Destroy()
		{
			m_messageQueue.Clear();
			OnMessageDisplayEvent = null;
		}

19 Source : LightFlickerEffect.cs
with MIT License
from alexjhetherington

public void Reset()
    {
        smoothQueue.Clear();
        lastSum = 0;
    }

19 Source : Program.cs
with GNU Lesser General Public License v3.0
from Alois-xx

private bool Parse()
        {
            Queue<string> args = new Queue<string>(Args);
            if( args.Count == 0)
            {
                Help("Error: You need to specify a dump file or live process to replacedyze.");
                return false;
            }

            bool lret = true;
            try
            {
                while (args.Count > 0)
                {
                    string param = args.Dequeue();
                    switch (param.ToLower())
                    {
                        case "-f":
                            SetDefaultActionIfNotSet();
                            TargetInformation.DumpFileName1 = NotAnArg(args.Dequeue());
                            break;
                        case "-f2":
                            TargetInformation.DumpFileName2 = NotAnArg(args.Dequeue());
                            break;
                        case "-pid":
                            SetDefaultActionIfNotSet();
                            TargetInformation.Pid1 = int.Parse(NotAnArg(args.Dequeue()));
                            break;
                        case "-child":
                            IsChild = true;
                            break;
                        case "-pid2":
                            TargetInformation.Pid2 = int.Parse(NotAnArg(args.Dequeue()));
                            break;
                        case "-silent":
                            IsSilent = true;
                            break;
                        case "-unit":
                            string next = args.Dequeue();
                            if ( Enum.TryParse(NotAnArg(next), true, out DisplayUnit tmpUnit) )
                            {
                                DisplayUnit = tmpUnit;
                            }
                            else
                            {
                                Console.WriteLine($"Warning: DisplayUnit {next} is not a valid value. Using default: {DisplayUnit}");
                            }
                            break;
                        case "-vmmap":
                            GetVMMapData = true;
                            break;
                        case "-procdump":
                            Action = Actions.ProcDump;
                            // give remaining args to procdump and to not try to parse them by ourself
                            ProcDumpArgs = args.ToArray();
                            args.Clear();
                            break;
                        case "-verifydump":
                            VerifyDump = true;
                            break;
                        case "-renameproc":
                            ProcessRenameFile = NotAnArg(args.Dequeue());
                            break;
                        case "-debug":
                            IsDebug = true;
                            break;
                        case "-noexcelsep":
                            DisableExcelCSVSep = true;
                            break;
                        case "-sep":
                            string sep = NotAnArg(args.Dequeue());
                            sep = sep.Trim(new char[] { '"', '\'' });
                            sep = sep == "\\t" ? "\t" : sep;
                            if( sep.Length != 1)
                            {
                                Console.WriteLine($"Warning CSV separator character \"{sep}\" was not recognized. Using default \t");
                            }
                            else
                            {
                                OutputStringWriter.SeparatorChar = sep[0];
                            }
                            break;
                        case "-dts":
                            Action = Actions.DumpTypesBySize;
                            if ( args.Count > 0 && NotAnArg(args.Peek(),false) != null)
                            {
                                ParseTopNQuery(args.Dequeue(), out int n, out int MinCount);
                                TopN = n > 0 ? n : TopN;
                            }
                            break;
                        case "-dtn":
                            Action = Actions.DumpTypesByCount;
                            if (args.Count > 0 && NotAnArg(args.Peek(),false) != null)
                            {
                                ParseTopNQuery(args.Dequeue(), out int n, out MinCount);
                                TopN =  n > 0 ? n : TopN;
                            }
                            break;
                        case "-live":
                            LiveOnly = true;
                            break;
                        case "-dacdir":
                            DacDir = NotAnArg(args.Dequeue());
                            // quoted mscordacwks file paths are not correctly treated so far. 
                            Environment.SetEnvironmentVariable("_NT_SYMBOL_PATH", DacDir.Trim(new char[] { '"' }));
                            break;
                        case "-process":
                            ProcessNameFilter = NotAnArg(args.Dequeue());
                            break;
                        case "-dstrings":
                            Action = Actions.DumpStrings;
                            if (args.Count > 0 && NotAnArg(args.Peek(), false) != null)
                            {
                                TopN = int.Parse(args.Dequeue());
                            }
                            break;
                        case "-showaddress":
                            ShowAddress = true;
                            break;
                        case "-o":
                            OutFile = NotAnArg(args.Dequeue());
                            TopN = 20 * 1000; // if output is dumped to file pipe all types to output
                                              // if later -dts/-dstrings/-dtn is specified one can still override this behavior.
                            break;
                        case "-overwrite":
                            OverWriteOutFile = true;
                            break;
                        case "-timefmt":
                            TimeFormat = NotAnArg(args.Dequeue());
                            break;
                        case "-time":
                            TargetInformation.ExternalTime = NotAnArg(args.Dequeue());
                            break;
                        case "-context":
                            Context = NotAnArg(args.Dequeue());
                            break;
                        default:
                            throw new ArgNotExpectedException(param);
                    }
                    
                }
            }
            catch(ArgNotExpectedException ex)
            {
                Help("Unexpected command line argument: {0}", ex.Message);
                lret = false;
            }

            return lret;
        }

19 Source : UnitOfWork.cs
with MIT License
from amolines

public void RollBack()
        {
            if (State != UnitOfWorkState.InAction)
                throw new InvalidStateForActionException(State, "RollBack");
            _dbTransaction?.Rollback();
            _events.Clear();
            State = UnitOfWorkState.RollBack;

        }

19 Source : LogRevisionControl.cs
with Apache License 2.0
from AmpScm

public void Reset()
        {
            lock (_instanceLock)
            {
                LogRequest rq = _currentRequest;
                if (rq != null)
                {
                    _currentRequest = null;
                    rq.Cancel = true;
                }
                _running = false;
            }

            _logItems.Clear();
            Items.Clear();
            _lastRevision = -1;
            fetchCount = 0;

        }

19 Source : LogRevisionControl.cs
with Apache License 2.0
from AmpScm

void OnShowItems()
        {
            Debug.replacedert(!InvokeRequired);

            LogRevisionItem[] items;
            lock (_logItems)
            {
                items = _logItems.Count > 0 ? _logItems.ToArray() : null;

                _logItems.Clear();
            }

            if (items != null)
            {
                Items.AddRange(items);
                _lastRevision = items[items.Length - 1].Revision;
            }
        }

19 Source : NLPTokenizer.cs
with Apache License 2.0
from AnkiUniversal

public List<WordInformation> Tokenize(string tokenizedSentence)
        {
            currentTokenizedSentence = tokenizedSentence;
            unTokenizedWords.Clear();
            undoSkip.Clear();
            return GetWords();            
        }

19 Source : VPOManager.cs
with GNU General Public License v3.0
from anotak

public void Start(string filename, string mapname)
		{
			this.filename = filename;
			this.mapname = mapname;
			results.Clear();
			
			// Start a thread on each core
			threads = new Thread[dlls.Length];
			for(int i = 0; i < threads.Length; i++)
			{
				threads[i] = new Thread(ProcessingThread);
				threads[i].Priority = ThreadPriority.BelowNormal;
				threads[i].Name = "Visplane Explorer " + i;
				threads[i].Start(i);
			}
		}

19 Source : VPOManager.cs
with GNU General Public License v3.0
from anotak

public void Stop()
		{
			if(threads != null)
			{
				lock(points)
				{
					// Stop all threads
					for(int i = 0; i < threads.Length; i++)
					{
						threads[i].Interrupt();
						threads[i].Join();
					}
					threads = null;
					points.Clear();
					results.Clear();
				}
			}
		}

19 Source : Pool.cs
with MIT License
from AnotherEnd15

public void Clear()
        {
            this.pool.Clear();
        }

19 Source : CoroutineLockQueue.cs
with MIT License
from AnotherEnd15

public override void Dispose()
        {
            if (this.IsDisposed)
            {
                return;
            }
            
            base.Dispose();
            
            this.queue.Clear();
        }

19 Source : ControlReplacer.cs
with GNU Lesser General Public License v3.0
from antonmihaylov

public void ClearQueue()
        {
            executionQueue.Clear();
        }

See More Examples