📄 messagesettingscontrol.cs
字号:
namespace Imps.Client.Pc
{
using Imps.Client.Core;
using Imps.Client.Utils;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
public class MessageSettingsControl : GroupOptionsControlBase
{
private IFrameworkWindow _framework;
private IContainer components;
private GroupBox gbMessageSetting;
private GroupBox gbSMSetting;
private RadioButton rbMessageReceiveAndShow;
private RadioButton rbMessageReceiveNotShow;
private RadioButton rbMessageReject;
private RadioButton rbSMReceive;
private RadioButton rbSMRejectReceive;
public MessageSettingsControl(IFrameworkWindow wnd)
{
this._framework = wnd;
this.InitializeComponent();
}
public override bool CheckUserInput()
{
return true;
}
protected override void Dispose(bool disposing)
{
if (disposing && (this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void handleUiEvent()
{
this.rbSMRejectReceive.CheckedChanged += new EventHandler(this.uiData_Changed);
this.rbSMReceive.CheckedChanged += new EventHandler(this.uiData_Changed);
this.rbMessageReject.CheckedChanged += new EventHandler(this.uiData_Changed);
this.rbMessageReceiveNotShow.CheckedChanged += new EventHandler(this.uiData_Changed);
this.rbMessageReceiveAndShow.CheckedChanged += new EventHandler(this.uiData_Changed);
}
private void InitializeComponent()
{
this.gbSMSetting = new GroupBox();
this.rbSMRejectReceive = new RadioButton();
this.rbSMReceive = new RadioButton();
this.gbMessageSetting = new GroupBox();
this.rbMessageReject = new RadioButton();
this.rbMessageReceiveNotShow = new RadioButton();
this.rbMessageReceiveAndShow = new RadioButton();
this.gbSMSetting.SuspendLayout();
this.gbMessageSetting.SuspendLayout();
base.SuspendLayout();
this.gbSMSetting.Controls.Add(this.rbSMRejectReceive);
this.gbSMSetting.Controls.Add(this.rbSMReceive);
this.gbSMSetting.Location = new System.Drawing.Point(5, 3);
this.gbSMSetting.Name = "gbSMSetting";
this.gbSMSetting.Size = new Size(0x12f, 0x6d);
this.gbSMSetting.TabIndex = 0;
this.gbSMSetting.TabStop = false;
this.gbSMSetting.Text = "短信设置";
this.rbSMRejectReceive.set_AutoSize(true);
this.rbSMRejectReceive.Location = new System.Drawing.Point(0x25, 0x45);
this.rbSMRejectReceive.Name = "rbSMRejectReceive";
this.rbSMRejectReceive.Size = new Size(0x61, 0x11);
this.rbSMRejectReceive.TabIndex = 1;
this.rbSMRejectReceive.Text = "不接收群短信";
this.rbSMRejectReceive.set_UseVisualStyleBackColor(true);
this.rbSMReceive.set_AutoSize(true);
this.rbSMReceive.Checked = true;
this.rbSMReceive.Location = new System.Drawing.Point(0x25, 0x21);
this.rbSMReceive.Name = "rbSMReceive";
this.rbSMReceive.Size = new Size(0x55, 0x11);
this.rbSMReceive.TabIndex = 0;
this.rbSMReceive.TabStop = true;
this.rbSMReceive.Text = "接收群短信";
this.rbSMReceive.set_UseVisualStyleBackColor(true);
this.gbMessageSetting.Controls.Add(this.rbMessageReject);
this.gbMessageSetting.Controls.Add(this.rbMessageReceiveNotShow);
this.gbMessageSetting.Controls.Add(this.rbMessageReceiveAndShow);
this.gbMessageSetting.Location = new System.Drawing.Point(5, 0x76);
this.gbMessageSetting.Name = "gbMessageSetting";
this.gbMessageSetting.Size = new Size(0x12f, 0xa4);
this.gbMessageSetting.TabIndex = 1;
this.gbMessageSetting.TabStop = false;
this.gbMessageSetting.Text = "消息设置";
this.rbMessageReject.set_AutoSize(true);
this.rbMessageReject.Location = new System.Drawing.Point(0x26, 0x6d);
this.rbMessageReject.Name = "rbMessageReject";
this.rbMessageReject.Size = new Size(0x85, 0x11);
this.rbMessageReject.TabIndex = 2;
this.rbMessageReject.TabStop = true;
this.rbMessageReject.Text = "拒绝该群的即时消息";
this.rbMessageReject.set_UseVisualStyleBackColor(true);
this.rbMessageReceiveNotShow.set_AutoSize(true);
this.rbMessageReceiveNotShow.Location = new System.Drawing.Point(0x26, 0x4a);
this.rbMessageReceiveNotShow.Name = "rbMessageReceiveNotShow";
this.rbMessageReceiveNotShow.Size = new Size(0xeb, 0x11);
this.rbMessageReceiveNotShow.TabIndex = 1;
this.rbMessageReceiveNotShow.TabStop = true;
this.rbMessageReceiveNotShow.Text = "接收但不提示消息(只保留在聊天记录中)";
this.rbMessageReceiveNotShow.set_UseVisualStyleBackColor(true);
this.rbMessageReceiveAndShow.set_AutoSize(true);
this.rbMessageReceiveAndShow.Checked = true;
this.rbMessageReceiveAndShow.Location = new System.Drawing.Point(0x26, 0x26);
this.rbMessageReceiveAndShow.Name = "rbMessageReceiveAndShow";
this.rbMessageReceiveAndShow.Size = new Size(0x6d, 0x11);
this.rbMessageReceiveAndShow.TabIndex = 0;
this.rbMessageReceiveAndShow.TabStop = true;
this.rbMessageReceiveAndShow.Text = "接收并提示消息";
this.rbMessageReceiveAndShow.set_UseVisualStyleBackColor(true);
base.set_AutoScaleDimensions(new SizeF(6f, 13f));
base.set_AutoScaleMode(1);
this.BackColor = Color.Transparent;
base.Controls.Add(this.gbMessageSetting);
base.Controls.Add(this.gbSMSetting);
base.Name = "MessageSettingsControl";
base.Size = new Size(0x13a, 290);
this.gbSMSetting.ResumeLayout(false);
this.gbSMSetting.PerformLayout();
this.gbMessageSetting.ResumeLayout(false);
this.gbMessageSetting.PerformLayout();
base.ResumeLayout(false);
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
}
private void setContolsEditable()
{
this.rbSMRejectReceive.Enabled = base._personalGroup.UserInfo.EnableModifyMyInfo;
this.rbSMReceive.Enabled = base._personalGroup.UserInfo.EnableModifyMyInfo;
this.rbMessageReject.Enabled = base._personalGroup.UserInfo.EnableModifyMyInfo;
this.rbMessageReceiveNotShow.Enabled = base._personalGroup.UserInfo.EnableModifyMyInfo;
this.rbMessageReceiveAndShow.Enabled = base._personalGroup.UserInfo.EnableModifyMyInfo;
}
private void uiData_Changed(object sender, EventArgs e)
{
UiErrorHelper.HandEventSafely(this._framework, delegate {
base.UserInfoModified = 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.EnableModifyMyInfo)
{
return false;
}
try
{
if (this.rbSMRejectReceive.Checked)
{
base._personalGroup.UserInfo.GroupReceiveSMSPolicy.ProposedValue = false;
}
else
{
base._personalGroup.UserInfo.GroupReceiveSMSPolicy.ProposedValue = true;
}
if (this.rbMessageReject.Checked)
{
base._personalGroup.UserInfo.GroupReceiveMessagePolicy.ProposedValue = PersonalGroupReceiveMessagePolicy.Reject;
}
else if (this.rbMessageReceiveNotShow.Checked)
{
base._personalGroup.UserInfo.GroupReceiveMessagePolicy.ProposedValue = PersonalGroupReceiveMessagePolicy.AcceptButNotShow;
}
else
{
base._personalGroup.UserInfo.GroupReceiveMessagePolicy.ProposedValue = PersonalGroupReceiveMessagePolicy.Accept;
}
this.uiData_Updated();
}
catch (Exception exception)
{
this._framework.UnifiedMessageBox.ShowError(this, exception.ToString());
}
}
else
{
try
{
this.handleUiEvent();
this.setContolsEditable();
if (base._personalGroup.UserInfo.GroupReceiveSMSPolicy.Value)
{
this.rbSMReceive.Checked = true;
}
else
{
this.rbSMRejectReceive.Checked = true;
}
switch (base._personalGroup.UserInfo.GroupReceiveMessagePolicy.Value)
{
case PersonalGroupReceiveMessagePolicy.Reject:
this.rbMessageReject.Checked = true;
goto Label_0181;
case PersonalGroupReceiveMessagePolicy.Accept:
this.rbMessageReceiveAndShow.Checked = true;
goto Label_0181;
}
this.rbMessageReceiveNotShow.Checked = true;
}
catch (Exception exception2)
{
ClientLogger.WriteException(exception2);
return false;
}
finally
{
base.UserInfoModified = false;
}
}
Label_0181:
return true;
}
private User CurrentUser
{
get
{
return this._framework.AccountManager.CurrentUser;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -