예제 #1
0
 public void Handle(StatusChangedNotification notification)
 {
     Toggle(notification.State.IsLocalChokingRemote, notification.Peer, LocalChoking);
     Toggle(notification.State.IsLocalInterestedInRemote, notification.Peer, LocalInterested);
     Toggle(notification.State.IsRemoteChokingLocal, notification.Peer, RemoteChoking);
     Toggle(notification.State.IsRemoteInterestedInLocal, notification.Peer, RemoteInterested);
 }
예제 #2
0
파일: Root.cs 프로젝트: AnyStatus/AnyStatus
        protected override void OnPropertyChanged(PropertyChangedEventArgs e)
        {
            base.OnPropertyChanged(e);

            if (e.PropertyName.Equals(nameof(Status)) && Status != PreviousStatus)
            {
                _ = WidgetNotifications.PublishAsync(StatusChangedNotification.Create(this));
            }
        }
        protected override void Handle(StatusChangedNotification <TWidget> notification)
        {
            var message = $"Widget '{notification.Widget.Name}' status changed from {notification.Widget.PreviousStatus?.Metadata?.DisplayName} to {notification.Widget.Status?.Metadata?.DisplayName}.";

            _logger.LogDebug(message);

            if (notification.Widget.NotificationsSettings?.IsEnabled == true && notification.Widget.PreviousStatus != Status.None)
            {
                _notificationService.Send(new Notification(message, notification.Widget.Name));
            }
        }
        protected override void Handle(StatusChangedNotification <TWidget> notification)
        {
            var message = $"Widget '{notification.Widget.Name}' status changed from {notification.Widget.PreviousStatus} to {notification.Widget.Status}.";

            if (_logger.IsEnabled(LogLevel.Trace))
            {
                _logger.LogTrace(message);
            }

            if (notification.Widget.PreviousStatus != Status.None)
            {
                _notificationService.Send(new Notification(message, notification.Widget.Name));
            }
        }
예제 #5
0
 public virtual void Handle(StatusChangedNotification notification)
 {
 }
예제 #6
0
 public override void Handle(StatusChangedNotification notification)
 {
     peers.Handle(notification);
 }