Ejemplo 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);
        }
Ejemplo 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();
        }
Ejemplo 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);
            }
        }
Ejemplo 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>();
        }
Ejemplo 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();
        }
Ejemplo 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>();
        }
Ejemplo n.º 7
0
        private static void Main(string[] args)
        {
#if !DEBUG
            try
            {
#endif
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }

            BuildAvaloniaApp().BeforeStarting(_ =>
            {
                var studio = IoC.Get <IStudio>();

                InitializeLogging();

                Platform.Initialise();

                PackageSources.InitialisePackageSources();

                Dispatcher.UIThread.Post(async() =>
                {
                    await PackageManager.LoadAssetsAsync().ConfigureAwait(false);
                });
            })
            .StartShellApp <AppBuilder, MainWindow>("AvalonStudio", null, () => new MainWindowViewModel());
#if !DEBUG
        }

        catch (Exception e)
        {
            Print(e);
        }
        finally
#endif
            {
                Application.Current.Exit();
            }
        }
Ejemplo 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();
            }

            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);
        }