Esempio n. 1
0
        public BlockPage()
        {
            InitializeComponent();

            users.load = async(c) =>
            {
                try
                {
                    var result =
                        await FanfouAPI.FanfouAPI.Instance.BlocksBlocking(SettingStorage.Instance.messageSize, ++page);

                    if (result.Count == 0)
                    {
                        users.HasMoreItems = false;
                    }

                    foreach (User i in result)
                    {
                        users.Add(i);
                    }

                    return(result.Count);
                }
                catch (Exception)
                {
                    Utils.ToastShow.ShowInformation("加载失败,请检查网络");
                    return(0);
                }
            };

            navigationHelper            = new NavigationHelper(this);
            navigationHelper.LoadState += NavigationHelper_LoadState;
            navigationHelper.SaveState += NavigationHelper_SaveState;
        }
Esempio n. 2
0
        public DirectPage()
        {
            InitializeComponent();

            messages.load = async(c) =>
            {
                try
                {
                    var result = await FanfouAPI.FanfouAPI.Instance.DirectMessagesConversationList(++page);

                    if (result.Count == 0)
                    {
                        messages.HasMoreItems = false;
                    }

                    foreach (DirectMessageItem i in result)
                    {
                        messages.Add(i);
                    }

                    return(result.Count);
                }
                catch (Exception)
                {
                    Utils.ToastShow.ShowInformation("加载失败,请检查网络");
                    return(0);
                }
            };

            navigationHelper            = new NavigationHelper(this);
            navigationHelper.LoadState += NavigationHelper_LoadState;
            navigationHelper.SaveState += NavigationHelper_SaveState;
        }
Esempio n. 3
0
        public UserPage()
        {
            InitializeComponent();

            navigationHelper            = new NavigationHelper(this);
            navigationHelper.LoadState += NavigationHelper_LoadState;
            navigationHelper.SaveState += NavigationHelper_SaveState;

            App.RootFrame.SizeChanged += RootFrame_SizeChanged;

            statuses.load = async(c) =>
            {
                if (statuses.Count > 0)
                {
                    try
                    {
                        var list = await FanfouAPI.FanfouAPI.Instance.StatusUserTimeline(user.id, c, max_id : statuses.Last().id);

                        if (list.Count == 0)
                        {
                            statuses.HasMoreItems = false;
                        }
                        Utils.StatusesReform.append(statuses, list);
                        return(list.Count);
                    }
                    catch (Exception)
                    {
                        Utils.ToastShow.ShowInformation("加载失败,请检查网络");
                        return(0);
                    }
                }
                return(0);
            };

            favorites.load = async(c) =>
            {
                if (favorites.Count > 0)
                {
                    try
                    {
                        var result =
                            await FanfouAPI.FanfouAPI.Instance.FavoritesId(user.id, SettingStorage.Instance.messageSize, ++favoritePage);

                        if (result.Count == 0)
                        {
                            favorites.HasMoreItems = false;
                        }
                        StatusesReform.append(favorites, result);

                        return(result.Count);
                    }
                    catch (Exception)
                    {
                        return(0);
                    }
                }
                return(0);
            };


            friends.load = async(c) =>
            {
                if (friends.Count > 0)
                {
                    try
                    {
                        var result =
                            await FanfouAPI.FanfouAPI.Instance.UsersFriends(user.id, SettingStorage.Instance.messageSize, ++friendsPage);

                        if (result.Count == 0)
                        {
                            friends.HasMoreItems = false;
                        }

                        foreach (User i in result)
                        {
                            friends.Add(i);
                        }

                        return(result.Count);
                    }
                    catch (Exception)
                    {
                        Utils.ToastShow.ShowInformation("加载失败,请检查网络");
                        return(0);
                    }
                }
                return(0);
            };

            followers.load = async(c) =>
            {
                if (followers.Count > 0)
                {
                    try
                    {
                        var result =
                            await FanfouAPI.FanfouAPI.Instance.UsersFollowers(user.id, SettingStorage.Instance.messageSize, ++followersPage);

                        if (result.Count == 0)
                        {
                            followers.HasMoreItems = false;
                        }

                        foreach (User i in result)
                        {
                            followers.Add(i);
                        }

                        return(result.Count);
                    }
                    catch (Exception)
                    {
                        Utils.ToastShow.ShowInformation("加载失败,请检查网络");
                        return(0);
                    }
                }
                return(0);
            };
        }