CreateContainer() public static method

public static CreateContainer ( ) : System.ComponentModel.Composition.Hosting.CompositionContainer
return System.ComponentModel.Composition.Hosting.CompositionContainer
Exemplo n.º 1
0
        private static int Main(string[] args)
        {
            Platform.Initialise();

            PackageSources.InitialisePackageSources();

            var container = CompositionRoot.CreateContainer();

            MinimalShell.Instance = container.GetExportedValue <IShell>();

            Console.WriteLine("Avalon Build - {0} - {1}  - {2}", releaseName, version, Platform.PlatformIdentifier);

            var result = Parser.Default.ParseArguments
                         <AddOptions, RemoveOptions, AddReferenceOptions, BuildOptions, CleanOptions, CreateOptions, PackageOptions, TestOptions>(args).MapResult(
                (BuildOptions opts) => RunBuild(opts),
                (AddOptions opts) => RunAdd(opts),
                (AddReferenceOptions opts) => RunAddReference(opts),
                (PackageOptions opts) => RunInstallPackage(opts),
                (CleanOptions opts) => RunClean(opts),
                (CreateOptions opts) => RunCreate(opts),
                (RemoveOptions opts) => RunRemove(opts),
                (TestOptions opts) => RunTest(opts),
                errs => 1);

            return(result - 1);
        }
Exemplo n.º 2
0
        public void Startup()
        {
            var progressBar = this.FindControl <ProgressBar>("StatusProgressBar");

            Platform.Initialise();

            PackageSources.InitialisePackageSources();

            var container = CompositionRoot.CreateContainer();

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

            var main = new MainWindow();

            main.WindowState = WindowState.Minimized;

            this.Hide();

            Dispatcher.UIThread.InvokeAsync(() => {
                main.WindowState = WindowState.Maximized;
            });

            main.Show();

            ShellViewModel.Instance.Cleanup();
        }
Exemplo n.º 3
0
        private static void Main(string[] args)
        {
            try
            {
                if (args == null)
                {
                    throw new ArgumentNullException(nameof(args));
                }

                var builder = BuildAvaloniaApp().AfterSetup(async _ =>
                {
                    Platform.Initialise();
                    PackageSources.InitialisePackageSources();

                    var extensionManager = new ExtensionManager();
                    var container        = CompositionRoot.CreateContainer(extensionManager);

                    var shellExportFactory  = container.GetExport <ExportFactory <ShellViewModel> >();
                    ShellViewModel.Instance = shellExportFactory.CreateExport().Value;

                    await PackageManager.LoadAssetsAsync().ConfigureAwait(false);
                });

                InitializeLogging();

                builder.Start <MainWindow>();
            }
            catch (Exception e)
            {
                Print(e);
            }
        }
Exemplo n.º 4
0
        private static void Main(string[] args)
        {
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }

            var builder = AppBuilder.Configure <App>().UseReactiveUI().AvalonStudioPlatformDetect().AfterSetup(async _ =>
            {
                Platform.Initialise();

                PackageSources.InitialisePackageSources();

                ExtensionManager.Initialise();

                var extensionManager = IoC.Get <ExtensionManager>();
                var extensions       = extensionManager.GetInstalledExtensions();
                var container        = CompositionRoot.CreateContainer(extensions);

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

                await PackageManager.LoadAssetsAsync();
            });

            InitializeLogging();

            builder.Start <MainWindow>();
        }
Exemplo n.º 5
0
        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();

            main.WindowState = WindowState.Minimized;

            this.Hide();

            Dispatcher.UIThread.InvokeAsync(() => {
                main.WindowState = WindowState.Maximized;
            });

            main.Show();

            ShellViewModel.Instance.Cleanup();
        }
Exemplo n.º 6
0
        private static void Main(string[] args)
        {
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }

            var builder = AppBuilder.Configure <App>();

            if (args.Length >= 1 && args[0] == "--skia")
            {
                builder.UseSkia();

                if (Platform.OSDescription == "Windows")
                {
                    builder.UseWin32();
                }
                else
                {
                    builder.UseGtk3();
                }
            }
            else if (Platform.PlatformIdentifier == Platforms.PlatformID.Win32NT)
            {
                builder.UsePlatformDetect().UseSkia();
            }
            else
            {
                builder.UseGtk3().UseSkia();
            }

            builder.UseReactiveUI();

            builder.SetupWithoutStarting();

            Platform.Initialise();

            PackageSources.InitialisePackageSources();

            var container = CompositionRoot.CreateContainer();

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

            builder.Start <MainWindow>();
        }
Exemplo n.º 7
0
        private static int Main(string[] args)
        {
            if (args.Length >= 1 && args[0] == "debug")
            {
                Console.WriteLine("Waiting for debugger to attach.");

                while (!Debugger.IsAttached)
                {
                    Thread.Sleep(100);
                }

                Debugger.Break();

                args = args.ToList().Skip(1).ToArray();
            }

            Platform.Initialise();

            PackageSources.InitialisePackageSources();

            var container = CompositionRoot.CreateContainer();

            var studio = container.GetExport <IStudio>();

            Console.WriteLine("Avalon Build - {0} - {1}  - {2}", releaseName, version, Platform.PlatformIdentifier);

            var result = Parser.Default.ParseArguments <AddOptions, RemoveOptions, AddReferenceOptions, BuildOptions, CleanOptions, CreateOptions, PackageOptions, TestOptions>(args)
                         .MapResult((BuildOptions opts) => RunBuild(opts),
                                    (AddOptions opts) => RunAdd(opts),
                                    (AddReferenceOptions opts) => RunAddReference(opts),
                                    (PackageOptions opts) => RunInstallPackage(opts),
                                    (CleanOptions opts) => RunClean(opts),
                                    (CreateOptions opts) => RunCreate(opts),
                                    (RemoveOptions opts) => RunRemove(opts),
                                    (TestOptions opts) => RunTest(opts),
                                    errs => 1);

            return(result - 1);
        }
Exemplo n.º 8
0
        private static int Main(string[] args)
        {
            if (args.Length >= 1 && args[0] == "debug")
            {
                Console.WriteLine("Waiting for debugger to attach.");

                while (!Debugger.IsAttached)
                {
                    Thread.Sleep(100);
                }

                Debugger.Break();

                args = args.ToList().Skip(1).ToArray();
            }

            AvalonStudio.Shell.Extensibility.Platforms.Platform.AppName = "AvalonStudio";
            AvalonStudio.Shell.Extensibility.Platforms.Platform.Initialise();

            Platform.Initialise();

            var extensionManager = new ExtensionManager();
            var container        = CompositionRoot.CreateContainer(extensionManager);

            var shell = container.GetExport <IShell>();

            IoC.Initialise(container);

            ShellViewModel.Instance = IoC.Get <ShellViewModel>();

            ShellViewModel.Instance.Initialise();

            PackageManager.LoadAssetsAsync().Wait();

            Console.WriteLine("Avalon Build - {0} - {1}  - {2}", releaseName, ThisAssembly.Git.BaseVersion.Major + "." + ThisAssembly.Git.BaseVersion.Minor + "." + ThisAssembly.Git.BaseVersion.Patch, Platform.PlatformIdentifier);

            var result = Parser.Default.ParseArguments <
                BuildOptions,
                CleanOptions,
                CreateOptions,
                TestOptions,
                ListOptions,
                InstallOptions,
                UninstallOptions,
                PrintEnvironmentOptions,
                CreatePackageOptions,
                PushPackageOptions,
                PackageOptions>(args)
                         .MapResult((BuildOptions opts) => RunBuild(opts),
                                    (CleanOptions opts) => RunClean(opts),
                                    (CreateOptions opts) => RunCreate(opts),
                                    (TestOptions opts) => RunTest(opts),
                                    (ListOptions opts) => RunList(opts),
                                    (InstallOptions opts) => RunInstall(opts),
                                    (UninstallOptions opts) => RunUninstall(opts),
                                    (PrintEnvironmentOptions opts) => RunPrintEnv(opts),
                                    (CreatePackageOptions opts) => RunCreatePackage(opts),
                                    (PushPackageOptions opts) => RunPushPackage(opts),
                                    (PackageOptions opts) => RunPackage(opts),
                                    errs => 1);

            return(result - 1);
        }