protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.serial_console);

            ActionBar.SetTitle(Resource.String.test_console_title);

            ActivityStatus = TEST_STATUS.STANDBY;

            TransfarRate = DEFAULT_TRANSFAR_RATE;

            DeviceName = UseUsbSerialPort.GetType().Name;

            if (0 == String.Compare(DeviceName, 0, "Cdc", 0, 3))
            {
                IsCdcDevice = true;
            }
            else
            {
                IsCdcDevice = false;
            }

            TestModeTextView = (TextView)FindViewById(Resource.Id.test_mode);
            TitleTextView    = (TextView)FindViewById(Resource.Id.serial_device_name);

            TransfarRateTitleTextView = (TextView)FindViewById(Resource.Id.title_transfar_rate);
            TransfarRateValueTextView = (TextView)FindViewById(Resource.Id.transfar_rate_value);
            if (IsCdcDevice)
            {
                TransfarRateTitleTextView.Enabled = false;
                TransfarRateValueTextView.Enabled = false;
            }
            else
            {
                TransfarRateValueTextView.SetText(TransfarRate.ToString(), TextView.BufferType.Normal);
            }

            DumpTextView = (TextView)FindViewById(Resource.Id.consoleText);
            ScrollView   = (ScrollView)FindViewById(Resource.Id.demoScroller);

            ActivityStatusTextView = (TextView)FindViewById(Resource.Id.activity_status);
            ActivityStatusTextView.SetText(Resource.String.activity_status_standby);

            TestTimeTextView = (TextView)FindViewById(Resource.Id.test_time);
            TestTimeTextView.SetText(string.Format("{0:0#}:{1:0#}", TestTimePeriod / 60, TestTimePeriod % 60), TextView.BufferType.Normal);

            RemainTimeTextView = (TextView)FindViewById(Resource.Id.remain_time);
            RemainTimeTextView.SetText(Resource.String.remain_time_initial);

            TitleGoodTextView  = (TextView)FindViewById(Resource.Id.title_good);
            GoodCountTextView  = (TextView)FindViewById(Resource.Id.good_count);
            TitleErrorTextView = (TextView)FindViewById(Resource.Id.title_error);
            ErrorCountTextView = (TextView)FindViewById(Resource.Id.error_count);
            TitleTotalTextView = (TextView)FindViewById(Resource.Id.title_total);
            TotalCountTextView = (TextView)FindViewById(Resource.Id.total_count);

            ModeChangeButton        = (Button)FindViewById(Resource.Id.modeChange);
            ModeChangeButton.Click += ModeChangeButtonHandler;

            UseUsbSerialPort.DataReceivedEventLinser += DataReceivedHandler;

            CheckNmeaCheckSumInstance = new CheckNmeaCheckSum(this);
            CheckCyclic00ToFFInstance = new CheckCyclic00ToFF(this);
            CheckCyclic41To5AInstance = new CheckCyclic41To5A(this);
            CheckSendDataInstance     = new CheckSendData(this);
            CheckSendDataCdcInstance  = new CheckSendDataCdc(this);

            CheckInstance = CheckCyclic00ToFFInstance;
            TestModeTextView.SetText(CheckInstance.TestMode, TextView.BufferType.Normal);
        }
        bool CheckTestModeMenu(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.test_mode_nmew_check_sum:
                TestModeResourceId            = Resource.Id.test_mode_nmew_check_sum;
                TitleGoodTextView.Visibility  = ViewStates.Visible;
                GoodCountTextView.Visibility  = ViewStates.Visible;
                TitleErrorTextView.Visibility = ViewStates.Visible;
                ErrorCountTextView.Visibility = ViewStates.Visible;
                TitleTotalTextView.SetText(Resource.String.title_total_receive);
                SetTransferRateDisplayState();
                CheckInstance = CheckNmeaCheckSumInstance;
                break;

            case Resource.Id.test_mode_cyclic_0x00_to_0xff:
                TestModeResourceId            = Resource.Id.test_mode_cyclic_0x00_to_0xff;
                TitleGoodTextView.Visibility  = ViewStates.Visible;
                GoodCountTextView.Visibility  = ViewStates.Visible;
                TitleErrorTextView.Visibility = ViewStates.Visible;
                ErrorCountTextView.Visibility = ViewStates.Visible;
                TitleTotalTextView.SetText(Resource.String.title_total_receive);
                SetTransferRateDisplayState();
                CheckInstance = CheckCyclic00ToFFInstance;
                break;

            case Resource.Id.test_mode_cyclic_0x41_to_0x5A:
                TestModeResourceId            = Resource.Id.test_mode_cyclic_0x41_to_0x5A;
                TitleGoodTextView.Visibility  = ViewStates.Visible;
                GoodCountTextView.Visibility  = ViewStates.Visible;
                TitleErrorTextView.Visibility = ViewStates.Visible;
                ErrorCountTextView.Visibility = ViewStates.Visible;
                TitleTotalTextView.SetText(Resource.String.title_total_receive);
                SetTransferRateDisplayState();
                CheckInstance = CheckCyclic41To5AInstance;
                break;

            case Resource.Id.test_mode_send_data:
                TestModeResourceId            = Resource.Id.test_mode_send_data;
                TitleGoodTextView.Visibility  = ViewStates.Invisible;
                GoodCountTextView.Visibility  = ViewStates.Invisible;
                TitleErrorTextView.Visibility = ViewStates.Invisible;
                ErrorCountTextView.Visibility = ViewStates.Gone;
                TitleTotalTextView.SetText(Resource.String.title_total_send);
                SetTransferRateDisplayState();
                CheckInstance = CheckSendDataInstance;
                break;

            case Resource.Id.test_mode_send_data_cdc:
                TestModeResourceId            = Resource.Id.test_mode_send_data_cdc;
                TitleGoodTextView.Visibility  = ViewStates.Visible;
                GoodCountTextView.Visibility  = ViewStates.Visible;
                TitleErrorTextView.Visibility = ViewStates.Visible;
                ErrorCountTextView.Visibility = ViewStates.Visible;
                TitleTotalTextView.SetText(Resource.String.title_total_send);
                SetTransferRateDisplayState();
                CheckInstance = CheckSendDataCdcInstance;
                break;

            default:
                return(false);
            }
            RunOnUiThread(() =>
                          TestModeTextView.SetText(CheckInstance.TestMode, TextView.BufferType.Normal)
                          );
            return(true);
        }