www.pudn.com > Fetion.rar > GroupSMSForm.cs
namespace Imps.Client.Pc
{
using Imps.Client;
using Imps.Client.Core;
using Imps.Client.Pc.BizControls;
using Imps.Client.Pc.Controls;
using Imps.Client.Pc.Properties;
using Imps.Client.Pc.Utils;
using Imps.Client.Resource;
using Imps.Client.Utils;
using Imps.Common;
using Imps.Utils;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
public class GroupSMSForm : XIMDialog
{
private int _alreadySendCount;
private SendSMSItem _currentSendingItem;
private IFrameworkWindow _frameworkWin;
private GroupSMSFailedForm _groupSMSFailedForm;
private ChatEditCtrlManager _historyChatManager;
private bool _sendFrequent;
private Queue _stackSMSItems;
private DateTime _time;
private XButton btnSend;
private XButton btnTimingManager;
private CheckBox chkTimingSMS;
private IContainer components;
private InviteControl inviteControl;
private Label lblDay;
private HtmlLabel lblInputInfo;
private Label lblMonth;
private Label lblYear;
private bool m_fIsProcessKey;
private menu_widget menuSendType;
private AsyncBizOperation op;
private AsyncBizOperation opTriming;
private Panel panel1;
private Panel panel2;
private NumericUpDown pickHour;
private NumericUpDown pickMinute;
private DateTimePicker pickYear;
private Panel plInviteContacts;
private Panel pnlMain;
private bool sending;
private ToolStripMenuItem tsSendCtrlEnter;
private ToolStripMenuItem tsSendEnter;
private ChatRichTextBox txtHistory;
private XTextBox txtSendContent;
public GroupSMSForm(IFrameworkWindow frameworkWin) : this(frameworkWin, null)
{
}
public GroupSMSForm(IFrameworkWindow frameworkWin, List list)
{
EventHandler handler = null;
EventHandler handler2 = null;
EventHandler handler3 = null;
this._stackSMSItems = new Queue();
this.InitializeComponent();
this._frameworkWin = frameworkWin;
try
{
base.HemlineStyle = HemlineStyle.None;
this.InitTimingDate();
this.inviteControl = new InviteControl(frameworkWin, list);
this.inviteControl.SelectType = SelectContactsType.GroupSms;
int maxFriendsNumBatchSms = this.CurrentUser.Configuration.SystemSetting.SysSmsSetting.MaxFriendsNumBatchSms;
this.inviteControl.Message = string.Format(StringTable.Conversation.MsgSelectSMSContacts, maxFriendsNumBatchSms);
this.inviteControl.MaxSelectedCount = maxFriendsNumBatchSms;
this.inviteControl.OnlyShowOnline = false;
this.inviteControl.ShowSMSOnline = true;
this.inviteControl.ShowGroup = true;
this.inviteControl.ShowSelf = true;
this.inviteControl.ShowMobileBuddy = true;
this.inviteControl.ShowSMSOffline = false;
this.inviteControl.Dock = DockStyle.Fill;
this.inviteControl.MessageLabelHeight = 20;
this.plInviteContacts.Controls.Add(this.inviteControl);
if (handler == null)
{
handler = delegate {
this.txtSendContent.Focus();
};
}
this.inviteControl.SplitterMoved += handler;
if (handler2 == null)
{
handler2 = delegate {
this.txtSendContent.Focus();
};
}
base.Shown += handler2;
if (handler3 == null)
{
handler3 = delegate {
this.txtSendContent.Focus();
};
}
base.Activated += handler3;
this.lblInputInfo.Text = string.Format(StringTable.Conversation.MsgSMSInputInfo, this.MaxInputLength.ToString());
base.ShowIcon = true;
base.Icon = ImpsIcons.Logo;
this.CurrentUser.StatusChanged += new EventHandler(this.CurrentUser_StatusChanged);
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
this._historyChatManager = new ChatEditCtrlManager(this.txtHistory, true);
this._historyChatManager.LinkButtonClick += new ChatEditClickEventHandler(this._historyChatManager_LinkButtonClick);
this._historyChatManager.DefaultTextFont = new Font("宋体", 10.5f, FontStyle.Regular);
this._historyChatManager.SelectionFont = new Font("宋体", 10.5f, FontStyle.Regular);
this._historyChatManager.ForeColor = SystemColors.ControlText;
this.btnTimingManager.SizeChanged += new EventHandler(this.btnTimingManager_SizeChanged);
}
private int _historyChatManager_LinkButtonClick(object sender, ChatEditClickEventArgs e)
{
try
{
if ((e.EventType == ChatEditEventType.LinkButton) && (e.Command == "frequent"))
{
if (this._groupSMSFailedForm == null)
{
if (this._currentSendingItem != null)
{
this._stackSMSItems.Enqueue(this._currentSendingItem);
}
this._groupSMSFailedForm = new GroupSMSFailedForm(this._stackSMSItems);
}
this._groupSMSFailedForm.Location = base.Location;
this._groupSMSFailedForm.Show();
}
}
catch
{
}
return 1;
}
private void btnAddMyMobileNo_Click(object sender, EventArgs e)
{
if (((this.txtSendContent.Text.Length + 11) + 2) > this.MaxInputLength)
{
this._frameworkWin.UnifiedMessageBox.ShowInfo(string.Format("您一条信息最多只能输入{0}个字符!", this.MaxInputLength));
}
else
{
this.txtSendContent.SelectionStart = this.txtSendContent.Text.Length;
if (string.IsNullOrEmpty(this.CurrentUser.MobileNo))
{
ClientLogger.WriteGeneral("群发短信的时候,尝试加入手机号失败,MobileNo属性为空!");
}
if (this.txtSendContent.Text != "")
{
this.txtSendContent.AppendText("\r\n" + this.CurrentUser.MobileNo);
}
else
{
this.txtSendContent.AppendText(this.CurrentUser.MobileNo);
}
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
base.Close();
}
private void btnSend_Click(object sender, EventArgs e)
{
this.Send();
}
private void btnTimingManager_Click(object sender, EventArgs e)
{
try
{
this._frameworkWin.ConversationManager.ShowScheduleSmsForm(this);
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
private void btnTimingManager_SizeChanged(object sender, EventArgs e)
{
try
{
int num = this.btnTimingManager.Top - this.panel1.Bottom;
int y = this.btnTimingManager.Bottom + num;
int height = this.panel2.Bottom - y;
this.panel2.SetBounds(0, y, 0, height, BoundsSpecified.Height | BoundsSpecified.Y);
}
catch
{
}
}
private void chkTimingSMS_CheckedChanged(object sender, EventArgs e)
{
bool flag = this.chkTimingSMS.Checked;
this.pickHour.Visible = this.pickMinute.Visible = this.pickYear.Visible = flag;
this.lblDay.Visible = this.lblMonth.Visible = this.lblYear.Visible = flag;
}
private void CurrentUser_StatusChanged(object sender, UserSatusChangedEventArgs e)
{
if ((e.NewStatus == UserAccountStatus.Logoff) || (e.NewStatus == UserAccountStatus.Disconnected))
{
base.Close();
}
}
protected override void Dispose(bool disposing)
{
if (disposing && (this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void FormatSendInfo()
{
}
private void InitializeComponent()
{
this.components = new Container();
ComponentResourceManager manager = new ComponentResourceManager(typeof(GroupSMSForm));
this.plInviteContacts = new Panel();
this.txtHistory = new ChatRichTextBox();
this.lblInputInfo = new HtmlLabel();
this.txtSendContent = new XTextBox();
this.menuSendType = new menu_widget(this.components);
this.tsSendEnter = new ToolStripMenuItem();
this.tsSendCtrlEnter = new ToolStripMenuItem();
this.pnlMain = new Panel();
this.btnSend = new XButton();
this.btnTimingManager = new XButton();
this.pickMinute = new NumericUpDown();
this.pickHour = new NumericUpDown();
this.lblDay = new Label();
this.lblMonth = new Label();
this.lblYear = new Label();
this.pickYear = new DateTimePicker();
this.chkTimingSMS = new CheckBox();
this.panel2 = new Panel();
this.panel1 = new Panel();
this.menuSendType.SuspendLayout();
this.pnlMain.SuspendLayout();
this.pickMinute.BeginInit();
this.pickHour.BeginInit();
this.panel2.SuspendLayout();
this.panel1.SuspendLayout();
base.SuspendLayout();
this.plInviteContacts.Anchor = AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
this.plInviteContacts.Location = new System.Drawing.Point(4, 10);
this.plInviteContacts.Name = "plInviteContacts";
this.plInviteContacts.Size = new Size(0xf3, 0x1ee);
this.plInviteContacts.TabIndex = 0;
this.txtHistory.BackColor = Color.White;
this.txtHistory.BorderColor = Color.Empty;
this.txtHistory.BorderStyle = BorderStyle.None;
this.txtHistory.Dock = DockStyle.Fill;
this.txtHistory.Location = new System.Drawing.Point(1, 1);
this.txtHistory.MinimumSize = new Size(4, 100);
this.txtHistory.Name = "txtHistory";
this.txtHistory.ReadOnly = true;
this.txtHistory.RightToLeft = RightToLeft.No;
this.txtHistory.ScrollBars = RichTextBoxScrollBars.Vertical;
this.txtHistory.Size = new Size(0x169, 0x15b);
this.txtHistory.TabIndex = 4;
this.txtHistory.TabStop = false;
this.txtHistory.Text = "";
this.txtHistory.KeyDown += new KeyEventHandler(this.txtHistory_KeyDown);
this.lblInputInfo.ForeColor = Color.MediumBlue;
this.lblInputInfo.LinkColor = Color.Blue;
this.lblInputInfo.Location = new System.Drawing.Point(0x1d8, 0x16e);
this.lblInputInfo.Name = "lblInputInfo";
this.lblInputInfo.ShowBackgroundImage = false;
this.lblInputInfo.Size = new Size(0x8b, 0x12);
this.lblInputInfo.TabIndex = 8;
this.lblInputInfo.Text = "123";
this.txtSendContent.BackColor = Color.White;
this.txtSendContent.BorderStyle = BorderStyle.None;
this.txtSendContent.Dock = DockStyle.Fill;
this.txtSendContent.EmptyTextTip = "";
this.txtSendContent.EmptyTextTipColor = Color.DarkGray;
this.txtSendContent.Location = new System.Drawing.Point(1, 1);
this.txtSendContent.MinimumSize = new Size(2, 40);
this.txtSendContent.Multiline = true;
this.txtSendContent.Name = "txtSendContent";
this.txtSendContent.RightToLeft = RightToLeft.No;
this.txtSendContent.ScrollBars = ScrollBars.Vertical;
this.txtSendContent.Size = new Size(0x169, 0x54);
this.txtSendContent.TabIndex = 8;
this.txtSendContent.TextChanged += new EventHandler(this.txtSendContent_TextChanged);
this.txtSendContent.KeyDown += new KeyEventHandler(this.txtSendContent_KeyDown);
this.menuSendType.Items.AddRange(new ToolStripItem[] { this.tsSendEnter, this.tsSendCtrlEnter });
this.menuSendType.Name = "contextMenuSendMessage";
this.menuSendType.Size = new Size(0xcc, 0x30);
this.menuSendType.UseMnemonic = true;
this.tsSendEnter.Checked = true;
this.tsSendEnter.CheckState = CheckState.Checked;
this.tsSendEnter.Name = "tsSendEnter";
this.tsSendEnter.Size = new Size(0xcb, 0x16);
this.tsSendEnter.Text = "按 Enter 键发送消息";
this.tsSendEnter.Click += new EventHandler(this.tsSendEnter_Click);
this.tsSendCtrlEnter.Name = "tsSendCtrlEnter";
this.tsSendCtrlEnter.Size = new Size(0xcb, 0x16);
this.tsSendCtrlEnter.Text = "按 Ctrl+Enter 键发送消息";
this.tsSendCtrlEnter.Click += new EventHandler(this.tsSendCtrlEnter_Click);
this.pnlMain.BackColor = Color.Transparent;
this.pnlMain.Controls.Add(this.btnSend);
this.pnlMain.Controls.Add(this.btnTimingManager);
this.pnlMain.Controls.Add(this.pickMinute);
this.pnlMain.Controls.Add(this.pickHour);
this.pnlMain.Controls.Add(this.lblDay);
this.pnlMain.Controls.Add(this.lblMonth);
this.pnlMain.Controls.Add(this.lblYear);
this.pnlMain.Controls.Add(this.pickYear);
this.pnlMain.Controls.Add(this.chkTimingSMS);
this.pnlMain.Controls.Add(this.lblInputInfo);
this.pnlMain.Controls.Add(this.panel2);
this.pnlMain.Controls.Add(this.panel1);
this.pnlMain.Controls.Add(this.plInviteContacts);
this.pnlMain.Location = new System.Drawing.Point(3, 6);
this.pnlMain.Name = "pnlMain";
this.pnlMain.Size = new Size(0x26b, 0x1fc);
this.pnlMain.TabIndex = 6;
this.btnSend.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
this.btnSend.AutoArrangementX = true;
this.btnSend.AutoSizeToImage = false;
this.btnSend.BackColor = Color.Transparent;
this.btnSend.BackgroundImage = (Image) manager.GetObject("btnSend.BackgroundImage");
this.btnSend.BackgroundImageDisable = (Image) manager.GetObject("btnSend.BackgroundImageDisable");
this.btnSend.BackgroundImageDown = (Image) manager.GetObject("btnSend.BackgroundImageDown");
this.btnSend.BackgroundImageHover = (Image) manager.GetObject("btnSend.BackgroundImageHover");
this.btnSend.ChangeSkin = false;
this.btnSend.Enabled = false;
this.btnSend.Location = new System.Drawing.Point(0x217, 0x1df);
this.btnSend.Name = "btnSend";
this.btnSend.Size = new Size(0x51, 0x15);
this.btnSend.TabIndex = 13;
this.btnSend.Text = "发送";
this.btnSend.UseVisualStyleBackColor = false;
this.btnSend.Click += new EventHandler(this.btnSend_Click);
this.btnTimingManager.AutoArrangementX = true;
this.btnTimingManager.AutoSizeToImage = false;
this.btnTimingManager.BackColor = Color.Transparent;
this.btnTimingManager.BackgroundImage = (Image) manager.GetObject("btnTimingManager.BackgroundImage");
this.btnTimingManager.BackgroundImageDisable = (Image) manager.GetObject("btnTimingManager.BackgroundImageDisable");
this.btnTimingManager.BackgroundImageDown = (Image) manager.GetObject("btnTimingManager.BackgroundImageDown");
this.btnTimingManager.BackgroundImageHover = (Image) manager.GetObject("btnTimingManager.BackgroundImageHover");
this.btnTimingManager.ChangeSkin = false;
this.btnTimingManager.Image = Resources.GroupSms;
this.btnTimingManager.ImageAlign = ContentAlignment.TopLeft;
this.btnTimingManager.Location = new System.Drawing.Point(0xfd, 0x16b);
this.btnTimingManager.Name = "btnTimingManager";
this.btnTimingManager.Size = new Size(0x7c, 0x15);
this.btnTimingManager.TabIndex = 7;
this.btnTimingManager.Text = "定时短信管理器";
this.btnTimingManager.TextAlign = ContentAlignment.MiddleLeft;
this.btnTimingManager.TextImageRelation = TextImageRelation.ImageBeforeText;
this.btnTimingManager.UseVisualStyleBackColor = false;
this.btnTimingManager.Click += new EventHandler(this.btnTimingManager_Click);
this.pickMinute.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
int[] bits = new int[4];
bits[0] = 5;
this.pickMinute.Increment = new decimal(bits);
this.pickMinute.Location = new System.Drawing.Point(0x1dc, 0x1e1);
int[] numArray2 = new int[4];
numArray2[0] = 0x37;
this.pickMinute.Maximum = new decimal(numArray2);
this.pickMinute.Name = "pickMinute";
this.pickMinute.Size = new Size(0x29, 20);
this.pickMinute.TabIndex = 12;
this.pickMinute.Visible = false;
this.pickMinute.ValueChanged += new EventHandler(this.pickMinute_ValueChanged);
this.pickHour.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
this.pickHour.Location = new System.Drawing.Point(420, 0x1e1);
int[] numArray3 = new int[4];
numArray3[0] = 0x17;
this.pickHour.Maximum = new decimal(numArray3);
this.pickHour.Name = "pickHour";
this.pickHour.Size = new Size(0x29, 20);
this.pickHour.TabIndex = 11;
int[] numArray4 = new int[4];
numArray4[0] = 12;
this.pickHour.Value = new decimal(numArray4);
this.pickHour.Visible = false;
this.lblDay.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
this.lblDay.AutoSize = true;
this.lblDay.Location = new System.Drawing.Point(0x204, 0x1e5);
this.lblDay.Name = "lblDay";
this.lblDay.Size = new Size(0x13, 13);
this.lblDay.TabIndex = 11;
this.lblDay.Text = "分";
this.lblDay.Visible = false;
this.lblMonth.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
this.lblMonth.AutoSize = true;
this.lblMonth.Location = new System.Drawing.Point(460, 0x1e6);
this.lblMonth.Name = "lblMonth";
this.lblMonth.Size = new Size(0x13, 13);
this.lblMonth.TabIndex = 11;
this.lblMonth.Text = "时";
this.lblMonth.Visible = false;
this.lblYear.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
this.lblYear.AutoSize = true;
this.lblYear.Location = new System.Drawing.Point(0x194, 0x1e6);
this.lblYear.Name = "lblYear";
this.lblYear.Size = new Size(0x13, 13);
this.lblYear.TabIndex = 11;
this.lblYear.Text = "日";
this.lblYear.Visible = false;
this.pickYear.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
this.pickYear.Format = DateTimePickerFormat.Short;
this.pickYear.Location = new System.Drawing.Point(320, 0x1e1);
this.pickYear.MinDate = new DateTime(0x7d7, 2, 0x1c, 0, 0, 0, 0);
this.pickYear.Name = "pickYear";
this.pickYear.RightToLeft = RightToLeft.No;
this.pickYear.Size = new Size(0x53, 20);
this.pickYear.TabIndex = 10;
this.pickYear.Visible = false;
this.chkTimingSMS.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
this.chkTimingSMS.AutoSize = true;
this.chkTimingSMS.Location = new System.Drawing.Point(0xfc, 0x1e4);
this.chkTimingSMS.Name = "chkTimingSMS";
this.chkTimingSMS.Size = new Size(0x4a, 0x11);
this.chkTimingSMS.TabIndex = 9;
this.chkTimingSMS.Text = "定时短信";
this.chkTimingSMS.UseVisualStyleBackColor = true;
this.chkTimingSMS.CheckedChanged += new EventHandler(this.chkTimingSMS_CheckedChanged);
this.panel2.BackColor = Color.FromArgb(0xca, 0xd4, 0xde);
this.panel2.Controls.Add(this.txtSendContent);
this.panel2.Location = new System.Drawing.Point(0xfb, 0x183);
this.panel2.Name = "panel2";
this.panel2.Padding = new Padding(1);
this.panel2.Size = new Size(0x16b, 0x56);
this.panel2.TabIndex = 5;
this.panel1.BackColor = Color.FromArgb(0xca, 0xd4, 0xde);
this.panel1.Controls.Add(this.txtHistory);
this.panel1.Location = new System.Drawing.Point(0xfb, 11);
this.panel1.Name = "panel1";
this.panel1.Padding = new Padding(1);
this.panel1.Size = new Size(0x16b, 0x15d);
this.panel1.TabIndex = 4;
base.AutoScaleDimensions = new SizeF(6f, 13f);
base.AutoScaleMode = AutoScaleMode.Font;
base.BaseHeight = 0x248;
base.BaseWidth = 0x27d;
base.ClientSize = new Size(0x27d, 0x248);
base.Controls.Add(this.pnlMain);
base.DisplayLocation = new System.Drawing.Point(0, -95);
base.DisplaySize = new Size(0x27d, 0x248);
base.Icon = (Icon) manager.GetObject("$this.Icon");
this.MinimumSize = new Size(520, 460);
base.Name = "GroupSMSForm";
base.Padding = new Padding(3);
base.Text = "群发短信";
this.menuSendType.ResumeLayout(false);
this.pnlMain.ResumeLayout(false);
this.pnlMain.PerformLayout();
this.pickMinute.EndInit();
this.pickHour.EndInit();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.panel1.ResumeLayout(false);
base.ResumeLayout(false);
}
private void InitTimingDate()
{
try
{
DateTime time = DateTime.Now.AddMinutes(30.0);
this.pickYear.Value = time;
this.pickHour.Value = time.Hour;
this.pickMinute.Value = time.Minute;
}
catch (Exception)
{
}
}
private void Localize()
{
this.btnSend.Text = StringTable.Conversation.BtnSend;
}
protected override void OnFormClosed(FormClosedEventArgs e)
{
this._historyChatManager = null;
this.CurrentUser.StatusChanged -= new EventHandler(this.CurrentUser_StatusChanged);
if (this._groupSMSFailedForm != null)
{
this._groupSMSFailedForm.Close();
}
base.OnFormClosed(e);
this.CurrentUser.Configuration.UserSetting.ConversationSetting.SendMessageByEnterKey.Value = this.tsSendEnter.Checked;
}
protected override void OnFormClosing(FormClosingEventArgs e)
{
if (((this._stackSMSItems.Count > 0) && !this._sendFrequent) && (this._frameworkWin.UnifiedMessageBox.ShowConfirmation(this, "如果您现在关闭窗口,将无法看到短信发送的结果,\r\n\r\n是否现在就关闭窗口?") != DialogResult.Yes))
{
e.Cancel = true;
}
else
{
base.OnFormClosing(e);
}
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
try
{
this.txtSendContent.MaxLength = this.MaxInputLength;
this.Localize();
this.FormatSendInfo();
if (this.CurrentUser.Configuration.UserSetting.ConversationSetting.SendMessageByEnterKey == null)
{
this.tsSendCtrlEnter.Checked = true;
this.tsSendEnter.Checked = false;
}
this.inviteControl.SearchTextboxAtTop = true;
this.inviteControl.SplitterDistance = this.panel1.Height + 2;
}
catch
{
}
}
private void op_ImpsError(object sender, ImpsErrorEventArgs e)
{
if (!base.IsDisposed && (e.Description == "486"))
{
this._sendFrequent = true;
this._historyChatManager.LinkButtonFont = new Font("Microsoft Sans Serif", 9.5f, FontStyle.Regular, GraphicsUnit.Point, 0);
this._historyChatManager.AppentString("【系统提示】: " + StringHelper.EncodString(e.Summary) + "");
OleKey newKey = OleKeyManager.Instance.NewKey;
this._historyChatManager.AppendLink(newKey, "详细内容", "frequent");
this._historyChatManager.AppendCRLF();
this.txtSendContent.Enabled = false;
this.txtSendContent.Enabled = false;
}
else
{
this.SendNext();
}
}
private void op_Successed(object sender, EventArgs e)
{
this.SendNext();
}
private void opTriming_ImpsError(object sender, ImpsErrorEventArgs e)
{
if (!base.IsDisposed && !string.IsNullOrEmpty(e.Summary))
{
try
{
this._historyChatManager.AppentString(string.Format("【系统提示】:{0}", StringHelper.EncodString(e.Summary)));
this._historyChatManager.AppendCRLF();
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
}
private void opTriming_Successed(object sender, EventArgs e)
{
if (!base.IsDisposed)
{
try
{
List selectedContacts = this.inviteControl.SelectedContacts;
StringBuilder builder = new StringBuilder();
for (int i = 0; i < selectedContacts.Count; i++)
{
string displayName = selectedContacts[i].DisplayName;
if (selectedContacts[i].Uri.Raw == this.CurrentUser.Uri.Raw)
{
displayName = this.CurrentUser.Nickname;
}
builder.Append(displayName);
if (i < (selectedContacts.Count - 1))
{
builder.Append(",");
}
}
this._historyChatManager.AppentString(string.Format("【系统提示】:将于{0}年{1}月{2}日{3}时{4}分发送给:{5}!", 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.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("【系统提示】:短信发送完毕!");
this._historyChatManager.AppendCRLF();
}
}
}
private void SendSMS()
{
SimpleEventHandler method = null;
try
{
List selectedContacts = this.inviteControl.SelectedContacts;
if (selectedContacts.Count == 0)
{
if (method == null)
{
method = delegate {
this._frameworkWin.UnifiedMessageBox.ShowInfo("您至少要选择一个联系人!");
};
}
base.BeginInvoke(method);
}
else
{
string text = this.txtSendContent.Text;
if (this.op == null)
{
this.op = new AsyncBizOperation();
this.op.Successed += new EventHandler(this.op_Successed);
this.op.ImpsError += new EventHandler(this.op_ImpsError);
}
foreach (Imps.Client.Core.Contact contact in selectedContacts)
{
if ((contact.Uri.Raw == this.CurrentUser.Uri.Raw) || contact.EnableSMS)
{
SendSMSItem item = new SendSMSItem(contact, text);
this._stackSMSItems.Enqueue(item);
}
}
if ((this._stackSMSItems.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 selectedContacts = this.inviteControl.SelectedContacts;
if (selectedContacts.Count == 0)
{
if (method == null)
{
method = delegate {
this._frameworkWin.UnifiedMessageBox.ShowInfo("您至少要选择一个联系人!");
};
}
base.BeginInvoke(method);
}
else
{
string str = this.pickYear.Value.ToString("yyyy-MM-dd");
string str2 = this.pickHour.Value.ToString();
string str3 = this.pickMinute.Value.ToString();
if (DateTime.TryParse(string.Format("{0} {1}:{2}", str, str2, str3), out this._time))
{
if (this._time < DateTime.Now)
{
BalloonHelper.ShowInputErrorBallon(this.pickMinute, "您不能设置比当前更早的时间发送定时短信,请重新设定!");
}
else
{
IicUri[] uris = new IicUri[selectedContacts.Count];
for (int i = 0; i < selectedContacts.Count; i++)
{
uris[i] = selectedContacts[i].Uri;
}
if (this.opTriming == null)
{
this.opTriming = new AsyncBizOperation();
this.opTriming.Successed += new EventHandler(this.opTriming_Successed);
this.opTriming.ImpsError += new EventHandler(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.Checked = false;
this.tsSendCtrlEnter.Checked = true;
}
private void tsSendEnter_Click(object sender, EventArgs e)
{
this.tsSendEnter.Checked = true;
this.tsSendCtrlEnter.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.SuppressKeyPress = true;
this.Send();
}
else if (((this.tsSendEnter.Checked && (e.KeyCode == Keys.Return)) && !e.Control) || ((this.tsSendCtrlEnter.Checked && e.Control) && (e.KeyCode == Keys.Return)))
{
e.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;
}
}
}
}