コード例 #1
0
ファイル: Form1.cs プロジェクト: pcyin/RumorDetection
        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';
            }*/
        }
コード例 #2
0
ファイル: ServiceHelper.cs プロジェクト: pcyin/RumorDetection
        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]);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: sunzhong0201/WCF-
        static void Main(string[] args)
        {
            //客户端调用服务器端服务方式1 :通过微软的svcutil 工具生成配置+代理类client
            UserInfoServiceClient userinfoClient = new UserInfoServiceClient();
            int      result   = userinfoClient.Add(1, 2);
            UserInfo userinfo = userinfoClient.GetUserInfo();

            Console.WriteLine(userinfo.userName);



            OrderInfoServiceClient orderInfoClient = new OrderInfoServiceClient();
            int orderResult = orderInfoClient.Add();

            Console.WriteLine("orderinfo:" + orderResult);
            Console.ReadKey();
        }