示例#1
0
        public void ManageDisposedConnection(CommandConnection disposedItem)
        {
            if (disposedItem.Type != CommandConnectionType.Disposed)
                return;

            var opendConnection = PluginContext.ProfilerData.Connections
                                           .FirstOrDefault(x => x.ConnectionId == disposedItem.ConnectionId &&
                                                       x.Type == CommandConnectionType.Opened &&
                                                       x.ApplicationIdentity.Equals(disposedItem.ApplicationIdentity));
            if (opendConnection == null)
            {
                return;
            }

            if (opendConnection.Duration >= OneSecond)
            {
                if (disposedItem.ApplicationIdentity.Equals(GuiModelData.SelectedApplicationIdentity))
                {
                    GuiModelData.RelatedConnections.Add(opendConnection);
                }

                _localCommandConnection.Add(opendConnection);
                PluginContext.NotifyPluginsHost(NotificationType.Update, 1);
                UpdateAppIdentityNotificationsCount(disposedItem);
            }
        }
示例#2
0
        public void RemoveDisposedConnection(CommandConnection item)
        {
            if (item.Type != CommandConnectionType.Disposed)
                return;

            var connections = _localCommandConnection
                               .Where(x => x.ConnectionId == item.ConnectionId &&
                                           x.ApplicationIdentity.Equals(item.ApplicationIdentity))
                               .ToList();
            foreach (var commandConnection in connections)
            {
                _localCommandConnection.Remove(commandConnection);
                PluginContext.NotifyPluginsHost(NotificationType.Update, -1);
                UpdateAppIdentityNotificationsCount(item, -1);
            }

            connections = GuiModelData.RelatedConnections
                               .Where(x => x.ConnectionId == item.ConnectionId &&
                                           x.ApplicationIdentity.Equals(item.ApplicationIdentity))
                               .ToList();
            foreach (var commandConnection in connections)
            {
                GuiModelData.RelatedConnections.Remove(commandConnection);
            }
        }
        public void ManageCommandConnections(CommandConnection item)
        {
            if (item.ApplicationIdentity.Equals(GuiModelData.SelectedApplicationIdentity))
            {
                GuiModelData.RelatedConnections.Add(item);
            }

            PluginContext.NotifyPluginsHost(NotificationType.Update, 1);
            UpdateAppIdentityNotificationsCount(item);
        }