Exemplo n.º 1
0
        private void Window_Loaded(object sender, RoutedEventArgs args)
        {
            if (OGContext == null)
            {
                try
                {
                    OGContextFactory.CreateRemoteEngineContext();
                    throw new ArgumentException("Unexpectedly succeeded this time");
                }
                catch (Exception e)
                {
                    MessageBox.Show(string.Format("Failed to connect to remote server:\n\t{0}\nHave you updated app.config?", e.Message), "Failed to connect to server");
                }

                Close();
                return;
            }

            Title = string.Format("OpenGamma Analytics ({0})", OGContext.RootUri);

            _remoteViewProcessor = OGContext.ViewProcessor;
            var viewNames       = _remoteViewProcessor.ViewDefinitionRepository.GetDefinitionNames();
            var liveDataSources = _remoteViewProcessor.LiveMarketDataSourceRegistry.GetNames();

            _remoteSecuritySource    = OGContext.SecuritySource;
            viewSelector.DataContext = viewNames;

            liveMarketDataSelector.DataContext = liveDataSources;

            WindowLocationPersister.InitAndPersistPosition(this, Settings);

            var viewToSelect = viewNames.Where(v => Settings.PreviousViewName == v).FirstOrDefault();

            viewSelector.SelectedItem = viewToSelect;
        }
        public ComputationResultsTables(ISecuritySource remoteSecuritySource, ICompiledViewDefinition compiledViewDefinition)
            : base(remoteSecuritySource, compiledViewDefinition.Portfolio)
        {
            _viewDefinition         = compiledViewDefinition.ViewDefinition;
            _compiledViewDefinition = compiledViewDefinition;
            _portfolioColumns       = GetPortfolioColumns(_viewDefinition, _compiledViewDefinition).ToList();
            _primitiveColumns       = GetPrimitiveColumns(_viewDefinition, _compiledViewDefinition).ToList();

            _primitiveRows = BuildPrimitiveRows().ToList();
        }
 protected PortfolioResultsTableBase(ISecuritySource remoteSecuritySource, IPortfolio portfolio)
 {
     _securityFactory = new ActionFactory <ExternalIdBundle, ISecurity>(remoteSecuritySource.GetSecurity);
     _portfolio       = portfolio;
     _portfolioRows   = BuildPortfolioRows().ToList();
 }
Exemplo n.º 4
0
        private void Window_Loaded(object sender, RoutedEventArgs args)
        {
            if (OGContext == null)
            {
                try
                {
                    OGContextFactory.CreateRemoteEngineContext();
                    throw new ArgumentException("Unexpectedly succeeded this time");
                }
                catch (Exception e)
                {
                    MessageBox.Show(string.Format("Failed to connect to remote server:\n\t{0}\nHave you updated app.config?", e.Message), "Failed to connect to server");
                }

                Close();
                return;
            }

            Title = string.Format("OpenGamma Analytics ({0})", OGContext.RootUri);

            _remoteViewProcessor = OGContext.ViewProcessor;
            var viewNames = _remoteViewProcessor.ViewDefinitionRepository.GetDefinitionNames();
            var liveDataSources = _remoteViewProcessor.LiveMarketDataSourceRegistry.GetNames();

            _remoteSecuritySource = OGContext.SecuritySource;
            viewSelector.DataContext = viewNames;

            liveMarketDataSelector.DataContext = liveDataSources;

            WindowLocationPersister.InitAndPersistPosition(this, Settings);

            var viewToSelect = viewNames.Where(v => Settings.PreviousViewName == v).FirstOrDefault();
            viewSelector.SelectedItem = viewToSelect;
        }