📄 useraccountmanager.cs
字号:
return false;
}
this._msgBoxPending = true;
if (e.CancelReasons.get_Count() > 0)
{
builder = new StringBuilder();
using (IEnumerator<string> enumerator2 = e.CancelReasons.GetEnumerator())
{
while (enumerator2.MoveNext())
{
string text = enumerator2.get_Current();
if (builder.Length > 0)
{
builder.Append("\r\n");
}
builder.Append(text);
}
}
this._frameworkWnd.UnifiedMessageBox.ShowInfo((IWin32Window) this._frameworkWnd, builder.ToString());
return false;
}
if (e.CancelQuestions.get_Count() > 0)
{
builder = new StringBuilder();
using (IEnumerator<string> enumerator3 = e.CancelQuestions.GetEnumerator())
{
while (enumerator3.MoveNext())
{
string text2 = enumerator3.get_Current();
if (builder.Length > 0)
{
builder.Append("\r\n");
}
builder.Append(text2);
}
}
bool realCancelled = this._frameworkWnd.UnifiedMessageBox.ShowConfirmation(this._frameworkWnd.MainWindow, builder.ToString()) != DialogResult.Yes;
using (IEnumerator<ImpsCancelOperationDelegate> enumerator4 = e.CancelOperations.GetEnumerator())
{
while (enumerator4.MoveNext())
{
enumerator4.get_Current()(realCancelled);
}
}
if (realCancelled)
{
return false;
}
}
else
{
return false;
}
}
finally
{
this._msgBoxPending = false;
}
}
return true;
}
private bool InnerLogout(ref bool cancel, bool force)
{
ImpsCancelEventArgs e = new ImpsCancelEventArgs();
FuncDispatcher.OnEventHandler<ImpsCancelEventArgs>(this, this.BeforeUserLogOut, e);
bool flag = this.InnerContinueAfterImpsCancel(e, force);
if (flag)
{
this.CurrentUser.AsyncLogout();
return flag;
}
cancel = true;
return flag;
}
public bool Login()
{
return this._entryControl.DoLogin();
}
internal void LoginAs(long id, string pass, MainPresence mp, bool auto)
{
this.CurrentUser.Initialize(id, pass);
this.CurrentUser.CurrentAccount = new UserAccounts.AccountData(id.ToString(), pass, auto, mp);
this.CurrentUser.AsyncLogin(mp, auto);
}
public bool LoginOrLogout()
{
try
{
switch (this.CurrentUserStatus)
{
case UserAccountStatus.Loginning:
case UserAccountStatus.Logouting:
goto Label_004C;
case UserAccountStatus.Logon:
case UserAccountStatus.OfflineLogon:
{
bool cancel = false;
return this.Logout(ref cancel);
}
}
return this.Login();
}
catch (Exception exception)
{
this._frameworkWnd.UnifiedMessageBox.ShowException(exception);
}
Label_004C:
return false;
}
public bool Logout(ref bool cancel)
{
return this.InnerLogout(ref cancel, false);
}
public void LogoutForcibly()
{
bool cancel = false;
this.InnerLogout(ref cancel, true);
}
public void miBySms_Click(object sender, EventArgs e)
{
UiErrorHelper.HandEventSafely(this._frameworkWnd, delegate {
this.InnerChangeSmsStatus(TimeSpan.Zero);
});
}
private void miExit_Click(object sender, EventArgs e)
{
UiErrorHelper.HandEventSafely(this._frameworkWnd, delegate {
((Form) this._frameworkWnd).Close();
});
}
private void miHelpAbout_Click(object sender, EventArgs e)
{
UiErrorHelper.HandEventSafely(this._frameworkWnd, delegate {
this._frameworkWnd.ShowAbout(this._frameworkWnd.MainWindow);
});
}
public void miInfo_Click(object sender, EventArgs e)
{
UiErrorHelper.HandEventSafely(this._frameworkWnd, delegate {
this._frameworkWnd.ShowOptions("PsGeneral");
});
}
private void miMsgHistory_Click(object sender, EventArgs e)
{
try
{
this._frameworkWnd.MessageHistoryManager.ShowMessageHistory(this._frameworkWnd.MainWindow);
}
catch
{
}
}
private void miMyServic_DropDownOpening(object sender, EventArgs e)
{
ToolStripMenuItem item = sender as ToolStripMenuItem;
if (item != null)
{
foreach (ToolStripItem item2 in item.get_DropDownItems())
{
item2.set_Visible(this.CurrentUser.Status != UserAccountStatus.OfflineLogon);
}
}
}
private void miMyStatus_DropDownOpening(object sender, EventArgs e)
{
UiErrorHelper.HandEventSafely(this._frameworkWnd, delegate {
this.DoPresenceMenuItemsOpening(((ToolStripMenuItem) sender).get_DropDownItems());
});
}
public void miNotBySms_Click(object sender, EventArgs e)
{
UiErrorHelper.HandEventSafely(this._frameworkWnd, delegate {
OfflineMsgSettingForm form = this.InnerOfflineMsgForm;
innerOfflineMsgForm.HoursNotBySms = (int) this.CurrentUser.Presence.SmsStatus.OriginalValue.TotalHours;
if (innerOfflineMsgForm.Visible)
{
innerOfflineMsgForm.BringToFront();
innerOfflineMsgForm.Activate();
}
else if (ControlHelper.ShowDialogCenterOnParent(innerOfflineMsgForm, this._frameworkWnd.MainWindow, true) == DialogResult.OK)
{
this.InnerChangeSmsStatus(new TimeSpan(this._offlineMsgForm.HoursNotBySms, 0, 0));
}
});
}
internal void MIOfflineLoginVisible(bool value)
{
this._loginOnPC = value;
if (this._miOfflineLogin != null)
{
this._miOfflineLogin.set_Visible(value);
}
}
private void miPresence_Click(object sender, EventArgs e)
{
UiErrorHelper.HandEventSafely(this._frameworkWnd, delegate {
ToolStripMenuItem item1 = (ToolStripMenuItem) sender;
if (item1.get_Tag() is CustomPresence)
{
CustomPresence presence = (CustomPresence) item1.get_Tag();
if ((this.CurrentUser.Presence.MainPresence != presence.BasicPresence) || (this.CurrentUser.Presence.Text != presence.Desccription))
{
MainPresence basicPresence = presence.BasicPresence;
if (((this.CurrentUser.Presence.MainPresence == MainPresence.OfflineLogin) && (basicPresence != MainPresence.OfflineLogin)) || ((this.CurrentUser.Presence.MainPresence != MainPresence.OfflineLogin) && (basicPresence == MainPresence.OfflineLogin)))
{
if (Interlocked.Increment(ref this.statusChangedEventCount) == 1)
{
this.CurrentUser.StatusChanged += new EventHandler<UserSatusChangedEventArgs>(this, (IntPtr) this.UserStatusChangedOnlineOfflineSwitch);
}
this.switchPassword = this.CurrentUser.Password;
this.LogoutForcibly();
this._switchTarget = basicPresence;
}
else
{
this.ChangePresence(presence.BasicPresence, presence.Desccription);
}
}
}
});
}
private void miPresenceCustomize_Click(object sender, EventArgs e)
{
UiErrorHelper.HandEventSafely(this._frameworkWnd, delegate {
this._frameworkWnd.ShowOptions("SsPresence");
});
}
private void miProvisioning_Click(object sender, EventArgs e)
{
UiErrorHelper.HandEventSafely(this._frameworkWnd, delegate {
this.Register();
});
}
private void miRecentBuddies_Click(object sender, EventArgs e)
{
UiErrorHelper.HandEventSafely(this._frameworkWnd, delegate {
ToolStripMenuItem item1 = (ToolStripMenuItem) sender;
if (item1.get_Tag() is IicUri)
{
this._frameworkWnd.ConversationManager.StartConversation(this._frameworkWnd.MainWindow, ConversationOperation.ImChat, new string[] { ((IicUri) item1.get_Tag()).ToString() });
}
});
}
private void miRecentBuddies_DropDownOpening(object sender, EventArgs e)
{
UiErrorHelper.HandEventSafely(this._frameworkWnd, delegate {
this.DoPresenceMenuItemsOpening(((ToolStripMenuItem) sender).get_DropDownItems());
});
}
private void miShowMain_Click(object sender, EventArgs e)
{
UiErrorHelper.HandEventSafely(this._frameworkWnd, delegate {
this._frameworkWnd.ActiveMainWindow();
});
}
private void miSignIn_Click(object sender, EventArgs e)
{
UiErrorHelper.HandEventSafely(this._frameworkWnd, delegate {
if ((!this.Login() && (this.CurrentUser.Status != UserAccountStatus.Logon)) && !((Form) this._frameworkWnd).Focused)
{
long id;
string password;
this._frameworkWnd.ActiveMainWindow();
this._entryControl.CheckInput(out id, out password);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -