protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); RequestWindowFeature(WindowFeatures.CustomTitle); // Create your application here SetContentView(Resource.Layout.RegisterStepTwoLayout); Window.SetFeatureInt(WindowFeatures.CustomTitle, Resource.Layout.custom_title_bar); sp_userinfo = this.GetSharedPreferences(Global.SHAREDPREFERENCES_USERINFO, FileCreationMode.Private); _jpushUtil = new JPushUtil(this); InitView(); }
private void InitView() { //设置标题栏 var img_header_back = FindViewById <ImageView> (Resource.Id.img_header_back); img_header_back.Click += (sender, e) => { this.Finish(); OverridePendingTransition(Resource.Animation.bottom_out, 0); }; var tv_back = FindViewById <TextView> (Resource.Id.tv_back); tv_back.Text = ""; var tv_desc = FindViewById <TextView> (Resource.Id.tv_desc); tv_desc.Text = "登录"; _jpushUtil = new JPushUtil(this); // Create your application here //或得共享实例变量 sp_userinfo = this.GetSharedPreferences(Global.SHAREDPREFERENCES_USERINFO, FileCreationMode.Private); //获得实例对象 edit_userName = FindViewById <EditText>(Resource.Id.edit_UserName); edit_userPassword = FindViewById <EditText> (Resource.Id.edit_PassWord); cb_passWord = FindViewById <CheckBox> (Resource.Id.cb_Password); btn_login = FindViewById <Button> (Resource.Id.btn_Login); tv_Register = FindViewById <TextView> (Resource.Id.tv_Register); var tv_forgetPwd = FindViewById <TextView> (Resource.Id.tv_forgetPwd); var img_eye = FindViewById <ImageView> (Resource.Id.img_eye); img_eye.Click += (sender, e) => { if (edit_userPassword.InputType == (Android.Text.InputTypes.ClassText | Android.Text.InputTypes.TextVariationPassword)) { edit_userPassword.InputType = Android.Text.InputTypes.ClassText | Android.Text.InputTypes.TextVariationVisiblePassword; img_eye.SetImageResource(Resource.Drawable.ic_login_eye_selected); } else if (edit_userPassword.InputType == (Android.Text.InputTypes.ClassText | Android.Text.InputTypes.TextVariationVisiblePassword)) { edit_userPassword.InputType = Android.Text.InputTypes.ClassText | Android.Text.InputTypes.TextVariationPassword; img_eye.SetImageResource(Resource.Drawable.ic_login_eye_normal); } }; //点击注册 tv_Register.Click += (sender, e) => { StartActivity(typeof(RegisterStepOneActivity)); OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight); }; //找回密码 tv_forgetPwd.Click += (sender, e) => { var intent = new Intent(this, typeof(SendSecurityCodeActivity)); var sendbundle = new Bundle(); sendbundle.PutString("SendType", "FindPwd"); sendbundle.PutString("PhoneNumber", string.Empty); intent.PutExtras(sendbundle); StartActivity(intent); OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight); }; //如果选择了记住密码,则赋值 if (sp_userinfo.GetBoolean(Global.refrence_Password_Check, false)) { cb_passWord.Checked = true; edit_userName.Text = sp_userinfo.GetString(Global.refrence_UserName, string.Empty); edit_userPassword.Text = sp_userinfo.GetString(Global.refrence_Password, string.Empty); } //记住密码选择事件 cb_passWord.CheckedChange += (sender, e) => { if (cb_passWord.Checked) { sp_userinfo.Edit().PutBoolean(Global.refrence_Password_Check, true).Commit(); } else { sp_userinfo.Edit().PutBoolean(Global.refrence_Password_Check, false).Commit(); } }; //登录按钮事件 btn_login.Click += (sender, e) => { Login(); }; }
private static async Task PushAppNotification(DataCollectedEventArgs e) { if (e.Rule == Pk10Rule.Sum) { return; } var plans = e.LastForecastData; bool isTwoSide = (int)e.Rule > 4; //实时更新 var realTimeAudience = isTwoSide ? new { tag_and = new string[] { "realtime", "twoside" } } : (object)new { tag = new string[] { "realtime" } }; await JPushUtil.PushMessageAsync("PK10最新预测", JsonConvert.SerializeObject(plans), realTimeAudience); //连挂提醒 plans.ForEach(async p => { var tags = new List <string>(); for (var i = 1; i <= 4; i++) { if (p.KeepGuaCnt < i) { break; } tags.Add($"liangua{i}"); } var msg = $"{p.KeepGuaCnt}连挂 {p.LastDrawnPeriod + 1}期 {p.Rule} {p.ForecastNo}"; if (tags.Any()) { var audience = isTwoSide ? new { tag = tags, tag_and = new string[] { "twoside" } } : (object)new { tag = tags }; await JPushUtil.PushNotificationAsync("PK10连挂提醒", msg, audience); } if (p.KeepGuaCnt >= MinKeepGua) { await TelegramBotUtil.SendMessageAsync(msg); } }); //重复度提醒 if (isTwoSide) { return; } var repetition = new List <string>(); var plan = plans.FirstOrDefault(); for (var i = 60; i <= 100; i += 20) { if (plan.RepetitionScore < i) { break; } repetition.Add($"repetition{i}"); } var rMsg = $"重{plan.RepetitionScore}% {plan.LastDrawnPeriod + 1}期 {plan.Rule} {plan.ForecastNo}/{plans.LastOrDefault().ForecastNo}"; if (repetition.Any()) { await JPushUtil.PushNotificationAsync("PK10高重提醒", rMsg, new { tag = repetition }); } // if (plan.RepetitionScore >= MinRepetition) // await TelegramBotUtil.SendMessageAsync(rMsg); }