Example #1
0
        private async void Start()
        {
            var splash = new SplashWindow();
            splash.Show();

            var bootstrapper = new Bootstrapper();
            var container = bootstrapper.Build();

            Log.Info("Initializing reactive trader API...");
            var sw = Stopwatch.StartNew();
            var reactiveTraderApi = container.Resolve<IReactiveTrader>();

            var username = container.Resolve<IUserProvider>().Username;
            reactiveTraderApi.Initialize(username, container.Resolve<IConfigurationProvider>().Servers, container.Resolve<ILoggerFactory>());
            Log.InfoFormat("Reactive trader API initialized in {0}ms", sw.ElapsedMilliseconds);

            MainWindow = new MainWindow();
            var shellViewModel = container.Resolve<IShellViewModel>();
            MainWindow.Content = new ShellView(shellViewModel);

            await Task.Delay(TimeSpan.FromSeconds(1.5));
            splash.Close();
            MainWindow.Show();
            Log.InfoFormat("Main UI displayed {0}ms after process start.", DateTime.Now - Process.GetCurrentProcess().StartTime);
        }
Example #2
0
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            var shellView = Window.Current.Content as ShellView;
            if (shellView == null)
            {
                var bootstrapper = new Bootstrapper();
                var container = bootstrapper.Build();

                var reactiveTraderApi = container.Resolve<IReactiveTrader>();

                var username = container.Resolve<IUserProvider>().Username;
                reactiveTraderApi.Initialize(username, container.Resolve<IConfigurationProvider>().Servers, container.Resolve<ILoggerFactory>());

                shellView = new ShellView {DataContext = container.Resolve<IShellViewModel>()};

                Window.Current.Content = shellView;
            }

            Window.Current.Activate();
        }