private static void OnConfigureServices(ContainerBuilder builder, BatchArguments args) { builder.RegisterType <RecentFilesManager>() .As <IRecentFilesManager>(); builder.RegisterType <BatchRunner>(); builder.RegisterType <BatchRunnerModel>().As <IBatchRunnerModel>(); builder.RegisterType <BatchRunJobExecutor>().As <IBatchRunJobExecutor>(); builder.RegisterType <BatchManagerVM>(); builder.RegisterType <PollyResilientWorker <BatchJobContext> >() .As <IResilientWorker <BatchJobContext> >() .WithParameter(new TypedParameter(typeof(int), MAX_RETRIES)); builder.RegisterType <PopupKiller>().As <IPopupKiller>(); builder.RegisterType <BatchDocumentVM>(); builder.RegisterType <AboutService>().As <IAboutService>(); builder.Register <Window>(c => m_Window); builder.RegisterType <BatchApplicationProxy>().As <IBatchApplicationProxy>().SingleInstance(); builder.RegisterAdapter <IApplication, ICadApplicationInstanceProvider[]>(x => ((IBatchApplication)x).ApplicationProviders); builder.RegisterType <XCadMacroProvider>().As <IXCadMacroProvider>(); builder.RegisterType <JobManager>().As <IJobManager>() .SingleInstance() .OnActivating(x => x.Instance.Init()); builder.RegisterType <JournalTextExporter>().As <IJournalExporter>(); builder.RegisterType <ResultsSummaryExcelExporter>().As <IResultsSummaryExcelExporter>(); }
private static void BatchOperation(BatchArguments arguments) { var config = ConfigHelper.GetConfig(arguments.ConfigFilePath); var batch = new Batch(config, arguments); batch.Execute(); }
public virtual List<WepayBatch> Create(BatchArguments arguments) { arguments.ClientId = arguments.ClientId.Equals(null) ? (ClientId == null ? WePayConfiguration.GetClientId() : ClientId) : arguments.ClientId; arguments.ClientSecret = string.IsNullOrWhiteSpace(arguments.ClientSecret) ? (string.IsNullOrWhiteSpace(ClientSecret) ? WePayConfiguration.GetClientSecret() : ClientSecret) : arguments.ClientSecret; var parameters = ParameterBuilder.ApplyParameters(arguments); var response = Requestor.PostStringBearer(Urls.BatchCreate, AccessToken, parameters); return WepayMapping<List<WepayBatch>>.AsyncMapBatchFromJson(response).Result; }
public virtual List <WepayBatch> Create(BatchArguments arguments) { arguments.ClientId = arguments.ClientId.Equals(null) ? (ClientId == null ? WePayConfiguration.GetClientId() : ClientId) : arguments.ClientId; arguments.ClientSecret = string.IsNullOrWhiteSpace(arguments.ClientSecret) ? (string.IsNullOrWhiteSpace(ClientSecret) ? WePayConfiguration.GetClientSecret() : ClientSecret) : arguments.ClientSecret; var parameters = ParameterBuilder.ApplyParameters(arguments); var response = Requestor.PostStringBearer(Urls.BatchCreate, AccessToken, parameters); return(WepayMapping.MapBatchFromJson(response).Result); }
private static void OnWindowCreated(MainWindow window, BatchArguments args) { try { m_Window = window; m_BatchManager = m_AppLauncher.Container.Resolve <BatchManagerVM>(); window.Closing += OnWindowClosing; window.DataContext = m_BatchManager; m_BatchManager.ParentWindow = window; if (m_StartupOptions != null) { if (!string.IsNullOrEmpty(m_StartupOptions.FilePath)) { m_BatchManager.OpenDocument(m_StartupOptions.FilePath); } if (m_StartupOptions.CreateNew) { m_BatchManager.CreateDocument(m_StartupOptions.ApplicationId); } } } catch (Exception ex) { IMessageService msgSvc; try { msgSvc = m_AppLauncher.Container.Resolve <IMessageService>(); } catch { msgSvc = new GenericMessageService("Batch+"); } msgSvc.ShowError(ex.ParseUserError()); Environment.Exit(1); } }
private static async Task RunConsoleBatch(BatchArguments args) { try { using (var batchRunner = m_AppLauncher.Container.Resolve <BatchRunner>( new TypedParameter[] { new TypedParameter(typeof(BatchJob), args.Job), new TypedParameter(typeof(TextWriter), Console.Out), new TypedParameter(typeof(IProgressHandler), new ConsoleProgressWriter()) })) { await batchRunner.BatchRunAsync().ConfigureAwait(false); } } catch (Exception ex) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(ex.ParseUserError()); Console.ResetColor(); Environment.Exit(1); } }
private static bool OnParseArguments(string[] input, Parser parser, ref BatchArguments args, ref bool createConsole) { args = default; var hasError = false; if (input.Any()) { BatchArguments argsLocal = default; bool createConsoleLocal = false; CreateParserResult(parser, input) .WithParsed <RunOptions>(a => { argsLocal = a; createConsoleLocal = true; }) .WithParsed <JobOptions>(a => { argsLocal = a; createConsoleLocal = true; }) .WithParsed <Base.FileOptions>(a => m_StartupOptions = a) .WithNotParsed(err => { hasError = true; createConsoleLocal = true; }); args = argsLocal; createConsole = createConsoleLocal; } return(!hasError); }
private static Task OnRunConsoleAsync(BatchArguments args) => RunConsoleBatch(args);
public Batch(Config config, BatchArguments arguments) { _config = config; _arguments = arguments; _toggl = new Toggl(_config.TogglApikey); }