コード例 #1
0
ファイル: Main.cs プロジェクト: cexdelta/WeGramSharp
        private async WTask.Task <TLUser> FindPeer(string search)
        {
            TLUser user = await SearchContact(search);

            if (user == null)
            {
                TLContactsFound ChBot = await SearchBotOrChannel(search);

                if (ChBot != null)
                {
                    foreach (TLUser us in ChBot.getUsers())
                    {
                        user = us;
                        break;
                    }
                }
            }


            return(user);
        }
コード例 #2
0
ファイル: Main.cs プロジェクト: cexdelta/WeGramSharp
        private async WTask.Task <TLContactsFound> SearchBotOrChannel(string BouUsername)
        {
            TLContactsFound res = null;

            if (BouUsername != "")
            {
                try
                {
                    TLRequestContactsSearch req = new TLRequestContactsSearch();
                    req.setLimit(1);
                    req.setQ(BouUsername.Trim());
                    //res = (TLContactsFound)Api.doRpcCall(req);
                    res = await WTask.Task.Run(() => (TLContactsFound)Api.doRpcCall(req));
                }
                catch (Exception ex)
                {
                    NotifyBar.Text      = "خطا: " + ex.Message;
                    NotifyBar.ForeColor = Color.Red;
                }
            }
            return(res);
        }