private async static Task <bool> Translate2Svf(string urn, JobPayloadDestination.RegionEnum targetRegion = JobPayloadDestination.RegionEnum.US) { try { Console.WriteLine("**** Requesting SVF translation for: " + urn); JobPayloadInput jobInput = new JobPayloadInput(urn); JobPayloadOutput jobOutput = new JobPayloadOutput( new List <JobPayloadItem> ( new JobPayloadItem [] { new JobPayloadItem( JobPayloadItem.TypeEnum.Svf, new List <JobPayloadItem.ViewsEnum> ( new JobPayloadItem.ViewsEnum [] { JobPayloadItem.ViewsEnum._2d, JobPayloadItem.ViewsEnum._3d } ), null ) } ), new JobPayloadDestination(targetRegion) ); JobPayload job = new JobPayload(jobInput, jobOutput); bool bForce = true; ApiResponse <dynamic> response = await DerivativesAPI.TranslateAsyncWithHttpInfo(job, bForce); httpErrorHandler(response, "Failed to register file for SVF translation"); return(true); } catch (Exception) { Console.WriteLine("**** Failed to register file for SVF translation"); return(false); } }
private async Task <bool> TranslateObject(ObservableCollection <ForgeObjectInfo> items, ForgeObjectInfo item) { try { string urn = URN((string)BucketsInRegion.SelectedItem, item, false); JobPayloadInput jobInput = new JobPayloadInput( urn, System.IO.Path.GetExtension(item.Name).ToLower() == ".zip", item.Name ); JobPayloadOutput jobOutput = new JobPayloadOutput( new List <JobPayloadItem> ( new JobPayloadItem [] { new JobPayloadItem( JobPayloadItem.TypeEnum.Svf, new List <JobPayloadItem.ViewsEnum> ( new JobPayloadItem.ViewsEnum [] { JobPayloadItem.ViewsEnum._2d, JobPayloadItem.ViewsEnum._3d } ), null ) } ) ); JobPayload job = new JobPayload(jobInput, jobOutput); bool bForce = true; DerivativesApi md = new DerivativesApi(); md.Configuration.AccessToken = accessToken; ApiResponse <dynamic> response = await md.TranslateAsyncWithHttpInfo(job, bForce); httpErrorHandler(response, "Failed to register file for translation"); item.TranslationRequested = StateEnum.Busy; item.Manifest = response.Data; JobProgress jobWnd = new JobProgress(item, accessToken); jobWnd._callback = new JobCompletedDelegate(this.TranslationCompleted); jobWnd.Owner = this; jobWnd.Show(); } catch (Exception /*ex*/) { item.TranslationRequested = StateEnum.Idle; return(false); } return(true); }