📄 extendinfocontrol.cs
字号:
namespace Imps.Client.Pc
{
using Imps.Client.Core;
using Imps.Client.Pc.Controls;
using Imps.Client.Utils;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
public class ExtendInfoControl : GroupOptionsControlBase
{
private IFrameworkWindow _framework;
private CheckBox cbEnbalSearched;
private IContainer components;
private GroupBox gbCategory;
private GroupBox gbIntroduce;
private GroupBox gbJoinMethod;
private RadioButton rbAllAgree;
private RadioButton rbAllReject;
private RadioButton rbNeedApprove;
private GroupCategory ucGroupCategory;
private XTextBox xtbGroupIntroduce;
public ExtendInfoControl(IFrameworkWindow wnd)
{
this._framework = wnd;
this.InitializeComponent();
}
public override bool CheckUserInput()
{
return true;
}
public override bool ControlUnload()
{
return base.ControlUnload();
}
protected override void Dispose(bool disposing)
{
if (disposing && (this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void handleUiEvent()
{
this.ucGroupCategory.xcmbCategoryOne.SelectedIndexChanged += new EventHandler(this.uiData_Changed);
this.ucGroupCategory.xcmbCategoryTwo.SelectedIndexChanged += new EventHandler(this.uiData_Changed);
this.xtbGroupIntroduce.TextChanged += new EventHandler(this.uiData_Changed);
this.cbEnbalSearched.CheckedChanged += new EventHandler(this.uiData_Changed);
this.rbAllReject.CheckedChanged += new EventHandler(this.uiData_Changed);
this.rbAllAgree.CheckedChanged += new EventHandler(this.uiData_Changed);
this.rbNeedApprove.CheckedChanged += new EventHandler(this.uiData_Changed);
}
private void InitializeComponent()
{
this.gbCategory = new GroupBox();
this.ucGroupCategory = new GroupCategory();
this.gbIntroduce = new GroupBox();
this.xtbGroupIntroduce = new XTextBox();
this.cbEnbalSearched = new CheckBox();
this.gbJoinMethod = new GroupBox();
this.rbAllReject = new RadioButton();
this.rbAllAgree = new RadioButton();
this.rbNeedApprove = new RadioButton();
this.gbCategory.SuspendLayout();
this.gbIntroduce.SuspendLayout();
this.gbJoinMethod.SuspendLayout();
base.SuspendLayout();
this.gbCategory.Controls.Add(this.ucGroupCategory);
this.gbCategory.Location = new System.Drawing.Point(4, 1);
this.gbCategory.Name = "gbCategory";
this.gbCategory.Size = new Size(0x133, 0x41);
this.gbCategory.TabIndex = 0;
this.gbCategory.TabStop = false;
this.gbCategory.Text = "所属分类";
this.ucGroupCategory.BackColor = Color.Transparent;
this.ucGroupCategory.Location = new System.Drawing.Point(0x21, 0x18);
this.ucGroupCategory.Name = "ucGroupCategory";
this.ucGroupCategory.Size = new Size(0xe7, 0x23);
this.ucGroupCategory.TabIndex = 2;
this.ucGroupCategory.Value = "-1";
this.gbIntroduce.Controls.Add(this.xtbGroupIntroduce);
this.gbIntroduce.Location = new System.Drawing.Point(4, 0x4c);
this.gbIntroduce.Name = "gbIntroduce";
this.gbIntroduce.Size = new Size(0x133, 90);
this.gbIntroduce.TabIndex = 1;
this.gbIntroduce.TabStop = false;
this.gbIntroduce.Text = "群简介(非群成员也可见,限制256个字以内)";
this.xtbGroupIntroduce.BackColor = Color.White;
this.xtbGroupIntroduce.BorderStyle = BorderStyle.FixedSingle;
this.xtbGroupIntroduce.Dock = DockStyle.Fill;
this.xtbGroupIntroduce.EmptyTextTip = "";
this.xtbGroupIntroduce.EmptyTextTipColor = Color.DarkGray;
this.xtbGroupIntroduce.Location = new System.Drawing.Point(3, 0x10);
this.xtbGroupIntroduce.MaxLength = 0x100;
this.xtbGroupIntroduce.Multiline = true;
this.xtbGroupIntroduce.Name = "xtbGroupIntroduce";
this.xtbGroupIntroduce.ScrollBars = ScrollBars.Vertical;
this.xtbGroupIntroduce.Size = new Size(0x12d, 0x47);
this.xtbGroupIntroduce.TabIndex = 0;
this.cbEnbalSearched.set_AutoSize(true);
this.cbEnbalSearched.Checked = true;
this.cbEnbalSearched.CheckState = CheckState.Checked;
this.cbEnbalSearched.Location = new System.Drawing.Point(0x16, 0xab);
this.cbEnbalSearched.Name = "cbEnbalSearched";
this.cbEnbalSearched.Size = new Size(0x86, 0x11);
this.cbEnbalSearched.TabIndex = 2;
this.cbEnbalSearched.Text = "允许被其它人搜索到";
this.cbEnbalSearched.set_UseVisualStyleBackColor(true);
this.gbJoinMethod.Controls.Add(this.rbAllReject);
this.gbJoinMethod.Controls.Add(this.rbAllAgree);
this.gbJoinMethod.Controls.Add(this.rbNeedApprove);
this.gbJoinMethod.Location = new System.Drawing.Point(4, 0xc2);
this.gbJoinMethod.Name = "gbJoinMethod";
this.gbJoinMethod.Size = new Size(0x133, 0x5c);
this.gbJoinMethod.TabIndex = 3;
this.gbJoinMethod.TabStop = false;
this.gbJoinMethod.Text = "其它用户加入方式";
this.rbAllReject.set_AutoSize(true);
this.rbAllReject.Location = new System.Drawing.Point(0x20, 0x41);
this.rbAllReject.Name = "rbAllReject";
this.rbAllReject.Size = new Size(0x49, 0x11);
this.rbAllReject.TabIndex = 2;
this.rbAllReject.TabStop = true;
this.rbAllReject.Text = "全部拒绝";
this.rbAllReject.set_UseVisualStyleBackColor(true);
this.rbAllAgree.set_AutoSize(true);
this.rbAllAgree.Location = new System.Drawing.Point(0x20, 0x2a);
this.rbAllAgree.Name = "rbAllAgree";
this.rbAllAgree.Size = new Size(0x49, 0x11);
this.rbAllAgree.TabIndex = 1;
this.rbAllAgree.TabStop = true;
this.rbAllAgree.Text = "全部同意";
this.rbAllAgree.set_UseVisualStyleBackColor(true);
this.rbNeedApprove.set_AutoSize(true);
this.rbNeedApprove.Checked = true;
this.rbNeedApprove.Location = new System.Drawing.Point(0x20, 20);
this.rbNeedApprove.Name = "rbNeedApprove";
this.rbNeedApprove.Size = new Size(0xb5, 0x11);
this.rbNeedApprove.TabIndex = 0;
this.rbNeedApprove.TabStop = true;
this.rbNeedApprove.Text = "需要管理员同意才能加入该群";
this.rbNeedApprove.set_UseVisualStyleBackColor(true);
base.set_AutoScaleDimensions(new SizeF(6f, 13f));
base.set_AutoScaleMode(1);
this.BackColor = Color.Transparent;
base.Controls.Add(this.gbJoinMethod);
base.Controls.Add(this.cbEnbalSearched);
base.Controls.Add(this.gbIntroduce);
base.Controls.Add(this.gbCategory);
base.Name = "ExtendInfoControl";
base.Size = new Size(0x13a, 290);
this.gbCategory.ResumeLayout(false);
this.gbIntroduce.ResumeLayout(false);
this.gbIntroduce.PerformLayout();
this.gbJoinMethod.ResumeLayout(false);
this.gbJoinMethod.PerformLayout();
base.ResumeLayout(false);
base.PerformLayout();
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
}
private void setContolsEditable()
{
this.ucGroupCategory.Enabled = base._personalGroup.UserInfo.EnableModifyGroupInfo;
this.xtbGroupIntroduce.ReadOnly = !base._personalGroup.UserInfo.EnableModifyGroupInfo;
this.cbEnbalSearched.Enabled = base._personalGroup.UserInfo.EnableModifyGroupInfo;
this.rbAllReject.Enabled = base._personalGroup.UserInfo.EnableModifyGroupInfo;
this.rbAllAgree.Enabled = base._personalGroup.UserInfo.EnableModifyGroupInfo;
this.rbNeedApprove.Enabled = base._personalGroup.UserInfo.EnableModifyGroupInfo;
}
private void uiData_Changed(object sender, EventArgs e)
{
UiErrorHelper.HandEventSafely(this._framework, delegate {
base.GroupInfoModified = true;
});
}
private void uiData_Updated()
{
UiErrorHelper.HandEventSafely(this._framework, delegate {
base.GroupInfoModified = false;
base.UserInfoModified = false;
});
}
public override bool UpdateData(bool update)
{
if (update)
{
if (!this.CheckUserInput())
{
return false;
}
if (!base._personalGroup.UserInfo.EnableModifyGroupInfo)
{
return false;
}
try
{
base._personalGroup.GroupInfo.Category.ProposedValue = this.ucGroupCategory.Value;
base._personalGroup.GroupInfo.Introduce.ProposedValue = this.xtbGroupIntroduce.Text;
base._personalGroup.GroupInfo.EnableSearched.ProposedValue = this.cbEnbalSearched.Checked;
if (this.rbAllReject.Checked)
{
base._personalGroup.GroupInfo.ValidateType.ProposedValue = PersonalGroupValidateType.AllRejct;
}
else if (this.rbAllAgree.Checked)
{
base._personalGroup.GroupInfo.ValidateType.ProposedValue = PersonalGroupValidateType.AllAgree;
}
else
{
base._personalGroup.GroupInfo.ValidateType.ProposedValue = PersonalGroupValidateType.NeedValidate;
}
this.uiData_Updated();
}
catch (Exception exception)
{
this._framework.UnifiedMessageBox.ShowError(this, exception.ToString());
}
}
else
{
try
{
this.ucGroupCategory.Categorys = this.CurrentUser.PersonalGroupManager.GroupCategory.Categorys;
this.handleUiEvent();
this.setContolsEditable();
this.ucGroupCategory.Value = base._personalGroup.GroupInfo.Category.Value;
this.xtbGroupIntroduce.Text = base._personalGroup.GroupInfo.Introduce.Value;
this.cbEnbalSearched.Checked = base._personalGroup.GroupInfo.EnableSearched.Value;
switch (base._personalGroup.GroupInfo.ValidateType.Value)
{
case PersonalGroupValidateType.AllRejct:
this.rbAllReject.Checked = true;
goto Label_01F5;
case PersonalGroupValidateType.AllAgree:
this.rbAllAgree.Checked = true;
goto Label_01F5;
}
this.rbNeedApprove.Checked = true;
}
catch (Exception exception2)
{
ClientLogger.WriteException(exception2);
return false;
}
finally
{
base.GroupInfoModified = false;
}
}
Label_01F5:
return true;
}
private User CurrentUser
{
get
{
return this._framework.AccountManager.CurrentUser;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -