📄 groupoptionsmanager.cs
字号:
namespace Imps.Client.Pc
{
using Imps.Client;
using Imps.Client.Core;
using Imps.Client.Pc.UserAccount;
using Imps.Client.Resource;
using Imps.Client.Utils;
using System;
using System.Drawing;
using System.Reflection;
using System.Windows.Forms;
public class GroupOptionsManager : IOptionsManager
{
private OptionsCategory[] _categories;
private IFrameworkWindow _frameworkWnd;
public GroupOptionsManager(IFrameworkWindow framework)
{
this._frameworkWnd = framework;
}
private void BuildOptionsCategory()
{
switch (((this.CurrentUser == null) ? UserAccountStatus.None : this.CurrentUser.Status))
{
case UserAccountStatus.Logon:
case UserAccountStatus.OfflineLogon:
{
this._categories = new OptionsCategory[1];
OptionsItem[] items = new OptionsItem[3];
this._categories[0] = new OptionsCategory(StringTable.Options.SystemSetting, items);
items[0] = new OptionsItem(this, "BasicInfo", StringTable.GroupOptions.BasicInfo, typeof(BasicInfoControl));
items[1] = new OptionsItem(this, "ExtendInfo", StringTable.GroupOptions.ExtendInfo, typeof(ExtendInfoControl));
items[2] = new OptionsItem(this, "MessegeSetting", StringTable.GroupOptions.MessegeSetting, typeof(MessageSettingsControl));
break;
}
}
}
public IOptionsControl CreateOptionsControl(OptionsItem oi)
{
IOptionsControl control = null;
ConstructorInfo constructor = oi.ControlType.GetConstructor(new Type[] { typeof(IFrameworkWindow) });
if (constructor == null)
{
control = (IOptionsControl) Activator.CreateInstance(oi.ControlType);
}
else
{
control = (IOptionsControl) constructor.Invoke(new object[] { this._frameworkWnd });
}
InitOptionsControl(control.Control);
control.ControlLoad();
return control;
}
public void HandleConnectionFailed(IFrameworkWindow wnd, int ErrorCode)
{
Imps.Client.Core.User currentUser = this._frameworkWnd.AccountManager.CurrentUser;
LoginFailedForm form = new LoginFailedForm(ErrorCode, currentUser);
if (ControlHelper.ShowDialogCenterOnParent(form, wnd.MainWindow, true) == DialogResult.OK)
{
NetworkDetectForm form2 = new NetworkDetectForm();
ControlHelper.ShowDialogCenterOnParent(form2, wnd.MainWindow, true);
}
}
private static void InitOptionsControl(Control ctrl)
{
ctrl.Location = new System.Drawing.Point(0, 0);
ctrl.Anchor = AnchorStyles.Left | AnchorStyles.Top;
ctrl.BackColor = Color.Transparent;
ctrl.Visible = true;
}
public OptionsCategory[] Categories
{
get
{
this.BuildOptionsCategory();
return this._categories;
}
}
private Imps.Client.Core.User CurrentUser
{
get
{
return this._frameworkWnd.AccountManager.CurrentUser;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -