public void ReloadData() { Initialize(); LayoutAnchorable defaultTab = AnchorablePane.Children.FirstOrDefault(pane => ((PositionControl)pane.Content).FilterSettingsWin.FilterId == DEFAULT_ID); AnchorablePane.Children.Clear(); if (defaultTab != null) { AnchorablePane.Children.Add(defaultTab); } var filtersettings = ClientDbContext.GetFilterSettings(TradeHandler.MessageWrapper.User.Id, PersistanceId); bool found = false; foreach (var fs in filtersettings) { var positionctrl = new PositionControl(PersistanceId, fs.Id, TradeHandler, MarketDataHandler); AnchorablePane.AddContent(positionctrl).Title = fs.Title; positionctrl.Filter(fs.Title, fs.Exchange, fs.Underlying, fs.Contract, fs.Portfolio); if (fs.Id == DEFAULT_ID) { found = true; } } if (found) { AnchorablePane.Children.Remove(defaultTab); } }
//private void MenuItem_Click_Open(object sender, RoutedEventArgs e) //{ // var tradeWin = new TradeRecordControl(Guid.NewGuid().ToString(), MessageHandlerContainer.DefaultInstance.Get<TraderExHandler>()); // tradeWin.FilterByStatus(new List<OrderOpenCloseType> { OrderOpenCloseType.OPEN }); // tradePane.AddContent(tradeWin).Title = WPFUtility.GetLocalizedString("Open", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName); //} //private void MenuItem_Click_Close(object sender, RoutedEventArgs e) //{ // var tradeWin = new TradeRecordControl(Guid.NewGuid().ToString(), MessageHandlerContainer.DefaultInstance.Get<TraderExHandler>()); // tradeWin.FilterByStatus(new List<OrderOpenCloseType> { OrderOpenCloseType.CLOSE }); // tradePane.AddContent(tradeWin).Title = WPFUtility.GetLocalizedString("Close", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName); //} private void MenuItem_Click_Position(object sender, RoutedEventArgs e) { //positionPane.AddContent(new PositionControl()).Title = WPFUtility.GetLocalizedString("Position", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName); var title = WPFUtility.GetLocalizedString("Position", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName); var positionWin = new PositionControl(positionsWindow.PersistanceId, Guid.NewGuid().ToString(), MessageHandlerContainer.DefaultInstance.Get<TraderExHandler>(), MessageHandlerContainer.DefaultInstance.Get<MarketDataHandler>()); positionWin.FilterSettingsWin.Title += "(" + title + ")"; positionWin.FilterSettingsWin.FilterTabTitle = title; positionPane.AddContent(positionWin).Title = title; positionWin.FilterSettingsWin.Save(); }
private void MenuItem_Click_Position(object sender, RoutedEventArgs e) { if (AnchorablePane != null) { var title = WPFUtility.GetLocalizedString("Position", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName); var positionctrl = new PositionControl(PersistanceId, Guid.NewGuid().ToString(), TradeHandler, MarketDataHandler); AnchorablePane.AddContent(positionctrl).Title = title; positionctrl.FilterSettingsWin.FilterTabTitle = title; positionctrl.FilterSettingsWin.Save(); } }