コード例 #1
0
 private BaseFetcher SelectDefaultFetcher()
 {
     BaseFetcher fetcher = null;
     if (!String.IsNullOrEmpty(PreferenceHelper.GetPreference("SinaWeibo_ID"))
         && !String.IsNullOrEmpty(PreferenceHelper.GetPreference("SinaWeibo_FollowerID"))
         && !String.IsNullOrEmpty(PreferenceHelper.GetPreference("SinaWeibo_Token")))
     {
         AvatarSource = PreferenceHelper.GetPreference("SinaWeibo_FollowerAvatar2");
         Name = PreferenceHelper.GetPreference("SinaWeibo_FollowerNickName");
         m_herID = PreferenceHelper.GetPreference("SinaWeibo_FollowerID");
         fetcher = new SinaWeiboFetcher();
         m_type = EntryType.SinaWeibo;
     }
     else if (!String.IsNullOrEmpty(PreferenceHelper.GetPreference("Renren_ID"))
         && !String.IsNullOrEmpty(PreferenceHelper.GetPreference("Renren_FollowerID")))
     {
         // 因为人人的avatar2 很可能是不规则的,所以这里用低清的
         AvatarSource = PreferenceHelper.GetPreference("Renren_FollowerAvatar2");
         Name = PreferenceHelper.GetPreference("Renren_FollowerNickName");
         m_herID = PreferenceHelper.GetPreference("Renren_FollowerID");
         fetcher = new RenrenFetcher();
         m_type = EntryType.Renren;
     }
     else if (!String.IsNullOrEmpty(PreferenceHelper.GetPreference("Douban_ID"))
         && !String.IsNullOrEmpty(PreferenceHelper.GetPreference("Douban_FollowerID"))
         && !String.IsNullOrEmpty(PreferenceHelper.GetPreference("Douban_Token")))
     {
         AvatarSource = PreferenceHelper.GetPreference("Douban_FollowerAvatar2");
         Name = PreferenceHelper.GetPreference("Douban_FollowerNickName");
         m_herID = PreferenceHelper.GetPreference("Renren_FollowerID");
         fetcher = new DoubanFetcher();
         m_type = EntryType.Douban;
     }
     return fetcher;
 }
コード例 #2
0
        private void Refresh()
        {
            Name1 = "";
            Name2 = "";
            Name3 = "";
            Value1 = 0;
            Value2 = 0;
            Value3 = 0;

            if (m_progressBarHelper == null)
            {
                m_progressBarHelper = new ProgressBarHelper(LoadProgessBar, () => { });
            }
            m_progressBarHelper.PushTask();
            BaseFetcher fetcher = null;
            switch (m_type)
            {
                case EntryType.SinaWeibo:
                    fetcher = new SinaWeiboFetcher();
                    AvatarSource = PreferenceHelper.GetPreference("SinaWeibo_FollowerAvatar2");
                    Name = PreferenceHelper.GetPreference("SinaWeibo_FollowerNickName");
                    m_herID = PreferenceHelper.GetPreference("SinaWeibo_FollowerID");
                    break;
                case EntryType.Renren:
                    fetcher = new RenrenFetcher();
                    AvatarSource = PreferenceHelper.GetPreference("Renren_FollowerAvatar2");
                    Name = PreferenceHelper.GetPreference("Renren_FollowerNickName");
                    m_herID = PreferenceHelper.GetPreference("Renren_FollowerID");
                    break;
                case EntryType.Douban:
                    fetcher = new DoubanFetcher();
                    AvatarSource = PreferenceHelper.GetPreference("Douban_FollowerAvatar2");
                    Name = PreferenceHelper.GetPreference("Douban_FollowerNickName");
                    m_herID = PreferenceHelper.GetPreference("Douban_FollowerID");
                    break;
                default:
                    fetcher = SelectDefaultFetcher();
                    break;
            }
            if (fetcher == null)
            {
                DialogHelper.ShowMessageDialog("请至少登陆一个平台并设置好关注人");
                m_progressBarHelper.PopTask();
                return;
            }
            fetcher.FetchCommentManList((List<CommentMan> list) =>
            {
                m_listMan = list;
                if (list == null)
                {
                    m_progressBarHelper.PopTask();
                    return;
                }
                GetData();

                ControlPanel.Children.Clear();
                ControlPanel.Children.Add(new PotentialEnemyControl(Name1, Value1, Name2, Value2, Name3, Value3));

                m_progressBarHelper.PopTask();
            });
        }