Example #1
0
        public override bool Execute(string[] arguments)
        {
            BookGenArgumentBase args = new BookGenArgumentBase();

            if (!ArgumentParser.ParseArguments(arguments, args))
            {
                return(false);
            }

            CurrentState.Log.LogLevel = args.Verbose ? Api.LogLevel.Detail : Api.LogLevel.Info;

            FolderLock.ExitIfFolderIsLocked(args.Directory, CurrentState.Log);

            using (var l = new FolderLock(args.Directory))
            {
                System.IO.Stream?Ui = typeof(GuiModule).Assembly.GetManifestResourceStream("BookGen.ConsoleUi.InitializeView.xml");
                var vm = new InitializeViewModel(CurrentState.Log, new FsPath(args.Directory));

                if (Ui != null)
                {
                    uiRunner?.Run(Ui, vm);
                    return(true);
                }
            }
            return(false);
        }
Example #2
0
        public override bool Execute(string[] arguments)
        {
            BookGenArgumentBase args = new BookGenArgumentBase();

            if (!ArgumentParser.ParseArguments(arguments, args))
            {
                return(false);
            }

            CurrentState.Gui             = true;
            CurrentState.GeneratorRunner = Program.CreateRunner(args.Verbose, args.Directory);

            FolderLock.ExitIfFolderIsLocked(args.Directory, CurrentState.Log);

            using (var l = new FolderLock(args.Directory))
            {
                System.IO.Stream?Ui = typeof(GuiModule).Assembly.GetManifestResourceStream("BookGen.ConsoleUi.MainView.xml");
                var vm = new MainViewModel(CurrentState.GeneratorRunner);

                if (Ui != null)
                {
                    uiRunner.Run(Ui, vm);
                    return(true);
                }
            }
            return(false);
        }
Example #3
0
        public override bool Execute(string[] arguments)
        {
            BookGenArgumentBase args = new BookGenArgumentBase();

            if (!ArgumentParser.ParseArguments(arguments, args))
            {
                return(false);
            }

            Api.LogLevel logLevel = args.Verbose ? Api.LogLevel.Detail : Api.LogLevel.Info;

            var log = new ConsoleLog(logLevel);

            System.IO.Stream?Ui = typeof(GuiModule).Assembly.GetManifestResourceStream("BookGen.ConsoleUi.InitializeView.xml");
            var vm = new InitializeViewModel(log, new FsPath(args.Directory));

            if (Ui != null)
            {
                uiRunner.Run(Ui, vm);
                return(true);
            }
            return(false);
        }