private string GetArgString()
        {
            try
            {
                string argType = ArgTypeArg;
                if (_radioButtonArgTypeId.Checked)
                {
                    argType = ArgTypeID;
                }

                StringBuilder sb = new StringBuilder();
                if (_mwBlock)
                {
                    sb.Append(_checkBoxDefineBlockNew.Checked ? "YES" : "NO");
                }
                else
                {
                    if (_dynamicId)
                    {
                        int blockNumber = 0;
                        int position    = _spinnerBlockNumber.SelectedItemPosition;
                        if (position >= 0 && position < _spinnerBlockNumberAdapter.Items.Count)
                        {
                            StringObjType item = _spinnerBlockNumberAdapter.Items[position];
                            blockNumber = (int)item.Data;
                        }

                        sb.Append(string.Format(CultureInfo.InvariantCulture, "{0}", blockNumber));
                        sb.Append(";");

                        sb.Append(_checkBoxDefineBlockNew.Checked ? "YES" : "NO");
                        sb.Append(";");
                    }

                    sb.Append(argType);
                }

                foreach (EdiabasToolActivity.ExtraInfo extraInfo in _argsListAdapter.Items)
                {
                    if (extraInfo.ItemSelected)
                    {
                        sb.Append(";");
                        sb.Append(extraInfo.Type);
                    }
                }

                return(sb.ToString());
            }
            catch (Exception)
            {
                return(string.Empty);
            }
        }
Exemplo n.º 2
0
        private void UpdateActuator()
        {
            if (_spinnerBmwActuatorFunction.SelectedItemPosition >= 0)
            {
                StringObjType item     = _spinnerBmwActuatorFunctionAdapter.Items[_spinnerBmwActuatorFunction.SelectedItemPosition];
                int           function = (int)item.Data;
                if (function >= 0)
                {
                    _instanceData.SelectedFunction     = function;
                    _instanceData.SelectedFunctionText = item.Text;
                }
            }

            UpdateActuatorInfo();
        }
Exemplo n.º 3
0
        private string GetArgString()
        {
            try
            {
                string argType = ArgTypeArg;
                if (_radioButtonArgTypeId.Checked)
                {
                    argType = ArgTypeID;
                }

                StringBuilder sb = new StringBuilder();
                sb.Append(argType);

                int position = _spinnerArgument.SelectedItemPosition;
                if (position >= 0 && position < _spinnerArgumentAdapter.ItemsVisible.Count)
                {
                    EdiabasToolActivity.ExtraInfo item = _spinnerArgumentAdapter.ItemsVisible[position];
                    if (!string.IsNullOrEmpty(item.Name))
                    {
                        sb.Append(";");
                        sb.Append(item.Name);
                    }
                }

                string controlParameter = string.Empty;
                if (_controlRoutine)
                {
                    if (_radioButtonStpr.Checked)
                    {
                        controlParameter = "STPR";
                    }
                    else if (_radioButtonRrr.Checked)
                    {
                        controlParameter = "RRR";
                    }
                    else
                    {
                        controlParameter = "STR";
                    }
                }
                else if (_controlIo)
                {
                    if (_radioButtonRtd.Checked)
                    {
                        controlParameter = "RTD";
                    }
                    else if (_radioButtonFcs.Checked)
                    {
                        controlParameter = "FCS";
                    }
                    else if (_radioButtonSta.Checked)
                    {
                        controlParameter = "STA";
                    }
                    else
                    {
                        controlParameter = "RCTECU";
                    }
                }

                if (!string.IsNullOrEmpty(controlParameter))
                {
                    sb.Append(";");
                    sb.Append(controlParameter);
                }

                if (_layoutArgParams.Visibility == ViewStates.Visible)
                {
                    foreach (ParameterData parameterData in _parameterList)
                    {
                        string parameter = string.Empty;
                        foreach (object itemObject in parameterData.ItemList)
                        {
                            parameter = string.Empty;
                            if (itemObject is EditText editText)
                            {
                                parameter = editText.Text;
                            }
                            else if (itemObject is Spinner spinner)
                            {
                                if (spinner.Adapter is StringObjAdapter spinnerAdapter)
                                {
                                    int spinnerPos = spinner.SelectedItemPosition;
                                    if (spinnerPos >= 0 && spinnerPos < spinnerAdapter.Items.Count)
                                    {
                                        StringObjType itemSpinner = spinnerAdapter.Items[spinnerPos];
                                        if (itemSpinner.Data is EdiabasToolActivity.SgFuncValNameInfo valNameInfo)
                                        {
                                            parameter = valNameInfo.Text;
                                        }
                                    }
                                }
                            }

                            if (!string.IsNullOrWhiteSpace(parameter))
                            {
                                break;
                            }
                        }

                        sb.Append(";");
                        sb.Append(parameter);
                    }
                }

                return(sb.ToString());
            }
            catch (Exception)
            {
                return(string.Empty);
            }
        }