Background:
Let's suppose if by clicking the PositionSummaryItem I want to display details of this item in my OrderCompositeView - so it's not going to be a new entry but an existing one. How do I pass the TransactionInfo details to my OrderDetailsViewModel?
This is where the concrete class gets injected in the OrderCompositeViewModel:
In the StartOrder method of the OrderController the TransactionInfo is passed to the OrderCompositeViewModel through this property injection:
I know I could I start newing things up and create unnecessary coupling. I'm very keen to do this the right way. Any help would be greatly appreciated.
-
With StockTraderRI demo application when you select an action in the PositionSummary view an OrderCompositeView is activated by the OrderController. The only information displayed on the view is the symbol, ie STOCK01. This is done via TransactionInfo object.
-
There is a binding between OrderDetailsViewModel to OrderCompositeView via this property:
public object OrderDetails { get { return this.orderDetailsViewModel; } }
-
When the OrderCompositeView is displayed the entry is blank and awaits user input before it can be processed.
Let's suppose if by clicking the PositionSummaryItem I want to display details of this item in my OrderCompositeView - so it's not going to be a new entry but an existing one. How do I pass the TransactionInfo details to my OrderDetailsViewModel?
This is where the concrete class gets injected in the OrderCompositeViewModel:
[ImportingConstructor]
public OrderCompositeViewModel(IOrderDetailsViewModel orderDetailsViewModel)
{
this.orderDetailsViewModel = orderDetailsViewModel;
this.orderDetailsViewModel.CloseViewRequested += _orderPresenter_CloseViewRequested;
}
How do I pass the tickerSymbol parameter to the OrderDetailsViewModel in order to activate the OrderDetailsView with data from STOCK01 object ?In the StartOrder method of the OrderController the TransactionInfo is passed to the OrderCompositeViewModel through this property injection:
var orderCompositeViewModel = ServiceLocator.Current.GetInstance<IOrderCompositeViewModel>();
orderCompositeViewModel.TransactionInfo = new TransactionInfo(tickerSymbol, transactionType);
This very tickerSymbol needs to be passed down to the constructor of the OrderDetailsViewModel as well. How do I do that? At what point in OrderDetailsViewModel do I retrieve the new record using the tickerSymbol? Do I use the ServiceLocator as in ServiceLocator.Current.GetInstance<IOrderDetailsViewModel>(); ? How is the ticker Symbol passed ?I know I could I start newing things up and create unnecessary coupling. I'm very keen to do this the right way. Any help would be greatly appreciated.