⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 conversationwindow.cs

📁 飞信的收发使用csharp进行开发
💻 CS
📖 第 1 页 / 共 5 页
字号:
                            button.ImageTransparentColor = Color.Transparent;
                            button.Name = "tsCapture";
                            button.Size = new Size(0x20, 0x16);
                            button.Text = "捕捉屏幕";
                            button.Click += new EventHandler(this.tsCapture_Click);
                            this.tsSendMessage.Items.Add(button);
                        }
                    }
                }
                catch (Exception exception)
                {
                    this.HandleException(exception);
                }
            }
        }

        private void ConversationWindow_Resize(object sender, EventArgs e)
        {
            this.SizeChange();
        }

        private void ConversationWindow_ResizeEnd(object sender, EventArgs e)
        {
            this.SizeChange();
        }

        private static string ConvertString(string source)
        {
            return StringHelper.EncodString(source);
        }

        private void CurrentUser_StatusChanged(object sender, UserSatusChangedEventArgs e)
        {
            if (!base.IsDisposed)
            {
                try
                {
                    if (e.NewStatus == UserAccountStatus.Logon)
                    {
                        this.DoUserLogon();
                    }
                    else if (e.OldStatus == UserAccountStatus.Logon)
                    {
                        this.DoUserNotLogon();
                    }
                    this.FormatTooltipInfo();
                }
                catch (Exception exception)
                {
                    this.HandleException(exception);
                }
            }
        }

        private void de_DisplayEmoticonsHide(object sender, EventArgs e)
        {
            this.tsbEmoticons.Checked = false;
        }

        private void de_EmoticonSelected(object sender, EmoticonEventArgs e)
        {
            try
            {
                this._inputChatManager.InsertEmoticon(e.Emoticon.Key);
            }
            catch (Exception)
            {
            }
        }

        private void diallg_SendMessageFailed(object sender, MessageSendFailedEventArgs e)
        {
            this.AppendSendMessageError(e.Message.Content, e.Error);
        }

        private void dialog_AddParticipant(object sender, ParticipantEventArgs e)
        {
            try
            {
                Dialog dialog = sender as Dialog;
                Imps.Client.Core.Contact contact = e.Participant.Contact;
                if (dialog.IsMulitiConversation)
                {
                    foreach (ConversationParticipant participant in this.CurrentConversation.CurrentDialog.Participants)
                    {
                        this.AddParticipant(participant.Contact);
                    }
                }
                else
                {
                    this.FormatContactInfo(contact);
                }
            }
            catch (Exception exception)
            {
                ClientLogger.WriteGeneral("多人会话添加联系人失败!", exception.ToString());
            }
        }

        private void dialog_AddShareContent(object sender, ShareContentEventArgs e)
        {
            try
            {
                ShareContent shareContent = e.ShareContent;
                shareContent.ShareContentCancel += new EventHandler(this.sc_ShareContentCancel);
                shareContent.ShareContentComplete += new EventHandler(this.sc_ShareContentComplete);
                shareContent.ShareContentFailed += new EventHandler<ShareContentFailedEventArgs>(this.sc_ShareContentFailed);
                shareContent.ShareContentProgress += new EventHandler<ShareContentProcessEventArgs>(this.sc_ShareContentProgress);
                shareContent.Closed += new EventHandler(this.sc_Closed);
                this.BuildShareContent(shareContent);
                if (!this.BeActivated)
                {
                    ControlHelper.FlashWindow(this);
                }
            }
            catch (Exception exception)
            {
                this.HandleException(exception);
            }
        }

        private void dialog_Closed(object sender, EventArgs e)
        {
            try
            {
                Dialog dialog = sender as Dialog;
                dialog.MessageRecieved -= new EventHandler<MessageEventArgs>(this.dialog_MessageRecieved);
                dialog.SendMessageFailed -= new EventHandler<MessageSendFailedEventArgs>(this.diallg_SendMessageFailed);
                dialog.Closed -= new EventHandler(this.dialog_Closed);
                dialog.AddParticipant -= new EventHandler<ParticipantEventArgs>(this.dialog_AddParticipant);
                dialog.RemoveParticipant -= new EventHandler<ParticipantEventArgs>(this.dialog_RemoveParticipant);
                dialog.AddShareContent -= new EventHandler<ShareContentEventArgs>(this.dialog_AddShareContent);
                dialog.StatusChange -= new EventHandler<DialogStatusChangeEventArgs>(this.dialog_StatusChange);
            }
            catch (Exception exception)
            {
                this.HandleException(exception);
            }
        }

        private void dialog_MessageRecieved(object sender, MessageEventArgs e)
        {
            try
            {
                this.AppendMessage(e.Message);
            }
            catch (Exception exception)
            {
                this.HandleException(exception);
            }
        }

        private void dialog_RemoveParticipant(object sender, ParticipantEventArgs e)
        {
            Dialog dialog = sender as Dialog;
            if ((this.CurrentConversation != null) && (this.CurrentConversation.CurrentDialog == dialog))
            {
                Imps.Client.Core.Contact contact = e.Participant.Contact;
                this.RemoveContact(contact);
            }
        }

        private void dialog_StatusChange(object sender, DialogStatusChangeEventArgs e)
        {
            try
            {
                if (((this.CurrentConversation == null) || (this.CurrentConversation.CurrentDialog == null)) || (this.CurrentConversation.CurrentDialog.IsMulitiConversation || !this.CurrentConversation.CurrentDialog.Participants[0].Contact.IsBlocked))
                {
                    this.tsInvite.Enabled = this.CanInviteNewContact;
                    if (e.NewStatus != DialogStatus.Invited)
                    {
                        this.tsStopHistory.Enabled = false;
                    }
                    else
                    {
                        this.tsStopHistory.Enabled = true;
                    }
                }
            }
            catch (Exception exception)
            {
                this.HandleException(exception);
            }
        }

        private void Dialogs_AddDialog(object sender, DialogEventArgs e)
        {
            this.InitCurrentDialog(e.Dialog);
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void DoContactDragDrop(DragEventArgs e)
        {
            try
            {
                if (e.Data.GetDataPresent("{66FFF7D8-C9A4-4a5d-9707-82D22DF3633F}"))
                {
                    tree_widget.dragging_data data = e.Data.GetData("{66FFF7D8-C9A4-4a5d-9707-82D22DF3633F}") as tree_widget.dragging_data;
                    if (data.dragging_item.data is tree_widget_buddy)
                    {
                        Imps.Client.Core.Contact contact = (data.dragging_item.data as tree_widget_buddy).contact;
                        this.TryAddContact(contact);
                    }
                }
                else
                {
                    Imps.Client.Core.Contact contact2 = e.Data.GetData("Imps.ImpsContact") as Imps.Client.Core.Contact;
                    if (contact2 != null)
                    {
                        this.TryAddContact(contact2);
                    }
                }
            }
            catch (Exception exception)
            {
                this.HandleException(exception);
            }
        }

        private void DoContactDragEnter(DragEventArgs e)
        {
            try
            {
                if (e.Data.GetDataPresent("{66FFF7D8-C9A4-4a5d-9707-82D22DF3633F}"))
                {
                    tree_widget.dragging_data data = e.Data.GetData("{66FFF7D8-C9A4-4a5d-9707-82D22DF3633F}") as tree_widget.dragging_data;
                    if (data.dragging_item.data is tree_widget_buddy)
                    {
                        e.Effect = DragDropEffects.Copy;
                    }
                }
                else
                {
                    Imps.Client.Core.Contact contact = e.Data.GetData("Imps.ImpsContact") as Imps.Client.Core.Contact;
                    if (((contact != null) && contact.EnableMultiIM) && ((string.IsNullOrEmpty(this.Uri) || (this.Uri != contact.Uri.Raw)) && (((this.CurrentConversation == null) || (this.CurrentConversation.CurrentDialog == null)) || !this.CurrentConversation.CurrentDialog.Participants.Contains(contact))))
                    {
                        if (!this.IsMultiConversation)
                        {
                            Imps.Client.Core.Contact contact2 = this.CurrentUser.ContactList.FindContact(this.Uri);
                            if ((contact2 == null) || !contact2.EnableMultiIM)
                            {
                                return;
                            }
                        }
                        e.Effect = DragDropEffects.Copy;
                    }
                }
            }
            catch (Exception exception)
            {
                this.HandleException(exception);
            }
        }

        private void DoUserLogon()
        {
            if (this.CurrentUser.Uri.Raw != this._myUri)
            {
                base.Close();
            }
            else
            {
                this.rtfInput.Enabled = true;
                this.tsMain.Enabled = true;
                this.mainMenu.Enabled = true;
                this.pnlRight.Enabled = true;
                this.initConversation();
            }
        }

        private void DoUserNotLogon()
        {
            if (this.CurrentConversation != null)
            {
                this.CurrentConversation.Close();
            }
            this.rtfInput.Enabled = false;
            this.tsMain.Enabled = false;
            this.mainMenu.Enabled = false;
            this.pnlRight.Enabled = false;
            if ((this._lstContacts != null) && (this._lstContacts.Items.Count > 0))
            {
                this._uri = (this._lstContacts.Items[0] as buddylistbox_item<string>).context;
            }
        }

        pri

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -