private void OpenNotification(Context context, Bundle bundle) { //清除所有通知 JPushInterface.ClearAllNotifications(context); //判断app进程是否存活 if (EldYoungUtil.IsApplive(context, "com.lelaozu.communitycenter")) { //如果存活的话,就直接启动报警DetailActivity,但要考虑一种情况,就是app的进程虽然仍然在 //但Task栈已经空了,比如用户点击Back键退出应用,但进程还没有被系统回收,如果直接启动 //DetailActivity,再按Back键就不会返回任何界面了。所以在启动DetailActivity前,要先启动splash界面。 Log.Info("NotificationReceiver", "the app process is alive"); Intent mainIntent = new Intent(context, typeof(MainActivity)); mainIntent.SetFlags(ActivityFlags.NewTask | ActivityFlags.SingleTop); Intent alarmDetailInfoIntent = new Intent(context, typeof(AlarmDetailInfoActivity)); bundle.PutString("alarmOrigin", "Jpush"); alarmDetailInfoIntent.PutExtras(bundle); Intent[] intents = new Intent[] { mainIntent, alarmDetailInfoIntent }; context.StartActivities(intents); } else { //如果app进程已经被杀死,先重新启动app,将alarmDetailActivity的启动参数传入Intent中,参数经过 //SplashActivity传入MainActivity,此时app的初始化已经完成,在MainActivity中就可以根据传入,参数跳转到DetailActivity中去了 Log.Info("NotificationReceiver", "the app process is dead"); Intent launchIntent = context.PackageManager.GetLaunchIntentForPackage("com.lelaozu.communitycenter"); launchIntent.SetFlags( ActivityFlags.NewTask | ActivityFlags.ResetTaskIfNeeded); bundle.PutString("alarmOrigin", "Jpush"); launchIntent.PutExtras(bundle); context.StartActivity(launchIntent); } }
/// <summary> /// 重写ITagAliasCallback方法 /// </summary> /// <param name="p0">P0.</param> /// <param name="p1">P1.</param> /// <param name="p2">P2.</param> public void GotResult(int code, string alias, ICollection <string> tags) { string logs; switch (code) { case 0: logs = "set alias or tags sucess"; Log.Debug(Tag, logs); //写入shareprefrences值,保存 sp_jpushInfo.Edit().PutString(Global.Jpush_Alias, alias).Commit(); break; case 6002: logs = "failed set to alias or tags due to timeout,try again after 60s"; Log.Debug(Tag, logs); if (EldYoungUtil.IsConnected(context)) { handler.SendMessageDelayed(handler.ObtainMessage(MSG_SET_ALIAS, alias), 1000 * 60); } else { Log.Debug(Tag, "no network"); } break; default: logs = "faild with errcode:" + code; Log.Debug(Tag, logs); break; } }
private void InitView() { gv_server = View.FindViewById <GridView> (Resource.Id.gv_server); var adapter = new ServerItemAdapter(Activity); adapter.Add(new ServerTypeItem() { ServerTypeName = "管理员", ServerTypeImage = Resource.Drawable.icon_admin, FuncType = FuncActivityType.AdminMain }); adapter.Add(new ServerTypeItem() { ServerTypeName = "跑腿", ServerTypeImage = Resource.Drawable.icon_run, FuncType = FuncActivityType.ErrandMain }); adapter.Add(new ServerTypeItem() { ServerTypeName = "护理", ServerTypeImage = Resource.Drawable.icon_nurse, FuncType = FuncActivityType.NurseMain }); adapter.Add(new ServerTypeItem() { ServerTypeName = "家政", ServerTypeImage = Resource.Drawable.icon_housekeep, FuncType = FuncActivityType.HouseKeepMain }); gv_server.Adapter = adapter; //gridview 单击事件 gv_server.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => { var clickItem = adapter.GetItem(e.Position); EldYoungUtil.StartTargetActivity(Activity, clickItem.FuncType); }; }
public override Android.Views.View GetView(int position, Android.Views.View convertView, Android.Views.ViewGroup parent) { AlarmItemView _alarmItemView = null; var item = GetItem(position); if (convertView == null) { convertView = LayoutInflater.From(Context).Inflate(Resource.Layout.alarmListitemView, null); _alarmItemView = new AlarmItemView(); _alarmItemView.tv_alarmTrueName = convertView.FindViewById <TextView> (Resource.Id.tv_alarmTrueName); _alarmItemView.tv_alarmTime = convertView.FindViewById <TextView> (Resource.Id.tv_alarmTime); _alarmItemView.tv_alarmStatus = convertView.FindViewById <TextView> (Resource.Id.tv_alarmStatus); _alarmItemView.tv_alarmContent = convertView.FindViewById <TextView> (Resource.Id.tv_alarmContent); convertView.SetTag(Resource.Id.alarmlistitemview, (Java.Lang.Object)_alarmItemView); } else { _alarmItemView = (AlarmItemView)convertView.GetTag(Resource.Id.alarmlistitemview); } _alarmItemView.tv_alarmTrueName.Text = EldYoungUtil.FormatStrVaue(item.TrueName); _alarmItemView.tv_alarmTime.Text = string.IsNullOrEmpty(item.AlarmTime)?string.Empty: Convert.ToDateTime(item.AlarmTime).ToString("yyyy-MM-dd HH:mm:ss"); _alarmItemView.tv_alarmStatus.Text = EldYoungUtil.FormatStrVaue(item.Status); _alarmItemView.tv_alarmContent.Text = EldYoungUtil.FormatStrVaue(item.AlarmContent); return(convertView); }
public override void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); //设置下拉刷新动画 pull_refresh_scroll_finance = View.FindViewById <PullToRefreshScrollView> (Resource.Id.pull_refresh_scroll_finance); //设置可以上拉加载。下拉刷新 pull_refresh_scroll_finance.Mode = PullToRefreshBase.PullToRefreshMode.PullFromStart; //绑定监听事件 pull_refresh_scroll_finance.SetOnRefreshListener(this); tv_totalAssets = View.FindViewById <TextView> (Resource.Id.tv_totalAssets); tv_availableAssets = View.FindViewById <TextView> (Resource.Id.tv_availableAssets); tv_frozenAssets = View.FindViewById <TextView> (Resource.Id.tv_frozenAssets); rl_charge = View.FindViewById <RelativeLayout> (Resource.Id.rl_charge); rl_withDraw = View.FindViewById <RelativeLayout> (Resource.Id.rl_withDraw); rl_bankCards = View.FindViewById <RelativeLayout> (Resource.Id.rl_bankCards); rl_DealRecords = View.FindViewById <RelativeLayout> (Resource.Id.rl_DealRecords); rl_dailyPay = View.FindViewById <RelativeLayout> (Resource.Id.rl_dailyPay); rl_respect = View.FindViewById <RelativeLayout> (Resource.Id.rl_respect); //充值 rl_charge.Click += (object sender, EventArgs e) => { EldYoungUtil.StartTargetActivity(Activity, FuncActivityType.Charge); }; //提现 rl_withDraw.Click += (object sender, EventArgs e) => { EldYoungUtil.StartTargetActivity(Activity, FuncActivityType.WithDraw); }; //银行卡 rl_bankCards.Click += (sender, e) => { EldYoungUtil.StartTargetActivity(Activity, FuncActivityType.BankCards); }; //交易记录 rl_DealRecords.Click += (sender, e) => { EldYoungUtil.StartTargetActivity(Activity, FuncActivityType.DealRecords); }; //日常缴费 rl_dailyPay.Click += (object sender, EventArgs e) => { EldYoungUtil.StartTargetActivity(Activity, FuncActivityType.DailyPay); }; //更多 rl_respect.Click += (sender, e) => { //todo nothing }; //初始化加载完成 new Handler().PostDelayed(() => { if (EldYoungUtil.HasLogin) { //第一次进入设置自动刷新view pull_refresh_scroll_finance.Refreshing = true; } }, 500); }
/// <summary> /// Valids the input. /// </summary> /// <returns><c>true</c>, if input was valided, <c>false</c> otherwise.</returns> private bool ValidInput() { phoneNumber = edit_prePhoneNo.Text; if (string.IsNullOrEmpty(phoneNumber) || !EldYoungUtil.IsMobileNo(phoneNumber)) { Toast.MakeText(this, "输入正确规范的手机号,且不能为空", ToastLength.Short).Show(); return(false); } return(true); }
/// <summary> ///获取交易详情 /// </summary> private void LoadData(string dealRecordId) { ProgressDialogUtil.StartProgressDialog(this, "正在获取交易详细数据..."); //检测网络连接 if (!EldYoungUtil.IsConnected(this)) { Toast.MakeText(this, "网络连接超时,请检测网路", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; } //todo:调用webservice赋值 }
private void InitView() { //设置标题栏 var btn_header_back = FindViewById <Button> (Resource.Id.btn_header_back); btn_header_back.Click += (sender, e) => { this.Finish(); OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight); }; var tv_header_title = FindViewById <TextView> (Resource.Id.tv_header_title); tv_header_title.Text = "关于我们"; var tv_appversion = FindViewById <TextView> (Resource.Id.tv_appversion); tv_appversion.Text = "乐老族Android版 V" + EldYoungUtil.GetAppVersionCode(this); }
/// <summary> /// Valids the input. /// </summary> /// <returns><c>true</c>, if input was valided, <c>false</c> otherwise.</returns> private bool ValidInput() { nickName = edit_RegisterName.Text; if (string.IsNullOrEmpty(nickName)) { Toast.MakeText(this, "用户名不能为空,请先填写用户名", ToastLength.Short).Show(); return(false); } if (!EldYoungUtil.IsValidUserName(nickName)) { Toast.MakeText(this, "请输入规范的用户名,建议由中英文、数字、下划线组成", ToastLength.Short).Show(); return(false); } passWord = edit_PassWord.Text; if (string.IsNullOrEmpty(passWord)) { Toast.MakeText(this, "密码不能为空,请输入密码", ToastLength.Short).Show(); return(false); } if (!EldYoungUtil.IsPassWord(passWord)) { Toast.MakeText(this, "请输入规范的密码,建议由字母、数字和符号两种以上组成", ToastLength.Short).Show(); return(false); } confirmPassWord = edit_ConfirmPassWord.Text; if (string.IsNullOrEmpty(confirmPassWord)) { Toast.MakeText(this, "确认密码不能为空,请输入确认密码", ToastLength.Short).Show(); return(false); } if (passWord != confirmPassWord) { Toast.MakeText(this, "输入两次密码不一致,请检查", ToastLength.Short).Show(); return(false); } phoneNumber = edit_Phone.Text; if (string.IsNullOrEmpty(phoneNumber) || !EldYoungUtil.IsMobileNo(phoneNumber)) { Toast.MakeText(this, "输入正确规范的手机号,且不能为空", ToastLength.Short).Show(); return(false); } return(true); }
/// <summary> /// 设置alias /// </summary> /// <param name="alias">Alias.</param> public void SetAlias(string alias) { if (string.IsNullOrEmpty(alias)) { return; } if (!EldYoungUtil.IsValidTagAndAlias(alias)) { return; } //判断是否已经设置过别名,若设置过,将不在设置 var jpush_alias = sp_jpushInfo.GetString(Global.Jpush_Alias, string.Empty); if (alias == jpush_alias) { return; } //使用hanlder异步设置alias handler.SendMessage(handler.ObtainMessage(MSG_SET_ALIAS, alias)); }
private void InitView() { //设置标题栏 var img_header_back = FindViewById <ImageView> (Resource.Id.img_header_back); img_header_back.Click += (sender, e) => { this.Finish(); OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight); }; var tv_back = FindViewById <TextView> (Resource.Id.tv_back); tv_back.Text = "返回"; var tv_desc = FindViewById <TextView> (Resource.Id.tv_desc); tv_desc.Text = "关于我们"; var tv_appversion = FindViewById <TextView> (Resource.Id.tv_appversion); tv_appversion.Text = "社区中心Android版 V" + EldYoungUtil.GetAppVersionCode(this); }
/// <summary> /// 事件处理程序 /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> private void ActionHandler(object sender, EventArgs e) { var btnAction = sender as Button; var item = (GetApplyInfoListItem)btnAction.Tag; var actionflag = btnAction.GetTag(Resource.Id.ll_action); ProgressDialogUtil.StartProgressDialog(activity, "正在处理中..."); //检测网络连接 if (!EldYoungUtil.IsConnected(activity)) { Toast.MakeText(activity, "网络连接超时,请检测网路", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; } examinebundGuardianParam.Ifagreen = actionflag.ToString(); examinebundGuardianParam.Id = item.Id; if (!requestParams.ContainsKey("eId")) { requestParams.Add("eId", examinebundGuardianParam.Eid); } else { requestParams ["eId"] = examinebundGuardianParam.Eid; } if (!requestParams.ContainsKey("eifagreen")) { requestParams.Add("eifagreen", examinebundGuardianParam.Eifagreen); } else { requestParams ["eifagreen"] = examinebundGuardianParam.Eifagreen; } if (!requestParams.ContainsKey("eaction")) { requestParams.Add("eaction", examinebundGuardianParam.Eaction); } else { requestParams ["eaction"] = examinebundGuardianParam.Eaction; } if (!requestParams.ContainsKey("md5")) { requestParams.Add("md5", examinebundGuardianParam.Md5); } else { requestParams ["md5"] = examinebundGuardianParam.Md5; } if (!requestParams.ContainsKey("key")) { requestParams.Add("key", examinebundGuardianParam.Key); } else { requestParams ["key"] = examinebundGuardianParam.Key; } //设置restsharprequest if (restSharpRequestHelp == null) { restSharpRequestHelp = new RestSharpRequestHelp(examinebundGuardianParam.Url, requestParams); } else { restSharpRequestHelp.RequestParams = requestParams; } restSharpRequestHelp.ExcuteAsync((RestSharp.IRestResponse response) => { if (response.ResponseStatus == RestSharp.ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK) { var result = response.Content; var examinebundGuardianJson = JsonConvert.DeserializeObject <ExamineBundGuardianJson>(result); if (examinebundGuardianJson.statuscode == "1") { activity.RunOnUiThread(() => { Toast.MakeText(activity, "处理成功...", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); Remove(item); return; }); } else { activity.RunOnUiThread(() => { Toast.MakeText(activity, "处理失败,稍后在试...", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } } else if (response.ResponseStatus == RestSharp.ResponseStatus.TimedOut) { activity.RunOnUiThread(() => { Toast.MakeText(activity, "网络连接超时,稍后在试...", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } else { activity.RunOnUiThread(() => { Toast.MakeText(activity, response.StatusDescription, ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } }); }
/// <summary> /// 加载数据 /// </summary> private void loadData() { //检测网络连接 if (!EldYoungUtil.IsConnected(this)) { Toast.MakeText(this, "网络连接超时,请检测网络", ToastLength.Short).Show(); return; } if (!requestParams.ContainsKey("key")) { requestParams.Add("key", getApplyInfoParam.Key); } else { requestParams ["key"] = getApplyInfoParam.Key; } if (!requestParams.ContainsKey("eId")) { requestParams.Add("eId", getApplyInfoParam.Eid); } else { requestParams ["eId"] = getApplyInfoParam.Eid; } if (!requestParams.ContainsKey("eaction")) { requestParams.Add("eaction", getApplyInfoParam.Eaction); } else { requestParams ["eaction"] = getApplyInfoParam.Eaction; } if (!requestParams.ContainsKey("md5")) { requestParams.Add("md5", getApplyInfoParam.Md5); } else { requestParams ["md5"] = getApplyInfoParam.Md5; } //设置restsharprequest if (restSharpRequestHelp == null) { restSharpRequestHelp = new RestSharpRequestHelp(getApplyInfoParam.Url, requestParams); } else { restSharpRequestHelp.RequestParams = requestParams; } restSharpRequestHelp.ExcuteAsync((RestSharp.IRestResponse response) => { if (response.ResponseStatus == RestSharp.ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK) { var result = response.Content; var getApplyInfoJson = JsonConvert.DeserializeObject <GetApplyInfoJson>(result); if (getApplyInfoJson.statuscode == "1") { RunOnUiThread(() => { getApplyInfoAdapter.Clear(); //清空所有数据 getApplyInfoAdapter.AddAll(getApplyInfoJson.data); getApplyInfoAdapter.NotifyDataSetChanged(); guardianApplyRefreshListView.OnRefreshComplete(); HasLoadedOnce = true; }); } else { RunOnUiThread(() => { Toast.MakeText(this, "获取监护申请信息失败,稍后在试...", ToastLength.Short).Show(); guardianApplyRefreshListView.OnRefreshComplete(); return; }); } } else if (response.ResponseStatus == RestSharp.ResponseStatus.TimedOut) { RunOnUiThread(() => { Toast.MakeText(this, "网络连接超时,稍后在试...", ToastLength.Short).Show(); guardianApplyRefreshListView.OnRefreshComplete(); return; }); } else { RunOnUiThread(() => { Toast.MakeText(this, response.StatusDescription, ToastLength.Short).Show(); guardianApplyRefreshListView.OnRefreshComplete(); return; }); } }); }
/// <summary> /// 发送消息 /// </summary> /// <param name="phoneNum">Phone number.</param> private void SendSMS(string _phoneNumber) { ProgressDialogUtil.StartProgressDialog(this, "正在发送验证码..."); //检测网络连接 if (!EldYoungUtil.IsConnected(this)) { Toast.MakeText(this, "网络连接超时,请检测网路", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; } var smsInfoParam = new SmsInfoParam() { PhoneNumber = phoneNumber, NickName = nickName, PassWord = passWord }; //使用restsharpApi方式 SetRestRequestParams(smsInfoParam); var restSharpRequestHelp = new RestSharpRequestHelp(smsInfoParam.Url, requestParams); restSharpRequestHelp.ExcuteAsync((resoponse) => { if (resoponse.ResponseStatus == ResponseStatus.Completed && resoponse.StatusCode == System.Net.HttpStatusCode.OK) { //获取并解析返回resultJson获取安全码结果值 var result = resoponse.Content; var smsJson = JsonConvert.DeserializeObject <SmsJson>(result); if (smsJson.statuscode == "1") { RunOnUiThread(() => { Intent intent = new Intent(this, typeof(RegisterResultActivity)); var bundle = new Bundle(); bundle.PutString("phoneNum", phoneNumber); bundle.PutString("nickName", nickName); bundle.PutString("passWord", passWord); bundle.PutString("securityCode", smsJson.data.ToString()); intent.PutExtras(bundle); StartActivity(intent); }); } else { RunOnUiThread(() => { Toast.MakeText(this, smsJson.message, ToastLength.Short).Show(); }); } } else if (resoponse.ResponseStatus == ResponseStatus.TimedOut) { RunOnUiThread(() => { Toast.MakeText(this, "网络连接超时", ToastLength.Short).Show(); }); } else { RunOnUiThread(() => { Toast.MakeText(this, resoponse.StatusDescription, ToastLength.Short).Show(); }); } RunOnUiThread(() => { ProgressDialogUtil.StopProgressDialog(); return; }); }); }
/// <summary> /// 发送消息 /// </summary> /// <param name="phoneNum">Phone number.</param> private void SendSMS(string _phoneNumber) { ProgressDialogUtil.StartProgressDialog(this, "正在发送验证码..."); //检测网络连接 if (!EldYoungUtil.IsConnected(this)) { Toast.MakeText(this, "网络连接超时,请检测网路", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; } var smsInfoParam = new SmsInfoParam() { PhoneNumber = phoneNum, NickName = nickName, PassWord = passWord }; //使用restsharpApi方式 SetRestRequestParams(smsInfoParam); var restSharpRequestHelp = new RestSharpRequestHelp(smsInfoParam.Url, requestSmsParams); restSharpRequestHelp.ExcuteAsync((response) => { if (response.ResponseStatus == ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK) { //获取并解析返回resultJson获取安全码结果值 var resultJson = response.Content; var smsJson = JsonConvert.DeserializeObject <SmsJson>(resultJson); if (smsJson.statuscode == "1") { RunOnUiThread(() => { securityCode = smsJson.data.ToString(); mc.Start(); tv_SendCodeStatusShow.Visibility = ViewStates.Visible; }); } else { RunOnUiThread(() => { tv_SendCodeStatusShow.Visibility = ViewStates.Invisible; Toast.MakeText(this, smsJson.message, ToastLength.Short).Show(); }); } } else if (response.ResponseStatus == ResponseStatus.TimedOut) { RunOnUiThread(() => { tv_SendCodeStatusShow.Visibility = ViewStates.Invisible; Toast.MakeText(this, "网络连接超时", ToastLength.Short).Show(); }); } else { RunOnUiThread(() => { tv_SendCodeStatusShow.Visibility = ViewStates.Invisible; Toast.MakeText(this, response.StatusDescription, ToastLength.Short).Show(); }); } RunOnUiThread(() => { ProgressDialogUtil.StopProgressDialog(); return; }); }); }
private void LoadDetailData() { ProgressDialogUtil.StartProgressDialog(this, "正在加载报警详细数据..."); if (string.IsNullOrEmpty(alarmId)) { ProgressDialogUtil.StopProgressDialog(); return; } //检测网络连接 if (!EldYoungUtil.IsConnected(this)) { Toast.MakeText(this, "网络连接超时,请检测网路", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; } alarmInfoDetailParam = new AlarmInfoDetailParam() { AId = alarmId }; if (!requestParams.ContainsKey("key")) { requestParams.Add("key", alarmInfoDetailParam.Key); } else { requestParams ["eAId"] = alarmInfoDetailParam.Key; } if (!requestParams.ContainsKey("eAId")) { requestParams.Add("eAId", alarmInfoDetailParam.EaId); } if (!requestParams.ContainsKey("eaction")) { requestParams.Add("eaction", alarmInfoDetailParam.Eaction); } else { requestParams ["eaction"] = alarmInfoDetailParam.Eaction; } if (!requestParams.ContainsKey("md5")) { requestParams.Add("md5", alarmInfoDetailParam.Md5); } else { requestParams ["md5"] = alarmInfoDetailParam.Md5; } //设置restsharprequest if (restSharpRequestHelp == null) { restSharpRequestHelp = new RestSharpRequestHelp(alarmInfoDetailParam.Url, requestParams); } else { restSharpRequestHelp.RequestParams = requestParams; } //调用webservice restSharpRequestHelp.ExcuteAsync((RestSharp.IRestResponse response) => { if (response.ResponseStatus == ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK) { var result = response.Content; var alarmdetailInfoJson = JsonConvert.DeserializeObject <SearchAlarmDeatilInfoJson>(result); if (alarmdetailInfoJson.statuscode == "1") { if (alarmdetailInfoJson.data.detail.Count > 0) { var detail = alarmdetailInfoJson.data.detail[0]; RunOnUiThread(() => { tv_detail_alamTime.Text = string.IsNullOrEmpty(detail.AlarmTime)?string.Empty:Convert.ToDateTime(detail.AlarmTime).ToString("yyyy-MM-dd HH:mm:ss"); tv_detail_alarmContent.Text = EldYoungUtil.FormatStrVaue(detail.AlarmContent); tv_detail_alarmDeviceId.Text = EldYoungUtil.FormatStrVaue(detail.AlarmDeviceId); tv_detail_alarmPosition.Text = EldYoungUtil.FormatStrVaue(detail.AlarmPosition); alarmPosition = EldYoungUtil.FormatStrVaue(detail.AlarmPosition); tv_detail_alarmWay.Text = EldYoungUtil.FormatStrVaue(detail.AlarmWay); tv_detail_cphoneNumberOne.Text = EldYoungUtil.FormatStrVaue(detail.CPhoneNumberOne); tv_detail_cTrueName.Text = EldYoungUtil.FormatStrVaue(detail.CTrueName); tv_detail_deviceElectricity.Text = EldYoungUtil.FormatStrVaue(detail.DeviceElectricity); tv_detail_handleUserType.Text = EldYoungUtil.FormatStrVaue(detail.HandleUserType); tv_detail_remark.Text = EldYoungUtil.FormatStrVaue(detail.Remark); tv_detail_status.Text = EldYoungUtil.FormatStrVaue(detail.Status); tv_detail_trueName.Text = EldYoungUtil.FormatStrVaue(detail.TrueName); }); } if (alarmdetailInfoJson.data.handdetail.Count > 0) { var handleDetails = alarmdetailInfoJson.data.handdetail; RunOnUiThread(() => { lv_handleDetail.Adapter = new AlarmHandleDetailInfoAdapter(this, handleDetails); }); } RunOnUiThread(() => { ProgressDialogUtil.StopProgressDialog(); }); } else { RunOnUiThread(() => { Toast.MakeText(this, "获取报警详情信息错误...", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } } else if (response.ResponseStatus == ResponseStatus.TimedOut) { RunOnUiThread(() => { Toast.MakeText(this, "网络连接超时,稍后在试...", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } else { RunOnUiThread(() => { Toast.MakeText(this, response.StatusDescription, ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } }); }
private void InitView() { //设置标题栏 var img_header_back = FindViewById <ImageView> (Resource.Id.img_header_back); img_header_back.Click += (sender, e) => { this.Finish(); OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight); }; var tv_back = FindViewById <TextView> (Resource.Id.tv_back); tv_back.Text = "返回"; var tv_desc = FindViewById <TextView> (Resource.Id.tv_desc); tv_desc.Text = "生活缴费"; rl_chargePhone = FindViewById <RelativeLayout> (Resource.Id.rl_chargePhone); rl_chargePhone.Click += (sender, e) => { EldYoungUtil.StartTargetActivity(this, FuncActivityType.ChargePhone); }; rl_chargeWater = FindViewById <RelativeLayout> (Resource.Id.rl_chargeWater); rl_chargeWater.Click += (sender, e) => { EldYoungUtil.StartTargetActivity(this, FuncActivityType.ChargeWater); }; rl_chargeEle = FindViewById <RelativeLayout> (Resource.Id.rl_chargeEle); rl_chargeEle.Click += (sender, e) => { EldYoungUtil.StartTargetActivity(this, FuncActivityType.ChargeEle); }; rl_chargeGas = FindViewById <RelativeLayout> (Resource.Id.rl_chargeGas); rl_chargeGas.Click += (sender, e) => { EldYoungUtil.StartTargetActivity(this, FuncActivityType.ChargeGas); }; rl_chargeTv = FindViewById <RelativeLayout> (Resource.Id.rl_chargeTv); rl_chargeTv.Click += (sender, e) => { EldYoungUtil.StartTargetActivity(this, FuncActivityType.ChargeTv); }; rl_chargeFix = FindViewById <RelativeLayout> (Resource.Id.rl_chargeFix); rl_chargeFix.Click += (sender, e) => { EldYoungUtil.StartTargetActivity(this, FuncActivityType.ChargeFix); }; rl_chargeOil = FindViewById <RelativeLayout> (Resource.Id.rl_chargeOil); rl_chargeOil.Click += (sender, e) => { EldYoungUtil.StartTargetActivity(this, FuncActivityType.ChargeOil); }; rl_chargeTraffic = FindViewById <RelativeLayout> (Resource.Id.rl_chargeTraffic); rl_chargeTraffic.Click += (sender, e) => { EldYoungUtil.StartTargetActivity(this, FuncActivityType.ChargeTraffic); }; }
/// <summary> /// 保存 /// </summary> private void Save() { var locationthreelevel = edit_locationthreelevel.Text; //todo:采用选择框赋值 var locationdetail = edit_locationdeatil.Text; if (string.IsNullOrEmpty(locationthreelevel) || string.IsNullOrEmpty(locationdetail)) { Toast.MakeText(this, "省市区或实际地址不能为空,请输入", ToastLength.Short).Show(); return; } var contactAddress = locationthreelevel + locationdetail; ProgressDialogUtil.StartProgressDialog(this, "正在保存..."); //检测网络连接 if (!EldYoungUtil.IsConnected(this)) { Toast.MakeText(this, "网络连接超时,请检测网络", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; } var updateMyInfoParam = new UpdateMyInfoParam() { Uid = Global.MyInfo.UId, ParamType = "ContactAddress", ParamValue = contactAddress }; if (!requestParams.ContainsKey("key")) { requestParams.Add("key", updateMyInfoParam.Key); } else { requestParams ["key"] = updateMyInfoParam.Key; } if (!requestParams.ContainsKey("eUId")) { requestParams.Add("eUId", updateMyInfoParam.Euid); } else { requestParams ["eUId"] = updateMyInfoParam.Euid; } if (!requestParams.ContainsKey("eparamType")) { requestParams.Add("eparamType", updateMyInfoParam.EparamType); } else { requestParams ["eparamType"] = updateMyInfoParam.EparamType; } if (!requestParams.ContainsKey("eparamValue")) { requestParams.Add("eparamValue", updateMyInfoParam.EparamValue); } else { requestParams ["eparamValue"] = updateMyInfoParam.EparamValue; } if (!requestParams.ContainsKey("md5")) { requestParams.Add("md5", updateMyInfoParam.Md5); } else { requestParams ["md5"] = updateMyInfoParam.Md5; } var restSharpRequestHelp = new RestSharpRequestHelp(updateMyInfoParam.Url, requestParams); restSharpRequestHelp.ExcuteAsync((RestSharp.IRestResponse response) => { if (response.ResponseStatus == RestSharp.ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK) { //获取并解析返回resultJson获取安全码结果值 var result = response.Content; var updateMyInfoJson = JsonConvert.DeserializeObject <UpdateMyInfoJson>(result); if (updateMyInfoJson.statuscode == "1") { RunOnUiThread(() => { Toast.MakeText(this, "保存成功", ToastLength.Short).Show(); Global.MyInfo.ContactAddress = contactAddress; ProgressDialogUtil.StopProgressDialog(); this.Finish(); OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight); }); } else { RunOnUiThread(() => { Toast.MakeText(this, updateMyInfoJson.message, ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } } else if (response.ResponseStatus == RestSharp.ResponseStatus.TimedOut) { RunOnUiThread(() => { Toast.MakeText(this, "网络连接超时,请重试", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } else { RunOnUiThread(() => { Toast.MakeText(this, response.StatusDescription, ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } }); }
/// <summary> /// Reister this instance. /// </summary> private void Reister() { ProgressDialogUtil.StartProgressDialog(this, "正在注册..."); //检测网络连接 if (!EldYoungUtil.IsConnected(this)) { Toast.MakeText(this, "网络连接超时,请检测网路", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; } //todo:调用restapi注册,将用户名、密码信息写 var registerInfoParam = new RegisterInfoParam() { PhoneNumber = phoneNum, NickName = nickName, PassWord = passWord }; //初始化参数 SetRestRequestParams(registerInfoParam); var restSharpRequestHelp = new RestSharpRequestHelp(registerInfoParam.Url, requestParams); restSharpRequestHelp.ExcuteAsync((response) => { if (response.ResponseStatus == ResponseStatus.Completed) { //获取并解析返回resultJson获取Guid结果值 if (response.StatusCode == System.Net.HttpStatusCode.OK) { var resultJson = response.Content; var registerJson = JsonConvert.DeserializeObject <RegisterJson>(resultJson); if (registerJson.statuscode == "1") { Global.MyInfo = registerJson.data.Table[0]; var Uid = Global.MyInfo.UId; Global.Guid = Uid; //登录成功,将登录guid写入refrence文件 sp_userinfo.Edit().PutString(Global.refrence_Guid, Uid).Commit(); var guidAsAlias = Uid.Replace("-", "_"); //注册用户成功,写极光推送别名,进入主界面 _jpushUtil.SetAlias(guidAsAlias); sp_userinfo.Edit().PutString(Global.refrence_UserName, nickName).Commit(); sp_userinfo.Edit().PutString(Global.refrence_Password, passWord).Commit(); sp_userinfo.Edit().PutBoolean(Global.refrence_Password_Check, true).Commit(); RunOnUiThread(() => { //跳转到功能主界面 var intent = new Intent(this, typeof(MainActivity)); intent.SetFlags(ActivityFlags.ClearTask | ActivityFlags.NewTask); StartActivity(intent); this.Finish(); ProgressDialogUtil.StopProgressDialog(); Toast.MakeText(this, "注册成功", ToastLength.Short).Show(); OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight); }); } else { //注册失败 RunOnUiThread(() => { Toast.MakeText(this, registerJson.message, ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } } } else if (response.ResponseStatus == ResponseStatus.TimedOut) { RunOnUiThread(() => { Toast.MakeText(this, "网络连接超时", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } else { RunOnUiThread(() => { Toast.MakeText(this, response.StatusDescription, ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } }); }
/// <summary> /// 发送验证码 /// </summary> private void SendCode() { ProgressDialogUtil.StartProgressDialog(this, "正在发送验证码..."); //检测网络连接 if (!EldYoungUtil.IsConnected(this)) { Toast.MakeText(this, "网络连接超时,请检测网络", ToastLength.Short).Show(); btn_Send.Enabled = true; ProgressDialogUtil.StopProgressDialog(); return; } var sendCodeParam = new SendCodeParam() { PhoneNumberOne = phoneNumber, Type = "" }; //使用restsharpApi方式 SetRestRequestSendCodeParams(sendCodeParam); var restSharpRequestHelp = new RestSharpRequestHelp(sendCodeParam.Url, requestsendcodeParams); restSharpRequestHelp.ExcuteAsync((RestSharp.IRestResponse response) => { if (response.ResponseStatus == RestSharp.ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK) { //获取并解析返回resultJson获取安全码结果值 var result = response.Content; var sendCodeJson = JsonConvert.DeserializeObject <SendCodeJson>(result); if (sendCodeJson.statuscode == "1") { RunOnUiThread(() => { securityCode = sendCodeJson.data.ToString(); ProgressDialogUtil.StopProgressDialog(); Toast.MakeText(this, "验证码发送成功", ToastLength.Short).Show(); tv_SendCodeStatusShow.Visibility = ViewStates.Visible; mc.Start(); }); } else { RunOnUiThread(() => { Toast.MakeText(this, sendCodeJson.message, ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); btn_Send.Enabled = true; tv_SendCodeStatusShow.Visibility = ViewStates.Invisible; return; }); } } else if (response.ResponseStatus == RestSharp.ResponseStatus.TimedOut) { RunOnUiThread(() => { Toast.MakeText(this, "网络连接超时", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); btn_Send.Enabled = true; tv_SendCodeStatusShow.Visibility = ViewStates.Invisible; return; }); } else { RunOnUiThread(() => { Toast.MakeText(this, response.StatusDescription, ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); btn_Send.Enabled = true; tv_SendCodeStatusShow.Visibility = ViewStates.Invisible; return; }); } }); }
private void InitView() { //设置标题栏 var img_header_back = FindViewById <ImageView> (Resource.Id.img_header_back); img_header_back.Click += (sender, e) => { this.Finish(); OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight); }; var tv_back = FindViewById <TextView> (Resource.Id.tv_back); tv_back.Text = "返回"; var tv_desc = FindViewById <TextView> (Resource.Id.tv_desc); tv_desc.Text = "填写短信验证码"; btn_Submit = FindViewById <Button> (Resource.Id.btn_Submit); btn_Send = FindViewById <Button> (Resource.Id.btn_Send); tv_PhoneShow = FindViewById <TextView> (Resource.Id.tv_PhoneShow); edit_SecurityCode = FindViewById <EditText> (Resource.Id.edit_SecurityCode); tv_SendCodeStatusShow = FindViewById <TextView>(Resource.Id.tv_SendCodeStatusShow); //取得上一页面传递过来的值 var bundle = Intent.Extras; //从bundle中获取值赋值显示 phoneNum = bundle.GetString("phoneNum"); nickName = bundle.GetString("nickName"); passWord = bundle.GetString("passWord"); securityCode = bundle.GetString("securityCode"); tv_PhoneShow.Text = phoneNum; //初始化计时器,启动 mc = new MyCount(this, 60000, 1000); mc.Start(); edit_SecurityCode.TextChanged += (sender, e) => { if (edit_SecurityCode.Text.Length > 0) { btn_Submit.Enabled = true; btn_Submit.SetBackgroundResource(Resource.Color.blue); } else { btn_Submit.Enabled = false; btn_Submit.SetBackgroundResource(Resource.Color.lightgray); } }; btn_Submit.Click += (sender, e) => { var inputCode = edit_SecurityCode.Text; if (string.IsNullOrEmpty(inputCode) || !EldYoungUtil.IsSecurityCode(inputCode)) { Toast.MakeText(this, "请输入接收到的手机验证码,且不能为空", ToastLength.Short).Show(); return; } if (inputCode != securityCode) { Toast.MakeText(this, "输入验证码不正确,请重新填写", ToastLength.Short).Show(); return; } Reister(); }; //发送验证码 btn_Send.Click += (sender, e) => { tv_SendCodeStatusShow.Visibility = ViewStates.Invisible; btn_Send.Clickable = false; btn_Send.SetBackgroundResource(Resource.Color.lightgray); btn_Send.SetTextColor(Resources.GetColor(Resource.Color.ingray)); SendSMS(phoneNum); }; }
/// <summary> /// 申请绑定监护人 /// </summary> /// <param name="item">Item.</param> /// <param name="applyMsgContent">Apply message content.</param> private void ApplyBindGuardian(SearchGuardianListItem item, string applyMsgContent) { ProgressDialogUtil.StartProgressDialog(activity, "正在申请中..."); //检测网络连接 if (!EldYoungUtil.IsConnected(activity)) { Toast.MakeText(activity, "网络连接超时,请检测网路", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; } applyBindGuardianParam.GId = item.UId; applyBindGuardianParam.ApplyContent = applyMsgContent; if (!requestParams.ContainsKey("key")) { requestParams.Add("key", applyBindGuardianParam.Key); } else { requestParams ["key"] = applyBindGuardianParam.Key; } if (!requestParams.ContainsKey("eapplycontent")) { requestParams.Add("eapplycontent", applyBindGuardianParam.EapplyContent); } else { requestParams ["eapplycontent"] = applyBindGuardianParam.EapplyContent; } if (!requestParams.ContainsKey("eUserId")) { requestParams.Add("eUserId", applyBindGuardianParam.EuserId); } else { requestParams ["eUserId"] = applyBindGuardianParam.EuserId; } if (!requestParams.ContainsKey("egid")) { requestParams.Add("egid", applyBindGuardianParam.Egid); } else { requestParams ["egid"] = applyBindGuardianParam.Egid; } if (!requestParams.ContainsKey("eaction")) { requestParams.Add("eaction", applyBindGuardianParam.Eaction); } else { requestParams ["eaction"] = applyBindGuardianParam.Eaction; } if (!requestParams.ContainsKey("md5")) { requestParams.Add("md5", applyBindGuardianParam.Md5); } else { requestParams ["md5"] = applyBindGuardianParam.Md5; } //设置restsharprequest if (restSharpRequestHelp == null) { restSharpRequestHelp = new RestSharpRequestHelp(applyBindGuardianParam.Url, requestParams); } else { restSharpRequestHelp.RequestParams = requestParams; } restSharpRequestHelp.ExcuteAsync((RestSharp.IRestResponse response) => { if (response.ResponseStatus == RestSharp.ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK) { var result = response.Content; var applyGuardianJson = JsonConvert.DeserializeObject <ApplyForGuardianJson>(result); if (applyGuardianJson.statuscode == "1") { if (applyGuardianJson.data == "1") { activity.RunOnUiThread(() => { Toast.MakeText(activity, "申请绑定监护人成功", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } else { activity.RunOnUiThread(() => { Toast.MakeText(activity, "申请绑定失败,稍后在试...", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } } else { activity.RunOnUiThread(() => { Toast.MakeText(activity, "申请绑定失败,稍后在试...", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } } else if (response.ResponseStatus == RestSharp.ResponseStatus.TimedOut) { activity.RunOnUiThread(() => { Toast.MakeText(activity, "网络连接超时,稍后在试...", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } else { activity.RunOnUiThread(() => { Toast.MakeText(activity, response.StatusDescription, ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } activity.RunOnUiThread(() => { if (RefreshAction != null) { RefreshAction(); } }); }); }
private void PublishAdvice() { var adviceTitle = edit_advice_title.Text; if (string.IsNullOrEmpty(adviceTitle)) { Toast.MakeText(Activity, "留言标题不能为空,请输入标题", ToastLength.Short).Show(); return; } var adviceContent = edit_advice_content.Text; if (string.IsNullOrEmpty(adviceContent)) { Toast.MakeText(Activity, "留言内容不能为空,请输入留言内容", ToastLength.Short).Show(); return; } ProgressDialogUtil.StartProgressDialog(Activity, "正在保存..."); //检测网络连接 if (!EldYoungUtil.IsConnected(Activity)) { Toast.MakeText(Activity, "网络连接超时,请检测网络", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; } //调用restapi注册,将用户名、密码信息写 var adviceWriteParam = new AdviceWriteParam() { UId = Global.Guid, AdviceType = _adviceType, AdviceTitle = adviceTitle, AdviceContent = adviceContent }; if (!requestParams.ContainsKey("key")) { requestParams.Add("key", adviceWriteParam.Key); } else { requestParams ["key"] = adviceWriteParam.Key; } if (!requestParams.ContainsKey("eaction")) { requestParams.Add("eaction", adviceWriteParam.Eaction); } else { requestParams ["eaction"] = adviceWriteParam.Eaction; } if (!requestParams.ContainsKey("eUId")) { requestParams.Add("eUId", adviceWriteParam.Euid); } else { requestParams ["eUId"] = adviceWriteParam.Euid; } if (!requestParams.ContainsKey("eAdviceType")) { requestParams.Add("eAdviceType", adviceWriteParam.EadviceType); } else { requestParams ["eAdviceType"] = adviceWriteParam.EadviceType; } if (!requestParams.ContainsKey("ePlatformType")) { requestParams.Add("ePlatformType", adviceWriteParam.EplatformType); } else { requestParams ["ePlatformType"] = adviceWriteParam.EplatformType; } if (!requestParams.ContainsKey("eAdviceTitle")) { requestParams.Add("eAdviceTitle", adviceWriteParam.EadviceTitle); } else { requestParams ["eAdviceTitle"] = adviceWriteParam.EadviceTitle; } if (!requestParams.ContainsKey("eAdviceContent")) { requestParams.Add("eAdviceContent", adviceWriteParam.EadviceContent); } else { requestParams ["eAdviceContent"] = adviceWriteParam.EadviceContent; } if (!requestParams.ContainsKey("md5")) { requestParams.Add("md5", adviceWriteParam.Md5); } else { requestParams ["md5"] = adviceWriteParam.Md5; } var restSharpRequestHelp = new RestSharpRequestHelp(adviceWriteParam.Url, requestParams); restSharpRequestHelp.ExcuteAsync((RestSharp.IRestResponse response) => { if (response.ResponseStatus == RestSharp.ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK) { //获取并解析返回resultJson获取安全码结果值 var result = response.Content; var adviceWriteJson = JsonConvert.DeserializeObject <AdviceWriteJson>(result); if (adviceWriteJson.statuscode == "1") { Activity.RunOnUiThread(() => { Toast.MakeText(Activity, "保存成功", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); }); } else { Activity.RunOnUiThread(() => { Toast.MakeText(Activity, adviceWriteJson.message, ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } } else if (response.ResponseStatus == RestSharp.ResponseStatus.TimedOut) { Activity.RunOnUiThread(() => { Toast.MakeText(Activity, "网络连接超时,请重试", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } else { Activity.RunOnUiThread(() => { Toast.MakeText(Activity, response.StatusDescription, ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } }); }
private void InitView() { //设置标题栏 var img_header_back = FindViewById <ImageView> (Resource.Id.img_header_back); img_header_back.Click += (sender, e) => { this.Finish(); OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight); }; var tv_back = FindViewById <TextView> (Resource.Id.tv_back); tv_back.Text = "返回"; var tv_desc = FindViewById <TextView> (Resource.Id.tv_desc); //取得上一页面传递过来的值包括是什么类型发送验证码(找回密码\修改支付密码\修改密码) var bundle = Intent.Extras; sendType = bundle.GetString("SendType"); phoneNumber = bundle.GetString("PhoneNumber"); tv_SendCodeStatusShow = FindViewById <TextView>(Resource.Id.tv_SendCodeStatusShow); edit_Phone = FindViewById <EditText> (Resource.Id.edit_Phone); edit_Phone.Text = phoneNumber; if (sendType == "FindPwd") { tv_desc.Text = "找回登录密码"; edit_Phone.Enabled = true; edit_Phone.Hint = "请输入手机号"; } else if (sendType == "ModifyPwd") { tv_desc.Text = "修改登录密码"; edit_Phone.Enabled = false; SetPhoneNumberShow(); } else if (sendType == "ModifyPayPwd") { tv_desc.Text = "设置支付密码"; edit_Phone.Enabled = false; SetPhoneNumberShow(); } edit_SecurityCode = FindViewById <EditText> (Resource.Id.edit_SecurityCode); btn_Send = FindViewById <Button> (Resource.Id.btn_Send); btn_Next = FindViewById <Button> (Resource.Id.btn_Next); //初始化计时器,启动 mc = new MyCount(this, 60000, 1000); //发送验证码 btn_Send.Click += (sender, e) => { tv_SendCodeStatusShow.Visibility = ViewStates.Invisible; btn_Send.Enabled = false; SendCode(); }; edit_SecurityCode.TextChanged += (sender, e) => { if (edit_SecurityCode.Text.Length > 0) { btn_Next.Enabled = true; } else { btn_Next.Enabled = false; } }; //下一步 btn_Next.Click += (sender, e) => { var inputCode = edit_SecurityCode.Text; if (string.IsNullOrEmpty(inputCode) || !EldYoungUtil.IsSecurityCode(inputCode)) { Toast.MakeText(this, "请输入接收到的手机验证码,且不能为空", ToastLength.Short).Show(); return; } if (inputCode != securityCode) { Toast.MakeText(this, "输入验证码不正确,请重新填写", ToastLength.Short).Show(); return; } var intent = new Intent(this, typeof(SetPasswordActivity)); var nextbundle = new Bundle(); nextbundle.PutString("SendType", sendType); if (sendType == "FindPwd") { nextbundle.PutString("PhoneNumber", phoneNumber); } intent.PutExtras(nextbundle); StartActivity(intent); if (sendType != "FindPwd") { this.Finish(); } ProgressDialogUtil.StopProgressDialog(); }; //拨打客服 var tv_customPhone = FindViewById <TextView>(Resource.Id.tv_customPhone); var customPhoneNum = tv_customPhone.Text; tv_customPhone.Click += (sender, e) => { Intent intent = new Intent(Intent.ActionCall, Android.Net.Uri.Parse("tel:" + customPhoneNum)); StartActivity(intent); }; }
/// <summary> /// Submit this instance. /// </summary> private void Submit() { passWord = edit_Pwd.Text; if (string.IsNullOrEmpty(passWord)) { Toast.MakeText(this, "密码不能为空,请输入密码", ToastLength.Short).Show(); return; } confirmPassWord = edit_ConfirmPwd.Text; if (string.IsNullOrEmpty(confirmPassWord)) { Toast.MakeText(this, "确认密码不能为空,请输入确认密码", ToastLength.Short).Show(); return; } if (passWord != confirmPassWord) { Toast.MakeText(this, "输入两次密码不一致,请检查", ToastLength.Short).Show(); return; } if (!EldYoungUtil.IsPassWord(passWord)) { Toast.MakeText(this, "请输入正确规范用户名6-20位,建议由字母、数字和符号两种以上组成", ToastLength.Short).Show(); return; } ProgressDialogUtil.StartProgressDialog(this, "正在提交..."); //检测网络连接 if (!EldYoungUtil.IsConnected(this)) { Toast.MakeText(this, "网络连接超时,请检测网路", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; } //调用restapi注册,将用户名、密码信息写 var modipwdParam = new ModiyPasswordParam() { Type = sendType, Password = passWord }; if (sendType == "FindPwd") { modipwdParam.UId = phoneNumber; } else { modipwdParam.UId = Global.MyInfo.UId; } //初始化参数 SetRestRequestParams(modipwdParam); var restSharpRequestHelp = new RestSharpRequestHelp(modipwdParam.Url, requestsubmitParams); restSharpRequestHelp.ExcuteAsync((RestSharp.IRestResponse response) => { if (response.ResponseStatus == RestSharp.ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK) { //获取并解析返回resultJson获取安全码结果值 var result = response.Content; var setpwdJson = JsonConvert.DeserializeObject <SetPasswordJson>(result); if (setpwdJson.statuscode == "1") { RunOnUiThread(() => { Toast.MakeText(this, setpwdJson.message, ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); var intent = new Intent(this, typeof(LoginActivity)); intent.SetFlags(ActivityFlags.ClearTask | ActivityFlags.NewTask); StartActivity(intent); this.Finish(); }); } else { RunOnUiThread(() => { Toast.MakeText(this, setpwdJson.message, ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } } else if (response.ResponseStatus == RestSharp.ResponseStatus.TimedOut) { RunOnUiThread(() => { Toast.MakeText(this, "网络连接超时,请重试", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } else { RunOnUiThread(() => { Toast.MakeText(this, response.StatusDescription, ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } }); }
// private void OpenNotification(Context context,Bundle bundle) // { // //清除通知 // //JPushInterface.ClearNotificationById(context,bundle.GetInt(JPushInterface.ExtraNotificationId));//根据通知id // String extras = bundle.GetString(JPushInterface.ExtraExtra); // JPushInterface.ClearAllNotifications(context);//清除所有通知 // Intent intent = new Intent(context,typeof(AlarmDetailInfoActivity)); // bundle.PutString("alarmOrigin","Jpush"); // intent.PutExtras (bundle); // intent.SetFlags (ActivityFlags.NewTask); // context.StartActivity (intent); // } private void OpenNotification(Context context, Bundle bundle) { //清除所有通知 JPushInterface.ClearAllNotifications(context); //判断app进程是否存活 if (EldYoungUtil.IsApplive(context, "com.eldyoung.lelaozuandroidapp")) { //如果存活的话,就直接启动报警DetailActivity,但要考虑一种情况,就是app的进程虽然仍然在 //但Task栈已经空了,比如用户点击Back键退出应用,但进程还没有被系统回收,如果直接启动 //DetailActivity,再按Back键就不会返回任何界面了。所以在启动DetailActivity前,要先启动splash界面。 Log.Info("NotificationReceiver", "the app process is alive"); bool mainActivityexistflag = false; Intent mainIntent = new Intent(context, typeof(MainFragActivity)); var cmpName = mainIntent.ResolveActivity(context.PackageManager); if (cmpName != null) { //系统存在此activity ActivityManager _activityManager = (ActivityManager)context.GetSystemService(Context.ActivityService); var taskInfoLists = _activityManager.GetRunningTasks(20); foreach (ActivityManager.RunningTaskInfo taskInfo in taskInfoLists) { if (taskInfo.BaseActivity.Equals(cmpName)) { mainActivityexistflag = true; break; } } } //堆栈中不存在主界面活动,进入splash界面 if (!mainActivityexistflag) { Intent launchIntent = context.PackageManager.GetLaunchIntentForPackage("com.eldyoung.lelaozuandroidapp"); launchIntent.SetFlags( ActivityFlags.NewTask | ActivityFlags.ResetTaskIfNeeded); bundle.PutString("alarmOrigin", "Jpush"); launchIntent.PutExtras(bundle); context.StartActivity(launchIntent); } else { //堆栈中存在主界面活动 Intent alarmDetailInfoIntent = new Intent(context, typeof(AlarmDetailInfoActivity)); alarmDetailInfoIntent.SetFlags(ActivityFlags.NewTask | ActivityFlags.SingleTop); bundle.PutString("alarmOrigin", "Jpush"); alarmDetailInfoIntent.PutExtras(bundle); context.StartActivity(alarmDetailInfoIntent); } } else { //如果app进程已经被杀死,先重新启动app,将alarmDetailActivity的启动参数传入Intent中,参数经过 //SplashActivity传入MainActivity,此时app的初始化已经完成,在MainActivity中就可以根据传入,参数跳转到DetailActivity中去了 Log.Info("NotificationReceiver", "the app process is dead"); Intent launchIntent = context.PackageManager.GetLaunchIntentForPackage("com.eldyoung.lelaozuandroidapp"); launchIntent.SetFlags( ActivityFlags.NewTask | ActivityFlags.ResetTaskIfNeeded); bundle.PutString("alarmOrigin", "Jpush"); launchIntent.PutExtras(bundle); context.StartActivity(launchIntent); } }
/// <summary> /// 保存 /// </summary> private void Save() { var fixedPhonePre = edit_fixedphonePre.Text; var fixedPhoneLast = edit_fixedPhoneLast.Text; var fixedPhone = string.Empty; if (string.IsNullOrEmpty(fixedPhonePre) || string.IsNullOrEmpty(fixedPhoneLast)) { Toast.MakeText(this, "固定电话不能为空,请输入", ToastLength.Short).Show(); return; } else { fixedPhone = fixedPhonePre + "-" + fixedPhoneLast; if (!EldYoungUtil.IsFixedPhone(fixedPhone)) { Toast.MakeText(this, "请输入规范的固定电话号码", ToastLength.Short).Show(); return; } } ProgressDialogUtil.StartProgressDialog(this, "正在保存..."); //检测网络连接 if (!EldYoungUtil.IsConnected(this)) { Toast.MakeText(this, "网络连接超时,请检测网络", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; } //调用restapi注册,将用户名、密码信息写 var updateMyInfoParam = new UpdateMyInfoParam() { Uid = Global.Guid, ParamType = "TelePhoneNumber", ParamValue = fixedPhone }; if (!requestParams.ContainsKey("key")) { requestParams.Add("key", updateMyInfoParam.Key); } else { requestParams ["key"] = updateMyInfoParam.Key; } if (!requestParams.ContainsKey("eUId")) { requestParams.Add("eUId", updateMyInfoParam.Euid); } else { requestParams ["eUId"] = updateMyInfoParam.Euid; } if (!requestParams.ContainsKey("eparamType")) { requestParams.Add("eparamType", updateMyInfoParam.EparamType); } else { requestParams ["eparamType"] = updateMyInfoParam.EparamType; } if (!requestParams.ContainsKey("eparamValue")) { requestParams.Add("eparamValue", updateMyInfoParam.EparamValue); } else { requestParams ["eparamValue"] = updateMyInfoParam.EparamValue; } if (!requestParams.ContainsKey("md5")) { requestParams.Add("md5", updateMyInfoParam.Md5); } else { requestParams ["md5"] = updateMyInfoParam.Md5; } var restSharpRequestHelp = new RestSharpRequestHelp(updateMyInfoParam.Url, requestParams); restSharpRequestHelp.ExcuteAsync((RestSharp.IRestResponse response) => { if (response.ResponseStatus == RestSharp.ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK) { //获取并解析返回resultJson获取安全码结果值 var result = response.Content; var updateMyInfoJson = JsonConvert.DeserializeObject <UpdateMyInfoJson>(result); if (updateMyInfoJson.statuscode == "1") { RunOnUiThread(() => { Toast.MakeText(this, "保存成功", ToastLength.Short).Show(); Global.MyInfo.TelePhoneNumber = fixedPhone; ProgressDialogUtil.StopProgressDialog(); this.Finish(); OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight); }); } else { RunOnUiThread(() => { Toast.MakeText(this, updateMyInfoJson.message, ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } } else if (response.ResponseStatus == RestSharp.ResponseStatus.TimedOut) { RunOnUiThread(() => { Toast.MakeText(this, "网络连接超时,请重试", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } else { RunOnUiThread(() => { Toast.MakeText(this, response.StatusDescription, ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } }); }
/// <summary> /// 解绑监护人 /// </summary> /// <param name="userId">User identifier.</param> private void UnBindGuardian(GuardianInfoListItem item) { //调用webservice ProgressDialogUtil.StartProgressDialog(activity, "正在解绑中..."); //检测网络连接 if (!EldYoungUtil.IsConnected(activity)) { Toast.MakeText(activity, "网络连接超时,请检测网路", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; } unBindGuardianParam.Id = item.Id; if (!requestParams.ContainsKey("key")) { requestParams.Add("key", unBindGuardianParam.Key); } else { requestParams ["key"] = unBindGuardianParam.Key; } if (!requestParams.ContainsKey("eId")) { requestParams.Add("eId", unBindGuardianParam.Eid); } else { requestParams ["eId"] = unBindGuardianParam.Eid; } if (!requestParams.ContainsKey("eaction")) { requestParams.Add("eaction", unBindGuardianParam.Eaction); } else { requestParams ["eaction"] = unBindGuardianParam.Eaction; } if (!requestParams.ContainsKey("md5")) { requestParams.Add("md5", unBindGuardianParam.Md5); } else { requestParams ["md5"] = unBindGuardianParam.Md5; } //设置restsharprequest if (restSharpRequestHelp == null) { restSharpRequestHelp = new RestSharpRequestHelp(unBindGuardianParam.Url, requestParams); } else { restSharpRequestHelp.RequestParams = requestParams; } //调用解绑web服务 restSharpRequestHelp.ExcuteAsync((RestSharp.IRestResponse response) => { if (response.ResponseStatus == RestSharp.ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK) { var result = response.Content; var unBindGuardianJson = JsonConvert.DeserializeObject <UnBindGuardianJson>(result); if (unBindGuardianJson.statuscode == "1") { if (unBindGuardianJson.data == "1") { activity.RunOnUiThread(() => { Toast.MakeText(activity, "解绑成功", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); Remove(item); return; }); } else { activity.RunOnUiThread(() => { Toast.MakeText(activity, "解绑失败,稍后在试...", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } } else { activity.RunOnUiThread(() => { Toast.MakeText(activity, "解绑失败,稍后在试...", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } } else if (response.ResponseStatus == RestSharp.ResponseStatus.TimedOut) { activity.RunOnUiThread(() => { Toast.MakeText(activity, "网络连接超时,稍后在试...", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } else { activity.RunOnUiThread(() => { Toast.MakeText(activity, response.StatusDescription, ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } }); }
/// <summary> /// 保存 /// </summary> private void Save() { var birth = edit_birth.Text; if (string.IsNullOrEmpty(birth)) { Toast.MakeText(this, "生日不能为空,请选择生日日期", ToastLength.Short).Show(); return; } if (Convert.ToDateTime(birth) >= Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"))) { Toast.MakeText(this, "生日应小于当前日期", ToastLength.Short).Show(); return; } ProgressDialogUtil.StartProgressDialog(this, "正在保存..."); //检测网络连接 if (!EldYoungUtil.IsConnected(this)) { Toast.MakeText(this, "网络连接超时,请检测网络", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; } //调用restapi注册,将用户名、密码信息写 var updateMyInfoParam = new UpdateMyInfoParam() { Uid = Global.Guid, ParamType = "Age", ParamValue = birth }; if (!requestParams.ContainsKey("key")) { requestParams.Add("key", updateMyInfoParam.Key); } else { requestParams ["key"] = updateMyInfoParam.Key; } if (!requestParams.ContainsKey("eUId")) { requestParams.Add("eUId", updateMyInfoParam.Euid); } else { requestParams ["eUId"] = updateMyInfoParam.Euid; } if (!requestParams.ContainsKey("eparamType")) { requestParams.Add("eparamType", updateMyInfoParam.EparamType); } else { requestParams ["eparamType"] = updateMyInfoParam.EparamType; } if (!requestParams.ContainsKey("eparamValue")) { requestParams.Add("eparamValue", updateMyInfoParam.EparamValue); } else { requestParams ["eparamValue"] = updateMyInfoParam.EparamValue; } if (!requestParams.ContainsKey("md5")) { requestParams.Add("md5", updateMyInfoParam.Md5); } else { requestParams ["md5"] = updateMyInfoParam.Md5; } var restSharpRequestHelp = new RestSharpRequestHelp(updateMyInfoParam.Url, requestParams); restSharpRequestHelp.ExcuteAsync((RestSharp.IRestResponse response) => { if (response.ResponseStatus == RestSharp.ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK) { //获取并解析返回resultJson获取安全码结果值 var result = response.Content; var updateMyInfoJson = JsonConvert.DeserializeObject <UpdateMyInfoJson>(result); if (updateMyInfoJson.statuscode == "1") { RunOnUiThread(() => { Toast.MakeText(this, "保存成功", ToastLength.Short).Show(); Global.MyInfo.Age = birth; ProgressDialogUtil.StopProgressDialog(); this.Finish(); OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight); }); } else { RunOnUiThread(() => { Toast.MakeText(this, updateMyInfoJson.message, ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } } else if (response.ResponseStatus == RestSharp.ResponseStatus.TimedOut) { RunOnUiThread(() => { Toast.MakeText(this, "网络连接超时,请重试", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } else { RunOnUiThread(() => { Toast.MakeText(this, response.StatusDescription, ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; }); } }); }
private void Login() { userNameValue = edit_userName.Text.ToString(); passwordValue = edit_userPassword.Text.ToString(); if (string.IsNullOrEmpty(userNameValue) || string.IsNullOrEmpty(passwordValue)) { Toast.MakeText(this, "用户名或密码不能为空,请填写...", ToastLength.Long).Show(); return; } if (!EldYoungUtil.IsValidUserName(userNameValue)) { Toast.MakeText(this, "请输入正确规范用户名4-20位,由中英文、数字、下划线组成", ToastLength.Short).Show(); return; } if (!EldYoungUtil.IsPassWord(passwordValue)) { Toast.MakeText(this, "请输入正确规范用户名6-20位,建议由字母、数字和符号两种以上组成", ToastLength.Short).Show(); return; } ProgressDialogUtil.StartProgressDialog(this, GetString(Resource.String.loginMsg), true); //检测网络连接 if (!EldYoungUtil.IsConnected(this)) { Toast.MakeText(this, "网络连接超时,请检测网络", ToastLength.Short).Show(); ProgressDialogUtil.StopProgressDialog(); return; } //调用restapi service 登录 var loginInfoParam = new LoginInfoParam() { LoginName = userNameValue, LoginPwd = passwordValue }; //初始化请求参数 SetRestRequestParams(loginInfoParam); var restSharpRequestHelp = new RestSharpRequestHelp(loginInfoParam.Url, requestParams); restSharpRequestHelp.ExcuteAsync((response) => { if (response.ResponseStatus == RestSharp.ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK) { //获取并解析返回resultJson获取安全码结果值 var resultJson = response.Content; var loginJson = JsonConvert.DeserializeObject <LoginJson>(resultJson); if (loginJson.statuscode == "1") { Global.MyInfo = loginJson.data.Table[0]; var Uid = Global.MyInfo.UId; var guidAsAlias = Uid.Replace("-", "_"); //使用用户guid作为推送别名 _jpushUtil.SetAlias(guidAsAlias); //登录成功,且记住用户密码选中,才记录 if (cb_passWord.Checked) { sp_userinfo.Edit().PutString(Global.login_UserName, userNameValue).Commit(); sp_userinfo.Edit().PutString(Global.login_Password, passwordValue).Commit(); sp_userinfo.Edit().PutBoolean(Global.login_Password_Check, true).Commit(); } RunOnUiThread(() => { //跳转到功能主界面 var intent = new Intent(this, typeof(MainFragActivity)); intent.SetFlags(ActivityFlags.ClearTask | ActivityFlags.NewTask); var bundle = Intent.Extras; if (bundle != null) { intent.PutExtras(bundle); } StartActivity(intent); this.Finish(); Toast.MakeText(this, "登录成功", ToastLength.Short).Show(); OverridePendingTransition(Android.Resource.Animation.FadeIn, Android.Resource.Animation.FadeOut); }); } else { RunOnUiThread(() => { Toast.MakeText(this, loginJson.message, ToastLength.Short).Show(); }); } } else if (response.ResponseStatus == RestSharp.ResponseStatus.TimedOut) { RunOnUiThread(() => { Toast.MakeText(this, "网络连接超时", ToastLength.Short).Show(); }); } else { RunOnUiThread(() => { Toast.MakeText(this, response.StatusDescription, ToastLength.Short).Show(); }); } RunOnUiThread(() => { ProgressDialogUtil.StopProgressDialog(); return; }); }); }