本文整理汇总了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();
}
示例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();
}