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();
        }
Esempio n. 2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            _allowFullScreenMode = false;

            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_control);

            InitBaseVariables();

            _controlRoutine = _serviceId == (int)EdiabasToolActivity.UdsServiceId.RoutineControl;
            _controlIo      = _serviceId == (int)EdiabasToolActivity.UdsServiceId.IoControlById;

            _scrollViewArgAssist = FindViewById <ScrollView>(Resource.Id.scrollViewArgAssist);
            _scrollViewArgAssist.SetOnTouchListener(this);

            _layoutArgAssist = FindViewById <LinearLayout>(Resource.Id.layoutArgAssist);
            _layoutArgAssist.SetOnTouchListener(this);

            _spinnerArgument = FindViewById <Spinner>(Resource.Id.spinnerArgument);
            _spinnerArgument.SetOnTouchListener(this);
            _spinnerArgumentAdapter        = new EdiabasToolActivity.ResultSelectListAdapter(this);
            _spinnerArgument.Adapter       = _spinnerArgumentAdapter;
            _spinnerArgument.ItemSelected += (sender, args) =>
            {
                if (_argumentSelectLastItem != _spinnerArgument.SelectedItemPosition)
                {
                    UpdateArgParams();
                    UpdateButtonState();
                }
                _argumentSelectLastItem = -1;
            };
            _argumentSelectLastItem = -1;

            _textViewControlParam            = FindViewById <TextView>(Resource.Id.textViewControlParam);
            _textViewControlParam.Visibility = _controlRoutine || _controlIo ? ViewStates.Visible : ViewStates.Gone;

            _radioGroupControlRoutine            = FindViewById <RadioGroup>(Resource.Id.radioGroupControlRoutine);
            _radioGroupControlRoutine.Visibility = _controlRoutine ? ViewStates.Visible : ViewStates.Gone;
            _radioGroupControlRoutine.SetOnTouchListener(this);
            _radioButtonStr = FindViewById <RadioButton>(Resource.Id.radioButtonStr);
            _radioButtonStr.SetOnTouchListener(this);
            _radioButtonStr.CheckedChange += RadioButtonControlCheckedChange;
            _radioButtonStpr = FindViewById <RadioButton>(Resource.Id.radioButtonStpr);
            _radioButtonStpr.SetOnTouchListener(this);
            _radioButtonStpr.CheckedChange += RadioButtonControlCheckedChange;
            _radioButtonRrr = FindViewById <RadioButton>(Resource.Id.radioButtonRrr);
            _radioButtonRrr.SetOnTouchListener(this);
            _radioButtonRrr.CheckedChange += RadioButtonControlCheckedChange;

            _radioGroupControlIo            = FindViewById <RadioGroup>(Resource.Id.radioGroupControlIo);
            _radioGroupControlIo.Visibility = _controlIo ? ViewStates.Visible : ViewStates.Gone;
            _radioGroupControlIo.SetOnTouchListener(this);
            _radioButtonRctEcu = FindViewById <RadioButton>(Resource.Id.radioButtonRctEcu);
            _radioButtonRctEcu.SetOnTouchListener(this);
            _radioButtonRctEcu.CheckedChange += RadioButtonControlCheckedChange;
            _radioButtonRtd = FindViewById <RadioButton>(Resource.Id.radioButtonRtd);
            _radioButtonRtd.SetOnTouchListener(this);
            _radioButtonRtd.CheckedChange += RadioButtonControlCheckedChange;
            _radioButtonFcs = FindViewById <RadioButton>(Resource.Id.radioButtonFcs);
            _radioButtonFcs.SetOnTouchListener(this);
            _radioButtonFcs.CheckedChange += RadioButtonControlCheckedChange;
            _radioButtonSta = FindViewById <RadioButton>(Resource.Id.radioButtonSta);
            _radioButtonSta.SetOnTouchListener(this);
            _radioButtonSta.CheckedChange += RadioButtonControlCheckedChange;

            _layoutArgParams = FindViewById <LinearLayout>(Resource.Id.layoutArgParams);
            _layoutArgParams.SetOnTouchListener(this);

            if (!_activityRecreated && _instanceData != null)
            {
                _instanceData.Arguments = Intent.GetStringExtra(ExtraArguments);
            }

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

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

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

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

            UpdateDisplay();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            SetTheme(ActivityCommon.SelectedThemeId);
            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);

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

            _barView = LayoutInflater.Inflate(Resource.Layout.bar_arg_assist, 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);

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

            _serviceId = Intent.GetIntExtra(ExtraServiceId, -1);
            _offline   = Intent.GetBooleanExtra(ExtraOffline, false);
            if (!_activityRecreated && _instanceData != null)
            {
                _instanceData.Arguments = Intent.GetStringExtra(ExtraArguments);
            }

            _activityCommon = new ActivityCommon(this);

            _sgFuncInfoList = IntentSgFuncInfo;

            _buttonApply = _barView.FindViewById <Button>(Resource.Id.buttonApply);
            _buttonApply.SetOnTouchListener(this);
            _buttonApply.Click += (sender, args) =>
            {
                if (ArgsSelectCount() > 0 && UpdateResult())
                {
                    Finish();
                }
            };

            _buttonExecute = _barView.FindViewById <Button>(Resource.Id.buttonExecute);
            _buttonExecute.SetOnTouchListener(this);
            _buttonExecute.Click += (sender, args) =>
            {
                if (ArgsSelectCount() > 0 && UpdateResult(true))
                {
                    Finish();
                }
            };

            _radioButtonArgTypeArg = FindViewById <RadioButton>(Resource.Id.radioButtonArgTypeArg);
            _radioButtonArgTypeArg.CheckedChange += (sender, args) =>
            {
                UpdateArgList();
            };

            _radioButtonArgTypeId = FindViewById <RadioButton>(Resource.Id.radioButtonArgTypeId);
            _radioButtonArgTypeId.CheckedChange += (sender, args) =>
            {
                UpdateArgList();
            };

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

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

            UpdateDisplay();
        }