Exemplo n.º 1
0
        /// <summary>
        /// 연락처를 가져 온다.
        /// </summary>
        /// <returns></returns>
        public async Task <DataTable> ContactsGet()
        {
            isAuth(true);

            //연락처를 받아 온다
            TeleSharp.TL.Contacts.TLContacts rst = await client.GetContactsAsync();

            if (_contacts == null)
            {
                _contacts = Fnc.DataTable_SchemaByObject("TelegramContacts", new TLUser());
            }

            _contacts.Rows.Clear();
            //DataRow dr;

            Fnc.DataTable_InsDataFromObject(_contacts, rst.users.lists);


            //foreach (TLUser u in rst.users.lists)
            //{
            //	dr = _contacts.NewRow();
            //	Fnc.DataRow_InsDataFromObject(dr, u);

            //	_contacts.Rows.Add(dr);
            //}


            return(_contacts);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 채팅 리스트를 가지고 온다.(개인 채팅은 제외)
        /// </summary>
        /// <returns></returns>
        public async Task <DataTable> ChatListGet()
        {
            //TeleSharp.TL.Messages.TLAbsDialogs dial = await client.GetUserDialogsAsync();

            TLDialogs dialogs = (TLDialogs)await client.GetUserDialogsAsync();


            if (_chatList == null)
            {
                _chatList = Fnc.DataTable_SchemaByObject("TelegramChatList", dialogs.chats.lists[0]);

                //_chatList.Columns.Add("access_hash", typeof(System.String));
            }

            _chatList.Rows.Clear();
            //DataRow dr;



            Fnc.DataTable_InsDataFromObject(_chatList, dialogs.chats.lists);

            return(_chatList);
        }