Esempio n. 1
0
        static async Task StartBot()
        {
            using (var container = new UnityContainer())
            {
                FuhrerContext.Init();
                await BL.Bootstrap.RegisterTypesAsync(container);

                Data.Bootstrap.RegisterTypes(container);

                //telegram UI
                var commandReader = new CommandReader(container);
                await commandReader.Execute();

                //console UI

                /*System.Console.WriteLine("Input command in format \"<command> <user name> <chat title>\"");
                 * var commandLine = string.Empty;
                 * while (string.IsNullOrEmpty(commandLine) || !commandLine.Equals("exit", StringComparison.OrdinalIgnoreCase))
                 * {
                 *      commandLine = System.Console.ReadLine();
                 *      if (string.IsNullOrEmpty(commandLine)) continue;
                 *      var commandLineArray = commandLine.Split(' ');
                 *      if (commandLineArray.Length < 2)
                 *      {
                 *              System.Console.WriteLine("Command arguments requiered");
                 *              continue;
                 *      }
                 *
                 *      var command = commandLineArray[0];
                 *      ICommand cmd;
                 *      try
                 *      {
                 *              cmd = container.Resolve<ICommand>(command.ToLower());
                 *      }
                 *      catch
                 *      {
                 *              System.Console.WriteLine("Incorrect command.");
                 *              continue;
                 *      }
                 *
                 *      try
                 *      {
                 *              var cmdResult = await cmd.Execute(commandLine.TrimStart(command + " "));
                 *              System.Console.WriteLine(cmdResult.Message);
                 *              while (!cmdResult.Success)
                 *              {
                 *                      cmdResult = await cmdResult.NextAction(System.Console.ReadLine());
                 *                      System.Console.WriteLine(cmdResult.Message);
                 *              }
                 *      }
                 *      catch (Exception ex)
                 *      {
                 *              System.Console.WriteLine(ex.Message);
                 *      }
                 * }*/
            }
        }
Esempio n. 2
0
 static void Main()
 {
     XmlConfigurator.Configure();
     ServiceBase[] ServicesToRun;
     FuhrerContext.Init();
     ServicesToRun = new ServiceBase[]
     {
         new TelegramFuhrerService()
     };
     ServiceBase.Run(ServicesToRun);
 }
Esempio n. 3
0
 public BaseRepository()
 {
     Context = new FuhrerContext();
 }