Exemple #1
0
        async void LoadNewGroupAsync()
        {
            try
            {
                Chats groupsList = await Service.MakeRequestAsync <Chats>("get", "groups/9999/" + groupMessageId, null);

                if (groupsList.result == null)
                {
                    return;
                }
                groupMessageId = groupsList.result[groupsList.result.Count - 1].message_id;
                for (int i = 0; i < groupsList.result.Count; i++)
                {
                    for (int j = 0; j < groupList.Items.Count; j++)
                    {
                        if (((ContactView)groupList.Items[j]).ChatId == groupsList.result[i].chat_id)
                        {
                            groupList.Items.RemoveAt(j);
                        }
                    }
                    groupList.Items.Insert(0, LoadChatView(groupsList.result[i]));
                }
            }
            catch (Exception ev)
            {
                MessageBox.Show(ev.Message);
            }
        }
Exemple #2
0
        async void LoadNewChatAsync()
        {
            try
            {
                Chats chatsList = await Service.MakeRequestAsync <Chats>("get", "chats/9999/" + chatMessageId, null);

                if (chatsList.result == null)
                {
                    return;
                }
                chatMessageId = chatsList.result[chatsList.result.Count - 1].message_id;
                for (int i = 0; i < chatsList.result.Count; i++)
                {
                    for (int j = 0; j < chatList.Items.Count; j++)
                    {
                        if (((ContactView)chatList.Items[j]).ChatId == chatsList.result[i].chat_id)
                        {
                            chatList.Items.RemoveAt(j);
                        }
                    }
                    chatList.Items.Insert(0, LoadChatView(chatsList.result[i]));
                }
            }
            catch (Exception ev)
            {
                MessageBox.Show(ev.Message);
            }
        }
Exemple #3
0
        async void LoadGroupsAsync(object obj, EventArgs e)
        {
            try
            {
                groupList.Items.Clear();
                Chats groupsList = await Service.MakeRequestAsync <Chats>("get", "groups", null);

                groupMessageId = groupsList.result[0].message_id;
                for (int i = 0; i < groupsList.result.Count; i++)
                {
                    groupList.Items.Add(LoadChatView(groupsList.result[i]));
                }
            }
            catch (Exception ev)
            {
                MessageBox.Show(ev.Message);
            }
        }