public Task ProcessCheckmarkField(string filePath, CheckmarkFieldProcessingSettings settings) { string url = String.Format("{0}/processCheckmarkField{1}", ServerUrl, settings.AsUrlParams); // Build post request WebRequest request = createPostRequest(url); writeFileToRequest(filePath, request); XDocument response = performRequest(request); Task task = ServerXml.GetTaskStatus(response); return(task); }
/// <summary> /// Call ProcessCheckmarkField asynchronously. /// Performs callbacks: /// UploadFileCompleted /// TaskProcessingCompleted /// </summary> public void ProcessCheckmarkFieldAsync(string filePath, CheckmarkFieldProcessingSettings settings, object taskId) { processFieldAsync(filePath, settings, taskId); }
private void fieldSelected(object sender, RegionSelectedEventArgs e) { string tempFilePath = System.IO.Path.GetTempFileName(); e.CroppedImage.Save(tempFilePath, System.Drawing.Imaging.ImageFormat.Tiff); string outputDir = getOutputDir(); UserTask task = new UserTask(tempFilePath); task.TaskStatus = "Uploading"; task.SourceIsTempFile = true; task.IsFieldLevel = true; // TODO: correct output name task.OutputFilePath = System.IO.Path.Combine( outputDir, "field-level" + System.IO.Path.GetRandomFileName() + ".xml"); task.SourceImage = e.CroppedImage; _userTasks.Add(task); _fieldLevelTasks.Add(task); // Select mode: text, barcode, checkmark if (flModeText.IsChecked == true) { TextFieldProcessingSettings settings = new TextFieldProcessingSettings(); restClientAsync.ProcessTextFieldAsync(tempFilePath, settings, task); } else if (flModeBarcode.IsChecked == true) { BarcodeFieldProcessingSettings settings = new BarcodeFieldProcessingSettings(); restClientAsync.ProcessBarcodeFieldAsync(tempFilePath, settings, task); } else { CheckmarkFieldProcessingSettings settings = new CheckmarkFieldProcessingSettings(); string userSettings = Properties.Settings.Default.CheckmarkOptions; if (!String.IsNullOrEmpty(userSettings)) settings.Params = userSettings; restClientAsync.ProcessCheckmarkFieldAsync(tempFilePath, settings, task); } // temp file will be deleted in ProcessingCompleted callback }
/// <summary> /// Call ProcessCheckmarkField asynchronously. /// Performs callbacks: /// UploadFileCompleted /// TaskProcessingCompleted /// </summary> public void ProcessCheckmarkFieldAsync(string filePath, CheckmarkFieldProcessingSettings settings, object taskId) { processFieldAsync(filePath, settings, taskId); }