public void OnWindowClosing(object sender, CancelEventArgs e) { var vm = ((VisiFireChart)sender).DataContext as VisiFireChartViewModel; _subscriptions.RemoveAll(item => item.Board == vm._board && item.Seccode == vm._seccode); TXmlConnector.ConnectorSendCommand(ConnectorCommands.SubscribeTicks(SecurityForTicks.ReturnSecuritiesXml(_subscriptions))); TXmlConnector.SendNewTicks -= vm.TicksToCandles; }
public VisiFireChartViewModel(string board, string seccode) { _board = board; _seccode = seccode; TXmlConnector.SendNewTicks += TicksToCandles; var sub = new SecurityForTicks { Board = board, Seccode = seccode, Tradeno = "1" }; _subscriptions.Add(new SecurityForTicks { Board = board, Seccode = seccode, Tradeno = "1" }); var cmd = ConnectorCommands.SubscribeTicks(SecurityForTicks.ReturnSecuritiesXml(_subscriptions)); TXmlConnector.ConnectorSendCommand(cmd); _subscriptions.Last().Tradeno = "0"; }