Пример #1
0
        public void OnAccountSelected(AccountVM accountVm)
        {
            string viewName     = accountVm.InvestorId;
            var    existingPane = RegionManager.GetExistingPane <PortfolioContentPane>(viewName);

            if (existingPane != null)
            {
                existingPane.Activate();
            }
            else
            {
                PortfolioContentPane pane = new PortfolioContentPane();
                pane.ViewName = viewName;
                var portfoliosView = ServiceLocator.Current.GetInstance <PortfoliosView>();
                portfoliosView.SetAccount(accountVm);
                pane.Content = portfoliosView;
                //pane.CloseAction = Infragistics.Windows.DockManager.PaneCloseAction.RemovePane;
                pane.Closed += new EventHandler <Infragistics.Windows.DockManager.Events.PaneClosedEventArgs>(pane_Closed);
                pane.Loaded += (s, e) => portfoliosView.OnViewSelected();

                RegionManager.RegisterViewWithRegion(RegionNames.PortfolioViewRegion,
                                                     () => pane);
                pane.Activate();
            }
        }
Пример #2
0
        private void OnQueryPosition(AccountVM acctVm)
        {
            string viewName     = acctVm.InvestorId;
            var    existingPane = RegionManager.GetExistingPane <PositionContentPane>(viewName);

            if (existingPane != null)
            {
                existingPane.Activate();
                PositionView positionView = existingPane.Content as PositionView;
                if (positionView != null)
                {
                    positionView.ViewModel.RefreshPositionCommand.Execute();
                }
            }
            else
            {
                PositionContentPane pane = new PositionContentPane();
                pane.ViewName = viewName;
                var positionView = ServiceLocator.Current.GetInstance <PositionView>();
                positionView.ViewModel.SetAccount(acctVm);
                positionView.ViewModel.RefreshPositionCommand.Execute();
                pane.Content = positionView;
                //pane.CloseAction = Infragistics.Windows.DockManager.PaneCloseAction.RemovePane;
                pane.Closed += new EventHandler <Infragistics.Windows.DockManager.Events.PaneClosedEventArgs>(pane_Closed);

                RegionManager.RegisterViewWithRegion(RegionNames.PortfolioViewRegion,
                                                     () => pane);
                pane.Activate();
            }
        }