Ejemplo n.º 1
0
        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();
        }