📄 customemotionmanagerform.cs
字号:
if (emotion != null)
{
try
{
this._iceManager.DeleteOwnerEmotion(emotion);
continue;
}
catch (Exception exception)
{
ClientLogger.WriteException("自定义表情 -> 删除", exception);
continue;
}
}
}
this.LoadCustomEmotion(this._curBegin);
this.BindList();
}
}
private void btnEdit_Click(object sender, EventArgs e)
{
if (this.dgvCustomEmotionList.get_SelectedRows().Count >= 1)
{
if ((this._customEmotionAddForm != null) && !this._customEmotionAddForm.IsDisposed)
{
if (this._customEmotionAddForm.OperateType != CustomEmotionAddForm.OperateTypeEnum.Edit)
{
this._customEmotionAddForm.Close();
this._customEmotionAddForm.Dispose();
this._customEmotionAddForm = new CustomEmotionAddForm(CustomEmotionAddForm.OperateTypeEnum.Edit, this._frameworkWin);
this._customEmotionAddForm.AddCE += new EventHandler<CustomEmotionEventArgs>(this, (IntPtr) this._customEmotionAddForm_AddCustomEmotion);
this._customEmotionAddForm.RefreshList += new EventHandler<CustomEmotionEventArgs>(this, (IntPtr) this._customEmotionAddForm_RefreshList);
}
}
else
{
this._customEmotionAddForm = new CustomEmotionAddForm(CustomEmotionAddForm.OperateTypeEnum.Edit, this._frameworkWin);
this._customEmotionAddForm.AddCE += new EventHandler<CustomEmotionEventArgs>(this, (IntPtr) this._customEmotionAddForm_AddCustomEmotion);
this._customEmotionAddForm.RefreshList += new EventHandler<CustomEmotionEventArgs>(this, (IntPtr) this._customEmotionAddForm_RefreshList);
}
int num = this.dgvCustomEmotionList.get_SelectedRows().Count - 1;
this._customEmotionAddForm.EditCustomEmotion = this.dgvCustomEmotionList.get_SelectedRows().get_Item(num).get_Tag() as Imps.Client.Core.CustomEmotion.CustomEmotion;
ControlHelper.ShowFormCenterOnParent(this._customEmotionAddForm, this);
this._customEmotionAddForm.Focus();
}
}
private void btnExport_Click(object sender, EventArgs e)
{
this.cmsExport.Show(this.btnExport, 0, this.btnExport.Height);
}
private void btnImport_Click(object sender, EventArgs e)
{
if ((this._customEmotionAddForm != null) && !this._customEmotionAddForm.IsDisposed)
{
if (this._customEmotionAddForm.OperateType != CustomEmotionAddForm.OperateTypeEnum.Import)
{
this._customEmotionAddForm.Close();
this._customEmotionAddForm.Dispose();
this._customEmotionAddForm = new CustomEmotionAddForm(CustomEmotionAddForm.OperateTypeEnum.Import, this._frameworkWin);
this._customEmotionAddForm.AddCE += new EventHandler<CustomEmotionEventArgs>(this, (IntPtr) this._customEmotionAddForm_AddCustomEmotion);
this._customEmotionAddForm.RefreshList += new EventHandler<CustomEmotionEventArgs>(this, (IntPtr) this._customEmotionAddForm_RefreshList);
}
}
else
{
this._customEmotionAddForm = new CustomEmotionAddForm(CustomEmotionAddForm.OperateTypeEnum.Import, this._frameworkWin);
this._customEmotionAddForm.AddCE += new EventHandler<CustomEmotionEventArgs>(this, (IntPtr) this._customEmotionAddForm_AddCustomEmotion);
this._customEmotionAddForm.RefreshList += new EventHandler<CustomEmotionEventArgs>(this, (IntPtr) this._customEmotionAddForm_RefreshList);
}
ControlHelper.ShowFormCenterOnParent(this._customEmotionAddForm, this);
this._customEmotionAddForm.Focus();
}
private void btnOK_Click(object sender, EventArgs e)
{
base.Close();
}
private void CustomEmotionManagerForm_FormClosed(object sender, FormClosedEventArgs e)
{
if ((this._customEmotionAddForm != null) && !this._customEmotionAddForm.IsDisposed)
{
this._customEmotionAddForm.Close();
this._customEmotionAddForm.Dispose();
}
}
private void CustomEmotionManagerForm_Load(object sender, EventArgs e)
{
this._dicImageByID = new Dictionary<string, Image>();
this.LoadCustomEmotion(this._curBegin);
this.BindList();
scroll_widget _widget = scroll_maker.instance.vscroll();
_widget.host = this.dgvCustomEmotionList;
this.dgvCustomEmotionList.Parent.Controls.Add(_widget);
this.btnAdd.Focus();
}
private void dgvCustomEmotionList_CellEnter(object sender, DataGridViewCellEventArgs e)
{
if (this.dgvCustomEmotionList.get_Rows().get_Item(e.get_RowIndex()).get_Tag() == null)
{
if (this.llLastPage.Enabled)
{
this.llLastPage.Focus();
}
else
{
this.btnAdd.Focus();
}
}
}
private void dgvCustomEmotionList_DataError(object sender, DataGridViewDataErrorEventArgs e)
{
ClientLogger.WriteException("自定义表情 -> 列表绑定", e.get_Exception());
e.Cancel = true;
}
private void dgvCustomEmotionList_Enter(object sender, EventArgs e)
{
this.dgvCustomEmotionList.set_CurrentCell(this.dgvCustomEmotionList.get_Item(0, 0));
}
private void dgvCustomEmotionList_Scroll(object sender, ScrollEventArgs e)
{
if ((e.NewValue > (this._curPageCustomEmotionList.get_Count() - 1)) && (this._curPageCustomEmotionList.get_Count() > 0))
{
this.dgvCustomEmotionList.set_FirstDisplayedScrollingRowIndex(this._curPageCustomEmotionList.get_Count() - 1);
}
}
private void dgvCustomEmotionList_SelectionChanged(object sender, EventArgs e)
{
try
{
if (this.listBinded)
{
foreach (DataGridViewRow row in this.dgvCustomEmotionList.get_SelectedRows())
{
if (row.get_Tag() == null)
{
row.set_Selected(false);
}
}
bool flag = this.dgvCustomEmotionList.get_SelectedRows().Count > 0;
this.btnDelete.Enabled = flag;
this.btnEdit.Enabled = this.dgvCustomEmotionList.get_SelectedRows().Count == 1;
this.tsmiExportSelected.set_Enabled(flag);
if (flag)
{
Imps.Client.Core.CustomEmotion.CustomEmotion emotion;
if (this.dgvCustomEmotionList.get_CurrentRow().get_Selected())
{
emotion = this.dgvCustomEmotionList.get_CurrentRow().get_Tag() as Imps.Client.Core.CustomEmotion.CustomEmotion;
}
else
{
emotion = this.dgvCustomEmotionList.get_SelectedRows().get_Item(0).get_Tag() as Imps.Client.Core.CustomEmotion.CustomEmotion;
}
Image srcImage = this._iceManager.GetEmotionImageById(emotion.Id);
if (srcImage != null)
{
if ((srcImage.Width > this.pbEmotion.Width) || (srcImage.Height > this.pbEmotion.Height))
{
this.pbEmotion.SizeMode = (PictureBoxSizeMode) 4;
}
else
{
this.pbEmotion.SizeMode = PictureBoxSizeMode.CenterImage;
}
}
this.pbEmotion.Image = CustomEmotionUtils.ClearImage(srcImage);
}
else
{
this.pbEmotion.Image = null;
}
}
}
catch (Exception exception)
{
ClientLogger.WriteException("自定义表情 -> 选择", exception);
}
}
protected override void Dispose(bool disposing)
{
if (disposing && (this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private string GetCustomEmotionStorePath(string id)
{
return this._frameworkWin.AccountManager.CurrentUser.CustomEmotionManager.GetOwnerEmotionImagePath(id);
}
private string GetSaveFilePath()
{
string fileName = string.Empty;
if (this.sfdExport.ShowDialog(this) == DialogResult.OK)
{
fileName = this.sfdExport.FileName;
}
return fileName;
}
private void InitializeComponent()
{
this.components = new Container();
DataGridViewCellStyle style = new DataGridViewCellStyle();
DataGridViewCellStyle style2 = new DataGridViewCellStyle();
DataGridViewCellStyle style3 = new DataGridViewCellStyle();
DataGridViewCellStyle style4 = new DataGridViewCellStyle();
DataGridViewCellStyle style5 = new DataGridViewCellStyle();
ComponentResourceManager manager = new ComponentResourceManager(typeof(CustomEmotionManagerForm));
this.dgvCustomEmotionList = new DataGridView();
this.columnImage = new DataGridViewTextBoxColumn();
this.columnShotCut = new DataGridViewTextBoxColumn();
this.columnName = new DataGridViewTextBoxColumn();
this.lTitleMessage = new Label();
this.lPages = new Label();
this.btnAdd = new XButton();
this.btnDelete = new XButton();
this.btnEdit = new XButton();
this.btnImport = new XButton();
this.btnExport = new XButton();
this.cmsExport = new menu_widget(this.components);
this.tsmiExportSelected = new ToolStripMenuItem();
this.tsmiExportAll = new ToolStripMenuItem();
this.pbEmotion = new PictureBox();
this.btnOK = new XButton();
this.sfdExport = new SaveFileDialog();
this.llLastPage = new LinkLabel();
this.llNextPage = new LinkLabel();
this.panel1 = new Panel();
this.panel2 = new Panel();
this.label1 = new Label();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -