コード例 #1
0
ファイル: Program.cs プロジェクト: uzbekdev1/StockTicker
        private static void Main(string[] args)
        {
            var stockProxy  = new StockWebServiceSoapClient();
            var credentials = new UserCredentials
            {
                UserName = "******",
                Password = "******"
            };
            var counter = 0;

            Console.WriteLine("-------------------------------------");
            Console.WriteLine("The prices should auto refresh every 10 seconds.");
            Console.WriteLine("-------------------------------------");
            Console.WriteLine();

            while (true)
            {
                counter++;

                var result = counter == 1
                    ? stockProxy.GetList(credentials)
                    : stockProxy.UpdatePrices(credentials);
                if (result.Success)
                {
                    Console.WriteLine("----------------{0}-------------------", counter);

                    foreach (var item in result.Result)
                    {
                        Console.WriteLine("{0}-{1}({2:C})", item.Symbol, item.Name, item.Price);
                    }

                    Console.WriteLine();
                }
                else
                {
                    Console.WriteLine(result.Error);
                }


                Thread.Sleep(10 * 1000);
            }
        }
コード例 #2
0
        //
        // GET: /Home/Index
        public ActionResult Index()
        {
            var credentials = new UserCredentials
            {
                UserName = MembershipHelper.User.UserName,
                Password = MembershipHelper.User.Password,
            };
            var model = _client.GetList(credentials);

            if (model.Success)
            {
                return(View(model.Result));
            }
            else
            {
                ViewBag.Error = model.Error;
            }

            return(View());
        }