void TransactionAccepted_State_InstanceUpdated(TransactionInstance obj) { if (Application.Current.Dispatcher.Thread != Thread.CurrentThread) { Application.Current.Dispatcher.BeginInvoke(new Action <TransactionInstance>(TransactionAccepted_State_InstanceUpdated), obj); return; } TransactionLine line = this.Transactions.FirstOrDefault(e => e.Transaction.Id == obj.PublicMember.Id); if (line == null) { line = new TransactionLine() { State = TransactionState.Accepted, Transaction = obj.PublicMember }; Transactions.Add(line); } else { XComponent.Common.Clone.XCClone.Clone(obj.PublicMember, line.Transaction); line.State = TransactionState.Accepted; } line.XCState = obj.StateName; line.XCPreviousState = obj.PublicMember.PreviousState; line.Context = obj.Context; }
void ErrorOnMapping_State_InstanceUpdated(TransactionInstance obj) { if (Application.Current.Dispatcher.Thread != Thread.CurrentThread) { Application.Current.Dispatcher.BeginInvoke(new Action <TransactionInstance>(ErrorOnMapping_State_InstanceUpdated), obj); return; } TransactionLine line = this.Transactions.FirstOrDefault(e => e.Transaction.Id == obj.PublicMember.Id); if (line == null) { line = new TransactionLine() { State = TransactionState.Error, Transaction = obj.PublicMember }; line.OnReject += delegate { ClientApiHelper.Instance.Api.TradeCapture_Component.Transaction_StateMachine.SendEvent(line.Context, new Reject()); }; line.OnUpdateRequested += delegate { ClientApiHelper.Instance.Api.TradeCapture_Component.Transaction_StateMachine.SendEvent(line.Context, new Instrument() { Name = line.Transaction.Instrument }); }; Transactions.Add(line); } else { XComponent.Common.Clone.XCClone.Clone(obj.PublicMember, line.Transaction); } line.XCState = obj.StateName; line.XCPreviousState = obj.PublicMember.PreviousState; line.Context = obj.Context; }