Beispiel #1
0
 private void Queue_Enqueued(object sender, QueueEventArgs e)
 {
     Assert.True(e != null);
     Assert.True(e.IsValid);
     Assert.True(e.Count > 0);
     Assert.True((int)e.Value == 1);
 }
Beispiel #2
0
 private void Queue_Enqueued_Invalid(object sender, QueueEventArgs e)
 {
     Assert.True(e != null);
     Assert.True(!e.IsValid);
     Assert.True(e.Count == 0);
     Assert.True(e.Value == null);
 }
Beispiel #3
0
 private void _messageQueue_OnException(object sender, QueueEventArgs <IMessage> arg)
 {
     Run(() =>
     {
         WriteError($"Messeque error : Desc: {arg.Exception.ToString()}");
     });
 }
Beispiel #4
0
 private void _messageQueue_OnDequeue(object sender, QueueEventArgs <IMessage> arg)
 {
     Run(() =>
     {
         WriteInfo(arg.Entry.ToString());
     });
 }
Beispiel #5
0
        void q_QueueItemAvailable(object sender, QueueEventArgs e)
        {
            ActivityExecutionContext aec = sender as ActivityExecutionContext;

            if (aec != null)
            {
                WorkflowQueuingService qs = aec.GetService <WorkflowQueuingService>();

                WorkflowQueue q = qs.GetWorkflowQueue(e.QueueName);
                //get the outparameters from the workflow
                object o = q.Dequeue();
                //delete the queue
                qs.DeleteWorkflowQueue(e.QueueName);
                Dictionary <string, object> outparams = o as Dictionary <string, object>;
                if (outparams != null)
                {
                    foreach (KeyValuePair <string, object> item in outparams)
                    {
                        if (this.Parameters.Contains(item.Key))
                        {
                            //modify the value
                            this.Parameters[item.Key].SetValue(WorkflowParameterBinding.ValueProperty, item.Value);
                        }
                    }
                }
                aec.CloseActivity();
            }
        }
Beispiel #6
0
 private void QueueOnItemAdded(object sender, QueueEventArgs<VoteableQueueItem<ISongStream>> e)
 {
     if (_queue.IsInFront(e.Item))
     {
         _streamPlayer.CurrentStream = e.Item.Item;
         _streamPlayer.Next(CancellationToken.None);
     }
 }
        private void HandleExternalEvent(Object sender, QueueEventArgs args)
        {
            ThreadMonitor.WriteToConsole(Thread.CurrentThread, "WaitForMessageActivity", "WaitForMessageActivity: Processed External Event");

            object data = this.workflowQueue.Dequeue();

            ActivityExecutionContext context = sender as ActivityExecutionContext;

            context.CloseActivity();
        }
 private void LogQueue_OnDequeue(object arg1, QueueEventArgs <string> arg2)
 {
     try
     {
         QuantConnect.Logging.Log.Debug(arg2.Entry);
     }
     catch (Exception ex)
     {
         TBYException tex = new TBYException(MethodInfo.GetCurrentMethod().GetFullName(), "Log kuyruğunda log yazılırken hata oluştu", ex);
         QuantConnect.Logging.Log.Error(tex.ToString());
     }
 }
 private void AddNews(QueueEventArgs <NewsDbLog> arg)
 {
     try
     {
         NewsDbLog log = arg.Entry;
         log.DbManager.ExecuteNForget(log.Query, log.IsStoreProcedure, log.Parameters);
     }
     catch (Exception ex)
     {
         TBYException tex = new TBYDBException(MethodBase.GetCurrentMethod().GetFullName(), "Veri yayın veritabanında hata oluştu.", ex);
         ProcessException(tex);
     }
 }
Beispiel #10
0
        // Handler when a queue item is available
        private void OnQueueItemAvailable(object sender, QueueEventArgs args)
        {
            ActivityExecutionContext context = sender as ActivityExecutionContext;

            WorkflowQueuingService qService = context.GetService <WorkflowQueuingService>() as WorkflowQueuingService;
            IComparable            qName    = this.Queue;

            // Dequeue the item and remove the handler
            if (TryDequeueAndComplete(context, qName))
            {
                qService.GetWorkflowQueue(qName).QueueItemAvailable -= this.OnQueueItemAvailable;
            }
        }
Beispiel #11
0
        public void OnQueueItemAvailable(Object sender, QueueEventArgs args)
        {
            Console.WriteLine("OnQueueItemAvailable!");
            //ThreadMonitor.WriteToConsole (Thread.CurrentThread, "WaitForMessageActivity",
            //	"WaitForMessageActivity: Processed External Event");

            object data = this.workflowQueue.Peek();

            Console.WriteLine("OnQueueItemAvailable event! {0}", data);

            ActivityExecutionContext context = sender as ActivityExecutionContext;
            //context.CloseActivity ();
        }
Beispiel #12
0
        private void Lobby_QueueEntered(object sender, QueueEventArgs e)
        {
            queueTimer.Start();
            queue = e.Queue;
            Dispatcher.Invoke(() => {
                foreach (var control in PlayerList.Children)
                {
                    ((LobbyPlayer2)control).CanControl = false;
                }

                QuitButton.Content        = "Cancel";
                StartButton.Visibility    = Visibility.Collapsed;
                QueueTimeLabel.Visibility = Visibility.Visible;
            });
        }
        private void NotifySynchronousSubscribers(IComparable queueName, EventQueueState qState, Object eventInstance)
        {
            QueueEventArgs args = new QueueEventArgs(queueName);

            for (int i = 0; i < qState.SynchronousListeners.Count; ++i)
            {
                if (qState.SynchronousListeners[i].HandlerDelegate != null)
                {
                    qState.SynchronousListeners[i].HandlerDelegate(new WorkflowQueue(this, queueName), args);
                }
                else
                {
                    qState.SynchronousListeners[i].EventListener.OnEvent(new WorkflowQueue(this, queueName), args);
                }
            }
        }
Beispiel #14
0
 internal void NotifyAsynchronousSubscribers(IComparable queueName, EventQueueState qState, int numberOfNotification)
 {
     for (int i = 0; i < numberOfNotification; i++)
     {
         QueueEventArgs e = new QueueEventArgs(queueName);
         lock (this.SyncRoot)
         {
             foreach (ActivityExecutorDelegateInfo <QueueEventArgs> info in qState.AsynchronousListeners)
             {
                 Activity contextActivityForId = this.rootWorkflowExecutor.GetContextActivityForId(info.ContextId);
                 info.InvokeDelegate(contextActivityForId, e, false);
                 WorkflowTrace.Runtime.TraceInformation("Queuing Service: Notifying async subscriber on queue:'{0}' activity:{1}", new object[] { queueName.ToString(), info.ActivityQualifiedName });
             }
         }
     }
 }
 internal void NotifyAsynchronousSubscribers(IComparable queueName, EventQueueState qState, int numberOfNotification)
 {
     for (int i = 0; i < numberOfNotification; ++i)
     {
         QueueEventArgs args = new QueueEventArgs(queueName);
         lock (SyncRoot)
         {
             foreach (ActivityExecutorDelegateInfo <QueueEventArgs> subscriber in qState.AsynchronousListeners)
             {
                 Activity contextActivity = rootWorkflowExecutor.GetContextActivityForId(subscriber.ContextId);
                 Debug.Assert(contextActivity != null);
                 subscriber.InvokeDelegate(contextActivity, args, false);
                 WorkflowTrace.Runtime.TraceInformation("Queuing Service: Notifying async subscriber on queue:'{0}' activity:{1}", queueName.ToString(), subscriber.ActivityQualifiedName);
             }
         }
     }
 }
Beispiel #16
0
        /// <summary>
        /// 插入到队列开始
        /// </summary>
        /// <param name="item"></param>
        public void InsertIntoQueue(TransferQueueItem item)
        {
            QueueEventArgs args = new QueueEventArgs(item);

            if (QueueAdding != null)
            {
                QueueAdding.Invoke(this, args);
                //如果取消
                if (args.Cancel)
                {
                    return;
                }
            }
            QueueItemList.Insert(0, item);
            if (QueueAdded != null)
            {
                QueueAdded(this, args);
            }
        }
        private void DistStreamQueue_OnException(object arg1, QueueEventArgs <Action> arg2)
        {
            TBYException tex = new TBYQueueException(MethodInfo.GetCurrentMethod().GetFullName(), "Veri yayın DistStreamQueue_OnException hatası oluştu", arg2.Exception);

            ProcessException(tex);
        }
Beispiel #18
0
        public void OnQueueItemArrived(Object sender, QueueEventArgs args)
        {
            object data = this.workflowQueue.Peek();

            Console.WriteLine("OnQueueItemArrived!  event {0}", data);
        }
 //private void DbLogQueue_OnException(object arg1, QueueEventArgs<DbLog> arg2)
 //{
 //    TBYException tex = new TBYException(MethodInfo.GetCurrentMethod().GetFullName(), "DbLogQueue_OnException hatası oluştu", arg2.Exception);
 //    HandleException(tex);
 //}
 private void LogQueue_OnException(object arg1, QueueEventArgs <string> arg)
 {
     HandleLog("CRITICAL ERROR!! LogQueue_OnException Message :" + arg.Exception.Message);
 }
Beispiel #20
0
 private void DatabaseCommandQueue_OnDequeue(object arg1, QueueEventArgs <Action> arg)
 {
     arg.Entry();
 }
 private void QueueHandler_MessageRecieved(object sender, QueueEventArgs e)
 {
     SendMessageToSockets(e.Message);
 }
Beispiel #22
0
 public void RaiseQueueStopped(QueueEventArgs e) => _queueStopped?.Invoke(e);
Beispiel #23
0
 private void Queue_Cleared(object sender, QueueEventArgs e)
 {
     Assert.True(e != null);
     Assert.True(e.IsValid);
     Assert.True(e.Count == 0);
 }
 private void DistStreamQueue_OnDequeue(object arg1, QueueEventArgs <Action> arg)
 {
     arg.Entry();
 }
Beispiel #25
0
 public void RaiseQueueEmpty(QueueEventArgs e) => _queueEmpty?.Invoke(e);
        private void LogQueue_OnException(object arg1, QueueEventArgs <string> arg)
        {
            TBYException tex = new TBYAppContextTCPRecieveException(MethodBase.GetCurrentMethod().GetFullName(), "Kritik Hata!!! Log kuyruğunda log yazılırken hata oluştu!!!", arg.Exception);

            QuantConnect.Logging.Log.Error(tex.ToString());
        }
Beispiel #27
0
        /// <summary>
        /// Will be called each time a message is received from the server.
        /// Add your parsing logic here.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void MsgHandler(object sender, QueueEventArgs e)
        {
            string receivedMsg = _client.Queue.Data.Dequeue();

            Console.WriteLine("Client received: {0}", receivedMsg);
        }
        private void DbNewsQueue_OnException(object arg1, QueueEventArgs <NewsDbLog> arg2)
        {
            TBYException tex = new TBYException(MethodInfo.GetCurrentMethod().GetFullName(), "DbNewsQueue_OnException hatası oluştu", arg2.Exception);

            ProcessException(tex);
        }
 private void DbNewsQueue_OnDequeue(object arg1, QueueEventArgs <NewsDbLog> arg)
 {
     AddNews(arg);
 }
 private void DbLogQueue_OnDequeue(object arg1, QueueEventArgs <SecurityDbLog> arg)
 {
     AddDbLog(arg);
 }
Beispiel #31
0
		private void OnSelectedTrackChanged(object sender, QueueEventArgs e)
		{
			if (queueController.SelectedTrack != null)
			{
				string artist = (!string.IsNullOrEmpty(queueController.SelectedTrack.Artist)) ? queueController.SelectedTrack.Artist : "Unknown Artist";
				string title = (!string.IsNullOrEmpty(queueController.SelectedTrack.Title)) ? queueController.SelectedTrack.Title : "Untitled";
				NowPlayingLabel.Text = string.Format("{0} - {1}", artist, title);
			}
			else NowPlayingLabel.Text = string.Empty;
		}
        private void ParserUnkownQueue_OnException(object arg1, QueueEventArgs <ParserArg> arg2)
        {
            TBYException tex = new TBYException(MethodInfo.GetCurrentMethod().GetFullName(), "ParserUnkownQueue_OnException hatası oluştu", arg2.Exception);

            HandleException(tex);
        }