private void SendMsg() { if (!Util_Buddy.GetCurrentBuddy().PresenceInfo.IsOnline) { Util_Misc.NotifyMsgToConversation(this.CurrentSessionTabItem.CommunitySession.Community.Id, true, CoreMessenger.Instance.MiscHelper.TXLoadString("CF_SELF_OFFLINE")); } else if (this.InputBox.GetTextLength() > 0x1194) { Util_Misc.NotifyMsgToConversation(this.CurrentSessionTabItem.CommunitySession.Community.Id, true, CoreMessenger.Instance.MiscHelper.TXLoadString("CF_EDITMSG_LARGE_MESSAGE")); } else { int imageCount = 0; MessagePack messagePack = this.InputBox.CreateMessagePack(out imageCount); if (imageCount > 1) { Util_Misc.NotifyMsgToConversation(this.CurrentSessionTabItem.CommunitySession.Community.Id, true, CoreMessenger.Instance.MiscHelper.TXLoadString("CF_Group_Image_TooManyImage")); } else if ((messagePack != null) && (this.CurrentSessionTabItem != null)) { this.CurrentSessionTabItem.SendMessage(messagePack); Buddy currentBuddy = Util_Buddy.GetCurrentBuddy(); this.CurrentSessionTabItem.AddMsg(currentBuddy, TimeConverter.Now, messagePack); try { this.InputBox.Document.Blocks.Clear(); } catch (Exception) { } } } }
/// <summary> /// 双击联系人头像 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void OnItemDoubleClicked(object sender, MouseButtonEventArgs e) { Action method = null; Buddy buddy; DependencyObject originalSource = e.OriginalSource as DependencyObject; if (originalSource != null) { if (originalSource is Run) { originalSource = (originalSource as Run).Parent; } if ((originalSource is Visual) && !MainWindow.IsQZoneFlag(originalSource)) { buddy = this.contactListPanel.buddyTree.SelectedItem as Buddy; if ((buddy != null) && (buddy != Util_Buddy.GetCurrentBuddy())) { if (method == null) { method = delegate { Util_Buddy.OpenContactSessionWindow(buddy); }; } base.Dispatcher.BeginInvoke(method, new object[0]); e.Handled = true; } } } }
/// <summary> /// 发送消息 /// </summary> private void SendMsg() { if (!Util_Buddy.IsOnlineStatus()) { Util_Misc.NotifyMsgToConversation(this.CurrentIMSession.Buddy.Uin, false, CoreMessenger.Instance.MiscHelper.TXLoadString("CF_SELF_OFFLINE")); } else if (this.InputBox.Text.Length > 0x1194) { Util_Misc.NotifyMsgToConversation(this.CurrentIMSession.Buddy.Uin, false, CoreMessenger.Instance.MiscHelper.TXLoadString("CF_EDITMSG_LARGE_MESSAGE")); } else { MessagePack messagePack = CreateMessagePack(); if ((messagePack != null) && (this.CurrentIMSession != null)) { this.CurrentIMSession.SendMessage(messagePack); Buddy currentBuddy = Util_Buddy.GetCurrentBuddy(); this.CurrentIMSession.AddMsg(currentBuddy, TimeConverter.Now, messagePack); try { this.InputBox.Text = ""; } catch (Exception) { } } } }
/// <summary> /// 回车键 /// </summary> /// <returns></returns> public bool ProcessEnterKey() { Buddy selectedItem = this.buddyTree.SelectedItem as Buddy; if ((selectedItem != null) && (selectedItem != Util_Buddy.GetCurrentBuddy())) { Util_Buddy.OpenContactSessionWindow(selectedItem); return(true); } return(false); }
private void OnLogin(object sender, LoginEventArgs e) { if (e.Succeeded) { TXLog.TXLog3("Login", string.Format("登录成功回调 _IsLogging={0}", this._IsLogging)); base.Opacity = 0.0; this.btnCancel.Visibility = Visibility.Hidden; if (Util_Buddy.GetCurrentBuddy() != null) { this.accountManager.SetAccountInfo(Util_Buddy.GetCurrentBuddy().Uin, this.LoginStatus); } this.InitPlugincenter(); if (base.IsLoaded) { CoreMessenger.Instance.TM.EventProcessing(AsyncHandle_Type.AsyncHandle_AutoUpdateMgr, 0x1, null); this.LoginResult = true; base.Close(); } } else { this.ShowInputFrame(true); LoginFailedEventArgs loginFailedEventArgs = e as LoginFailedEventArgs; if (loginFailedEventArgs != null) { if (loginFailedEventArgs.Code == LoginCallbackCode.IM_LOGINFAIL_CANCEL) { TXLog.TXLog3("Login", "取消登录回调"); } else { string messageBoxText = this.MakeLoginMessage(loginFailedEventArgs); string caption = "登录失败"; MessageBox.Show(messageBoxText, caption); if (((loginFailedEventArgs.Code == LoginCallbackCode.IM_LOGINFAIL_SERVER_REFUSE) || (loginFailedEventArgs.Code == LoginCallbackCode.IM_LOGINFAIL_PWD_EXPIRE1)) || (loginFailedEventArgs.Code == LoginCallbackCode.IM_LOGINFAIL_PWD_EXPIRE2)) { this.passwordBox.Clear(); this.passwordBox.Focus(); } else if (loginFailedEventArgs.Code == LoginCallbackCode.IM_LOGINFAIL_EXISTSAMEAPP) { this.accounts.Focus(); } } } } this._IsLogging = false; }
/// <summary> /// 状态变化 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void status_SourceUpdated(object sender, DataTransferEventArgs e) { if ((e.Property == Selector.SelectedValueProperty) && (sender == this.status)) { Util_DataReport.RID_Count_ClickStatusButton(); ITXIM service = CoreMessenger.Instance.GetService <ITXIM>(); try { service.ChangeStatus((ushort)Util_Buddy.GetCurrentBuddy().PresenceInfo.Presence, "", null); } finally { Marshal.ReleaseComObject(service); } } }
/// <summary> /// 执行群组成员管理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CommunitymemberMgr_Executed(object sender, ExecutedRoutedEventArgs e) { DependencyObject originalSource = e.OriginalSource as DependencyObject; if (originalSource != null) { ListBox ancestorByType = VisualTree.GetAncestorByType(originalSource, typeof(ListBox)) as ListBox; ListBoxItem container = VisualTree.GetAncestorByType(originalSource, typeof(ListBoxItem)) as ListBoxItem; if ((ancestorByType != null) && (container != null)) { InstanceAnswerPro.Core.Community.Community community = ancestorByType.ItemContainerGenerator.ItemFromContainer(container) as InstanceAnswerPro.Core.Community.Community; if ((community != null) && Util_Group.IsManager(community, Util_Buddy.GetCurrentBuddy().Uin)) { Util_Group.OpenCommunityInfoWindow(community, Util_Group.CommunityInfoWindowPageTag.PageMemberInfo); } } } }
public void AddSession(SessionTabItem sessionTabItem) { sessionTabItem.MessageIndex = 0; sessionTabItem.MessageAdded += new EventHandler <EventArgs>(this.OnMessageAdded); if (sessionTabItem.InputBoxDocument == null) { sessionTabItem.InputBoxDocument = new FlowDocument(); } this.sessionTabItems.Add(sessionTabItem); this.CurrentSessionTabItem = sessionTabItem; this.CurrentSessionTabItem.CommunitySession.Community.CommunityManager.RefreshCommunityFromServer(); this.CurrentSessionTabItem.CommunitySession.Community.CommunityManager.UpdateMemberStatus(true); this.CurrentSessionTabItem.CommunitySession.Community.CommunityManager.UpdateMemCardInfo(Util_Buddy.GetCurrentBuddy().Uin); }