예제 #1
0
        private Task OnDiscordMessage(MessageCreateEventArgs e)
        {
            _ = Task.Run(async() =>
            {
                try
                {
                    await Task.Delay(1000);

                    if (NotificationUtils.WillShowToast(e.Message))
                    {
                        _toastManager?.HandleMessage(e.Message);
                        _badgeManager?.Update();

                        if (_tileManager != null)
                        {
                            await _tileManager.HandleMessageAsync(e.Message);
                        }
                    }

                    if (_secondaryTileManager != null)
                    {
                        await _secondaryTileManager.HandleMessageAsync(e.Message);
                    }
                }
                catch (Exception)
                {
                    // TODO: log
                }
            });

            return(Task.CompletedTask);
        }
        private async Task OnDiscordMessage(MessageCreateEventArgs e)
        {
            try
            {
                if (NotificationUtils.WillShowToast(e.Message))
                {
                    _toastManager?.HandleMessage(e.Message);
                    _badgeManager?.Update();

                    if (_tileManager != null)
                    {
                        await _tileManager.HandleMessageAsync(e.Message);
                    }
                }

                if (_secondaryTileManager != null)
                {
                    await _secondaryTileManager.HandleMessageAsync(e.Message);
                }
            }
            catch (Exception)
            {
                // TODO: log
            }
        }
예제 #3
0
        private void Update()
        {
            _tileUpdater.EnableNotificationQueue(true);
            _tileUpdater.Clear();

            foreach (var message in _currentUnreads.Take(5))
            {
                var tileContent = NotificationUtils.CreateTileNotificationForMessage(message);
                _tileUpdater.Update(tileContent);
            }
        }
예제 #4
0
        public Task HandleMessageAsync(DiscordMessage message)
        {
            if (_tileStorage.TryGetValue(message.Channel.Id, out var tile))
            {
                var updater          = TileUpdateManager.CreateTileUpdaterForSecondaryTile(tile.TileId);
                var tileNotification = NotificationUtils.CreateTileNotificationForMessage(message);
                updater.EnableNotificationQueue(true);
                updater.Update(tileNotification);
            }

            return(Task.CompletedTask);
        }
예제 #5
0
        public void HandleMessage(DiscordMessage message)
        {
            var notification = NotificationUtils.CreateToastNotificationForMessage(message);

            _toastNotifier.Show(notification);
        }