UWP 发送短信公用倒计时按钮

/// <summary>
/// 倒计时类(发送验证码按钮,点击后,会倒计时60s,之后才能再次点击。不同界面的多个验证码按钮共享这个倒计时时间。)同一手机号码1分钟只能发1条;
/// </summary>
public static class CountDown
{
/// <summary>
/// 倒计时60秒
/// </summary>
public static int stTimeCount = ; /// <summary>
/// 倒计时60s方法
/// </summary>
/// <param name="btnCode"></param>
/// <param name="timeCount"></param>
public static void ShowCountDown(Button btnCode, int timeCount)
{
stTimeCount = timeCount;
DispatcherTimer dispatcherTimer = new DispatcherTimer();
dispatcherTimer.Interval = new TimeSpan(, , );
dispatcherTimer.Start();
int count = stTimeCount;
int i = ;
dispatcherTimer.Tick += delegate
{
if (count > )
count--;
//倒计时:设置按钮的值,以及按钮不可点击
btnCode.Content = count + " S ";
btnCode.IsEnabled = false;
stTimeCount = count;
if (count == i)
{
//倒计时完成: 设置按钮的值,以及按钮可用
dispatcherTimer.Stop();
btnCode.Content = "获取验证码";
btnCode.IsEnabled = true;
stTimeCount = count ;
}
};
}
}
4.修改登录密码界面构造函数中进行调用
public SetLoginPwd()
{
this.InitializeComponent(); //获取倒计时60秒是否有值,有值则继续倒计时
if (CountDown.stTimeCount > )
{
CountDown.ShowCountDown(btnCode, CountDown.stTimeCount);
}
}
UWP 发送短信公用倒计时按钮的更多相关文章
- js 发送短信验证码倒计时
html <input type="button" id="btn" value="免费获取验证码" onclick="se ...
- iOS 短信验证码倒计时按钮的实现
验证码倒计时按钮的应用是非常普遍的,本文介绍了IOS实现验证码倒计时功能,点击获取验证码,进入时间倒计时,感兴趣的小伙伴们可以参考一下: 实现思路: 创建按钮,添加点击方法: 用NSTimer定时器, ...
- 发送短信验证码倒计时,CountDownTimer;
1.声明CountDownTimer的成员变量: private CountDownTimer countDownTimer; 2.设置倒计时总时间和间隔时间: countDownTimer = ne ...
- WPF MVVM下做发送短信小按钮
最近做一个项目,因为涉及到注册,因此需要发送短信,一般发送短信都有一个倒计时的小按钮,因此,就做了一个,在此做个记录. 一.发送消息 没有调用公司的短信平台,只是模拟前台生成一串数字,将此串数字输出一 ...
- 使用定时器限制点击按钮发送短信(附源码)--JavaScript小案例
不说多哈,有注释哦,直接贴代码了哈,有疑问请追评呢…… 1.禁用按钮: this.disabled = "disabled"(this指按钮)或: this.disabled = ...
- js 发送短信倒计时、秒杀倒计时实现代码
<!doctype html> <html> <head> <meta charset="utf-8"> <meta name ...
- js模拟支付宝发送短信验证码&&&&短信倒计时
html <div class="pwdContent"> <div class="pwdBox"></div> <d ...
- jQuery实现倒计时重新发送短信验证码功能示例
<!doctype html> <html> <head> <meta charset="utf-8"> <title> ...
- Android中使用Intent的Action和Data属性实现点击按钮跳转到拨打电话和发送短信
场景 点击拨打电话按钮,跳转到拨打电话页面 点击发送短信按钮,跳转到发送短信页面 注: 博客: https://blog.csdn.net/badao_liumang_qizhi 关注公众号 霸道的程 ...
随机推荐
- iPhone6/6Plus下app状态栏内容放大问题处理
分为兼容模式和高分辨率模式. 兼容模式 当你的 app 没有提供 3x 的 LaunchImage 时,系统默认进入兼容模式,大屏幕一切按照 320 宽度渲染,屏幕宽度返回 320:然后等比例拉伸到大 ...
- 在视图上创建ListCtrl的做法
作者:朱金灿 来源:http://blog.csdn.net/clever101 今天介绍下如何在一个视图上动态创建一个ListCtrl. 1.新建一个MFC的单文档工程,这里暂定名字为ListDem ...
- noip刷题记录 20170818
天天爱跑步 lca + 树上差分 #include<iostream> #include<cstdio> #include<cstdlib> #include< ...
- [转载]Android Studio卡在refreshing gradle project的原因和快速解决办法
转载请注明出处:http://blog.csdn.net/u013005791/article/details/60143750 这个问题遇到过很多次,网上也有很多解决办法,但是好像都没有发现refr ...
- simlescalar CPU模拟器源代码分析
Sim-outorder.c Main性能 Fetch --> despetch--> issue--> ...
- Spring实战5-基于Spring构建Web应用
主要内容 将web请求映射到Spring控制器 绑定form参数 验证表单提交的参数 写在前面:关于Java Web,首先推荐一篇文章——写给java web一年左右工作经验的人,这篇文章的作者用精练 ...
- quick cocos2dx lua 网络图片 下载 自己主动更新
转载请注明,原文地址:http://blog.csdn.net/dd135373/article/details/46468505 quick coocs2d-x 网络图片下载,自己主动更新纹理,保存 ...
- LeetCode: Generate Parentheses [021]
[称号] Given n pairs of parentheses, write a function to generate all combinations of well-formed pare ...
- flask-mail发送邮件始终失败
from flask_mail import Mail,Message from flask import Flask import os app=Flask(__name__) app.config ...
- BS学习概述
从最初的牛腩新闻公布系统,到如今的JS,回想一下,自己的BS也算是学了大半,可是有时候想起来还是总是有一种不踏实的感觉,一是由于从开学到如今赶上了三级考试,自考.软考,导致BS学习时间被大大压缩了,代 ...