示例#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
            }
        }
        private async Task OnMessageCreated(MessageCreateEventArgs e)
        {
            try
            {
                if (NotificationUtils.WillShowToast(e.Message))
                {
                    _badgeManager.Update();
                    await _tileManager.HandleMessageAsync(e.Message);
                }

                await _secondaryTileManager.HandleMessageAsync(e.Message);
            }
            catch (Exception ex)
            {
                Crashes.TrackError(ex);
            }
        }