当前位置: 首页>>代码示例>>C#>>正文


C# IUserSession.AddUserToMyList方法代码示例

本文整理汇总了C#中IUserSession.AddUserToMyList方法的典型用法代码示例。如果您正苦于以下问题:C# IUserSession.AddUserToMyList方法的具体用法?C# IUserSession.AddUserToMyList怎么用?C# IUserSession.AddUserToMyList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IUserSession的用法示例。


在下文中一共展示了IUserSession.AddUserToMyList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DoListsTest


//.........这里部分代码省略.........
                    } while (nextcursor != 0);

                    ConsoleOutput.PrintMessage(String.Format("List Membership Count: {0}",
                        listCount));
                }


                // 4
                if (testSeq.Contains(4))
                {
                    ConsoleOutput.PrintMessage("10.4 Lists\\GetMembersOnList - Cursored", ConsoleColor.Gray);

                    long nextcursor = -1;

                    do
                    {
                        var lists4 =
                            await session.GetMembersOnList(listId: 52908745, slug: "autechheads", ownerId: 800364, ownerScreenName: "NickHodgeMSFT", cursor: nextcursor);
                        if (lists4.twitterFaulted)
                        {
                            successStatus = false;
                            TwitterLiveFireUserAuth.PrintTwitterErrors(lists4.twitterControlMessage);
                            break;
                        }
                        nextcursor = lists4.next_cursor;
                        ConsoleOutput.PrintMessage(String.Format("Previous cursor: {0} Next cursor: {1}",
                            lists4.previous_cursor, lists4.next_cursor), ConsoleColor.Magenta);
                        foreach (var lusr in lists4.users)
                        {
                            ConsoleOutput.PrintMessage(
                                         String.Format("UserID: {0} // ScreenName: {1}", lusr.UserId, lusr.ScreenName));
                        }
                    } while (nextcursor != 0);
                }


                // 5
                if (testSeq.Contains(5))
                {
                    ConsoleOutput.PrintMessage("10.5 Lists\\IsUserOnList", ConsoleColor.Gray);
                    var testScreenName = "coatsy";    
                    var lists5 =
                        await session.IsUserOnList(screenName: testScreenName, listId: 52908745, ownerId: 800364, ownerScreenName:"NickHodgeMSFT");

                    if (lists5.OK)
                    {
                        if (lists5.ScreenName == null)
                            ConsoleOutput.PrintMessage(String.Format("UserID: {0} is NOT ON the list", testScreenName));
                        else
                            ConsoleOutput.PrintMessage(String.Format("ScreenName: {0} is on the list", lists5.ScreenName));
                    }
                    else
                    {
                        TwitterLiveFireUserAuth.PrintTwitterErrors(lists5.twitterControlMessage);
                        successStatus = false;
                    }
                }

                // 6
                if (testSeq.Contains(6))
                {
                    ConsoleOutput.PrintMessage("10.6 Lists\\AddUserToMyList", ConsoleColor.Gray);
                    var testScreenName = "shiftkey";
                    var lists6 =
                        await session.AddUserToMyList(listId: 52908745, userIdToAdd: 14671135, screenNameToAdd:"shiftkey");

                    if (lists6.Status)
                    {
                        ConsoleOutput.PrintMessage(String.Format("ScreenName: {0} is added the list", testScreenName));
                    }
                }


                // 7
                if (testSeq.Contains(7))
                {
                    ConsoleOutput.PrintMessage("10.7 Lists\\DeleteUsersFromList", ConsoleColor.Gray);
                    var testScreenName = "coatsy";
                    var testScreenNames = new List<string> {testScreenName};

                    var lists7 =
                        await session.DeleteUsersFromList(listId: 52908745, ownerId: 800364, ownerScreenName:"NickHodgeMSFT", screenNames:testScreenNames);

                    if (lists7.Status)
                    {
                        ConsoleOutput.PrintMessage(String.Format("ScreenName: {0} is added the list", testScreenName));
                    }
                    else
                    {
                        TwitterLiveFireUserAuth.PrintTwitterErrors(lists7.twitterControlMessage);
                    }
                }
            }
            catch (Exception e)
            {
                ConsoleOutput.PrintError(e.ToString());
                return false;
            }
            return successStatus;
        }
开发者ID:gerryaobrien,项目名称:BoxKite.Twitter,代码行数:101,代码来源:10ListsLiveFireTests.cs


注:本文中的IUserSession.AddUserToMyList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。