AvalonStudio.BootScreen.Startup C# (CSharp) Method

Startup() public method

public Startup ( ) : void
return void
		public void Startup()
		{
			var progressBar = this.FindControl<ProgressBar>("StatusProgressBar");

			if (progressBar == null) throw new ApplicationException("Unable to locate progressbar");

			Platform.Initialise();
			progressBar.Value += 5;

			PackageSources.InitialisePackageSources();
			progressBar.Value += 5;

			var container = CompositionRoot.CreateContainer();
			progressBar.Value += 50;

			var commandService = container.GetExportedValue<ICommandService>();
			IoC.RegisterConstant(commandService, typeof(ICommandService));
			progressBar.Value += 10;

			var keyGestureService = container.GetExportedValue<ICommandKeyGestureService>();
			IoC.RegisterConstant(keyGestureService, typeof(ICommandKeyGestureService));
			progressBar.Value += 10;

			var toolBarBuilder = container.GetExportedValue<IToolBarBuilder>();
			IoC.RegisterConstant(toolBarBuilder, typeof(IToolBarBuilder));
			progressBar.Value += 10;

			ShellViewModel.Instance = container.GetExportedValue<ShellViewModel>();

			var main = new MainWindow();

			this.Hide();

			main.Show();

			ShellViewModel.Instance.Cleanup();
		}
	}