📄 groupsmsform.cs
字号:
{
if (!base.IsDisposed)
{
try
{
List<Imps.Client.Core.Contact> selectedContacts = this.inviteControl.SelectedContacts;
StringBuilder builder = new StringBuilder();
for (int i = 0; i < selectedContacts.get_Count(); i++)
{
string displayName = selectedContacts.get_Item(i).DisplayName;
if (selectedContacts.get_Item(i).Uri.Raw == this.CurrentUser.Uri.Raw)
{
displayName = this.CurrentUser.Nickname;
}
builder.Append(displayName);
if (i < (selectedContacts.get_Count() - 1))
{
builder.Append(",");
}
}
this._historyChatManager.AppentString(string.Format("<font size=9.5 color=95,161,1>【系统提示】:将于{0}年{1}月{2}日{3}时{4}分发送给:{5}!</font>", new object[] { this._time.Year, this._time.Month, this._time.Day, this._time.Hour, this._time.Minute, StringHelper.EncodString(builder.ToString()) }));
this._historyChatManager.AppendCRLF();
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
}
private void pickMinute_ValueChanged(object sender, EventArgs e)
{
try
{
if (decimal.op_Modulus(this.pickMinute.Value, 5M) != 0M)
{
int num = Convert.ToInt32(this.pickMinute.Value);
int num2 = Convert.ToInt32(decimal.op_Modulus(this.pickMinute.Value, 5M));
while ((num % 5) != 0)
{
if (num2 > 2)
{
num++;
}
else
{
num--;
}
}
if (num > 0x37)
{
num = 0x37;
}
this.pickMinute.Value = num;
}
}
catch (Exception)
{
}
}
private void Send()
{
try
{
if (this.txtSendContent.Text != "")
{
if (this.chkTimingSMS.Checked)
{
this.SendTimingSMS();
}
else
{
this.SendSMS();
}
}
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
private void SendNext()
{
if (this._stackSMSItems.get_Count() > 0)
{
this._currentSendingItem = this._stackSMSItems.Dequeue();
SMSManager.AsyncSendSMS(this.CurrentUser, this._currentSendingItem.Contact.Uri.Raw, this._currentSendingItem.Content, this.op);
}
else
{
this.sending = false;
if (!base.IsDisposed)
{
this._historyChatManager.AppentString("<font size=9.5 color=95,161,1>【系统提示】:短信发送完毕!</font>");
this._historyChatManager.AppendCRLF();
}
}
}
private void SendSMS()
{
SimpleEventHandler method = null;
try
{
List<Imps.Client.Core.Contact> selectedContacts = this.inviteControl.SelectedContacts;
if (selectedContacts.get_Count() == 0)
{
if (method == null)
{
method = delegate {
this._frameworkWin.UnifiedMessageBox.ShowInfo("您至少要选择一个联系人!");
};
}
base.BeginInvoke(method);
}
else
{
string content = this.txtSendContent.Text;
if (this.op == null)
{
this.op = new AsyncBizOperation();
this.op.Successed += new EventHandler(this.op_Successed);
this.op.ImpsError += new EventHandler<ImpsErrorEventArgs>(this, (IntPtr) this.op_ImpsError);
}
List<Imps.Client.Core.Contact>.Enumerator enumerator = selectedContacts.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
Imps.Client.Core.Contact contact = enumerator.get_Current();
if ((contact.Uri.Raw == this.CurrentUser.Uri.Raw) || contact.EnableSMS)
{
SendSMSItem item = new SendSMSItem(contact, content);
this._stackSMSItems.Enqueue(item);
}
}
}
finally
{
enumerator.Dispose();
}
if ((this._stackSMSItems.get_Count() > 0) && !this.sending)
{
this.StartSend();
}
this._alreadySendCount++;
this.FormatSendInfo();
this._historyChatManager.AppendRichTextPlainString(this.txtSendContent.Text + "\r\n--------------------\r\n");
this._historyChatManager.ScrollToEnd();
this.txtSendContent.Text = "";
}
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
private void SendTimingSMS()
{
SimpleEventHandler method = null;
List<Imps.Client.Core.Contact> selectedContacts = this.inviteControl.SelectedContacts;
if (selectedContacts.get_Count() == 0)
{
if (method == null)
{
method = delegate {
this._frameworkWin.UnifiedMessageBox.ShowInfo("您至少要选择一个联系人!");
};
}
base.BeginInvoke(method);
}
else
{
string text = this.pickYear.Value.ToString("yyyy-MM-dd");
string text2 = this.pickHour.Value.ToString();
string text3 = this.pickMinute.Value.ToString();
if (DateTime.TryParse(string.Format("{0} {1}:{2}", text, text2, text3), ref this._time))
{
if (this._time < DateTime.Now)
{
BalloonHelper.ShowInputErrorBallon(this.pickMinute, "您不能设置比当前更早的时间发送定时短信,请重新设定!");
}
else
{
IicUri[] uris = new IicUri[selectedContacts.get_Count()];
for (int i = 0; i < selectedContacts.get_Count(); i++)
{
uris[i] = selectedContacts.get_Item(i).Uri;
}
if (this.opTriming == null)
{
this.opTriming = new AsyncBizOperation();
this.opTriming.Successed += new EventHandler(this.opTriming_Successed);
this.opTriming.ImpsError += new EventHandler<ImpsErrorEventArgs>(this, (IntPtr) this.opTriming_ImpsError);
}
this.CurrentUser.ScheduleSmsMgr.AsyncSetScheduleSms(this._time, this.txtSendContent.Text, uris, this.opTriming);
this._historyChatManager.AppendRichTextPlainString(this.txtSendContent.Text + "\r\n--------------------\r\n");
this._historyChatManager.ScrollToEnd();
this.txtSendContent.Text = "";
}
}
}
}
private void splitContainer1_SplitterMoved(object sender, SplitterEventArgs e)
{
this.txtSendContent.Focus();
}
private void StartSend()
{
this.sending = true;
this.SendNext();
}
private void tsSendCtrlEnter_Click(object sender, EventArgs e)
{
this.tsSendEnter.set_Checked(false);
this.tsSendCtrlEnter.set_Checked(true);
}
private void tsSendEnter_Click(object sender, EventArgs e)
{
this.tsSendEnter.set_Checked(true);
this.tsSendCtrlEnter.set_Checked(false);
}
private void txtHistory_KeyDown(object sender, KeyEventArgs e)
{
}
private void txtSendContent_KeyDown(object sender, KeyEventArgs e)
{
if (Keys.ProcessKey == e.KeyCode)
{
this.m_fIsProcessKey = true;
}
else if ((e.KeyCode == Keys.A) && (e.Modifiers == Keys.Control))
{
this.txtSendContent.SelectAll();
}
else if ((e.KeyCode == Keys.S) && (e.Modifiers == Keys.Alt))
{
e.set_SuppressKeyPress(true);
this.Send();
}
else if (((this.tsSendEnter.get_Checked() && (e.KeyCode == Keys.Return)) && !e.Control) || ((this.tsSendCtrlEnter.get_Checked() && e.Control) && (e.KeyCode == Keys.Return)))
{
e.set_SuppressKeyPress(true);
this.Send();
}
}
private void txtSendContent_TextChanged(object sender, EventArgs e)
{
base.BeginInvoke(delegate {
this.btnSend.Enabled = this.txtSendContent.Text != "";
this.lblInputInfo.Text = string.Format(StringTable.Conversation.MsgSMSInputInfo, this.MaxInputLength - this.txtSendContent.Text.Length);
});
}
public int AlreadySendCount
{
get
{
return this._alreadySendCount;
}
}
public Imps.Client.Core.User CurrentUser
{
get
{
return this._frameworkWin.AccountManager.CurrentUser;
}
}
public int MaxInputLength
{
get
{
return this.CurrentUser.Configuration.SystemSetting.SysSmsSetting.MaxMsgLenSmsOnline;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -