Пример #1
0
        private Program(DiadocApi diadocApi, ICrypt crypt)
        {
            consoleContext = new ConsoleContext
            {
                DiadocApi = diadocApi,
                Crypt     = crypt
            };

            consoleCommands = new List <IConsoleCommand>
            {
                new AuthenticateCommand(consoleContext),
                new LoginCommand(consoleContext),
                new ListCounteragentsCommand(consoleContext),
                new ActOnCounteragentCommand(consoleContext),
                new SelectBoxCommand(consoleContext),
                new ListEventsCommand(consoleContext),
                new GetEventCommand(consoleContext),
                new GetMessageCommand(consoleContext),
                new PostMessageCommand(consoleContext),
                new PrintCommand(consoleContext),
                new ConfigureProxyCommand(consoleContext),
                new GetProxyStatusCommand(consoleContext),
                new SearchCommand(consoleContext),
                new GetInvoicesCommand(consoleContext),
                new AttorneyCommand(consoleContext),
                new StatusCommand(consoleContext),
                new ExitCommand(consoleContext)
            };
        }
Пример #2
0
        public static void ShowBoxes(ConsoleContext consoleContext)
        {
            var myOrgs  = consoleContext.DiadocApi.GetMyOrganizations(consoleContext.CurrentToken).Organizations;
            var myBoxes = myOrgs.SelectMany(o => o.Boxes).ToList();

            System.Console.WriteLine(myBoxes.Count == 0 ? "Доступных ящиков нет" : "Список доступных ящиков:");
            PrintBoxes(myOrgs);
            consoleContext.Orgs  = myOrgs;
            consoleContext.Boxes = myBoxes;
        }
Пример #3
0
 public static string AutocompleteBoxId(ConsoleContext consoleContext, string boxId)
 {
     if (consoleContext.Boxes != null)
     {
         var foundId = consoleContext.Boxes
                       .Select(b => b.BoxId)
                       .FirstOrDefault(id => id.StartsWith(boxId, StringComparison.InvariantCultureIgnoreCase));
         if (foundId != null)
         {
             return(foundId);
         }
     }
     return(boxId);
 }