コード例 #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);
        }
コード例 #2
0
        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
            }
        }