📄 短信自动回复.cs
字号:
this.spTime = (TimeSpan)(this.endTime - now);
if (this.spTime.TotalMinutes > 0.0)
{
timeNow.Text = "当前时间: " + now.ToShortTimeString();
this.spTime = (TimeSpan)(this.endTime - now);
this.sysStat.Text = "剩余时间: " + ((int)this.spTime.TotalMinutes).ToString() + "分钟";
}
else
{
this.sysStat.Text = "监视任务结束";
this.canSend = false;
}
}
public void state_Changed(object sender, ChangeEventArgs args)
{
//try
//{
// if (args.NewValue != null)
// {
// number = (String)args.NewValue;
// MessageBox.Show(number);
// }
//}
//catch (Exception ex) { MessageBox.Show(ex.Message); }
bool flag = false;
if (this.canSend)
{
SystemState state1 = (SystemState)sender;
string str = SystemState.PhoneIncomingCallerNumber.ToString();
DropCall.Drop();
if (!SystemState.PhoneIncomingCallerNumber.ToString().Equals(""))
{
if (SystemState.PhoneIncomingCallerNumber.ToString().Equals(this.lastcome))
{
this.lastcomeTime++;
flag = true;
if (this.lastcomeTime > 5)
{
return;
}
}
else
{
if (this.lastcome.Equals("蓝浪"))
{
this.lastcomeTime++;
}
else
{
this.lastcomeTime = 1;
}
this.lastcome = SystemState.PhoneIncomingCallerNumber.ToString();
}
//WKHKey(0x76, 0, 0);
//WKHKey(0x76, 0, 2);
//WKHKey(0x73, 0, 0);
//WKHKey(0x73, 0, 2);
string phoneIncomingCallerName = SystemState.PhoneIncomingCallerName;
if (phoneIncomingCallerName.Length > 4)
{
phoneIncomingCallerName = phoneIncomingCallerName.Substring(0, 4);
}
string str3 = phoneIncomingCallerName;
phoneIncomingCallerName = str3 + "(" + str + ")[" + DateTime.Now.ToShortTimeString() + "]";
this.comboHis.Items.Insert(0, phoneIncomingCallerName);
this.comboHis.SelectedIndex = 0;
if (!flag)
{
this.tim.Enabled = true;
}
}
}
}
private void 短信自动回复_Load(object sender, EventArgs e)
{
SystemState state = new SystemState(SystemProperty.PhoneIncomingCall);
state.ComparisonType = StatusComparisonType.NotEqual;
state.ComparisonValue = true;
state.Changed += new ChangeEventHandler(this.state_Changed);
this.stateList.Add(state);
this.lastcome = "蓝浪";
this.lastcomeTime = 1;
this.tim.Interval = 0xbb8;
this.tim.Tick += new EventHandler(this.tim_Tick);
this.tim_time.Interval = 0x7530;
this.tim_time.Tick += new EventHandler(this.tim_time_Tick);
this.comRType.SelectedIndex = 1;
this.startTime = DateTime.Now;
this.textStarth.Text = this.startTime.Hour.ToString();
this.textStartm.Text = this.startTime.Minute.ToString();
this.lastTime = 30;
this.endTime = this.startTime.AddMinutes(30.0);
this.textEndh.Text = "30";
this.timeNow.Text = "当前时间: " + this.startTime.ToShortTimeString();
this.spTime = (TimeSpan)(this.endTime - this.startTime);
this.textStarth.Enabled = false;
this.textStartm.Enabled = false;
this.label7.Enabled = false;
this.textEndh.Enabled = false;
this.comRType.Enabled = false;
this.textkey.Enabled = false;
this.tim_time.Enabled = true;
}
[DllImport("mapirule.dll")]
public static extern void WKHKey(byte vk, byte bscan, int type);
private void MessageBox1(string p)
{
MessageBox.Show(p, "蓝浪温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
}
//新任务开始
private void SetTimeQuickPub()
{
this.startTime = DateTime.Now;
this.textStarth.Text = this.startTime.Hour.ToString();
this.textStartm.Text = this.startTime.Minute.ToString();
this.endTime = this.startTime.AddMinutes((double)this.lastTime);
this.textEndh.Text = this.lastTime.ToString();
this.spTime = (TimeSpan)(this.endTime - this.startTime);
this.sysStat.Text = "新任务开始";
this.canSend = true;
}
/*---------------------------------------------------------------------------------------------------------------------
* 蓝浪自发短信软件
* lanlangSendMessage()是短信发送的方法
* 蓝浪2008-9-18
*/
private void lanlangSendMessage()
{
this.tim.Enabled = false;
string[] strArray = new string[] { "你好,我正在", this.textkey.Text, ",不方便接听您的电话,现在离结束还有", ((int)this.spTime.TotalMinutes).ToString(), "分钟,请您稍候再打!如有急事请连拨5次,我会接听您的电话!" };
this.sms.Body = string.Concat(strArray);
if (this.comRType.SelectedIndex == 0)
{
this.MessageBox1(this.sms.Body.ToString());
}
else
{
//清空sms列表之前的电话号码
for (int i = 0; i < sms.To.Count; i++)
{ this.sms.To.Remove(i); }
this.sms.To.Add(new Recipient(this.lastcome));
this.sms.RequestDeliveryReport = false;
try
{
this.sms.Send();
}
catch (Exception exception)
{
this.MessageBox1(exception.Message);
return;
}
this.MessageBox1("OK,回应短消息已发送!");
}
}
private TimeSpan spTime;
private void timer1_Tick(object sender, EventArgs e)
{
}
private void textEndh_GotFocus(object sender, EventArgs e)
{
//切换输入法---数字
Win32Pinvoke.SetInputMode(this.textEndh, Win32Pinvoke.InputMode.Numbers);
}
private void textkey_GotFocus(object sender, EventArgs e)
{
//切换输入法---数字
Win32Pinvoke.SetInputMode(this.textEndh, Win32Pinvoke.InputMode.T9);
}
private void menuHide_Click_1(object sender, EventArgs e)
{
WKHKey(0x1b, 0, 0);
WKHKey(0x1b, 0, 2);
}
private String number;
//-------------------------------------------------------------------------------------------------------------------
#region 事件处理函数
void SS_Changed(object sender, ChangeEventArgs args)
{
try
{
if (DropCall.BannedList.Exists((s) =>
{
s = number;
return (from t in DropCall.BannedList
where t.Equals(s)
select t).Count() == 0 ? false : true;
}))
DropCall.Drop();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
//void state_Changed(object sender, ChangeEventArgs args)
//{
// try
// {
// if (args.NewValue != null)
// {
// number = (String)args.NewValue;
// MessageBox.Show(number);
// }
// }
// catch (Exception ex) { MessageBox.Show(ex.Message); }
//}
#endregion
//-------------------------------------------------------------------------------------------------------------------
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -