📄 entrypointcontrol.cs
字号:
if (_radioitem != null)
{
CustomPresence presence = _radioitem.get_Tag() as CustomPresence;
if (presence != null)
{
if (presence.BasicPresence == this._initPresence)
{
_radioitem.Radioed = true;
continue;
}
_radioitem.Radioed = false;
}
}
}
}
private void InitStatusMenuItems()
{
EventHandler handler = null;
ToolStripItem[] basicPresenceMenuItems = this._manager.GetBasicPresenceMenuItems();
for (int i = 0; i < basicPresenceMenuItems.Length; i++)
{
this.InitStatusMenu.get_Items().Add(basicPresenceMenuItems[i]);
if (handler == null)
{
handler = delegate (object sender, EventArgs e) {
ToolStripItem item = sender as ToolStripItem;
if (item != null)
{
CustomPresence presence = item.get_Tag() as CustomPresence;
if (presence != null)
{
this.InitStatus.OnlineStatusText = MainPresenceHelper.MainPresence2Str(presence.BasicPresence);
this._initPresence = presence.BasicPresence;
}
}
};
}
basicPresenceMenuItems[i].add_Click(handler);
}
}
private void InnerOnKeyPress(KeyPressEventArgs e)
{
try
{
if (base.Visible)
{
this.HideErrorTip();
switch (e.KeyChar)
{
case '\r':
this.DoLoginOrCancel();
break;
case '\x001b':
this.CancelLogin();
break;
}
}
}
catch
{
}
}
private static bool IsIdCompleted(string id)
{
return (id.Length == 11);
}
private void llEraseInfo_LinkClicked(object sender, EventArgs e)
{
try
{
string id = this.cmbId.Text;
if (id.Length > 0)
{
EraseAccountForm form = new EraseAccountForm(id);
if (ControlHelper.ShowDialogCenterOnParent(form, base.ParentForm, true) == DialogResult.OK)
{
if (UserAccounts.EraseAccountElement(id))
{
UserAccounts.SaveToLocal();
}
this.cmbId.Items.Remove(id);
this.cmbId.Text = string.Empty;
this.tbPassword.Text = string.Empty;
this.TryLoadPortrait(string.Empty);
this.TryFillRelatedInfo();
this.cmbId.Focus();
if (id.Length >= 11)
{
long mappedSid = UserAccounts.GetMappedSid(id);
if (mappedSid <= 0)
{
return;
}
id = mappedSid.ToString();
}
if (form.RbAllMaterials.Checked)
{
this._manager.FrameworkWnd.PersistentManager.DelById(id);
}
else if (form.RbDetailOption.Checked)
{
if (form.CkChatHistory.Checked)
{
this._manager.FrameworkWnd.PersistentManager.DelChatHistoryById(id);
}
if (form.CkContactInfo.Checked)
{
this._manager.FrameworkWnd.PersistentManager.DelContactsInfoById(id);
}
if (form.CkCaches.Checked)
{
this._manager.FrameworkWnd.PersistentManager.DelUserInfoById(id);
this._manager.FrameworkWnd.PersistentManager.DelPortraitsById(id);
this._manager.FrameworkWnd.PersistentManager.DelPluginsCfgById(id);
this._manager.FrameworkWnd.PersistentManager.DelPortraitsById(id);
}
}
}
}
}
catch (Exception exception)
{
UiErrorHelper.HandExceptionSafely(this._manager.FrameworkWnd, exception);
}
}
private void llForgetPass_LinkClicked(object sender, EventArgs e)
{
try
{
SetPasswordWizard form = new SetPasswordWizard(this._manager.FrameworkWnd);
form.CurrentMobileNo = this.CurrentId;
ControlHelper.ShowDialogCenterOnParent(form, this, true);
}
catch (Exception exception)
{
UiErrorHelper.HandExceptionSafely(this._manager.FrameworkWnd, exception);
}
}
private void llNetSetting_LinkClicked(object sender, EventArgs e)
{
try
{
this._manager.FrameworkWnd.ShowOptions("SsNet");
}
catch (Exception exception)
{
UiErrorHelper.HandExceptionSafely(this._manager.FrameworkWnd, exception);
}
}
private void llProvisioning_Click(object sender, EventArgs e)
{
try
{
this._manager.Register();
}
catch (Exception exception)
{
UiErrorHelper.HandExceptionSafely(this._manager.FrameworkWnd, exception);
}
}
private void llReconnectAtOnce_Click(object sender, EventArgs e)
{
this.autoReconnect.ConnectNow();
}
internal void LoadUserAccounts()
{
this.cmbId.Items.Clear();
try
{
string[] ids = UserAccounts.EnumAccounts();
SortIds(ids);
this.cmbId.Items.AddRange(ids);
this.cmbId.Text = UserAccounts.LatestId;
this.TryFillRelatedInfo();
}
catch (Exception exception)
{
ClientLogger.WriteGeneral(exception.ToString());
}
}
private void MainWindow_Activated(object sender, EventArgs e)
{
try
{
if (base.Visible)
{
this.cmbId.Focus();
}
}
catch
{
}
}
protected override void OnControlAdded(ControlEventArgs e)
{
e.Control.KeyPress += new KeyPressEventHandler(this.Child_KeyPress);
base.OnControlAdded(e);
}
protected override void OnControlRemoved(ControlEventArgs e)
{
e.Control.KeyPress -= new KeyPressEventHandler(this.Child_KeyPress);
base.OnControlRemoved(e);
}
protected override void OnKeyPress(KeyPressEventArgs e)
{
this.InnerOnKeyPress(e);
base.OnKeyPress(e);
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
using (Pen pen = new Pen(Color.Gray))
{
pen.DashStyle = DashStyle.Dot;
e.Graphics.DrawLine(pen, new System.Drawing.Point(5, 0x24), new System.Drawing.Point(base.Width - 5, 0x24));
e.Graphics.DrawLine(pen, new System.Drawing.Point(5, this.llNetSetting.Bottom + 7), new System.Drawing.Point(base.Width - 5, this.llNetSetting.Bottom + 7));
}
}
private void rbPrivate_CheckedChanged(object sender, EventArgs e)
{
this._causedByUser = false;
this.cbSaveAccount.Checked = true;
this._causedByUser = true;
this._manager.MIOfflineLoginVisible(this.rbPrivate.Checked);
}
private void rbPublic_CheckedChanged(object sender, EventArgs e)
{
this.EnableControls(this.cmbId.Enabled);
if (this.rbPublic.Checked)
{
this._causedByUser = false;
this.cbSaveAccount.Checked = false;
this.cbSavePassword.Checked = false;
this.cbSaveAccount.Checked = false;
this._causedByUser = true;
if (this._initPresence == MainPresence.OfflineLogin)
{
this.InitStatus.OnlineStatusText = MainPresenceHelper.MainPresence2Str(MainPresence.Online);
this._initPresence = MainPresence.Online;
}
}
}
private void RearrangeControls()
{
base.SuspendLayout();
try
{
int x;
int y = 50;
Size clientSize = base.ClientSize;
this.lblWelcome.Location = new System.Drawing.Point(11, 14);
this.bDisplayHelp.Location = new System.Drawing.Point((base.Width - this.bDisplayHelp.Width) - 11, 12);
bool flag = clientSize.Height >= this.HeightShowPortrait;
bool flag2 = clientSize.Width >= this.WidthShowProvisioning;
bool flag3 = clientSize.Height >= this.HeightShowSaveInfo;
bool flag4 = clientSize.Height >= this.HeightShowButton;
this.pbPortrait.Visible = flag;
this.pnPortrait.Visible = flag;
this.InitStatus.Visible = flag;
this.llProvisioning.Visible = flag2;
this.llForgetPass.Visible = flag2;
this.cbAutoLogin.Visible = flag3;
this.llEraseInfo.Visible = flag3 && flag2;
this.cbSaveAccount.Visible = false;
this.cbSavePassword.Visible = flag3;
this.rbPrivate.Visible = flag3;
this.rbPublic.Visible = flag3;
this.btnLogin.Visible = flag4;
if (flag)
{
x = (clientSize.Width - this.pbPortrait.Width) / 2;
this.pbPortrait.SetBounds(x, y, 0, 0, BoundsSpecified.Location);
this.pnPortrait.Location = new System.Drawing.Point((clientSize.Width - this.pnPortrait.Width) / 2, this.pbPortrait.Top - 8);
y = this.pbPortrait.Bottom + 50;
}
x = 0x18;
int num3 = clientSize.Width - 0x18;
int width = num3 - 0x18;
if (flag2)
{
width -= 5 + this.WidthMaxProvisioning;
}
if (width > 160)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -