当前位置: 首页>>代码示例>>C#>>正文


C# ChannelFactory.AddTrade方法代码示例

本文整理汇总了C#中System.ServiceModel.ChannelFactory.AddTrade方法的典型用法代码示例。如果您正苦于以下问题:C# ChannelFactory.AddTrade方法的具体用法?C# ChannelFactory.AddTrade怎么用?C# ChannelFactory.AddTrade使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.ServiceModel.ChannelFactory的用法示例。


在下文中一共展示了ChannelFactory.AddTrade方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: btnCallService_Click

        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();

        }
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:26,代码来源:FormClient.cs

示例2: Main

        public static void Main(string[] args)
        {
            Console.WriteLine("Press any key when the  tradeservice is ready.");
            Console.ReadKey();
            ITradeService tradeProxy = new ChannelFactory<ITradeService>("TradeServiceConfiguration").CreateChannel();
            tradeProxy.BeginTrade();
            Trade trade = new Trade();
            trade.Amount = 100;
            trade.Symbol = "ABCX";
            trade.Date = DateTime.Now.AddMonths(1);
            tradeProxy.AddTrade(trade);
            tradeProxy.AddFunct("TradeEstimate");
            tradeProxy.AddFunct("StockEstimate");
            decimal tradeValue = tradeProxy.DoCalc();
            Console.WriteLine(string.Format("Deal value estimated at ${0}", tradeValue));
            tradeProxy.Buy();
            tradeProxy.EndTrade();

            Console.WriteLine();
            Console.WriteLine("Completed");
            Console.ReadKey();
        }
开发者ID:ssickles,项目名称:archive,代码行数:22,代码来源:Program.cs


注:本文中的System.ServiceModel.ChannelFactory.AddTrade方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。