Exemple #1
0
        private void MessageSent(object sender, ProcessMessagesCompletedEventArgs e)
        {
            // TODO: REVIEW THIS
            // Per MSDN:
            // if the system runs continuously, TickCount will increment from zero to Int32.MaxValue for approximately 24.9 days,
            // then jump to Int32.MinValue, which is a negative number, then increment back to zero during the next 24.9 days.
            ApplicationActivityMonitor.Instance.LastActivityTick = Environment.TickCount;
            var msgs = e.UserState as MessageSet;

            if (msgs != null)
            {
                PerformanceMonitor.CurrentInstance.DecrementMouseWheelMsgCount(msgs.Messages.Count(i => i is MouseWheelMessage));
            }

            if (e.Error != null)
            {
                OnError(e.Error);
                return;
            }

            if (e.Result != null)
            {
                if (e.Result.EventSet != null && e.Result.EventSet.Events != null)
                {
                    bool isMoveMoveMsg = msgs != null && msgs.Messages.Any(i => i is MouseMoveMessage);
                    if (isMoveMoveMsg)
                    {
                        long dt = Environment.TickCount - msgs.Tick;
                        var  p  = PerformanceMonitor.CurrentInstance;

                        //bool tileUpdateEventReturned = e.Result.EventSet != null && e.Result.EventSet.Events.Any((i) => i is TileUpdatedEvent);

                        p.LogMouseMoveRTTWithResponse(msgs.Number, dt);
                    }

                    if (e.Result.EventSet != null)
                    {
                        if (!_connectionOpened)
                        {
                            Platform.Log(LogLevel.Error, "Received messages after connection has been closed!");
                        }
                        else if (MessageReceived != null)
                        {
                            var args = new ServerEventReceivedEventArgs
                            {
                                EventSet = e.Result.EventSet
                            };
                            MessageReceived(this, args);
                        }
                        else
                        {
                            Platform.Log(LogLevel.Error, "Received messages without message event registered!");
                        }
                    }
                }
            }
        }
Exemple #2
0
        private void MessageSent(object sender, ProcessMessagesCompletedEventArgs e)
        {
            // TODO: REVIEW THIS
            // Per MSDN:
            // if the system runs continuously, TickCount will increment from zero to Int32.MaxValue for approximately 24.9 days, 
            // then jump to Int32.MinValue, which is a negative number, then increment back to zero during the next 24.9 days.
            ApplicationActivityMonitor.Instance.LastActivityTick = Environment.TickCount;
            var msgs = e.UserState as MessageSet;
            if (msgs!=null)
                PerformanceMonitor.CurrentInstance.DecrementMouseWheelMsgCount(msgs.Messages.Count(i => i is MouseWheelMessage));

            if (e.Error != null)
            {
                OnError(e.Error);
                return;
            }

            if (e.Result != null)
            {
                if (e.Result.EventSet != null && e.Result.EventSet.Events != null)
                {
                    bool isMoveMoveMsg = msgs != null && msgs.Messages.Any(i => i is MouseMoveMessage);
                    if (isMoveMoveMsg)
                    {

                        long dt = Environment.TickCount - msgs.Tick;
                        var p = PerformanceMonitor.CurrentInstance;

                        //bool tileUpdateEventReturned = e.Result.EventSet != null && e.Result.EventSet.Events.Any((i) => i is TileUpdatedEvent);

                        p.LogMouseMoveRTTWithResponse(msgs.Number, dt);
                    }

                    if (e.Result.EventSet != null)
                    {
                        if (!_connectionOpened)
                        {
                            Platform.Log(LogLevel.Error, "Received messages after connection has been closed!");
                        }
                        else if (MessageReceived != null)
                        {
                            var args = new ServerEventReceivedEventArgs
                                           {
                                               EventSet = e.Result.EventSet
                                           };
                            MessageReceived(this, args);
                        }
                        else
                        {
                            Platform.Log(LogLevel.Error, "Received messages without message event registered!");
                        }
                    }
                }
            }
        }