Exemple #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetDisplayShowCustomEnabled(true);
            SetContentView(Resource.Layout.can_adapter_config);

            _imm         = (InputMethodManager)GetSystemService(InputMethodService);
            _contentView = FindViewById <View>(Android.Resource.Id.Content);

            _barView = LayoutInflater.Inflate(Resource.Layout.bar_can_adapter, null);
            ActionBar.LayoutParams barLayoutParams = new ActionBar.LayoutParams(
                ViewGroup.LayoutParams.MatchParent,
                ViewGroup.LayoutParams.WrapContent);
            barLayoutParams.Gravity = barLayoutParams.Gravity &
                                      (int)(~(GravityFlags.HorizontalGravityMask | GravityFlags.VerticalGravityMask)) |
                                      (int)(GravityFlags.Left | GravityFlags.CenterVertical);
            SupportActionBar.SetCustomView(_barView, barLayoutParams);

            SetResult(Android.App.Result.Canceled);

            _deviceAddress = Intent.GetStringExtra(ExtraDeviceAddress);
            ActivityCommon.InterfaceType interfaceType = (ActivityCommon.InterfaceType)Intent.GetIntExtra(ExtraInterfaceType,
                                                                                                          (int)ActivityCommon.InterfaceType.Bluetooth);
            ViewStates visibility = interfaceType == ActivityCommon.InterfaceType.Bluetooth ? ViewStates.Visible : ViewStates.Gone;

            _buttonRead = _barView.FindViewById <Button>(Resource.Id.buttonAdapterRead);
            _buttonRead.SetOnTouchListener(this);
            _buttonRead.Click += (sender, args) =>
            {
                PerformRead();
            };
            _buttonRead.Visibility = visibility;

            _buttonWrite = _barView.FindViewById <Button>(Resource.Id.buttonAdapterWrite);
            _buttonWrite.SetOnTouchListener(this);
            _buttonWrite.Click += (sender, args) =>
            {
                PerformWrite();
            };

            _layoutCanAdapter = FindViewById <LinearLayout>(Resource.Id.layoutCanAdapter);
            _layoutCanAdapter.SetOnTouchListener(this);

            _spinnerCanAdapterMode = FindViewById <Spinner>(Resource.Id.spinnerCanAdapterMode);
            _spinnerCanAdapterMode.SetOnTouchListener(this);
            _spinnerCanAdapterModeAdapter  = new StringObjAdapter(this);
            _spinnerCanAdapterMode.Adapter = _spinnerCanAdapterModeAdapter;
            _spinnerCanAdapterModeAdapter.Items.Add(new StringObjType(GetString(Resource.String.button_can_adapter_can_500), AdapterMode.Can500));
            _spinnerCanAdapterModeAdapter.Items.Add(new StringObjType(GetString(Resource.String.button_can_adapter_can_100), AdapterMode.Can100));
            _spinnerCanAdapterModeAdapter.Items.Add(new StringObjType(GetString(Resource.String.button_can_adapter_can_off), AdapterMode.CanOff));
            _spinnerCanAdapterModeAdapter.NotifyDataSetChanged();

            _textViewCanAdapterSepTimeTitle            = FindViewById <TextView>(Resource.Id.textViewCanAdapterSepTimeTitle);
            _textViewCanAdapterSepTimeTitle.Visibility = visibility;

            _spinnerCanAdapterSepTime = FindViewById <Spinner>(Resource.Id.spinnerCanAdapterSepTime);
            _spinnerCanAdapterSepTime.SetOnTouchListener(this);
            _spinnerCanAdapterSepTimeAdapter  = new StringAdapter(this);
            _spinnerCanAdapterSepTime.Adapter = _spinnerCanAdapterSepTimeAdapter;
            _spinnerCanAdapterSepTimeAdapter.Items.Add(GetString(Resource.String.can_adapter_text_off));
            for (int i = 1; i <= 2; i++)
            {
                _spinnerCanAdapterSepTimeAdapter.Items.Add(i.ToString());
            }
            _spinnerCanAdapterSepTimeAdapter.NotifyDataSetChanged();
            _spinnerCanAdapterSepTime.Visibility = visibility;

            _textViewCanAdapterBlockSizeTitle            = FindViewById <TextView>(Resource.Id.textViewCanAdapterBlockSizeTitle);
            _textViewCanAdapterBlockSizeTitle.Visibility = visibility;

            _spinnerCanAdapterBlockSize = FindViewById <Spinner>(Resource.Id.spinnerCanAdapterBlockSize);
            _spinnerCanAdapterBlockSize.SetOnTouchListener(this);
            _spinnerCanAdapterBlockSizeAdapter  = new StringAdapter(this);
            _spinnerCanAdapterBlockSize.Adapter = _spinnerCanAdapterBlockSizeAdapter;
            _spinnerCanAdapterBlockSizeAdapter.Items.Add(GetString(Resource.String.can_adapter_text_off));
            for (int i = 0; i <= 15; i++)
            {
                _spinnerCanAdapterBlockSizeAdapter.Items.Add(i.ToString());
            }
            _spinnerCanAdapterBlockSizeAdapter.NotifyDataSetChanged();
            _spinnerCanAdapterBlockSize.Visibility = visibility;

            _textViewBtPinTitle            = FindViewById <TextView>(Resource.Id.textViewCanAdapterBtPinTitle);
            _textViewBtPinTitle.Visibility = visibility;

            _editTextBtPin            = FindViewById <EditText>(Resource.Id.editTextBtPin);
            _editTextBtPin.Visibility = visibility;

            _textViewBtNameTitle            = FindViewById <TextView>(Resource.Id.textViewCanAdapterBtNameTitle);
            _textViewBtNameTitle.Visibility = visibility;

            _editTextBtName            = FindViewById <EditText>(Resource.Id.editTextBtName);
            _editTextBtName.Visibility = visibility;

            _textViewCanAdapterIgnitionStateTitle            = FindViewById <TextView>(Resource.Id.textViewCanAdapterIgnitionStateTitle);
            _textViewCanAdapterIgnitionStateTitle.Visibility = visibility;

            _textViewIgnitionState            = FindViewById <TextView>(Resource.Id.textViewCanAdapterIgnitionState);
            _textViewIgnitionState.Visibility = visibility;

            _textViewBatteryVoltageTitle            = FindViewById <TextView>(Resource.Id.textViewCanAdapterBatVoltageTitle);
            _textViewBatteryVoltageTitle.Visibility = visibility;

            _textViewBatteryVoltage            = FindViewById <TextView>(Resource.Id.textViewCanAdapterBatVoltage);
            _textViewBatteryVoltage.Visibility = visibility;

            _textViewFwVersionTitle            = FindViewById <TextView>(Resource.Id.textViewCanAdapterFwVersionTitle);
            _textViewFwVersionTitle.Visibility = visibility;

            _textViewFwVersion            = FindViewById <TextView>(Resource.Id.textViewCanAdapterFwVersion);
            _textViewFwVersion.Visibility = visibility;

            _textViewSerNumTitle = FindViewById <TextView>(Resource.Id.textViewCanAdapterSerNumTitle);
            _textViewSerNum      = FindViewById <TextView>(Resource.Id.textViewCanAdapterSerNum);
#if DEBUG
            _textViewSerNumTitle.Visibility = visibility;
            _textViewSerNum.Visibility      = visibility;
#else
            _textViewSerNumTitle.Visibility = ViewStates.Gone;
            _textViewSerNum.Visibility      = ViewStates.Gone;
#endif
            _buttonFwUpdate            = FindViewById <Button>(Resource.Id.buttonCanAdapterFwUpdate);
            _buttonFwUpdate.Visibility = visibility;
            _buttonFwUpdate.Click     += (sender, args) =>
            {
                PerformUpdateMessage();
            };
            _checkBoxExpert            = FindViewById <CheckBox>(Resource.Id.checkBoxCanAdapterExpert);
            _checkBoxExpert.Visibility = visibility;
            _checkBoxExpert.Click     += (sender, args) =>
            {
                UpdateDisplay();
            };

            _activityCommon = new ActivityCommon(this)
            {
                SelectedInterface = interfaceType
            };

            UpdateDisplay();
            PerformRead();
        }
Exemple #2
0
        private void UpdateArgParams(List <string> selectParams = null)
        {
            try
            {
                _layoutArgParams.RemoveAllViews();
                _parameterList.Clear();
                Android.Content.Res.ColorStateList captionTextColors = _textViewArgTypeTitle.TextColors;
                Drawable captionTextBackground = _textViewArgTypeTitle.Background;
                int      position = _spinnerArgument.SelectedItemPosition;
                if (position >= 0 && position < _spinnerArgumentAdapter.ItemsVisible.Count)
                {
                    EdiabasToolActivity.ExtraInfo item = _spinnerArgumentAdapter.ItemsVisible[position];
                    if (item.Tag is EdiabasToolActivity.SgFuncInfo funcInfo)
                    {
                        if (funcInfo.ArgInfoList != null)
                        {
                            foreach (EdiabasToolActivity.SgFuncArgInfo funcArgInfo in funcInfo.ArgInfoList)
                            {
                                string selectParam = string.Empty;
                                if (selectParams != null && selectParams.Count > _parameterList.Count)
                                {
                                    selectParam = selectParams[_parameterList.Count];
                                }

                                LinearLayout argLayout = new LinearLayout(this);
                                argLayout.Orientation = Orientation.Vertical;

                                LinearLayout.LayoutParams wrapLayoutParams = new LinearLayout.LayoutParams(
                                    ViewGroup.LayoutParams.MatchParent,
                                    ViewGroup.LayoutParams.WrapContent);

                                TextView textViewCaption = new TextView(this);
                                textViewCaption.SetOnTouchListener(this);
                                textViewCaption.SetTextColor(captionTextColors);
                                textViewCaption.Background = captionTextBackground;

                                StringBuilder sbCaption = new StringBuilder();
                                sbCaption.Append(GetString(Resource.String.arg_assist_control_parameter));
                                sbCaption.Append(": ");
                                sbCaption.Append(funcArgInfo.Arg);
                                textViewCaption.Text = sbCaption.ToString();
                                argLayout.AddView(textViewCaption, wrapLayoutParams);

                                TextView      textViewDesc = null;
                                StringBuilder sbDesc       = new StringBuilder();
                                string        info         = funcArgInfo.InfoTrans ?? funcArgInfo.Info;
                                if (!string.IsNullOrEmpty(info))
                                {
                                    sbDesc.Append(info);
                                }

                                if (!string.IsNullOrEmpty(funcArgInfo.DataType))
                                {
                                    if (sbDesc.Length > 0)
                                    {
                                        sbDesc.Append("\r\n");
                                    }
                                    sbDesc.Append("Data type: ");
                                    sbDesc.Append(funcArgInfo.DataType);
                                }

                                if (!string.IsNullOrEmpty(funcArgInfo.Unit))
                                {
                                    if (sbDesc.Length > 0)
                                    {
                                        sbDesc.Append("\r\n");
                                    }
                                    sbDesc.Append("Unit: ");
                                    sbDesc.Append(funcArgInfo.Unit);
                                }


                                if (funcArgInfo.TableDataType == EdiabasToolActivity.TableDataType.Float)
                                {
                                    string minText = funcArgInfo.MinText;
                                    if (string.IsNullOrEmpty(minText))
                                    {
                                        if (funcArgInfo.Min.HasValue)
                                        {
                                            minText = string.Format(CultureInfo.InvariantCulture, "{0:0.0}", funcArgInfo.Min.Value);
                                        }
                                    }
                                    if (!string.IsNullOrEmpty(minText))
                                    {
                                        if (sbDesc.Length > 0)
                                        {
                                            sbDesc.Append("\r\n");
                                        }
                                        sbDesc.Append("Min: ");
                                        sbDesc.Append(minText);
                                    }

                                    string maxText = funcArgInfo.MaxText;
                                    if (string.IsNullOrEmpty(maxText))
                                    {
                                        if (funcArgInfo.Max.HasValue)
                                        {
                                            maxText = string.Format(CultureInfo.InvariantCulture, "{0:0.0}", funcArgInfo.Max.Value);
                                        }
                                    }
                                    if (!string.IsNullOrEmpty(maxText))
                                    {
                                        if (sbDesc.Length > 0)
                                        {
                                            sbDesc.Append("\r\n");
                                        }
                                        sbDesc.Append("Max: ");
                                        sbDesc.Append(maxText);
                                    }
                                }

                                if (sbDesc.Length > 0)
                                {
                                    textViewDesc = new TextView(this);
                                    textViewDesc.SetOnTouchListener(this);
                                    textViewDesc.Text = sbDesc.ToString();
                                    argLayout.AddView(textViewDesc, wrapLayoutParams);
                                }

                                Drawable      defaultBackground = null;
                                List <object> itemList          = new List <object>();
                                if (funcArgInfo.NameInfoList != null && funcArgInfo.NameInfoList.Count > 0)
                                {
                                    if (funcArgInfo.NameInfoList[0] is EdiabasToolActivity.SgFuncValNameInfo)
                                    {
                                        Spinner spinner = new Spinner(this);
                                        spinner.SetOnTouchListener(this);
                                        defaultBackground = spinner.Background;
                                        StringObjAdapter spinnerAdapter = new StringObjAdapter(this);
                                        spinnerAdapter.Items.Add(new StringObjType("--", null, Android.Graphics.Color.Red));
                                        int selection = 0;
                                        int index     = 1;
                                        foreach (EdiabasToolActivity.SgFuncNameInfo funcNameInfo in funcArgInfo.NameInfoList)
                                        {
                                            if (funcNameInfo is EdiabasToolActivity.SgFuncValNameInfo valNameInfo)
                                            {
                                                spinner.Adapter = spinnerAdapter;
                                                StringBuilder sbName = new StringBuilder();
                                                sbName.Append(valNameInfo.Value);
                                                sbName.Append(": ");
                                                sbName.Append(valNameInfo.Text);
                                                spinnerAdapter.Items.Add(new StringObjType(sbName.ToString(), valNameInfo));
                                                if (string.Compare(valNameInfo.Text, selectParam, StringComparison.OrdinalIgnoreCase) == 0)
                                                {
                                                    selection = index;
                                                }
                                            }

                                            index++;
                                        }

                                        spinnerAdapter.NotifyDataSetChanged();
                                        spinner.SetSelection(selection);
                                        spinner.ItemSelected += (sender, args) =>
                                        {
                                            ValidateParams();
                                        };
                                        argLayout.AddView(spinner, wrapLayoutParams);
                                        itemList.Add(spinner);
                                    }
                                }
                                else
                                {
                                    EditText editText = new EditText(this);
                                    defaultBackground = editText.Background;
                                    editText.SetSingleLine();
                                    editText.ImeOptions = ImeAction.Done;
                                    editText.Text       = selectParam;

                                    editText.TextChanged += (sender, args) =>
                                    {
                                        ValidateParams();
                                    };

                                    editText.EditorAction += (sender, args) =>
                                    {
                                        switch (args.ActionId)
                                        {
                                        case ImeAction.Go:
                                        case ImeAction.Send:
                                        case ImeAction.Next:
                                        case ImeAction.Done:
                                        case ImeAction.Previous:
                                            ValidateParams();
                                            HideKeyboard();
                                            break;
                                        }
                                    };

                                    argLayout.AddView(editText, wrapLayoutParams);
                                    itemList.Add(editText);
                                }

                                _layoutArgParams.AddView(argLayout, wrapLayoutParams);

                                _parameterList.Add(new ParameterData(funcArgInfo, textViewCaption, textViewDesc, defaultBackground, itemList));
                            }
                        }
                    }
                }

                ValidateParams();
            }
            catch (Exception)
            {
                // ignored
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            SetTheme(ActivityCommon.SelectedThemeId);
            base.OnCreate(savedInstanceState);
            _allowFullScreenMode = false;
            if (savedInstanceState != null)
            {
                _instanceData = GetInstanceState(savedInstanceState, _instanceData) as InstanceData;
            }

            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            //SupportActionBar.SetDisplayShowCustomEnabled(true);
            SetContentView(Resource.Layout.bmw_actuator);

            _imm         = (InputMethodManager)GetSystemService(InputMethodService);
            _contentView = FindViewById <View>(Android.Resource.Id.Content);

            SetResult(Android.App.Result.Canceled);

            if (IntentEcuInfo == null)
            {
                Finish();
                return;
            }

            _activityCommon = new ActivityCommon(this, () =>
            {
            }, BroadcastReceived);
            _updateHandler = new Handler(Looper.MainLooper);

            _ecuDir      = Intent.GetStringExtra(ExtraEcuDir);
            _traceDir    = Intent.GetStringExtra(ExtraTraceDir);
            _traceAppend = Intent.GetBooleanExtra(ExtraTraceAppend, true);
            _activityCommon.SelectedInterface = (ActivityCommon.InterfaceType)
                                                Intent.GetIntExtra(ExtraInterface, (int)ActivityCommon.InterfaceType.None);
            _deviceAddress = Intent.GetStringExtra(ExtraDeviceAddress);
            _activityCommon.SelectedEnetIp = Intent.GetStringExtra(ExtraEnetIp);

            _ecuInfo = IntentEcuInfo;
            UpdateInfoAdaptionList();

            SupportActionBar.Title = string.Format(GetString(Resource.String.bmw_actuator_title), Intent.GetStringExtra(ExtraEcuName) ?? string.Empty);

            _scrollViewBmwActuator = FindViewById <ScrollView>(Resource.Id.scrollViewBmwActuator);
            _scrollViewBmwActuator.SetOnTouchListener(this);

            _layoutBmwActuator = FindViewById <LinearLayout>(Resource.Id.layoutBmwActuator);
            _layoutBmwActuator.SetOnTouchListener(this);

            _layoutBmwActuatorFunction = FindViewById <LinearLayout>(Resource.Id.layoutBmwActuatorFunction);
            _layoutBmwActuatorFunction.SetOnTouchListener(this);

            _textViewBmwActuatorFunction = FindViewById <TextView>(Resource.Id.textViewBmwActuatorFunction);
            _textViewBmwActuatorFunction.SetOnTouchListener(this);

            _spinnerBmwActuatorFunction = FindViewById <Spinner>(Resource.Id.spinnerBmwActuatorFunction);
            _spinnerBmwActuatorFunction.SetOnTouchListener(this);
            _spinnerBmwActuatorFunctionAdapter        = new StringObjAdapter(this);
            _spinnerBmwActuatorFunction.Adapter       = _spinnerBmwActuatorFunctionAdapter;
            _spinnerBmwActuatorFunction.ItemSelected += ActuatorFunctionItemSelected;

            _layoutBmwActuatorInfo = FindViewById <LinearLayout>(Resource.Id.layoutBmwActuatorInfo);
            _layoutBmwActuatorInfo.SetOnTouchListener(this);

            _layoutBmwActuatorComments = FindViewById <LinearLayout>(Resource.Id.layoutBmwActuatorComments);
            _layoutBmwActuatorComments.SetOnTouchListener(this);

            _textViewBmwActuatorCommentsTitle = FindViewById <TextView>(Resource.Id.textViewBmwActuatorCommentsTitle);
            _textViewBmwActuatorCommentsTitle.SetOnTouchListener(this);

            _textBmwActuatorComments = FindViewById <TextView>(Resource.Id.textBmwActuatorComments);
            _textBmwActuatorComments.SetOnTouchListener(this);
            _textBmwActuatorComments.MovementMethod = new ScrollingMovementMethod();

            _layoutBmwActuatorStatus = FindViewById <LinearLayout>(Resource.Id.layoutBmwActuatorStatus);
            _layoutBmwActuatorStatus.SetOnTouchListener(this);

            _textViewBmwActuatorStatusTitle = FindViewById <TextView>(Resource.Id.textViewBmwActuatorStatusTitle);
            _textViewBmwActuatorStatusTitle.SetOnTouchListener(this);

            _textBmwActuatorStatus = FindViewById <TextView>(Resource.Id.textBmwActuatorStatus);
            _textBmwActuatorStatus.SetOnTouchListener(this);
            _textBmwActuatorStatus.MovementMethod = new ScrollingMovementMethod();

            _layoutBmwActuatorOperation = FindViewById <LinearLayout>(Resource.Id.layoutBmwActuatorOperation);
            _layoutBmwActuatorOperation.SetOnTouchListener(this);

            _textViewBmwActuatorOperationTitle = FindViewById <TextView>(Resource.Id.textViewBmwActuatorOperationTitle);
            _textViewBmwActuatorOperationTitle.SetOnTouchListener(this);

            _buttonBmwActuatorExecuteSingle = FindViewById <Button>(Resource.Id.buttonBmwActuatorExecuteSingle);
            _buttonBmwActuatorExecuteSingle.SetOnTouchListener(this);
            _buttonBmwActuatorExecuteSingle.Click += (sender, args) =>
            {
                ExecuteActuatorFunction(false);
            };

            _buttonBmwActuatorExecuteContinuous = FindViewById <Button>(Resource.Id.buttonBmwActuatorExecuteContinuous);
            _buttonBmwActuatorExecuteContinuous.SetOnTouchListener(this);
            _buttonBmwActuatorExecuteContinuous.Click += (sender, args) =>
            {
                ExecuteActuatorFunction(true);
            };

            _buttonBmwActuatorStop = FindViewById <Button>(Resource.Id.buttonBmwActuatorStop);
            _buttonBmwActuatorStop.SetOnTouchListener(this);
            _buttonBmwActuatorStop.Click += (sender, args) =>
            {
                _instanceData.StopActuator = true;
            };

            UpdateActuatorFunctionList();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            if (savedInstanceState != null)
            {
                _activityRecreated = true;
                _instanceData      = GetInstanceState(savedInstanceState, _instanceData) as InstanceData;
            }

            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetDisplayShowCustomEnabled(true);
            SetContentView(Resource.Layout.arg_assist_status);

            InitBaseVariables();

            _dynamicId = _serviceId == (int)SgFunctions.UdsServiceId.DynamicallyDefineId;
            _mwBlock   = _serviceId == (int)SgFunctions.UdsServiceId.MwBlock;
            if (!_activityRecreated && _instanceData != null)
            {
                _instanceData.Arguments = Intent.GetStringExtra(ExtraArguments);
            }

            _buttonApply.Click += (sender, args) =>
            {
                if (ArgsSelectCount() > 0 && UpdateResult())
                {
                    Finish();
                }
            };

            _buttonExecute.Click += (sender, args) =>
            {
                if (ArgsSelectCount() > 0 && UpdateResult(true))
                {
                    Finish();
                }
            };

            _radioButtonArgTypeArg.CheckedChange += (sender, args) =>
            {
                if (_ignoreCheckChange)
                {
                    return;
                }
                UpdateArgList();
            };

            _radioButtonArgTypeId.CheckedChange += (sender, args) =>
            {
                if (_ignoreCheckChange)
                {
                    return;
                }
                UpdateArgList();
            };

            _layoutArgType = FindViewById <LinearLayout>(Resource.Id.layoutArgType);
            _layoutArgType.SetOnTouchListener(this);
            _layoutArgType.Visibility = _mwBlock ? ViewStates.Gone : ViewStates.Visible;

            _layoutBlockNumber = FindViewById <LinearLayout>(Resource.Id.layoutBlockNumber);
            _layoutBlockNumber.SetOnTouchListener(this);
            _layoutBlockNumber.Visibility = _dynamicId ? ViewStates.Visible : ViewStates.Gone;

            _spinnerBlockNumber         = FindViewById <Spinner>(Resource.Id.spinnerBlockNumber);
            _spinnerBlockNumberAdapter  = new StringObjAdapter(this);
            _spinnerBlockNumber.Adapter = _spinnerBlockNumberAdapter;

            _checkBoxDefineBlockNew = FindViewById <CheckBox>(Resource.Id.checkBoxDefineBlockNew);
            _checkBoxDefineBlockNew.SetOnTouchListener(this);
            _checkBoxDefineBlockNew.Visibility = _mwBlock || _dynamicId ? ViewStates.Visible : ViewStates.Gone;

            _listViewArgs    = FindViewById <ListView>(Resource.Id.argList);
            _argsListAdapter = new EdiabasToolActivity.ResultSelectListAdapter(this);
            _argsListAdapter.CheckChanged += extraInfo =>
            {
                UpdateButtonState();
                CheckArgsAmount();
            };

            _listViewArgs.Adapter = _argsListAdapter;
            _listViewArgs.SetOnTouchListener(this);

            UpdateDisplay();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            if (savedInstanceState != null)
            {
                _instanceData = ActivityCommon.GetInstanceState(savedInstanceState, _instanceData) as InstanceData;
            }

            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            //SupportActionBar.SetDisplayShowCustomEnabled(true);
            SupportActionBar.Title = string.Format(GetString(Resource.String.vag_coding_title), Intent.GetStringExtra(ExtraEcuName) ?? string.Empty);
            SetContentView(Resource.Layout.vag_coding);

            _imm         = (InputMethodManager)GetSystemService(InputMethodService);
            _contentView = FindViewById <View>(Android.Resource.Id.Content);

            SetResult(Android.App.Result.Canceled);

            _activityCommon = new ActivityCommon(this, () =>
            {
            }, BroadcastReceived);

            _ecuDir      = Intent.GetStringExtra(ExtraEcuDir);
            _traceDir    = Intent.GetStringExtra(ExtraTraceDir);
            _traceAppend = Intent.GetBooleanExtra(ExtraTraceAppend, true);
            _activityCommon.SelectedInterface = (ActivityCommon.InterfaceType)
                                                Intent.GetIntExtra(ExtraInterface, (int)ActivityCommon.InterfaceType.None);
            _deviceAddress = Intent.GetStringExtra(ExtraDeviceAddress);
            _activityCommon.SelectedEnetIp = Intent.GetStringExtra(ExtraEnetIp);

            _ecuInfo = IntentEcuInfo;

            _layoutVagCoding = FindViewById <LinearLayout>(Resource.Id.layoutVagCoding);
            _layoutVagCoding.SetOnTouchListener(this);

            _textViewVagCodingSubsystem = FindViewById <TextView>(Resource.Id.textViewVagCodingSubsystem);
            _textViewVagCodingSubsystem.SetOnTouchListener(this);

            _spinnerVagCodingSubsystem = FindViewById <Spinner>(Resource.Id.spinnerVagCodingSubsystem);
            _spinnerVagCodingSubsystem.SetOnTouchListener(this);
            _spinnerVagCodingSubsystemAdapter        = new StringObjAdapter(this);
            _spinnerVagCodingSubsystem.Adapter       = _spinnerVagCodingSubsystemAdapter;
            _spinnerVagCodingSubsystem.ItemSelected += SubSystemItemSelected;

            _layoutVagCodingShort = FindViewById <LinearLayout>(Resource.Id.layoutVagCodingShort);
            _layoutVagCodingShort.SetOnTouchListener(this);

            _textViewVagCodingShortTitle = FindViewById <TextView>(Resource.Id.textViewVagCodingShortTitle);
            _textViewVagCodingShortTitle.SetOnTouchListener(this);

            _editTextVagCodingShort = FindViewById <EditText>(Resource.Id.editTextVagCodingShort);
            _editTextVagCodingShort.EditorAction += CodingEditorAction;

            _layoutVagCodingComments = FindViewById <LinearLayout>(Resource.Id.layoutVagCodingComments);
            _layoutVagCodingComments.SetOnTouchListener(this);

            _textViewVagCodingCommentsTitle = FindViewById <TextView>(Resource.Id.textViewVagCodingCommentsTitle);
            _textViewVagCodingCommentsTitle.SetOnTouchListener(this);

            _textViewCodingComments = FindViewById <TextView>(Resource.Id.textViewCodingComments);
            _textViewCodingComments.SetOnTouchListener(this);

            _textViewVagCodingRaw = FindViewById <TextView>(Resource.Id.textViewVagCodingRaw);
            _textViewVagCodingRaw.SetOnTouchListener(this);

            _editTextVagCodingRaw = FindViewById <EditText>(Resource.Id.editTextVagCodingRaw);
            _editTextVagCodingRaw.EditorAction += CodingEditorAction;

            _buttonCodingWrite = FindViewById <Button>(Resource.Id.buttonCodingWrite);
            _buttonCodingWrite.SetOnTouchListener(this);
            _buttonCodingWrite.Click += (sender, args) =>
            {
                ExecuteWriteCoding();
            };

            _layoutVagCodingAssitant = FindViewById <LinearLayout>(Resource.Id.layoutVagCodingAssitant);
            _layoutVagCodingAssitant.SetOnTouchListener(this);

            _listViewVagCodingAssistant         = FindViewById <ListView>(Resource.Id.listViewVagCodingAssistant);
            _layoutVagCodingAssitantAdapter     = new ResultListAdapter(this, -1, 0, true);
            _listViewVagCodingAssistant.Adapter = _layoutVagCodingAssitantAdapter;
            _listViewVagCodingAssistant.SetOnTouchListener(this);

            UpdateCodingSubsystemList();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            //SupportActionBar.SetDisplayShowCustomEnabled(true);
            SupportActionBar.Title = string.Format(GetString(Resource.String.xml_tool_ecu_title), Intent.GetStringExtra(ExtraEcuName) ?? string.Empty);
            SetContentView(Resource.Layout.xml_tool_ecu);

            _imm         = (InputMethodManager)GetSystemService(InputMethodService);
            _contentView = FindViewById <View>(Android.Resource.Id.Content);

            SetResult(Android.App.Result.Canceled);

            _activityCommon = new ActivityCommon(this);
            _ecuInfo        = IntentEcuInfo;
            _ediabas        = IntentEdiabas;

            _editTextPageName      = FindViewById <EditText>(Resource.Id.editTextPageName);
            _editTextPageName.Text = _ecuInfo.PageName;

            _editTextEcuName      = FindViewById <EditText>(Resource.Id.editTextEcuName);
            _editTextEcuName.Text = _ecuInfo.EcuName;

            _spinnerJobs         = FindViewById <Spinner>(Resource.Id.spinnerJobs);
            _spinnerJobsAdapter  = new JobListAdapter(this);
            _spinnerJobs.Adapter = _spinnerJobsAdapter;
            _spinnerJobs.SetOnTouchListener(this);
            _spinnerJobs.ItemSelected += (sender, args) =>
            {
                int pos = args.Position;
                JobSelected(pos >= 0 ? _spinnerJobsAdapter.Items[pos] : null);
            };

            _layoutJobConfig = FindViewById <LinearLayout>(Resource.Id.layoutJobConfig);
            _layoutJobConfig.SetOnTouchListener(this);

            _textViewJobCommentsTitle = FindViewById <TextView>(Resource.Id.textViewJobCommentsTitle);
            _textViewJobComments      = FindViewById <TextView>(Resource.Id.textViewJobComments);

            _spinnerJobResults               = FindViewById <Spinner>(Resource.Id.spinnerJobResults);
            _spinnerJobResultsAdapter        = new ResultListAdapter(this);
            _spinnerJobResults.Adapter       = _spinnerJobResultsAdapter;
            _spinnerJobResults.ItemSelected += (sender, args) =>
            {
                ResultSelected(args.Position);
            };

            _textViewResultCommentsTitle = FindViewById <TextView>(Resource.Id.textViewResultCommentsTitle);
            _textViewResultComments      = FindViewById <TextView>(Resource.Id.textViewResultComments);
            _editTextDisplayText         = FindViewById <EditText>(Resource.Id.editTextDisplayText);
            _editTextLogTag = FindViewById <EditText>(Resource.Id.editTextLogTag);

            _textViewFormatDot = FindViewById <TextView>(Resource.Id.textViewFormatDot);
            _editTextFormat    = FindViewById <EditText>(Resource.Id.editTextFormat);

            _spinnerFormatPos         = FindViewById <Spinner>(Resource.Id.spinnerFormatPos);
            _spinnerFormatPosAdapter  = new StringAdapter(this);
            _spinnerFormatPos.Adapter = _spinnerFormatPosAdapter;
            _spinnerFormatPosAdapter.Items.Add(GetString(Resource.String.xml_tool_ecu_format_right));
            _spinnerFormatPosAdapter.Items.Add(GetString(Resource.String.xml_tool_ecu_format_left));
            _spinnerFormatPosAdapter.NotifyDataSetChanged();
            _spinnerFormatPos.ItemSelected += FormatItemSelected;

            _spinnerFormatLength1         = FindViewById <Spinner>(Resource.Id.spinnerFormatLength1);
            _spinnerFormatLength1Adapter  = new StringObjAdapter(this);
            _spinnerFormatLength1.Adapter = _spinnerFormatLength1Adapter;
            _spinnerFormatLength1Adapter.Items.Add(new StringObjType("--", -1));
            foreach (int value in LengthValues)
            {
                _spinnerFormatLength1Adapter.Items.Add(new StringObjType(value.ToString(), value));
            }
            _spinnerFormatLength1Adapter.NotifyDataSetChanged();
            _spinnerFormatLength1.ItemSelected += FormatItemSelected;

            _spinnerFormatLength2         = FindViewById <Spinner>(Resource.Id.spinnerFormatLength2);
            _spinnerFormatLength2Adapter  = new StringObjAdapter(this);
            _spinnerFormatLength2.Adapter = _spinnerFormatLength2Adapter;
            _spinnerFormatLength2Adapter.Items.Add(new StringObjType("--", -1));
            foreach (int value in LengthValues)
            {
                _spinnerFormatLength2Adapter.Items.Add(new StringObjType(value.ToString(), value));
            }
            _spinnerFormatLength2Adapter.NotifyDataSetChanged();
            _spinnerFormatLength2.ItemSelected += FormatItemSelected;

            _spinnerFormatType         = FindViewById <Spinner>(Resource.Id.spinnerFormatType);
            _spinnerFormatTypeAdapter  = new StringObjAdapter(this);
            _spinnerFormatType.Adapter = _spinnerFormatTypeAdapter;
            _spinnerFormatTypeAdapter.Items.Add(new StringObjType("--", FormatType.None));
            _spinnerFormatTypeAdapter.NotifyDataSetChanged();
            _spinnerFormatType.ItemSelected += FormatItemSelected;

            _buttonTestFormat         = FindViewById <Button>(Resource.Id.buttonTestFormat);
            _buttonTestFormat.Enabled = _ediabas != null;
            _buttonTestFormat.Click  += (sender, args) =>
            {
                ExecuteTestFormat();
            };
            _textViewTestFormatOutput = FindViewById <TextView>(Resource.Id.textViewTestFormatOutput);

            _layoutJobConfig.Visibility = ViewStates.Gone;
            UpdateDisplay();
            ResetTestResult();
        }