public DecisionsFramework.Design.Flow.FlowStep ConvertStep(ConversionData allConvertData, ConvertedStep stepToConvert) { SystemUserContext suc = new SystemUserContext(); using (UserContextHolder.Register(suc)) { LinkedFlowStep lfs = new LinkedFlowStep(); // Get name of flow to run / id of flow to run. StepInput flowId = stepToConvert.StepProperties.FirstOrDefault(x => x.Name == "EmbeddedFlowId"); //string flowId = flowName.ConstantValue; //foreach (Flow cf in allConvertData.ConvertedFlows) //{ // if (cf.Name == flowName.ConstantValue) // { // flowId = cf.Id; // } //} lfs.RegistrationId = flowId.ConstantValue; return(new FlowStep(lfs)); } }
private static void addGenericConversions() { var colors = graph.GetVertices <ColorInfo, ConversionData <ColorInfo> >().ToList(); foreach (var genericColor in genericColors) { foreach (var color in colors) { var genericColorInfo = ColorInfo.GetInfo(genericColor.GetType(), color.ChannelType); if (color.NumberOfChannels != genericColorInfo.NumberOfChannels) { continue; } Add(ConversionData <ColorInfo> .AsCast ( source: genericColorInfo, destination: color )); Add(ConversionData <ColorInfo> .AsCast ( source: color, destination: genericColorInfo )); } } }
private void AbortAdjustment() { this.LeaveAdjustConversionState(); ConversionData c = this.DataContext as ConversionData; c.DiscardTweaks(); }
/// <summary> /// Creates a new instance of the <see cref="ColorConverter"/> class /// </summary> /// <param name="inColor">The input color</param> /// <param name="outColor">The output color</param> public ColorConverter(Color inColor, Color outColor) { if (inColor == null || outColor == null) { throw new ArgumentNullException(); } if (!IsInitiated) { Init(); } InColor = inColor; OutColor = outColor; InValuesHandle = GCHandle.Alloc(InColor.Values, GCHandleType.Pinned); OutValuesHandle = GCHandle.Alloc(OutColor.Values, GCHandleType.Pinned); InValues = (double *)InValuesHandle.AddrOfPinnedObject(); OutValues = (double *)OutValuesHandle.AddrOfPinnedObject(); Data = new ConversionData(InColor, OutColor); var types = new Type[] { typeof(ColorConverter), typeof(double *), typeof(double *), typeof(ConversionData) }; DynamicMethod convMethod = new DynamicMethod("ConversionMethod", null, types, typeof(ColorConverter)); GetConversionMethod(convMethod.GetILGenerator()); ConversionMethod = convMethod.CreateDelegate(typeof(ConversionDelegate), this) as ConversionDelegate; }
public DecisionsFramework.Design.Flow.FlowStep ConvertStep(ConversionData allConvertData, ConvertedStep stepToConvert) { FlowStep result = new FlowStep(new StartStep()); result.Name = stepToConvert.StepName; return(result); }
/// <summary> /// Releases all allocated resources /// </summary> /// <param name="managed">True if called by user, false if called by finalizer</param> protected virtual void Dispose(bool managed) { if (!IsDisposed) { if (InValuesHandle.IsAllocated) { InValuesHandle.Free(); } if (OutValuesHandle.IsAllocated) { OutValuesHandle.Free(); } if (Data != null) { Data.Dispose(); } if (managed) { ConversionMethod = null; Data = null; } IsDisposed = true; } }
public void LoadSelectedConversionData(GenderId gender, ConversionId conversion, string region, BrandId brand) { this.SelectedConversionData = this.conversiondsDB.ConversionData.Where(c => c.Gender == gender && c.Conversion == conversion && c.Region == region && c.Brand == brand).FirstOrDefault(); }
public DecisionsFramework.Design.Flow.FlowStep ConvertStep(ConversionData allConvertData, ConvertedStep stepToConvert) { DecisionsFramework.Design.Flow.CoreSteps.GetItemByIndex getItemStep = new DecisionsFramework.Design.Flow.CoreSteps.GetItemByIndex(); FlowStep fs = new FlowStep(getItemStep); fs.Name = stepToConvert.StepName; return(fs); }
protected bool Equals(ConversionData other) { return(string.Equals(FilePath, other.FilePath) && string.Equals(Title, other.Title) && string.Equals(Album, other.Album) && Equals(Performers, other.Performers) && Equals(AlbumArtists, other.AlbumArtists)); }
public DecisionsFramework.Design.Flow.FlowStep ConvertStep(ConversionData allConvertData, ConvertedStep stepToConvert) { InvokeMethodStep ims = new InvokeMethodStep("DecisionsFramework.Design.Flow.CoreSteps.StandardSteps.ObjectSteps", "ObjectIsNull", null); FlowStep fs = new FlowStep(ims); fs.Name = stepToConvert.StepName; return(fs); }
private static void addSelfPaths() { var colors = graph.GetVertices <ColorInfo, ConversionData <ColorInfo> >().ToList(); foreach (var color in colors) { Add(ConversionData <ColorInfo> .AsReturnSource(color)); } }
public DecisionsFramework.Design.Flow.FlowStep ConvertStep(ConversionData allConvertData, ConvertedStep stepToConvert) { GoToStep gs = new GoToStep(); FlowStep result = new FlowStep(gs); result.Name = stepToConvert.StepName; //gs.GoToStepName = ((GoToComponentByName)component).ComponentName; return(result); }
public DecisionsFramework.Design.Flow.FlowStep ConvertStep(ConversionData allConvertData, ConvertedStep stepToConvert) { // JoinStrings(string[] source, string separator InvokeMethodStep ims = new InvokeMethodStep("DecisionsFramework.Design.Flow.CoreSteps.StandardSteps.StringSteps", "JoinStrings", null); FlowStep fs = new FlowStep(ims); fs.Name = stepToConvert.StepName; return(fs); }
// Main set of methods for adjustments found in AdjustmentWidget.xaml.cs //private void conversionResultContainerGrid_Tap(object sender, System.Windows.Input.GestureEventArgs e) //{ // ConversionData c = (sender as Grid).DataContext as ConversionData; // c.IsAdjusting = !c.IsAdjusting; // if (c.IsAdjusting) // { // // First time adjusting, give a prompt // if (App.Settings.GetValueOrDefault<bool>("ShowHelpAdjustment", true)) // { // MessageBoxResult res = MessageBox.Show("Tap a brand name to adjust the sizes." // + Environment.NewLine // + Environment.NewLine // + "If you don't want to make an adjustment, tap the brand name again or hit the back button.", // "Making an adjustment", MessageBoxButton.OK); // App.Settings.AddOrUpdateValue("ShowHelpAdjustment", false); // App.Settings.Save(); // } // } // else // { // c.DiscardTweaks(); // } //} private void conversionResultContainerGrid_Tap(object sender, System.Windows.Input.GestureEventArgs e) { ConversionData c = (sender as Grid).DataContext as ConversionData; App.VM.SelectedConversionData = c; string uriStr = String.Format("/View/Pages/ConversionAdjustmentPage.xaml?GenderId={0}&BrandId={1}&ConversionId={2}&RegionId={3}&ProfileId={4}", App.VM.SelectedProfile.Gender, c.Brand, c.Conversion, c.Region, App.VM.SelectedProfile.Id); NavigationService.Navigate(new Uri(uriStr, UriKind.Relative)); }
private void rightSizeBtn_Tap(object sender, System.Windows.Input.GestureEventArgs e) { if (App.VM.AllowFeedBack == null) { this.PromptForFeedbackPermission(); } this.LeaveAdjustConversionState(); ConversionData c = this.DataContext as ConversionData; c.AcceptTweaks(); }
public DecisionsFramework.Design.Flow.FlowStep ConvertStep(ConversionData allConvertData, ConvertedStep stepToConvert) { StringMatchStep sms = new StringMatchStep(); sms.PossibleMatches = stepToConvert.StepProperties.FirstOrDefault(x => x.Name == "PossibleMatches").ConstantValue.Split(','); FlowStep result = new FlowStep(sms); result.Name = stepToConvert.StepName; return(result); }
private async void Converter_JobOperation(object sender, Leadtools.Document.Converter.DocumentConverterJobEventArgs e) { ConversionData conversionData = e.Job.JobData.UserData as ConversionData; await Device.InvokeOnMainThreadAsync(() => { int documentIndex = DocumentsIds.IndexOf(e.Document.DocumentId); DocumentsInfoLabel.Text = string.Format("Document {0}/{1}{2}", documentIndex + 1, DocumentsIds.Count, string.IsNullOrWhiteSpace(e.Document.Name) ? string.Empty : $" ({e.Document.Name})"); CurrentOperationLabel.Text = e.Operation.GetFriendlyName().ToUpper(); int currentPageNumber = (e.InputDocumentPageNumber == 0) ? 1 : e.InputDocumentPageNumber; CurrentPageLabel.Text = string.Format("Page {0}/{1}", currentPageNumber, (conversionData.LastPageIndex > 0) ? conversionData.LastPageIndex + 1 : e.Document.Pages.Count); }); }
public DecisionsFramework.Design.Flow.FlowStep ConvertStep(ConversionData allConvertData, ConvertedStep stepToConvert) { LogStep logStep = new LogStep(); logStep.Category = stepToConvert.StepProperties.FirstOrDefault(x => x.Name == "Category").ConstantValue; string logLevel = stepToConvert.StepProperties.FirstOrDefault(x => x.Name == "Type").ConstantValue; switch (logLevel) { case "Debug": logStep.Type = LogStep.LogType.Debug; break; case "Error": logStep.Type = LogStep.LogType.Error; break; case "Info": logStep.Type = LogStep.LogType.Info; break; case "Fatal": logStep.Type = LogStep.LogType.Fatal; break; case "Warn": logStep.Type = LogStep.LogType.Warn; break; default: logStep.Type = LogStep.LogType.Info; break; } FlowStep result = new FlowStep(logStep); result.Name = stepToConvert.StepName; MergeStringInputMapping text = new MergeStringInputMapping() { //ConstantInputMapping text = new ConstantInputMapping(); InputDataName = "Value", MergeResultType = DecisionsFramework.Utilities.Data.MergeDataType.PlainText, MergeString = stepToConvert.InputData.FirstOrDefault(x => x.Name == "Value").ConstantValue }; result.AddInputMapping(text); return(result); }
private static void addDepthConversions() { var colors = graph.GetVertices <ColorInfo, ConversionData <ColorInfo> >().ToList(); foreach (var color in colors) { foreach (var depthConversion in depthConversions) { var colorConversion = ConversionData <ColorInfo> .AsConvertDepth(color.ColorType, depthConversion); graph.AddOrUpdateEdge(colorConversion); } } }
/// <summary> /// The conversion method /// </summary> /// <param name="inColor">The pointer to the input color values</param> /// <param name="outColor">The pointer to the output color values</param> /// <param name="data">The data that is used to perform the conversion</param> public static void Convert(double *inColor, double *outColor, ConversionData data) { UMath.MultiplyMatrix_3x3_3x1((double *)data.OutSpaceData, inColor, outColor); if (outColor[0] < 0) { outColor[0] = 0; } if (outColor[1] < 0) { outColor[1] = 0; } if (outColor[2] < 0) { outColor[2] = 0; } data.OutTransform(outColor, outColor); }
/// <summary> /// Returns conversion data for color conversion with specified channel depth conversion data. /// </summary> /// <param name="colorType">Destination color type.</param> /// <param name="depthConversionData">Channel type conversion data.</param> /// <returns>Conversion info.</returns> public static ConversionData <ColorInfo> AsConvertDepth(Type colorType, ConversionData <Type> depthConversionData) { CreateImageFunc creationFunc = depthConversionData.CreateFunc ?? ((srcImg, destColor) => Image.Create(destColor, srcImg.Width, srcImg.Height)); var srcColor = ColorInfo.GetInfo(colorType, depthConversionData.Source); var dstColor = ColorInfo.GetInfo(colorType, depthConversionData.Destination); return(new ConversionData <ColorInfo> ( srcColor, dstColor, depthConversionData.ConvertFunc, depthConversionData.ForceSequential, creationFunc, depthConversionData.Cost )); }
public DecisionsFramework.Design.Flow.FlowStep ConvertStep(ConversionData allConvertData, ConvertedStep stepToConvert) { // This step is really special. We need a Form // step on the flow, but we also need to create the form and add // it to the currently being converted project. FormWrapperStep fws = new FormWrapperStep(); // Get element registration id from form id // in already converted data. string erId = allConvertData.OldFormIdToNewFormIdMap[stepToConvert.UniqueStepIdForConnections]; // We should WARN if no id found, but whatever. fws.RegistrationId = erId; FlowStep fs = new FlowStep(fws); return(fs); }
/// <summary> /// Converts an image by using specified conversion path. /// </summary> /// <param name="img">Image to convert.</param> /// <param name="conversionData">Conversion path.</param> /// <returns>Converted image.</returns> public static IImage Convert(this IImage img, ConversionData <ColorInfo> conversionData) { var proc = new ParallelProcessor <IImage, IImage> ( img.Size, () => conversionData.CreateFunc(img, conversionData.Destination), (src, dest, area) => conversionData.ConvertFunc(src.GetSubRect(area), dest.GetSubRect(area)) #if DEBUG , new ParallelOptions2D { ForceSequential = true } #else , new ParallelOptions2D { ForceSequential = conversionData.ForceSequential } #endif ); return(proc.Process(img)); }
public DecisionsFramework.Design.Flow.FlowStep ConvertStep(ConversionData allConvertData, ConvertedStep stepToConvert) { FlowStep result; InvokeMethodStep ms = new InvokeMethodStep("DecisionsFramework.Design.Flow.CoreSteps.StandardSteps.ObjectSteps", "ObjectsAreEqual", null); result = new FlowStep(ms); result.Name = stepToConvert.StepName; SelectValueInputMapping svim = new SelectValueInputMapping(); svim.DataPath = stepToConvert.InputData.First(x => x.Name == "value1").SelectValuePathName; svim.InputDataName = "value1"; result.AddInputMapping(svim); SelectValueInputMapping svim2 = new SelectValueInputMapping(); svim2.DataPath = stepToConvert.InputData.First(x => x.Name == "value2").SelectValuePathName; svim2.InputDataName = "value2"; result.AddInputMapping(svim2); return(result); }
/// <summary> /// The conversion method /// </summary> /// <param name="inColor">The pointer to the input color values</param> /// <param name="outColor">The pointer to the output color values</param> /// <param name="data">The data that is used to perform the conversion</param> /// <param name="matrix">The matrix that is used to perform the conversion</param> public static void Convert(double* inColor, double* outColor, ConversionData data, double** matrix) { UMath.MultiplyMatrix_3x3_3x1(matrix[0], inColor, outColor); }
/// <summary> /// The method that does the chromatic adaption /// </summary> /// <param name="inColor">The pointer to the input color values</param> /// <param name="outColor">The pointer to the output color values</param> /// <param name="data">The data that is used to perform the chromatic adaption</param> public static void CAMethod(double *inColor, double *outColor, ConversionData data) { UMath.MultiplyMatrix_3x3_3x1((double *)data.CAData, inColor, outColor); }
/// <summary> /// Gets the conversion data necessary for the chromatic adaption /// </summary> /// <param name="data">The data that is used to perform the chromatic adaption</param> /// <returns>The conversion data necessary for the chromatic adaption</returns> public override CustomData GetCAData(ConversionData data) { var matrix = DefaultMethod.CalculateMatrix(data.InWP, data.OutWP); return(new CA_XYZ_Data(matrix)); }
private static decimal CalculateConvertedPrice(RequestData requestData, ConversionData conversionData, string target) { return((decimal)conversionData.Rates.GetValueOrDefault(target) * requestData.Price); }
/// <summary> /// Gets the conversion data necessary for the chromatic adaption /// </summary> /// <param name="data">The data that is used to perform the chromatic adaption</param> /// <returns>The conversion data necessary for the chromatic adaption</returns> public abstract CustomData GetCAData(ConversionData data);
private async void ConvertDocuments(List <string> documentsIds, OcrOutputFormat outputFormat) { ConversionData conversionData = null; _documentConverterHelper.JobOperation += Converter_JobOperation; DocumentConverterJobStatus status = DocumentConverterJobStatus.Success; Dictionary <string, DocumentConvertResult> results = new Dictionary <string, DocumentConvertResult>(); foreach (var documentId in documentsIds) { try { LEADDocument document = LEADDocumentHelper.LoadFromCache(documentId); if (document == null) { results.Add(documentId, new DocumentConvertResult(null, DocumentConverterJobStatus.SuccessWithErrors, new Exception($"Unable to load document with ID {documentId} from cache"))); continue; } string outputDocumentPath = GetOutputDocumentFilePath(document, outputFormat); conversionData = new ConversionData() { Document = document, DocumentViewer = _documentViewer, FirstPageIndex = 0, LastPageIndex = -1, OutputFormat = outputFormat, OutputDocumentPath = outputDocumentPath, OutputAnnotationsFileName = Path.ChangeExtension(outputDocumentPath, "xml"), AnnotationsMode = _annotationsMode, Zones = null, DocumentScanType = DocumentScanType.Document }; status = _documentConverterHelper.Run(conversionData); if (_abort) { status = DocumentConverterJobStatus.Aborted; } List <string> finalOutputDocumentFiles = new List <string>(); if (_annotationsMode == DocumentConverterAnnotationsMode.External) { string firstDocumentFilePath = string.Empty; foreach (string file in _documentConverterHelper.OutputDocumentFiles) { if (File.Exists(file)) { if (string.IsNullOrWhiteSpace(firstDocumentFilePath)) { firstDocumentFilePath = file; } string outputDocumentFilePath = Path.Combine(_documentsDirectory, Path.GetFileName(file)); if (File.Exists(outputDocumentFilePath)) { File.Delete(outputDocumentFilePath); } File.Move(file, outputDocumentFilePath); finalOutputDocumentFiles.Add(outputDocumentFilePath); } } if (!string.IsNullOrWhiteSpace(firstDocumentFilePath)) { // Move annotations file to documents directory string tempAnnotationsFilePath = Path.Combine(Path.GetDirectoryName(firstDocumentFilePath), $"{document.Name}.xml"); if (File.Exists(tempAnnotationsFilePath)) { string outputAnnotationsFilePath = Path.Combine(_documentsDirectory, Path.ChangeExtension(Path.GetFileName(tempAnnotationsFilePath), "xml")); if (File.Exists(outputAnnotationsFilePath)) { File.Delete(outputAnnotationsFilePath); } File.Move(tempAnnotationsFilePath, outputAnnotationsFilePath); } } } else if (_documentConverterHelper.OutputDocumentFiles.Count > 0) { // In case of burning annotation into PDF file, which only occurs when sharing the document while it has annotations objects drawn // don't move the saved temp file into the final documents directory, share the document from the temp folder finalOutputDocumentFiles.Add(_documentConverterHelper.OutputDocumentFiles[0]); } results.Add(documentId, new DocumentConvertResult(finalOutputDocumentFiles, status, _documentConverterHelper.Error)); if (_abort) { List <string> convertedFiles = new List <string>(); foreach (KeyValuePair <string, DocumentConvertResult> entry in results) { if (entry.Value.OutputDocumentFiles != null && entry.Value.OutputDocumentFiles.Count > 0) { convertedFiles.AddRange(entry.Value.OutputDocumentFiles); } } DocumentConverterHelper.DeleteAllFiles(convertedFiles); break; } } catch (Exception ex) { results.Add(documentId, new DocumentConvertResult(null, DocumentConverterJobStatus.SuccessWithErrors, ex)); } } _documentConverterHelper.JobOperation -= Converter_JobOperation; // Go back _pageClosingEventArgs = new DocumentConvertEventArgs(results, status, outputFormat); await PopupNavigation.Instance.PopAsync(); }