/// <summary> /// The Parameter array should be populated with default values here /// </summary> public override void Initialize() { _inputParam = new Parameter[7]; _inputParam[0] = new PointFeatureSetParam(TextStrings.PointFeatureSet); _inputParam[1] = new ListParam(TextStrings.Zvalue) { HelpText = TextStrings.layercontainsvalues }; _inputParam[2] = new DoubleParam(TextStrings.CellSize, 0, 0, double.MaxValue) { HelpText = TextStrings.Thecellsizeingeographicunits }; _inputParam[3] = new DoubleParam(TextStrings.Power, 2, 1, double.MaxValue) { HelpText = TextStrings.Theinfluenceofdistance }; _neighborhoodType = new List <string> { TextStrings.FixedDistance, TextStrings.FixedCount }; _inputParam[4] = new ListParam(TextStrings.NeighborhoodType, _neighborhoodType, 0) { HelpText = TextStrings.Selectthetypeofneighborhood }; _inputParam[5] = new IntParam(TextStrings.MinMaxnumberofpoints, 12, 0, int.MaxValue) { HelpText = TextStrings.FixedDistanceHelpText }; _inputParam[6] = new DoubleParam(TextStrings.MinMaxdistance, 0, 0, double.MaxValue) { HelpText = TextStrings.FixedDistanceHelpText }; _outputParam = new Parameter[1]; _outputParam[0] = new RasterParam(TextStrings.Raster); }
/// <summary> /// Fires when one of the paramters value has beend changed, usually when a user changes a input or output Parameter value, this can be used to populate input2 Parameter default values. /// </summary> public override void ParameterChanged(Parameter sender) { // This will Diplay NoDataValue(Already exisit) in the Optional input box; if (sender != _inputParam[0]) { return; } IRaster inputTemp = _inputParam[0].Value as IRaster; if (inputTemp == null) { return; } DoubleParam inParam1 = _inputParam[1] as DoubleParam; if (inParam1 != null) { inParam1.Value = inputTemp.CellHeight; } DoubleParam inParam2 = _inputParam[2] as DoubleParam; if (inParam2 != null) { inParam2.Value = inputTemp.CellWidth; } }
/// <summary> /// Once the parameters have been configured, the Execute command can be called, it returns true if successful. /// </summary> /// <param name="cancelProgressHandler">The progress handler.</param> /// <returns>True if executed successfully.</returns> public override bool Execute(ICancelProgressHandler cancelProgressHandler) { // Get the needed input and output parameters IFeatureSet inputFeatures = _inputParam[0].Value as IFeatureSet; DoubleParam dp = _inputParam[1] as DoubleParam; double bufferDistance = 1; if (dp != null) { bufferDistance = dp.Value; } IFeatureSet outputFeatures = _outputParam[0].Value as IFeatureSet; if (Buffer.AddBuffer(inputFeatures, bufferDistance, outputFeatures, cancelProgressHandler)) { if (outputFeatures == null) { return(false); } outputFeatures.Save(); return(true); } _outputParam = null; return(false); }
public void TestDoubleParam() { DoubleParam sparam = new DoubleParam("myname", 42.0); DoubleParam sparam2 = (DoubleParam)sparam.ToXmlAndBack(); Assert.AreEqual(sparam.Value, sparam2.Value); Assert.AreEqual(sparam.Name, sparam2.Name); }
public override void Initialize() { _inputParam = new Parameter[2]; _inputParam[0] = new LineFeatureSetParam(TextStrings.InputFeatureSet); _inputParam[1] = new DoubleParam(TextStrings.LiLinePara, 10.0); _outputParam = new Parameter[1]; _outputParam[0] = new LineFeatureSetParam(TextStrings.OutputFeatureSet); }
/// <summary> /// Inititalize input and output arrays with parameter types and default values. /// </summary> public override void Initialize() { _inputParam = new Parameter[2]; _inputParam[0] = new FeatureSetParam(TextStrings.InputFeatureSet); _inputParam[1] = new DoubleParam(TextStrings.BufferDistance, 10.0); _outputParam = new Parameter[1]; _outputParam[0] = new PolygonFeatureSetParam(TextStrings.OutputPolygonFeatureSet); }
/// <summary> /// Inititalize input and output arrays with parameter types and default values. /// </summary> public override void Initialize() { _inputParam = new Parameter[2]; _inputParam[0] = new FeatureSetParam(TextStrings.InputFeatureSet); _inputParam[1] = new DoubleParam(TextStrings.BufferDistance, 10.0); _outputParam = new Parameter[2]; _outputParam[0] = new PolygonFeatureSetParam(TextStrings.OutputPolygonFeatureSet); _outputParam[1] = new BooleanParam(TextStrings.OutputParameter_AddToMap, TextStrings.OutputParameter_AddToMap_CheckboxText, true); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (!(value is double)) { return(null); } double v = (double)value; double p = parameter as double? ?? 0; return(SingleParam?.Invoke(v) ?? DoubleParam?.Invoke(v, p)); }
/// <summary> /// Creates an instance of the dialog /// </summary> /// <param name="param">The parameter this element represents</param> public DoubleElement(DoubleParam param) { //Needed by the designer InitializeializeializeComponent(); GroupBox.Text = param.Name; //We save the Parameter passed in Param = param; DoRefresh(); }
/// <summary> /// The Parameter array should be populated with default values here /// </summary> public override void Initialize() { _inputParam = new Parameter[2]; _inputParam[0] = new LineFeatureSetParam(TextStrings.LineFeatureSet); _inputParam[1] = new DoubleParam(TextStrings.Tolerance) { Value = 10.0 }; _outputParam = new Parameter[1]; _outputParam[0] = new LineFeatureSetParam(TextStrings.LineFeatureSet); }
/// <summary> /// Once the Parameter have been configured the Execute command can be called, it returns true if successful. /// </summary> /// <param name="cancelProgressHandler">The progress handler.</param> /// <returns>Boolean, true if the method was successful.</returns> public override bool Execute(ICancelProgressHandler cancelProgressHandler) { IRaster input1 = _inputParam[0].Value as IRaster; DoubleParam dp1 = _inputParam[1] as DoubleParam; DoubleParam dp2 = _inputParam[2] as DoubleParam; double value1 = dp1?.Value ?? 0; double value2 = dp2?.Value ?? 0; IRaster output = _outputParam[0].Value as IRaster; return(Execute(input1, value1, value2, output, cancelProgressHandler)); }
/// <summary> /// The Parameter array should be populated with default values here /// </summary> public override void Initialize() { _inputParam = new Parameter[2]; _inputParam[0] = new LineFeatureSetParam(TextStrings.LineFeatureSet); _inputParam[1] = new DoubleParam(TextStrings.Tolerance) { Value = 10.0 }; _outputParam = new Parameter[2]; _outputParam[0] = new LineFeatureSetParam(TextStrings.LineFeatureSet); _outputParam[1] = new BooleanParam(TextStrings.OutputParameter_AddToMap, TextStrings.OutputParameter_AddToMap_CheckboxText, true); }
/// <summary> /// Once the Parameter have been configured the Execute command can be called, it returns true if succesful /// </summary> public override bool Execute(ICancelProgressHandler cancelProgressHandler) { IFeatureSet input = _inputParam[0].Value as IFeatureSet; DoubleParam dp = _inputParam[1] as DoubleParam; double bufferDistance = 1; if (dp != null) { bufferDistance = dp.Value; } IFeatureSet output = _outputParam[0].Value as IFeatureSet; return(Execute(input, bufferDistance, output, cancelProgressHandler)); }
/// <summary> /// Once the parameters have been configured, the Execute command can be called, it returns true if succesful /// </summary> public override bool Execute(ICancelProgressHandler cancelProgressHandler) { //Get the needed input and output parameters IFeatureSet inputFeatures = _inputParam[0].Value as IFeatureSet; DoubleParam dp = _inputParam[1] as DoubleParam; double bufferDistance = 1; if (dp != null) { bufferDistance = dp.Value; } // IFeatureSet outputFeatures = _outputParam[0].Value as IFeatureSet; return(true); }
/// <summary> /// The Parameter array should be populated with default values here /// </summary> public override void Initialize() { _inputParam = new Parameter[2]; _inputParam[0] = new RasterParam(TextStrings.inputRaster) { HelpText = TextStrings.InputRastercontainingtargetcells }; _inputParam[1] = new DoubleParam(TextStrings.Maximumdistance, 100.0) { HelpText = TextStrings.Maximumdistancetobecalculated }; _outputParam = new Parameter[1]; _outputParam[0] = new RasterParam(TextStrings.OutputRaster) { HelpText = TextStrings.SelectresultrasterfileName }; }
public override void Initialize() { _inputParam = new Parameter[5]; _inputParam[0] = new LineFeatureSetParam(TextStrings.InputFeatureSet); _inputParam[1] = new DoubleParam(TextStrings.LiCirclePara1, 60.0); _inputParam[2] = new DoubleParam(TextStrings.LiCirclePara2, 3.0); _inputParam[3] = new DoubleParam(TextStrings.LiCirclePara3, 5.0); _inputParam[4] = new StringParam(TextStrings.LiCirclePara4, string.Empty); #if DEBUG _outputParam = new Parameter[2]; _outputParam[0] = new PointFeatureSetParam(TextStrings.OutputFeatureSet); _outputParam[1] = new PolygonFeatureSetParam("DEBUG MODE OUTPUT"); #else _outputParam = new Parameter[1]; _outputParam[0] = new PointFeatureSetParam(TextStrings.OutputFeatureSet); #endif }
/// <summary> /// The Parameter array should be populated with default values here /// </summary> public override void Initialize() { _inputParam = new Parameter[4]; _inputParam[0] = new FeatureSetParam(TextStrings.input1polygontoRaster) { HelpText = TextStrings.InputPolygontochange }; _inputParam[2] = new DoubleParam(TextStrings.DesiredCellSize) { HelpText = TextStrings.Themaximumnumber }; _inputParam[1] = new ListParam(TextStrings.stringnameoffield) { HelpText = TextStrings.Thevalueofeachcell }; _outputParam = new Parameter[1]; _outputParam[0] = new RasterParam(TextStrings.OutputRaster) { HelpText = TextStrings.Resultofaverageslope }; }
/// <summary> /// The Parameter array should be populated with default values here /// </summary> public override void Initialize() { _inputParam = new Parameter[3]; _inputParam[0] = new RasterParam(TextStrings.input1altitudeRaster) { HelpText = TextStrings.InputRasterforaverageslopecalculation }; _inputParam[1] = new DoubleParam(TextStrings.inputZfactor, 1.0) { HelpText = TextStrings.InputZfactorforslopedisplay }; _inputParam[2] = new BooleanParam(TextStrings.slopeinpercentage, TextStrings.boxSlopeInPercentage, false) { HelpText = TextStrings.slopeinpercentageindegree }; _outputParam = new Parameter[1]; _outputParam[0] = new RasterParam(TextStrings.OutputslopeRaster) { HelpText = TextStrings.Resultofaverageslope }; }
/// <summary> /// The Parameter array should be populated with default values here /// </summary> public override void Initialize() { _inputParam = new Parameter[7]; _inputParam[0] = new RasterParam(TextStrings.input1altitudeRaster) { HelpText = TextStrings.InputRasterforaverageslopecalculation }; _inputParam[1] = new DoubleParam(TextStrings.inputZfactor, 1.0) { HelpText = TextStrings.InputZfactorforslopedisplay }; _inputParam[2] = new BooleanParam(TextStrings.slopeinpercentage, TextStrings.boxSlopeInPercentage, false) { HelpText = TextStrings.slopeinpercentage }; _inputParam[3] = new FeatureSetParam(TextStrings.input1polygonfeatureset) { HelpText = TextStrings.averageslopeinarribute }; _inputParam[4] = new FeatureSetParam(TextStrings.inputtheareaofinterest) { HelpText = TextStrings.featuresetcontainareainterest }; _inputParam[5] = new IntParam(TextStrings.Indexofareaofinterestfeature, 0) { HelpText = TextStrings.indexspecificarea }; _inputParam[6] = new StringParam(TextStrings.Fieldnameforavrageslope, TextStrings.AveSlope) { HelpText = TextStrings.Fieldnamecolomavrageslope }; _outputParam = new Parameter[2]; _outputParam[0] = new FeatureSetParam(TextStrings.Outputwithaverageslope) { HelpText = TextStrings.SelecttheResultofOutput }; _outputParam[2] = new BooleanParam(TextStrings.OutputParameter_AddToMap, TextStrings.OutputParameter_AddToMap_CheckboxText, true); }
/// <summary> /// The Parameter array should be populated with default values here /// </summary> public override void Initialize() { _inputParam = new Parameter[3]; _inputParam[0] = new RasterParam(TextStrings.inputRaster) { HelpText = TextStrings.InputtheRasterforCellsizeChange }; _inputParam[1] = new DoubleParam(TextStrings.InputnewcellHight) { HelpText = TextStrings.DisplayingistheOldCellHight }; _inputParam[2] = new DoubleParam(TextStrings.InputnewcellWidth) { HelpText = TextStrings.DisplayingistheOldCellHight }; _outputParam = new Parameter[1]; _outputParam[0] = new RasterParam(TextStrings.OutputRaster) { HelpText = TextStrings.newrastername }; }
/// <summary> /// Once the Parameter have been configured the Execute command can be called, it returns true if succesful /// </summary> public override bool Execute(ICancelProgressHandler cancelProgressHandler) { IRaster input1 = _inputParam[0].Value as IRaster; DoubleParam dp1 = _inputParam[1] as DoubleParam; DoubleParam dp2 = _inputParam[2] as DoubleParam; double value1 = 0; double value2 = 0; if (dp1 != null) { value1 = dp1.Value; } if (dp2 != null) { value2 = dp2.Value; } IRaster output = _outputParam[0].Value as IRaster; return(Execute(input1, value1, value2, output, cancelProgressHandler)); }
/// <summary> /// The Parameter array should be populated with default values here /// </summary> public override void Initialize() { _inputParam = new Parameter[3]; _inputParam[0] = new RasterParam(TextStrings.input1altitudeRaster) { HelpText = TextStrings.InputRasterforaverageslopecalculation }; _inputParam[1] = new DoubleParam(TextStrings.inputZfactor, 1.0) { HelpText = TextStrings.InputZfactorforslopedisplay }; _inputParam[2] = new PolygonFeatureSetParam(TextStrings.input1polygonfeatureset) { HelpText = TextStrings.FindAverageSlopeDescription }; // _inputParam[2] = new FeatureSetParam(TextStrings."input1 polygon feature set"); _outputParam = new Parameter[1]; _outputParam[0] = new FeatureSetParam(TextStrings.Outputfeaturesetwithaverageslope) { HelpText = TextStrings.Resultofaverageslope }; }
/// <summary> /// The Parameter array should be populated with default values here. /// </summary> public override void Initialize() { _inputParam = new Parameter[3]; _inputParam[0] = new RasterParam(TextStrings.input1altitudeRaster) { HelpText = TextStrings.InputRasterforaverageslopecalculation }; _inputParam[1] = new DoubleParam("Base value", 0) { HelpText = TextStrings.RasterBinTool_Initialize_BaseValueHelText }; _inputParam[2] = new DoubleParam("Bin size", 10) { HelpText = TextStrings.RasterBinTool_Initialize_BinSizeHelpText }; _outputParam = new Parameter[2]; _outputParam[0] = new RasterParam(TextStrings.OutputslopeRaster) { HelpText = TextStrings.Resultofaverageslope }; _outputParam[1] = new BooleanParam(TextStrings.OutputParameter_AddToMap, TextStrings.OutputParameter_AddToMap_CheckboxText, true); }
/// <summary> /// The Parameter array should be populated with default values here /// </summary> public override void Initialize() { _inputParam = new Parameter[3]; _inputParam[0] = new RasterParam(TextStrings.input1altitudeRaster) { HelpText = TextStrings.InputRasterforaverageslopecalculation }; _inputParam[1] = new DoubleParam("Base value", 0) { HelpText = "The starting point for bin calculations. A base value of 10 with a bin size of 20 would give all values from 10 to 30 a value of 20." }; _inputParam[2] = new DoubleParam("Bin size", 10) { HelpText = "The size of the bins. A base value of 10 with a bin size of 20 would give all the values from 10 to 30 a value of 20." }; _outputParam = new Parameter[1]; _outputParam[0] = new RasterParam(TextStrings.OutputslopeRaster) { HelpText = TextStrings.Resultofaverageslope }; }
protected override Parameter[] SpecificParameters(IMatrixData data, ref string errString) { if (data.StringColumnCount == 0) { errString = "Please add at least one string column"; return(null); } var ConditionColumn1Param = new SingleChoiceParam("Condition column, eg R.FileName") { Values = data.StringColumnNames, Value = Math.Max(0, data.StringColumnNames.FindIndex(col => col.ToLower().Equals("r.filename"))), Help = "Chose experimental condition column, such as R.FileName, which will be used to create wide-format intensity columns. Has to be a text column." }; var PerlParam = new SingleChoiceWithSubParams("Condition grouping") { Values = new[] { "Group by condition column", "Skip" }, Value = 0, Help = "Chose if input should be grouped from long-format (e.g. Spectronaut report or MaxQuant LFQ evidence) or mixed-format " + "(e.g. MaxQuant TMT evidence with conditions) into wide-format required for this plugin. Chose skip if data is already in wide-format " + "(e.g. MaxQuant TMT evidence without conditions).", SubParams = new Parameters[] { // Define the different sub-parameter groups new Parameters(ConditionColumn1Param), // condition grouping new Parameters() // Skip } }; var Cutoff1aParam = new DoubleParam("Localization cutoff", 0.75) { Help = "Localization cutoff to be used to filter PTM localization. Can be between 0 and 1. Setting to 0 will not filter anything." }; var Cutoff1bParam = new DoubleParam("Localization cutoff", 0.75) { Help = "Localization cutoff to be used to filter PTM localization. Can be between 0 and 1. Setting to 0 will not filter anything." }; var Cutoff2aParam = new DoubleParam("Localization cutoff", 0.75) { Help = "Localization cutoff to be used to filter PTM localization. Can be between 0 and 1. Setting to 0 will not filter anything." }; var Cutoff2bParam = new DoubleParam("Localization cutoff", 0.75) { Help = "Localization cutoff to be used to filter PTM localization. Can be between 0 and 1. Setting to 0 will not filter anything." }; var Cutoff2cParam = new DoubleParam("Localization cutoff", 0.75) { Help = "Localization cutoff to be used to filter PTM localization. Can be between 0 and 1. Setting to 0 will not filter anything." }; var Cutoff3aParam = new DoubleParam("Localization cutoff", 0.75) { Help = "Localization cutoff to be used to filter PTM localization. Can be between 0 and 1. Setting to 0 will not filter anything." }; var Cutoff3bParam = new DoubleParam("Localization cutoff", 0.75) { Help = "Localization cutoff to be used to filter PTM localization. Can be between 0 and 1. Setting to 0 will not filter anything." }; var PTMPosCol1Param = new SingleChoiceParam("PTM position column type") { Values = new[] { "EG.PTMLocalizationProbabilities (SN)", "EG.PrecursorId (SN)" }, Help = "Chose which column PTM positions should be extracted from. Requires respective columns." }; var PTMPosCol2Param = new SingleChoiceParam("PTM position column type") { Values = new[] { "EG.PTMLocalizationProbabilities (SN)", "EG.PrecursorId (SN)", "Modified sequence (MQ)" }, Help = "Chose which column PTM positions should be extracted from. Requires respective columns." }; var PTMPosCol3Param = new SingleChoiceParam("PTM position column type") { Values = new[] { "EG.PTMLocalizationProbabilities (SN)", "EG.PrecursorId (SN)" }, Help = "Chose which column PTM positions should be extracted from. Requires respective columns." }; var PTMPosCol2cParam = new SingleChoiceParam("Target PTM Probabilities column") { Values = data.StringColumnNames, Value = Math.Max(0, data.StringColumnNames.FindIndex(col => col.ToLower().Equals("phospho (sty) probabilities"))), Help = "Chose which column PTM target probabilities should be extracted from. Requires respective columns." }; var ProbType1Param = new SingleChoiceWithSubParams("Probability column type") { Values = new[] { "EG.PTMLocalizationProbabilities (SN)", "EG.PTMAssayProbability (SN)", "No probability column" }, Help = "Chose which column probabilities and PTM positions should be extracted from. Requires resepctive columns. " + "EG.PTMAssayProbability will extract PTM positions from EG.PrecursorId.", SubParams = new Parameters[] { // Define the different sub-parameter groups new Parameters(Cutoff1aParam), // EG.PTMLocalizationProbabilities new Parameters(Cutoff1bParam), // EG.PTMAssayProbability new Parameters(PTMPosCol1Param) // Ignored } }; var ProbType2Param = new SingleChoiceWithSubParams("Probability column type") { Values = new[] { "EG.PTMLocalizationProbabilities (SN)", "EG.PTMAssayProbability (SN)", "No probability column", "Modified sequence (MQ)" }, Help = "Chose which column probabilities and PTM positions should be extracted from. Requires resepctive columns. " + "EG.PTMAssayProbability will extract PTM positions from EG.PrecursorId. Modified sequence will extract probabilities from provided PTM Probabilities columns.", SubParams = new Parameters[] { // Define the different sub-parameter groups new Parameters(Cutoff2aParam), // EG.PTMLocalizationProbabilities new Parameters(Cutoff2bParam), // EG.PTMAssayProbability new Parameters(PTMPosCol2Param), // Ignored new Parameters(Cutoff2cParam, PTMPosCol2cParam) // Modified sequence } }; var ProbType3Param = new SingleChoiceWithSubParams("Probability column type") { Values = new[] { "EG.PTMLocalizationProbabilities (SN)", "EG.PTMAssayProbability (SN)", "No probability column" }, Help = "Chose which column probabilities and PTM positions should be extracted from. Requires resepctive columns. " + "EG.PTMAssayProbability will extract PTM positions from EG.PrecursorId.", SubParams = new Parameters[] { // Define the different sub-parameter groups new Parameters(Cutoff3aParam), // EG.PTMLocalizationProbabilities new Parameters(Cutoff3bParam), // EG.PTMAssayProbability new Parameters(PTMPosCol3Param) // Ignored } }; var GenesParam = new SingleChoiceParam("Genes or protein groups") { Values = new[] { "PG.Genes", "PG.ProteinGroups" }, Help = "Chose if sites should be collapsed on gene or protein level." }; var FastaFileParam = new FileParam("FASTA file (optional)") { Help = "Define file location of FASTA file for PTM motif sequence annotation. Leaving blank will skip annotation." }; var FastaStringParam = new StringParam("FASTA identifier rule", ".*GN=([^ ]*) .*") { Help = "If FASTA file is provided, define identifier parsing rule. This is crucial to allow gene or protein name matching as defined above. Set e.g." + ".*GN=([^ ]*) .* for gene readout, or .*\\|(.*)\\|.* for protein readout" }; var StoichParam = new SingleChoiceParam("Stoichiometry calculation") { Values = new[] { "Calculate stoichiometries", "Skip" }, Help = "Chose if target PTM stoichiometries should be calculated." }; var CollapseParam = new SingleChoiceWithSubParams("Collapse level") { Values = new[] { "Target PTM site-level, e.g. ABC1_S15_M1", "Target PTM peptide-level, e.g. FS[ph]EAMST[ph]R (stoichiometry possible)", "ModSpec peptide-level, e.g. FSEAMSTR_2[ph];1[ox]" }, Value = 0, Help = "Chose if precursors should be collapsed on peptide- or site-level. Site-level requires PEP.PeptidePosition column.", SubParams = new Parameters[] { // Define the different sub-parameter groups new Parameters(ProbType1Param, GenesParam, FastaFileParam, FastaStringParam), // Localized Site new Parameters(ProbType2Param, StoichParam), // Localized Peptide new Parameters(ProbType3Param) // ModSpec Peptide } }; var PTMTypesParam = new StringParam("Variable PTMs, target PTM first", "[Phospho (STY)];[Deamidation (NQ)];[Oxidation (M)];[Carbamidomethyl (C)]") { Help = "List PTMs as listed in EG.PrecursorId, separated by semicolon. If target site- or target peptide-level collapse is performed, " + "target PTM needs to be listed first." }; var AggParam = new SingleChoiceParam("Aggregation type") { Values = new[] { "Linear modeling based", "Summing" }, Help = "Chose if peptide intensities should be aggregated based on a linear model or simply summed." }; var NumberOfCoresParam = new IntParam("CPUcores", 8) { Help = "Number of CPU threads to be created by the plugin where possible. Set to 1 for lowest CPU usage. Do not set higher than actual number of available CPU threads." }; return(new Parameter[] { PerlParam, CollapseParam, PTMTypesParam, AggParam, NumberOfCoresParam, }); }
private void buttonPrepareExport_Click(object sender, EventArgs e) { if (cbProcNames.Items.Count > 0) { List <ReportParamV2> paramList = new List <ReportParamV2>(); Dictionary <string, string> parameters = ServicesProvider.GetInstance().GetAccountingServices().SelectExportAccountingProcParams("ExportAccounting_" + cbProcNames.Text); if (parameters != null && parameters.Count > 0) { foreach (var parameter in parameters) { ReportParamV2 reportParam; string paramName = parameter.Key.TrimStart('@'); if (paramName.Equals("branch_id", StringComparison.CurrentCultureIgnoreCase)) { reportParam = new BranchParam(string.Empty); } else { string paramType = parameter.Value; switch (paramType) { case "bit": reportParam = new BoolParam(false); break; case "datetime": reportParam = new DateParam(DateTime.Today); break; case "char": reportParam = new CharParam(' '); break; case "nvarchar": case "varchar": case "text": reportParam = new StringParam(string.Empty); break; case "int": reportParam = new IntParam(1); break; case "float": reportParam = new DoubleParam(1d); break; case "money": reportParam = new DecimalParam(1m); break; default: throw new NotImplementedException(string.Format("Sql type:{0} is not handled.", paramName)); } } reportParam.Label = paramName; reportParam.Name = paramName; paramList.Add(reportParam); } ReportParamsForm frm = new ReportParamsForm(paramList, cbProcNames.Text); frm.ShowDialog(); } _dataTable = ServicesProvider.GetInstance().GetAccountingServices().FindElementaryMvtsToExport( "ExportAccounting_" + cbProcNames.Text, paramList, out _idTable); _total = _dataTable.Rows.Count; _bwSelect = new BackgroundWorker { WorkerSupportsCancellation = true }; _bwSelect.DoWork += BwSelect_DoWork; ExportBookings_Load(this, null); } }
/// <summary> /// Convert <see cref="BaseLib.Param"/> to <see cref="BaseLibS.Param"/> /// </summary> /// <param name="p"></param> /// <returns></returns> public static Parameter Convert(Parameter p) { if (p.Type == ParamType.Server){ return p; } if (p is RegexReplaceParamWf){ RegexReplaceParamWf q = (RegexReplaceParamWf) p; RegexReplaceParam b = new RegexReplaceParam(q.Name, q.Value.Item1, q.Value.Item2, q.Previews){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is RegexMatchParamWf){ RegexMatchParamWf q = (RegexMatchParamWf) p; RegexMatchParam b = new RegexMatchParam(q.Name, q.Value, q.Previews){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is BoolParamWf){ BoolParamWf q = (BoolParamWf) p; BoolParam b = new BoolParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is BoolWithSubParamsWf){ BoolWithSubParamsWf q = (BoolWithSubParamsWf) p; q.SubParamsFalse?.Convert(Convert); q.SubParamsTrue?.Convert(Convert); BoolWithSubParams b = new BoolWithSubParams(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, SubParamsFalse = q.SubParamsFalse, SubParamsTrue = q.SubParamsTrue, Default = q.Default, ParamNameWidth = q.ParamNameWidth, TotalWidth = q.TotalWidth, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is DictionaryIntValueParamWf){ DictionaryIntValueParamWf q = (DictionaryIntValueParamWf) p; DictionaryIntValueParam b = new DictionaryIntValueParam(q.Name, q.Value, q.Keys){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is DoubleParamWf){ DoubleParamWf q = (DoubleParamWf) p; DoubleParam b = new DoubleParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is FileParamWf){ FileParamWf q = (FileParamWf) p; FileParam b = new FileParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Default = q.Default, Filter = q.Filter, ProcessFileName = q.ProcessFileName, Save = q.Save, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is FolderParamWf){ FolderParamWf q = (FolderParamWf) p; FolderParam b = new FolderParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is IntParamWf){ IntParamWf q = (IntParamWf) p; IntParam b = new IntParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is LabelParamWf){ LabelParamWf q = (LabelParamWf) p; LabelParam b = new LabelParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is MultiChoiceMultiBinParamWf){ MultiChoiceMultiBinParamWf q = (MultiChoiceMultiBinParamWf) p; MultiChoiceMultiBinParam b = new MultiChoiceMultiBinParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Values = q.Values, Bins = q.Bins, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is MultiChoiceParamWf){ MultiChoiceParamWf q = (MultiChoiceParamWf) p; MultiChoiceParam b = new MultiChoiceParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Repeats = q.Repeats, Values = q.Values, Default = q.Default, DefaultSelections = q.DefaultSelections, DefaultSelectionNames = q.DefaultSelectionNames, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is MultiFileParamWf){ MultiFileParamWf q = (MultiFileParamWf) p; MultiFileParam b = new MultiFileParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Filter = q.Filter, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is MultiStringParamWf){ MultiStringParamWf q = (MultiStringParamWf) p; MultiStringParam b = new MultiStringParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is SingleChoiceParamWf){ SingleChoiceParamWf q = (SingleChoiceParamWf) p; SingleChoiceParam b = new SingleChoiceParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Values = q.Values, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is SingleChoiceWithSubParamsWf){ SingleChoiceWithSubParamsWf q = (SingleChoiceWithSubParamsWf) p; foreach (Parameters param in q.SubParams){ param?.Convert(Convert); } SingleChoiceWithSubParams b = new SingleChoiceWithSubParams(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Values = q.Values, Default = q.Default, SubParams = new Parameters[q.SubParams.Count], ParamNameWidth = q.ParamNameWidth, TotalWidth = q.TotalWidth, Url = q.Url }; for (int i = 0; i < q.SubParams.Count; i++){ b.SubParams[i] = q.SubParams[i]; } foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is StringParamWf){ StringParamWf q = (StringParamWf) p; StringParam b = new StringParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is Ms1LabelParamWf){ Ms1LabelParamWf q = (Ms1LabelParamWf) p; Ms1LabelParam b = new Ms1LabelParam(q.Name, q.Value){ Values = q.Values, Multiplicity = q.Multiplicity, Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } throw new Exception("Could not convert ParamWfeter"); }
private void DoubleParamTest( DoubleParam method, string command, string one, string two ) { method(one, two ); Assertion.AssertEquals(command + " " + one + " " + two, BufferToString() ); try { method(null, two ); Assertion.Fail( "Null first parameter."); } catch( ArgumentException ae ) { Assertion.Assert( true ); } try { method(null, null); Assertion.Fail( "Null first and second parameters."); } catch( ArgumentException ae ) { Assertion.Assert( true ); } try { method(one, null ); Assertion.Fail( "Null first parameter"); } catch( ArgumentException ae ) { Assertion.Assert( true ); } try { method(one, "" ); Assertion.Fail( "Empty first parameter"); } catch( ArgumentException ae ) { Assertion.Assert( true ); } try { method("", "" ); Assertion.Fail( "Empty first and second parameters"); } catch( ArgumentException ae ) { Assertion.Assert( true ); } try { method("", two ); Assertion.Fail( "Empty second parameter"); } catch( ArgumentException ae ) { Assertion.Assert( true ); } }
/// <summary> /// Convert <see cref="BaseLib.Param"/> to <see cref="BaseLibS.Param"/> /// </summary> /// <param name="p"></param> /// <returns></returns> public static Parameter Convert(Parameter p) { if (p.Type == ParamType.Server) { return(p); } if (p is RegexReplaceParamWf) { RegexReplaceParamWf q = (RegexReplaceParamWf)p; RegexReplaceParam b = new RegexReplaceParam(q.Name, q.Value.Item1, q.Value.Item2, q.Previews) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is RegexMatchParamWf) { RegexMatchParamWf q = (RegexMatchParamWf)p; RegexMatchParam b = new RegexMatchParam(q.Name, q.Value, q.Previews) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is BoolParamWf) { BoolParamWf q = (BoolParamWf)p; BoolParam b = new BoolParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is BoolWithSubParamsWf) { BoolWithSubParamsWf q = (BoolWithSubParamsWf)p; q.SubParamsFalse?.Convert(Convert); q.SubParamsTrue?.Convert(Convert); BoolWithSubParams b = new BoolWithSubParams(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, SubParamsFalse = q.SubParamsFalse, SubParamsTrue = q.SubParamsTrue, Default = q.Default, ParamNameWidth = q.ParamNameWidth, TotalWidth = q.TotalWidth, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is DictionaryIntValueParamWf) { DictionaryIntValueParamWf q = (DictionaryIntValueParamWf)p; DictionaryIntValueParam b = new DictionaryIntValueParam(q.Name, q.Value, q.Keys) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is DoubleParamWf) { DoubleParamWf q = (DoubleParamWf)p; DoubleParam b = new DoubleParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is FileParamWf) { FileParamWf q = (FileParamWf)p; FileParam b = new FileParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Default = q.Default, Filter = q.Filter, ProcessFileName = q.ProcessFileName, Save = q.Save, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is FolderParamWf) { FolderParamWf q = (FolderParamWf)p; FolderParam b = new FolderParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is IntParamWf) { IntParamWf q = (IntParamWf)p; IntParam b = new IntParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is LabelParamWf) { LabelParamWf q = (LabelParamWf)p; LabelParam b = new LabelParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is MultiChoiceMultiBinParamWf) { MultiChoiceMultiBinParamWf q = (MultiChoiceMultiBinParamWf)p; MultiChoiceMultiBinParam b = new MultiChoiceMultiBinParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Values = q.Values, Bins = q.Bins, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is MultiChoiceParamWf) { MultiChoiceParamWf q = (MultiChoiceParamWf)p; MultiChoiceParam b = new MultiChoiceParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Repeats = q.Repeats, Values = q.Values, Default = q.Default, DefaultSelections = q.DefaultSelections, DefaultSelectionNames = q.DefaultSelectionNames, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is MultiFileParamWf) { MultiFileParamWf q = (MultiFileParamWf)p; MultiFileParam b = new MultiFileParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Filter = q.Filter, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is MultiStringParamWf) { MultiStringParamWf q = (MultiStringParamWf)p; MultiStringParam b = new MultiStringParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is SingleChoiceParamWf) { SingleChoiceParamWf q = (SingleChoiceParamWf)p; SingleChoiceParam b = new SingleChoiceParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Values = q.Values, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is SingleChoiceWithSubParamsWf) { SingleChoiceWithSubParamsWf q = (SingleChoiceWithSubParamsWf)p; foreach (Parameters param in q.SubParams) { param?.Convert(Convert); } SingleChoiceWithSubParams b = new SingleChoiceWithSubParams(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Values = q.Values, Default = q.Default, SubParams = new Parameters[q.SubParams.Count], ParamNameWidth = q.ParamNameWidth, TotalWidth = q.TotalWidth, Url = q.Url }; for (int i = 0; i < q.SubParams.Count; i++) { b.SubParams[i] = q.SubParams[i]; } foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is StringParamWf) { StringParamWf q = (StringParamWf)p; StringParam b = new StringParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is Ms1LabelParamWf) { Ms1LabelParamWf q = (Ms1LabelParamWf)p; Ms1LabelParam b = new Ms1LabelParam(q.Name, q.Value) { Values = q.Values, Multiplicity = q.Multiplicity, Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } throw new Exception("Could not convert ParamWfeter"); }
public void SetParam(DoubleParam param, double value) { this._model.GetEnv().Set(param.param, value); }
public void TestDoubleParam() { var sparam = new DoubleParam("myname", 42.0); var sparam2 = (DoubleParam) sparam.ToXmlAndBack(); Assert.AreEqual(sparam.Value, sparam2.Value); Assert.AreEqual(sparam.Name, sparam2.Name); }
public double GetParam(DoubleParam param) { return this._model.GetEnv().Get(param.param); }