Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string[] temp = textBox1.Text.Split('/');

            ContentCrawlServiceClient contentClient = new ContentCrawlServiceClient();
            UserInfoServiceClient infoClient = new UserInfoServiceClient();
            var contentInfo = contentClient.GetContentCrawlResult(temp[3] + '|' + temp[4]);
            var userInfo = infoClient.GetUserInfo(temp[3]);

            StringBuilder sb = new StringBuilder();
            sb.Append("1:").Append(contentInfo.Sentiment).Append(" ");   //sentiment
            sb.Append("2:").Append(contentInfo.HasImg ? "1" : "0").Append(" ");   //HasImg ? "1" : "0"
            sb.Append("3:").Append(contentInfo.HasUrl ? "1" : "0").Append(" ");   //HasUrl ? "1" : "0"
            sb.Append("4:").Append(userInfo.FanNum).Append(" ");    //fans
            sb.Append("5:").Append(userInfo.WeiboNum).Append(" ");    //weibo
            sb.Append("6:").Append(userInfo.Credit).Append(" ");    //credit
            sb.Append("7:").Append(getLocVal(userInfo.Location)).Append(" "); //userLoc
            sb.Append("8:").Append(userInfo.Level).Append(" ");    //level
            sb.Append("9:").Append(userInfo.IsVerified).Append(" ");    //verified
            sb.Append("10:").Append(contentInfo.CommentEval).Append(" ");  //comval
            vector.Text = sb.ToString();
            /*List<string> newsList = sim.BiggestFiveTitle(weiboDataList[4]);
            foreach(string str in newsList)
            {
                news.Text += str + '\n';
            }*/
        }
        public static void GetServiceInfo(string url, out ContentCrawlResult contentInfo, out UserInfo userInfo)
        {
            string[] temp = url.Split('/');

            ContentCrawlServiceClient contentClient = new ContentCrawlServiceClient();
            UserInfoServiceClient infoClient = new UserInfoServiceClient();
            var contentTask = Task.Factory.StartNew<ContentCrawlResult>(() => {
                return contentClient.GetContentCrawlResult(temp[3] + '|' + temp[4]);
            });
            var userTask = Task.Factory.StartNew<UserInfo>(() => {
                return infoClient.GetUserInfo(temp[3]);
            });

            contentInfo = contentTask.Result;//contentClient.GetContentCrawlResult(temp[3] + '|' + temp[4]);
            userInfo = userTask.Result; //infoClient.GetUserInfo(temp[3]);
        }