コード例 #1
0
ファイル: MessageViewModel.cs プロジェクト: WamWooWam/Unicord
        private void UpdateReactions()
        {
            foreach (var reaction in Message.Reactions)
            {
                if (!Reactions.Contains(reaction))
                {
                    _context.Post((o) => Reactions.Add(reaction), null);
                }
            }

            foreach (var reaction in Reactions.ToList())
            {
                if (!Message.Reactions.Contains(reaction))
                {
                    _context.Post((o) => Reactions.Remove(reaction), null);
                }
            }
        }
コード例 #2
0
ファイル: ProjectPageViewModel.cs プロジェクト: FTim/ch
        private async void DeleteReactionCommand(ReactionInfo deleteThis)
        {
            try
            {
                OutputMessages.Add(new OutputMessage {
                    Message = "Deleting reaction(s)...", Level = "debug"
                });
                _logService.Write(this, "Deleting reaction(s)...", "debug");
                await _dbService.DeleteReaction(deleteThis.ReactionID);

                Reactions.Remove(deleteThis);
                OutputMessages.Add(new OutputMessage {
                    Message = "Reaction(s) deleted!", Level = "debug"
                });
                _logService.Write(this, "Deleting reaction(s)...", "debug");
            }
            catch (Exception e)
            {
                OutputMessages.Add(new OutputMessage {
                    Message = e.Message, Level = "fatal"
                });
                _logService.Write(this, e.Message, "fatal");
            }
        }