Example #1
0
        /// <summary>
        /// Main user experience
        /// </summary>
        private async Task MainMenu()
        {
            var total = _renewalStore.Renewals.Count();
            var due   = _renewalStore.Renewals.Count(x => x.IsDue());
            var error = _renewalStore.Renewals.Count(x => !x.History.Last().Success);

            var(allowIIS, allowIISReason) = _userRoleService.AllowIIS;
            var options = new List <Choice <Func <Task> > >
            {
                Choice.Create <Func <Task> >(
                    () => _renewalCreator.SetupRenewal(RunLevel.Interactive | RunLevel.Simple),
                    "Create new certificate (simple for IIS)", "N",
                    @default: allowIIS,
                    disabled: (!allowIIS, allowIISReason)),
                Choice.Create <Func <Task> >(
                    () => _renewalCreator.SetupRenewal(RunLevel.Interactive | RunLevel.Advanced),
                    "Create new certificate (full options)", "M",
                    @default: !allowIIS),
                Choice.Create <Func <Task> >(
                    () => _renewalManager.CheckRenewals(RunLevel.Interactive),
                    $"Run scheduled renewals ({due} currently due)", "R",
                    color: due == 0 ? (ConsoleColor?)null : ConsoleColor.Yellow),
                Choice.Create <Func <Task> >(
                    () => _renewalManager.ManageRenewals(),
                    $"Manage renewals ({total} total{(error == 0 ? "" : $", {error} in error")})", "A",
Example #2
0
        /// <summary>
        /// Main user experience
        /// </summary>
        private async Task MainMenu()
        {
            var total = _renewalStore.Renewals.Count();
            var due   = _renewalStore.Renewals.Count(x => _dueDateService.IsDue(x));
            var error = _renewalStore.Renewals.Count(x => !x.History.LastOrDefault()?.Success ?? false);

            var(allowIIS, allowIISReason) = _userRoleService.AllowIIS;
            var options = new List <Choice <Func <Task> > >
            {
                Choice.Create <Func <Task> >(
                    () => _renewalCreator.SetupRenewal(RunLevel.Interactive | RunLevel.Simple),
                    "Create certificate (default settings)", "N",
                    @default: true),
                Choice.Create <Func <Task> >(
                    () => _renewalCreator.SetupRenewal(RunLevel.Interactive | RunLevel.Advanced),
                    "Create certificate (full options)", "M"),
                Choice.Create <Func <Task> >(
                    () => _renewalManager.CheckRenewals(RunLevel.Interactive),
                    $"Run renewals ({due} currently due)", "R",
                    color: due == 0 ? null : ConsoleColor.Yellow,
                    disabled: (total == 0, "No renewals have been created yet.")),
                Choice.Create <Func <Task> >(
                    () => _renewalManager.ManageRenewals(),
                    $"Manage renewals ({total} total{(error == 0 ? "" : $", {error} in error")})", "A",