📄 conversationmanagerimp.cs
字号:
}
if (list.get_Count() > 1)
{
for (int j = list.get_Count() - 1; j >= 0; j--)
{
if (!list.get_Item(j).EnableMultiIM)
{
list.Remove(list.get_Item(j));
}
}
}
if (list.get_Count() == 0)
{
return;
}
Imps.Client.Core.Conversation conv = null;
string to = null;
if (list.get_Count() == 1)
{
to = list.get_Item(0).Uri.Raw;
List<Imps.Client.Core.Conversation>.Enumerator enumerator = this.CurrentUser.ConversationManager.Conversations.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
Imps.Client.Core.Conversation conversation2 = enumerator.get_Current();
if (conversation2.CurrentDialog != null)
{
if (!conversation2.CurrentDialog.IsMulitiConversation)
{
if (conversation2.CurrentDialog.To == to)
{
conv = conversation2;
}
}
else if ((conversation2.CurrentDialog.Participants.Count == 1) && (conversation2.CurrentDialog.Participants[0].Contact.Uri.Raw == to))
{
conv = conversation2;
}
}
else
{
try
{
if (this.CurrentUser.ConversationManager.Conversations.Contains(conv))
{
this.CurrentUser.ConversationManager.Conversations.Remove(conv);
}
conv = null;
continue;
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
continue;
}
}
}
}
finally
{
enumerator.Dispose();
}
}
ConversationWindow window = null;
if (list.get_Count() != 1)
{
goto Label_03F8;
}
List<ConversationWindow>.Enumerator enumerator2 = this.AllConversatonWindows.GetEnumerator();
try
{
while (enumerator2.MoveNext())
{
ConversationWindow window2 = enumerator2.get_Current();
if (window2.Uri == list.get_Item(0).Uri.Raw)
{
window = window2;
goto Label_02A4;
}
if ((conv != null) && (window2.CurrentConversation == conv))
{
window = window2;
goto Label_02A4;
}
}
}
finally
{
enumerator2.Dispose();
}
Label_02A4:
if ((window != null) || allowStranger)
{
goto Label_03F8;
}
Imps.Client.Core.Contact contact2 = list.get_Item(0);
int? relationStatus = contact2.RelationStatus;
if ((((relationStatus.GetValueOrDefault() == 1) && relationStatus.get_HasValue()) && !(contact2 is Imps.Client.Core.ChatFriend)) && !(contact2 is Stranger))
{
goto Label_03F8;
}
int? nullable3 = contact2.RelationStatus;
if (!((nullable3.GetValueOrDefault() == 0) && nullable3.get_HasValue()))
{
int? nullable4 = contact2.RelationStatus;
if (!((nullable4.GetValueOrDefault() == 2) && nullable4.get_HasValue()))
{
goto Label_0338;
}
}
string text = "由于对方尚未同意成为您的好友,所以您不能给对方发消息,\r\n\r\n是否再次发送添加好友申请?";
goto Label_033F;
Label_0338:
text = "由于对方不是您的好友,所以您不能给对方发送消息,\r\n\r\n是否添加对方为好友?";
Label_033F:
if (this._frameworkWnd.UnifiedMessageBox.ShowConfirmation(this._frameworkWnd.MainWindow, text) == DialogResult.Yes)
{
string mobileNo = string.IsNullOrEmpty(contact2.PersonalInfo.MobileNo) ? contact2.PersonalInfo.MobileNoUserSet : contact2.PersonalInfo.MobileNo;
int? targetGroupId = null;
if (contact2.BelongToGroups.get_Count() > 0)
{
targetGroupId = new int?(contact2.BelongToGroups.get_Item(0));
}
this._frameworkWnd.ContactManager.ShowAddBuddyWindow(this._frameworkWnd.MainWindow, mobileNo, new long?(contact2.Uri.Sid), string.Empty, targetGroupId, ContactType.ImpsContact);
}
return;
Label_03F8:
if (conv == null)
{
conv = this.CurrentUser.ConversationManager.OpenConversation(to, list);
}
if (window == null)
{
window = this.CreateConversationWindow(conv);
window.Show();
}
else
{
if (window.CurrentConversation == null)
{
window.CurrentConversation = conv;
}
Imps.Client.Utils.Win32.NativeMethods.ShowWindow(window.Handle, 9);
window.Activate();
}
if (operation == ConversationOperation.SendFile)
{
if (context == null)
{
window.SendFile();
}
else if (context is string[])
{
foreach (string text4 in context as string[])
{
window.SendFile(text4);
}
}
}
if ((operation == ConversationOperation.SmsChat) && (contactUris.Length == 1))
{
window.SendSMS = true;
}
else if ((((operation == ConversationOperation.ImChat) && window.SendSMS) && ((contactUris.Length == 1) && (list.get_Count() > 0))) && !(list.get_Item(0) is Imps.Client.Core.MobileBuddy))
{
window.SendSMS = false;
}
}
catch (Exception exception2)
{
ClientLogger.WriteException(exception2);
}
}
public void StartConversationAfterSelectContacts(IWin32Window owner, List<Imps.Client.Core.Contact> list)
{
try
{
using (InviteForm form = new InviteForm(this._frameworkWnd, StringTable.Conversation.MsgSelectConversationContacts, this.CurrentUser.Configuration.SystemSetting.SysConversationSetting.MaxParticipations - 1, true, true, list, null, false, false, false, false))
{
form.SelectType = SelectContactsType.MultiConversation;
if ((ControlHelper.ShowDialogCenterOnParent(form, owner, false) == DialogResult.OK) && (form.SelectedContacts.get_Count() != 0))
{
string[] contactUris = new string[form.SelectedContacts.get_Count()];
for (int i = 0; i < form.SelectedContacts.get_Count(); i++)
{
contactUris[i] = form.SelectedContacts.get_Item(i).Uri.Raw;
}
this.StartConversation(owner, ConversationOperation.ImChat, null, false, contactUris);
}
}
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
public void StartMultiSMS(IWin32Window owner)
{
this.StartMultiSMS(owner, null);
}
public void StartMultiSMS(IWin32Window owner, List<Imps.Client.Core.Contact> list)
{
FormClosedEventHandler handler = null;
if (((this._smsForm == null) || this._smsForm.IsDisposed) || (list != null))
{
if (this._smsForm != null)
{
this._smsForm.Close();
}
this._smsForm = new GroupSMSForm(this.FrameworkWnd, list);
if (handler == null)
{
handler = new FormClosedEventHandler(this, (IntPtr) this.<StartMultiSMS>b__2);
}
this._smsForm.add_FormClosed(handler);
ControlHelper.ShowFormCenterOnParent(this._smsForm, owner);
}
else
{
Imps.Client.Utils.Win32.NativeMethods.ShowWindow(this._smsForm.Handle, 9);
this._smsForm.Activate();
}
}
public void StartStrangerConversation(IWin32Window owner, string uri)
{
this.StartConversation(owner, ConversationOperation.ImChat, null, true, new string[] { uri });
}
public List<ConversationWindow> AllConversatonWindows
{
get
{
if (this._allConversatonWindows == null)
{
this._allConversatonWindows = new List<ConversationWindow>();
}
return this._allConversatonWindows;
}
set
{
this._allConversatonWindows = value;
}
}
internal Imps.Client.Core.User CurrentUser
{
get
{
return this._frameworkWnd.AccountManager.CurrentUser;
}
}
public bool ForceToCloseWindow
{
get
{
return this._forceToCloseWindow;
}
set
{
this._forceToCloseWindow = value;
}
}
internal IFrameworkWindow FrameworkWnd
{
get
{
return this._frameworkWnd;
}
}
internal bool ShowFileType
{
get
{
return this._showFileType;
}
set
{
this._showFileType = value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -