예제 #1
0
        private void requestNewMessages()
        {
            messageRequest.Wait();

            Channel channel = channels.Find(c => c.Name == "#osu");

            GetMessagesRequest gm = new GetMessagesRequest(new List <Channel> {
                channel
            }, lastMessageId);

            gm.Success += delegate(List <Message> messages)
            {
                foreach (Message m in messages)
                {
                    //m.LineWidth = this.Size.X; //this is kinda ugly.
                    //m.Drawable.Depth = m.Id;
                    //m.Drawable.FadeInFromZero(800);

                    //flow.Add(m.Drawable);

                    //if (osu.Messages.Count > 50)
                    //{
                    //    osu.Messages[0].Drawable.Expire();
                    //    osu.Messages.RemoveAt(0);
                    //}
                    flow.Add(new ChatLine(m));
                    channel.Messages.Add(m);
                }

                lastMessageId = messages.LastOrDefault()?.Id ?? lastMessageId;

                Debug.Write("success!");
                messageRequest.Continue();
            };
            gm.Failure += delegate
            {
                Debug.Write("failure!");
                messageRequest.Continue();
            };

            api.Queue(gm);
        }