📄 manageform.cs
字号:
{
this._currentPage = 1;
this.setPageLinks();
this.displayData(this.organizeData());
this.updateLabelInfo();
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
private void llLast_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
try
{
this._currentPage = this.MaxPage;
this.setPageLinks();
this.displayData(this.organizeData());
this.updateLabelInfo();
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
private void llNext_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
try
{
this._currentPage++;
this.setPageLinks();
this.displayData(this.organizeData());
this.updateLabelInfo();
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
private void llPre_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
try
{
this._currentPage--;
this.setPageLinks();
this.displayData(this.organizeData());
this.updateLabelInfo();
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
private void ManageForm_Load(object sender, EventArgs e)
{
this.displayData(this.organizeData());
}
protected override void OnFormClosed(FormClosedEventArgs e)
{
base.OnFormClosed(e);
this.CurrentUser.StatusChanged -= new EventHandler<UserSatusChangedEventArgs>(this, (IntPtr) this.CurrentUser_StatusChanged);
this.SmsMgr.ScheduleSmsesUpdated -= new EventHandler<ScheduleSmsesUpdateEventArgs>(this, (IntPtr) this.SmsMgr_ScheduleSmsesUpdated);
this.SmsMgr.ScheduleSmsesDeleted -= new EventHandler<ScheduleSmsesDeletedEventArgs>(this, (IntPtr) this.SmsMgr_ScheduleSmsesDeleted);
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
this.CurrentUser.StatusChanged += new EventHandler<UserSatusChangedEventArgs>(this, (IntPtr) this.CurrentUser_StatusChanged);
this.SmsMgr.ScheduleSmsesUpdated += new EventHandler<ScheduleSmsesUpdateEventArgs>(this, (IntPtr) this.SmsMgr_ScheduleSmsesUpdated);
this.SmsMgr.ScheduleSmsesDeleted += new EventHandler<ScheduleSmsesDeletedEventArgs>(this, (IntPtr) this.SmsMgr_ScheduleSmsesDeleted);
}
private IList<ScheduleSms> organizeData()
{
IList<ScheduleSms> list = new List<ScheduleSms>();
if (this.SmsMgr.ScheduleSmsList.ScheduleSmses.Count != 0)
{
if (this._currentPage > this.MaxPage)
{
this._currentPage = this.MaxPage;
}
int num = ((this._currentPage - 1) * 50) + 1;
if (num < 0)
{
num = 0;
}
int num2 = this._currentPage * 50;
for (int i = num; i <= num2; i++)
{
if ((i - 1) >= this.SmsMgr.ScheduleSmsList.ScheduleSmses.Count)
{
return list;
}
ScheduleSms sms = this.SmsMgr.ScheduleSmsList.ScheduleSmses[i - 1];
if (sms != null)
{
list.Add(sms);
}
}
}
return list;
}
private void setPageLinks()
{
if (this.SmsMgr.ScheduleSmsList.SMSCount == 0)
{
this.llFirst.Enabled = false;
this.llNext.Enabled = false;
this.llPre.Enabled = false;
this.llLast.Enabled = false;
}
else
{
this.llFirst.Enabled = this._currentPage != 1;
this.llNext.Enabled = this._currentPage != this.MaxPage;
this.llPre.Enabled = this._currentPage > 1;
this.llLast.Enabled = this._currentPage != this.MaxPage;
}
}
public void ShowMe(IWin32Window owner)
{
ControlHelper.ShowFormCenterOnParent(this, owner);
}
private void SmsMgr_ScheduleSmsesDeleted(object sender, ScheduleSmsesDeletedEventArgs e)
{
this.displayData(this.organizeData());
}
private void SmsMgr_ScheduleSmsesUpdated(object sender, ScheduleSmsesUpdateEventArgs e)
{
this.displayData(this.organizeData());
}
private void uBtnDelete_Click(object sender, EventArgs e)
{
try
{
ArrayList list = new ArrayList();
foreach (DataGridViewRow row in this.dataGridViewSms.get_Rows())
{
if ((row.get_Cells().get_Item(0).get_Value() != null) && ((bool) row.get_Cells().get_Item(0).get_FormattedValue()))
{
list.Add(row.get_Cells().get_Item(4).get_Value().ToString());
}
}
if (list.Count > 0)
{
UnifiedMessageBox box = new UnifiedMessageBox(this._framework);
if (box.ShowConfirmation(this, "是否确认删除定时短信?", MessageBoxDefaultButton.Button2) == DialogResult.Yes)
{
AsyncBizOperation op = new AsyncBizOperation();
this.SmsMgr.AsyncDeleteScheduleSms((string[]) list.ToArray(typeof(string)), op);
}
}
else
{
new UnifiedMessageBox(this._framework).ShowInfo(this, "请选择要删除的定时短信。");
}
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
private void uBtnRefresh_Click(object sender, EventArgs e)
{
try
{
this.getSmsData();
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
private void updateLabelInfo()
{
this.labelSum.Text = this.SmsMgr.ScheduleSmsList.SMSCount.ToString();
this.labelPage.Text = this._currentPage.ToString() + "/" + this.MaxPage.ToString();
}
private User CurrentUser
{
get
{
return this._framework.AccountManager.CurrentUser;
}
}
private int MaxPage
{
get
{
int num = this.SmsMgr.ScheduleSmsList.SMSCount / 50;
if (num == 0)
{
return 1;
}
if ((this.SmsMgr.ScheduleSmsList.SMSCount % 50) != 0)
{
num++;
}
return num;
}
}
private ScheduleSmsManager SmsMgr
{
get
{
return this.CurrentUser.ScheduleSmsMgr;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -