private void Button_Click(object sender, System.EventArgs e) { if (worker == null || !worker.IsAlive) { Context sContext = Android.App.Application.Context; textView.Text = ""; mContext = Android.App.Application.Context; ap = new AppPreferences(mContext); ReadPara(out StartDate, out EndDate, out StartTime, out EndTime, out Device_id, out Api_Key, out Limit_Cout); worker = new Thread(new ThreadStart(UpdateWork)); Toast.MakeText(sContext, "开始发送请求", ToastLength.Short).Show(); worker.Start(); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate(Resource.Layout.Setting, container, false); //mTextView = (TextView)view.FindViewById(Resource.Id.txt_content); ////mTextView = (TextView)getActivity().findViewById(R.id.txt_content); //mTextView.Text = context; SavePara = (Button)view.FindViewById(Resource.Id.SaveBtn); StartDate = (EditText)view.FindViewById(Resource.Id.SD_ShowDialog); EndDate = (EditText)view.FindViewById(Resource.Id.ED_ShowDialog); StartTime = (EditText)view.FindViewById(Resource.Id.ST_ShowDialog); EndTime = (EditText)view.FindViewById(Resource.Id.ET_ShowDialog); Device_id = (EditText)view.FindViewById(Resource.Id.Device_ID_Input); Api_Key = (EditText)view.FindViewById(Resource.Id.API_KEY_Input); Limit_Count = (EditText)view.FindViewById(Resource.Id.Limit_ShowDialog); mContext = Android.App.Application.Context; ap = new AppPreferences(mContext); if (ReadPara(out String StartDatesStr, out String EndDateStr, out String StartTimeStr, out String EndTimeStr, out String Device_idStr, out String Api_KeyStr, out String LimitStr)) { StartDate.Text = StartDatesStr; EndDate.Text = EndDateStr; StartTime.Text = StartTimeStr; EndTime.Text = EndTimeStr; Device_id.Text = Device_idStr; Api_Key.Text = Api_KeyStr; Limit_Count.Text = LimitStr; } else { Context sContext = Android.App.Application.Context; Toast.MakeText(sContext, "读取参数出错", ToastLength.Short).Show(); } SavePara.Click += SavePara_Click; return(view); }