コード例 #1
0
ファイル: FormClient.cs プロジェクト: spzenk/sfdocsamples
        private void btnCallService_Click(object sender, EventArgs e)
        {
            ///------------------------------------------------------------<endpoint name="TradingServiceConfiguration"
            ITradingService dealProxy = new ChannelFactory<ITradingService>("TradingServiceConfiguration").CreateChannel();

            dealProxy.BeginDeal();

            Trade trade = new Trade();
            trade.Count = 10;
            trade.Symbol = "MSFT";
            trade.Date = DateTime.Now.AddMonths(2);
            dealProxy.AddTrade(trade);

            dealProxy.AddFunction("InterestRateEstimation");
            dealProxy.AddFunction("TechnologyStockEstimation");

            decimal dealValue = dealProxy.Calculate();
            textBox1.Text= "Deal value estimated at ${0}" + dealValue;

            dealProxy.Purchase();

            dealProxy.EndDeal();

            ((IChannel)dealProxy).Close();

        }