?? useraccountmanager.cs
字號:
StringBuilder builder = new StringBuilder();
if (originalValue.Days > 0)
{
builder.Append(originalValue.Days);
builder.Append("天");
}
if (originalValue.Hours > 0)
{
builder.Append(originalValue.Hours);
builder.Append("小時");
}
if ((builder.Length == 0) && (originalValue.Minutes > 0))
{
builder.Append(originalValue.Minutes);
builder.Append("分鐘");
}
if (builder.Length > 0)
{
builder.Append("后將自動恢復為“通過短信接收”");
item.ToolTipText = builder.ToString();
}
else
{
item.ToolTipText = string.Empty;
}
}
else
{
item.ToolTipText = string.Empty;
}
}
public void FillUserIdAndPassword(string id, string pass, bool autoLogin)
{
this._entryControl.FillUserIdAndPassword(id, pass);
if (autoLogin)
{
this._entryControl.Invoke(new SimpleEventHandler(this.DoLogin));
}
}
internal ToolStripItem[] GetPresenceMenuItems(bool withSetInfo)
{
return this.GetPresenceMenuItems(withSetInfo, false);
}
internal ToolStripItem[] GetPresenceMenuItems(bool withSetInfo, bool handleClickSelf)
{
EventHandler handler = null;
MainPresence[] presenceArray = new MainPresence[] { MainPresence.Online, MainPresence.Busy, MainPresence.BeRightBack, MainPresence.Away, MainPresence.InTheMeeting, MainPresence.OnThePhone, MainPresence.OutToLunch, MainPresence.Invisible };
string[] strArray = new string[] { StringTable.Presence.MI_Online, StringTable.Presence.MI_Busy, StringTable.Presence.MI_BeRightBack, StringTable.Presence.MI_Away, StringTable.Presence.MI_Meeting, StringTable.Presence.MI_OnThePhone, StringTable.Presence.MI_OutToLunch, StringTable.Presence.MI_Invisible };
int num = (withSetInfo ? 6 : 4) + 8;
ToolStripItem[] itemArray = new ToolStripItem[num];
int index = 0;
index = 0;
while (index < presenceArray.Length)
{
ToolStripMenuItem item = new menu_radioitem(strArray[index]);
item.Tag = new CustomPresence(string.Empty, presenceArray[index]);
item.Image = ImpsPresenceIcons.Instance[presenceArray[index], 1];
if (!handleClickSelf)
{
item.Click += new EventHandler(this.miPresence_Click);
}
itemArray[index] = item;
index++;
}
ToolStripMenuItem item2 = new ToolStripMenuItem(StringTable.Presence.MI_CustomizePresence);
item2.DropDown = new menu_widget(this._frameworkWnd.ComponentContainer);
item2.DropDownOpening += new EventHandler(this.miCusPresence_DropDownOpening);
item2.DropDownItems.Add(StringTable.Presence.MI_SetCustomizePresence).Click += new EventHandler(this.miPresenceCustomize_Click);
itemArray[index] = item2;
ToolStripSeparator separator = new ToolStripSeparator();
separator.Enabled = false;
itemArray[++index] = separator;
itemArray[++index] = new menu_radioitem(StringTable.Presence.MI_MessageBySms);
itemArray[index].Click += new EventHandler(this.miBySms_Click);
itemArray[++index] = new menu_radioitem(StringTable.Presence.MI_MessageNotBySms);
itemArray[index].Click += new EventHandler(this.miNotBySms_Click);
if (withSetInfo)
{
ToolStripSeparator separator2 = new ToolStripSeparator();
separator2.Enabled = false;
itemArray[++index] = separator2;
itemArray[++index] = new ToolStripMenuItem(StringTable.Framework.MI_PersonalInfo);
if (handler == null)
{
handler = delegate {
this._frameworkWnd.ShowOptions("PsGeneral");
};
}
itemArray[index].Click += handler;
}
return itemArray;
}
void IUserAccountManager.OnOperationMenuItemsOpening(ToolStripMenuItem operationMenuItem)
{
this._menuItemsOperation[0].Enabled = this.CurrentUser.Status == UserAccountStatus.Logon;
}
public void Initialize(IFrameworkWindow framework, XmlNode section)
{
}
private void InnerChangeSmsStatus(TimeSpan ts)
{
this.CurrentUser.Presence.SmsStatus.ProposedValue = ts;
AsyncBizOperation op = new AsyncBizOperation();
op.IsImpsErrorHandled = true;
this.CurrentUser.Presence.CommitChanges(op);
}
private bool InnerContinueAfterImpsCancel(ImpsCancelEventArgs e, bool force)
{
if (e.Cancel)
{
try
{
StringBuilder builder;
if (force)
{
foreach (ImpsCancelOperationDelegate delegate2 in e.CancelOperations)
{
delegate2(true);
}
return true;
}
this._frameworkWnd.ActiveMainWindow();
if (this._msgBoxPending)
{
return false;
}
this._msgBoxPending = true;
if (e.CancelReasons.Count > 0)
{
builder = new StringBuilder();
foreach (string str in e.CancelReasons)
{
if (builder.Length > 0)
{
builder.Append("\r\n");
}
builder.Append(str);
}
this._frameworkWnd.UnifiedMessageBox.ShowInfo((IWin32Window) this._frameworkWnd, builder.ToString());
return false;
}
if (e.CancelQuestions.Count > 0)
{
builder = new StringBuilder();
foreach (string str2 in e.CancelQuestions)
{
if (builder.Length > 0)
{
builder.Append("\r\n");
}
builder.Append(str2);
}
bool realCancelled = this._frameworkWnd.UnifiedMessageBox.ShowConfirmation((IWin32Window) this._frameworkWnd, builder.ToString()) != DialogResult.Yes;
foreach (ImpsCancelOperationDelegate delegate3 in e.CancelOperations)
{
delegate3(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);
Control contactListControl = this._frameworkWnd.ContactManager.ContactListControl;
this.CurrentUser.AsyncLogin(mp, auto);
}
public bool LoginOrLogout()
{
try
{
switch (this.CurrentUserStatus)
{
case UserAccountStatus.Loginning:
case UserAccountStatus.Logouting:
goto Label_0049;
case UserAccountStatus.Logon:
{
bool cancel = false;
return this.Logout(ref cancel);
}
}
return this.Login();
}
catch (Exception exception)
{
this._frameworkWnd.UnifiedMessageBox.ShowException(exception);
}
Label_0049:
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);
}
private void miBySms_Click(object sender, EventArgs e)
{
UiErrorHelper.HandEventSafely(this._frameworkWnd, delegate {
this.InnerChangeSmsStatus(TimeSpan.Zero);
});
}
private void miCusPresence_DropDownOpening(object sender, EventArgs e)
{
ToolStripMenuItem item = (ToolStripMenuItem) sender;
for (int i = item.DropDownItems.Count - 2; i >= 0; i--)
{
item.DropDownItems.RemoveAt(i);
}
UserPresence presence = this.CurrentUser.Presence;
int count = this.CurrentUser.Configuration.UserSetting.CustomPresences.Count;
if (count > 0)
{
ToolStripSeparator separator = new ToolStripSeparator();
separator.Enabled = false;
item.DropDown.Items.Insert(0, separator);
while (count-- > 0)
{
CustomPresence presence2 = this.CurrentUser.Configuration.UserSetting.CustomPresences[count];
menu_radioitem _radioitem = new menu_radioitem(presence2.Desccription);
item.DropDownItems.Insert(0, _radioitem);
if (presence.IsCustomizedPresence && (presence.Text == presence2.Desccription))
{
_radioitem.Radioed = true;
}
else
{
_radioitem.Tag = presence2;
_radioitem.Click += new EventHandler(this.miPresence_Click);
}
}
}
}
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 as IWin32Window);
});
}
private 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 as Form);
}
catch
{
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -