public void ReloadData() { Initialize(); LayoutAnchorable defaultTab = AnchorablePane.Children.FirstOrDefault(pane => ((MarketDataControl)pane.Content).FilterSettingsWin.FilterId == DEFAULT_ID); AnchorablePane.Children.Clear(); if (defaultTab != null) { AnchorablePane.Children.Add(defaultTab); } // MessageHandlerContainer.DefaultInstance.Get<MarketDataHandler>().ResubMarketData(); var filtersettings = ClientDbContext.GetFilterSettings(MarketDataHandler.MessageWrapper.User.Id, PersistanceId); bool found = false; foreach (var fs in filtersettings) { var marketdatactrl = new MarketDataControl(PersistanceId, fs.Id, MarketDataHandler); AnchorablePane.AddContent(marketdatactrl).Title = fs.Title; marketdatactrl.LoadUserContracts(); marketdatactrl.Filter(fs.Title, fs.Exchange, fs.Underlying, fs.Contract); if (fs.Id == DEFAULT_ID) { found = true; } } if (found) { AnchorablePane.Children.Remove(defaultTab); } LoadUserContracts(); }
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_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(); } }
public void ReloadData() { Initialize(); //MessageHandlerContainer.DefaultInstance.Get<TraderExHandler>().OrderVMCollection.Clear(); //MessageHandlerContainer.DefaultInstance.Get<TraderExHandler>().QueryOrder(); LayoutAnchorable defaultTab = AnchorablePane.Children.FirstOrDefault(pane => ((ExecutionControl)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); //var userId = MessageHandlerContainer.DefaultInstance.Get<TraderExHandler>().MessageWrapper.User.Id; var userId = TradeHandler.MessageWrapper.User.Id; bool found = false; foreach (var fs in filtersettings) { var executionctrl = new ExecutionControl(PersistanceId, fs.Id, TradeHandler, fs.Title, fs.Exchange, fs.Underlying, fs.Contract); AnchorablePane.AddContent(executionctrl).Title = fs.Title; if (fs.Id == DEFAULT_ID) { found = true; } var statuses = ClientDbContext.GetOrderStatus(userId, fs.Id); executionctrl.FilterByStatus(statuses.Select(c => (OrderStatus)c)); if (statuses.Contains((int)OrderStatus.OPENED)) { var titleopen = WPFUtility.GetLocalizedString("Opened", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName); executionctrl.FilterSettingsWin.Title += " " + titleopen + " "; } else if ((statuses.Contains((int)OrderStatus.ALL_TRADED)) || (statuses.Contains((int)OrderStatus.PARTIAL_TRADING))) { var titletraded = WPFUtility.GetLocalizedString("TRADED", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName); executionctrl.FilterSettingsWin.Title += " " + titletraded + " "; } } if (found) { AnchorablePane.Children.Remove(defaultTab); } }