protected override void DoWork(DoWorkEventArgs e) { BackgroundOperationArgs <RFSDQArguments> args = e.Argument as BackgroundOperationArgs <RFSDQArguments>; if (args != null) { string endpointUrl = Endpoints.Endpoint_RegulatorFacilitySubmittalDocumentQuery.Replace("{CERSUniqueKey}", args.EndpointArguments.Identifier); UpdateEndpointUrl(endpointUrl); UpdateStatus("Invoking Service...Please Wait..."); RestClient client = new RestClient(App.AuthorizationHeader); var result = client.Execute(endpointUrl); UpdateOutputPanel(result); if (result.Status == System.Net.HttpStatusCode.OK) { Action <RestClientResult> saveFileResponseHandler = arg => { Utility.SaveFile(this, arg.RawData, "Save Binary File", "PDF|*.pdf|XML Files|*.xml"); }; Dispatcher.Invoke(saveFileResponseHandler, result); } } }
protected virtual void RunInBackground(BackgroundOperationType operationType) { if (_Worker != null && !_Worker.IsBusy) { BackgroundOperationArgs args = new BackgroundOperationArgs(operationType); RunInBackground(args); } }
protected virtual void RunInBackground <T>(BackgroundOperationType operationType, T args) { if (_Worker != null && !_Worker.IsBusy) { BackgroundOperationArgs <T> opArgs = new BackgroundOperationArgs <T>(args, operationType); _Worker.RunWorkerAsync(opArgs); } }
protected override void DoWork(DoWorkEventArgs e) { BackgroundOperationArgs <GenericDataUploadArguments> args = e.Argument as BackgroundOperationArgs <GenericDataUploadArguments>; if (args != null) { string endpointUrl = Endpoints.Format(Endpoints.Endpoint_RegulatorFacilityMetadata, App.RegulatorCode); UpdateEndpointUrl(endpointUrl); UpdateStatus("Invoking Service...Please Wait..."); RestClient client = new RestClient(App.AuthorizationHeader); var result = client.ExecuteXml(endpointUrl, args.EndpointArguments.Data); UpdateOutputPanel(result); } }
protected override void DoWork(DoWorkEventArgs e) { BackgroundOperationArgs <int> args = e.Argument as BackgroundOperationArgs <int>; if (args != null) { if (args.Type == BackgroundOperationType.Primary) { RestClient client = new RestClient(App.AuthorizationHeader); var restClientResult = client.Execute(Endpoints.Format(Endpoints.Endpoint_RegulatorAuthenticationTest, args.EndpointArguments), HttpMethod.Get); e.Result = new BackgroundOperationResult <RestClientResult>(true, args.Type, restClientResult, "Sign In Successfull!"); } else if (args.Type == BackgroundOperationType.Secondary) { App.LoadRegulators(); e.Result = new BackgroundOperationResult <RestClientResult>(true, args.Type, null, "Regulators Loaded Successfully"); } } }
protected override void DoWork(DoWorkEventArgs e) { BackgroundOperationArgs <RFQArguments> args = e.Argument as BackgroundOperationArgs <RFQArguments>; if (args != null) { StringBuilder endpointUrl = new StringBuilder(); endpointUrl.Append(Endpoints.Format(Endpoints.Endpoint_RegulatorFacilityQuery, App.RegulatorCode)); endpointUrl.AddQueryString(args.EndpointArguments.CERSID, "cersid"); endpointUrl.AddQueryString(args.EndpointArguments.CreatedOnStart, "createdOnStart"); endpointUrl.AddQueryString(args.EndpointArguments.CreatedOnEnd, "createdOnEnd"); endpointUrl.AddQueryString(args.EndpointArguments.OrganizationCode, "organizationCode"); UpdateEndpointUrl(endpointUrl); UpdateStatus("Invoking Service...Please Wait..."); RestClient client = new RestClient(App.AuthorizationHeader); var result = client.ExecuteXml(endpointUrl.ToString()); UpdateOutputPanel(result); } }
protected override void DoWork(DoWorkEventArgs e) { BackgroundOperationArgs <RCMEQArguments> args = e.Argument as BackgroundOperationArgs <RCMEQArguments>; if (args != null) { StringBuilder endpointUrl = new StringBuilder(); endpointUrl.Append(Endpoints.Format(Endpoints.Endpoint_RegulatorCMESubmittalQuery, App.RegulatorCode)); endpointUrl.AddQueryString(args.EndpointArguments.CERSID, "CERSID"); endpointUrl.AddQueryString(args.EndpointArguments.StartDate, "startDate"); endpointUrl.AddQueryString(args.EndpointArguments.EndDate, "endDate"); endpointUrl.AddQueryString(args.EndpointArguments.Status, "status"); UpdateEndpointUrl(endpointUrl); UpdateStatus("Invoking Service...Please Wait..."); RestClient client = new RestClient(App.AuthorizationHeader); var result = client.ExecuteXml(endpointUrl.ToString()); UpdateOutputPanel(result); } }
protected override void DoWork(DoWorkEventArgs e) { BackgroundOperationArgs <ROQArguments> args = e.Argument as BackgroundOperationArgs <ROQArguments>; if (args != null) { StringBuilder endpointUrl = new StringBuilder(); endpointUrl.Append(Endpoints.Format(Endpoints.Endpoint_RegulatorOrganizationQuery, App.RegulatorCode)); endpointUrl.AddQueryString(args.EndpointArguments.CERSID, "CERSID"); endpointUrl.AddQueryString(args.EndpointArguments.EstablishedSince, "establishedSince"); endpointUrl.AddQueryString(args.EndpointArguments.OrganizationCode, "organizationCode"); endpointUrl.AddQueryString(args.EndpointArguments.OrganizationName, "organizationName"); endpointUrl.AddQueryString(args.EndpointArguments.OrganizationHeadquarters, "organizationHeadquarters"); endpointUrl.AddQueryString(args.EndpointArguments.IncludeFacilities, "includeFacilities"); UpdateEndpointUrl(endpointUrl); UpdateStatus("Invoking Service...Please Wait..."); RestClient client = new RestClient(App.AuthorizationHeader); var result = client.ExecuteXml(endpointUrl.ToString()); UpdateOutputPanel(result); } }
protected override void DoWork(DoWorkEventArgs e) { BackgroundOperationArgs <CLQArguments> args = e.Argument as BackgroundOperationArgs <CLQArguments>; if (args != null) { //format our endpoint URL string endpointUrl = Endpoints.Endpoint_ChemicalLibraryQuery; if (!string.IsNullOrWhiteSpace(args.EndpointArguments.Identifier)) { endpointUrl += "/" + args.EndpointArguments.Identifier; } UpdateEndpointUrl(endpointUrl); UpdateStatus("Invoking Service...Please Wait..."); //invoke the REST call to the endpoint. RestClient client = new RestClient(App.AuthorizationHeader); var result = client.ExecuteXml(endpointUrl); UpdateOutputPanel(result); } }