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

📄 conversationwindow.cs

📁 飞信的收发使用csharp进行开发
💻 CS
📖 第 1 页 / 共 5 页
字号:
                {
                    this.tsOperationBlock.Text = StringTable.Conversation.MsgPreventContact + "(&B)";
                    this.tsBlock.Text = StringTable.Conversation.MsgPreventContact;
                    this.tsBlock.Image = (Image) new ComponentResourceManager(typeof(ConversationWindow)).GetObject("tsBlock.Image");
                }
                this.FormatTooltipInfo();
                this.tsBlock.ToolTipText = this.tsBlock.Text;
                if (contact is Imps.Client.Core.MobileBuddy)
                {
                    this.SendSMS = true;
                }
                this.tsMain.ResumeLayout();
                this.FormatSMSInfo();
            }
        }

        private void contact_PersonalInfo_PropertiesChanged(object sender, PropertiesChangedEventArgs e)
        {
            try
            {
                Imps.Client.Core.Contact owner = (sender as Imps.Client.Core.ContactInfo).Owner;
                if (!this.IsMultiConversation)
                {
                    this.contactToolTip.Tag = owner.DisplayName;
                    if (e.ContainsProperty("Provision"))
                    {
                        this.FormatControls(owner);
                    }
                    if (e.ContainsAnyOfProperties(new string[] { "MobileNo" }))
                    {
                        this.FormatPicContactInfo(owner);
                    }
                }
                else
                {
                    buddylistbox_item<string> listItemByContact = this.GetListItemByContact(owner);
                    if (listItemByContact != null)
                    {
                        listItemByContact.name = owner.DisplayName;
                    }
                    for (int i = 0; i < this.menuBlockUsers.Items.Count; i++)
                    {
                        if ((this.menuBlockUsers.Items[i].Tag as Imps.Client.Core.Contact) == owner)
                        {
                            this.menuBlockUsers.Items[i].Text = owner.DisplayName;
                        }
                    }
                    for (int j = 0; j < this.tsOperationBlock.DropDownItems.Count; j++)
                    {
                        if ((this.tsOperationBlock.DropDownItems[j].Tag as Imps.Client.Core.Contact) == owner)
                        {
                            this.tsOperationBlock.DropDownItems[j].Text = owner.DisplayName;
                        }
                    }
                    for (int k = 0; k < this.tsOperationContactInfo.DropDownItems.Count; k++)
                    {
                        if ((this.tsOperationContactInfo.DropDownItems[k].Tag as Imps.Client.Core.Contact) == owner)
                        {
                            this.tsOperationContactInfo.DropDownItems[k].Text = owner.DisplayName;
                        }
                    }
                    for (int m = 0; m < this.tsOperationMessageHistory.DropDownItems.Count; m++)
                    {
                        if ((this.tsOperationMessageHistory.DropDownItems[m].Tag as Imps.Client.Core.Contact) == owner)
                        {
                            this.tsOperationMessageHistory.DropDownItems[m].Text = owner.DisplayName;
                        }
                    }
                    for (int n = 0; n < this.tsHistory.DropDownItems.Count; n++)
                    {
                        if ((this.tsHistory.DropDownItems[n].Tag as Imps.Client.Core.Contact) == owner)
                        {
                            this.tsHistory.DropDownItems[n].Text = owner.DisplayName;
                        }
                    }
                }
                this.FormatTooltipInfo();
                this.FormatFormCaptionAndText();
            }
            catch (Exception exception)
            {
                this.HandleException(exception);
            }
        }

        private void contact_PortraitChanged(object sender, EventArgs e)
        {
            try
            {
                Imps.Client.Core.Contact contact = sender as Imps.Client.Core.Contact;
                if (this.IsMultiConversation)
                {
                    buddylistbox_item<string> listItemByContact = this.GetListItemByContact(contact);
                    if (listItemByContact != null)
                    {
                        listItemByContact.image = contact.PersonalInfo.Portrait;
                    }
                }
                else
                {
                    ControlHelper.FadeinImage(this.picContact, contact.PersonalInfo.Portrait);
                    this.FormatFormCaptionAndText();
                }
            }
            catch (Exception exception)
            {
                this.HandleException(exception);
            }
        }

        private void contact_Presence_PropertiesChanged(object sender, PropertiesChangedEventArgs ev)
        {
            try
            {
                Imps.Client.Core.Contact owner = (sender as ContactPresence).Owner;
                if (this.IsMultiConversation)
                {
                    if (ev.ContainsAnyOfProperties(new string[] { "value", "desc" }))
                    {
                        this.FormatTooltipInfo();
                    }
                    if (ev.ContainsAnyOfProperties(new string[] { "MoodPhrase" }))
                    {
                        buddylistbox_item<string> listItemByContact = this.GetListItemByContact(owner);
                        if (listItemByContact != null)
                        {
                            listItemByContact.personal_message = owner.Presence.MoodPhrase;
                        }
                    }
                }
                else
                {
                    this.FormatControlEnable(owner);
                    if (ev.ContainsAnyOfProperties(new string[] { "value", "desc" }))
                    {
                        this.FormatTooltipInfo();
                        this.FormatInputBoxMaxLength(owner);
                        this.tsIVR.Enabled = owner.EnableIvr;
                        if (ev.ContainsAllOfProperties(new string[] { "value" }))
                        {
                            bool canInviteNewContact = this.CanInviteNewContact;
                            if (this.tsInvite.Enabled != canInviteNewContact)
                            {
                                this.tsInvite.Enabled = canInviteNewContact;
                            }
                        }
                        bool flag2 = MainPresenceHelper.IsOnline(owner.Presence.MainPresence);
                        this.tsStopHistory.Enabled = flag2;
                        if ((flag2 && (this.CurrentConversation != null)) && ((this.CurrentConversation.CurrentDialog != null) && (this.CurrentConversation.CurrentDialog.Status == DialogStatus.None)))
                        {
                            this.CurrentConversation.CurrentDialog.Status = DialogStatus.Inviting;
                            this.CurrentConversation.CurrentDialog.AsyncSendInvite();
                        }
                    }
                    if (ev.ContainsAllOfProperties(new string[] { "MoodPhrase" }))
                    {
                        this.FormatFormCaptionAndText();
                    }
                    this.FormatSMSInfo();
                }
            }
            catch (Exception exception)
            {
                this.HandleException(exception);
            }
        }

        private void contact_RelationStatusChanged(object sender, EventArgs e)
        {
            try
            {
                if (!this.IsMultiConversation)
                {
                    this.FormatContactInfo(sender as Imps.Client.Core.Contact);
                }
            }
            catch (Exception exception)
            {
                this.HandleException(exception);
            }
        }

        private void contact_TypeChanged(object sender, ContactTypeChangedEventArgs ev)
        {
            try
            {
                if (this.IsMultiConversation)
                {
                    this.AddContactEvent(ev.NewContactInstance);
                    for (int i = 0; i < this.menuBlockUsers.Items.Count; i++)
                    {
                        if (this.menuBlockUsers.Items[i].Tag == sender)
                        {
                            this.menuBlockUsers.Items.Remove(this.menuBlockUsers.Items[i]);
                            break;
                        }
                    }
                    for (int j = 0; j < this.tsOperationBlock.DropDownItems.Count; j++)
                    {
                        if (this.tsOperationBlock.DropDownItems[j].Tag == sender)
                        {
                            this.tsOperationBlock.DropDownItems.Remove(this.tsOperationBlock.DropDownItems[j]);
                            break;
                        }
                    }
                    this.menuBlockUsers.Items.Add(this.GetBlockMenuItem(ev.NewContactInstance));
                    this.tsOperationBlock.DropDownItems.Add(this.GetBlockMenuItem(ev.NewContactInstance));
                    this.FormatTooltipInfo();
                }
                else
                {
                    this.FormatContactInfo(ev.NewContactInstance);
                    if ((this.CurrentConversation != null) && (this.CurrentConversation.CurrentDialog != null))
                    {
                        this.CurrentConversation.Close();
                    }
                }
            }
            catch (Exception exception)
            {
                this.HandleException(exception);
            }
            finally
            {
                ev.AutoResetEvent.Set();
            }
        }

        private void controlButton_CollapseExpand(object sender, EventArgs e)
        {
            try
            {
                this.isExpanded = this.controlButton.IsExpanded;
                this.CurrentUser.Configuration.UserSetting.ConversationSetting.ShowPortrait = !this.isExpanded;
                if (this.isExpanded)
                {
                    this.pnlRight.Width = 0;
                    this.scMain.Width = this.pnlTop.Width;
                }
                else
                {
                    this.pnlRight.Width = this.pnlRightWidth;
                    this.scMain.Width = (this.pnlTop.Width - this.pnlRight.Width) - 6;
                }
            }
            catch (Exception exception)
            {
                this.HandleException(exception);
            }
        }

        private void ConversationSetting_PropertiesChanged(object sender, PropertiesChangedEventArgs e)
        {
            if (!base.IsDisposed && e.ContainsProperty("EnterToSend"))
            {
                if (this.CurrentUser.Configuration.UserSetting.ConversationSetting.SendMessageByEnterKey != null)
                {
                    this.tsSendCtrlEnter.Checked = false;
                    this.tsSendEnter.Checked = true;
                }
                else
                {
                    this.tsSendCtrlEnter.Checked = true;
                    this.tsSendEnter.Checked = false;
                }
            }
        }

        private void ConversationWindow_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Alt && (e.KeyCode == Keys.S))
            {
                e.SuppressKeyPress = true;
                this.SendMessage();
            }
            if ((e.KeyCode == Keys.Escape) && string.IsNullOrEmpty(this._inputChatManager.Text.Trim()))
            {
                base.Close();
            }
            else
            {
                this._historyChatManager.SendKeys(e.KeyCode, e.Modifiers);
            }
            if (e.Control && (e.KeyCode == Keys.Decimal))
            {
                try
                {
                    if (!this.CurrentConversation.CurrentDialog.IsMulitiConversation && (this.CurrentConversation.CurrentDialog.Status == DialogStatus.Invited))
                    {
                        this._decimalCount++;
                        if (this._decimalCount == 3)
                        {
                            ToolStripButton button = new ToolStripButton();
                            button.AutoSize = false;
                            button.DisplayStyle = ToolStripItemDisplayStyle.Image;
                            button.Image = Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("Imps.Client.Pc.Resources.Capture.png"));
                            button.ImageScaling = ToolStripItemImageScaling.SizeToFit;

⌨️ 快捷键说明

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