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

📄 singleivrform.cs

📁 飞信的收发使用csharp进行开发
💻 CS
📖 第 1 页 / 共 2 页
字号:
            this.lblInviteInfo.TabIndex = 2;
            this.lblInviteInfo.Text = "您正在发起手机语聊,请等待对方接受邀请。";
            this.label1.BorderColor = Color.Empty;
            this.label1.BorderStyle = BorderStyle.Fixed3D;
            this.label1.ButtonBorderStyle = ButtonBorderStyle.None;
            this.label1.Location = new Point(11, 0x8e);
            this.label1.Name = "label1";
            this.label1.Size = new Size(390, 2);
            this.label1.TabIndex = 3;
            this.PicOwner.BackColor = Color.White;
            this.PicOwner.BorderColor = Color.FromArgb(0xa4, 170, 220);
            this.PicOwner.Image = (Image) manager.GetObject("PicOwner.Image");
            this.PicOwner.Location = new Point(7, 9);
            this.PicOwner.Name = "PicOwner";
            this.PicOwner.Size = new Size(0x76, 0x76);
            this.PicOwner.TabIndex = 0;
            this.PicOwner.ToolTipText = "";
            this.PicOwner.Click += new EventHandler(this.PicCurrentUser_Click);
            this.picContact.BackColor = Color.White;
            this.picContact.BorderColor = Color.FromArgb(0xa4, 170, 220);
            this.picContact.Image = (Image) manager.GetObject("picContact.Image");
            this.picContact.Location = new Point(7, 0x9e);
            this.picContact.Name = "picContact";
            this.picContact.Size = new Size(0x76, 0x76);
            this.picContact.TabIndex = 4;
            this.picContact.ToolTipText = "";
            this.picContact.Click += new EventHandler(this.picContact_Click);
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x1bd, 0x176);
            base.Controls.Add(this.panel1);
            base.Icon = (Icon) manager.GetObject("$this.Icon");
            this.MaximumSize = new Size(0x1c3, 400);
            this.MinimumSize = new Size(0x1c3, 400);
            base.Name = "SingleIVRForm";
            base.Padding = new Padding(5, 0x21, 0x13, 8);
            base.Text = "手机语聊";
            base.Controls.SetChildIndex(this.panel1, 0);
            base.Controls.SetChildIndex(base.menubar, 0);
            this.panel1.ResumeLayout(false);
            this.panel1.PerformLayout();
            ((ISupportInitialize) this.picWait).EndInit();
            base.ResumeLayout(false);
        }

        protected override void InitIVRDialog()
        {
            try
            {
                this.ShowMyInfo();
                Imps.Client.Core.Contact contact = base.OwnerDialog.IVRList[0].Contact;
                this.ShowContactInfo(contact);
                base.OwnerDialog.IVRStatusChange += new EventHandler<IVREventArgs>(this.OwnerDialog_IVRStatusChange);
                this.picWait.Image = ImpsResources.GetImage("Images.loading.gif");
                this._startTickets = Environment.TickCount;
                this.btnCancel.Text = string.Format("点击这里可以取消通话({0}秒后自动取消)", base.WaitTime);
                GlobalTimer.Register(new EventHandler(this.ShowInviteTime), this, 5);
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException(exception);
            }
        }

        protected override void OnFormClosed(FormClosedEventArgs e)
        {
            GlobalTimer.Unregister(new EventHandler(this.ShowInviteTime));
            base.OwnerDialog.IVRStatusChange -= new EventHandler<IVREventArgs>(this.OwnerDialog_IVRStatusChange);
            base.CurrentUser.PersonalInfo.PropertiesChanged -= new EventHandler<PropertiesChangedEventArgs>(this.PersonalInfo_PropertiesChanged);
            base.CurrentUser.Presence.PropertiesChanged -= new EventHandler<PropertiesChangedEventArgs>(this.Presence_PropertiesChanged);
            Imps.Client.Core.Contact contact = base.OwnerDialog.IVRList[0].Contact;
            contact.PersonalInfo.PropertiesChanged -= new EventHandler<PropertiesChangedEventArgs>(this.Contact_PropertiesChanged);
            contact.Presence.PropertiesChanged -= new EventHandler<PropertiesChangedEventArgs>(this.Contact_Presence_PropertiesChanged);
            base.OnFormClosed(e);
        }

        private void OwnerDialog_IVRStatusChange(object sender, IVREventArgs e)
        {
            if (GlobalTimer.IsHandlerRegistered(new EventHandler(this.ShowInviteTime)))
            {
                GlobalTimer.Unregister(new EventHandler(this.ShowInviteTime));
            }
            if (!base.OwnerDialog.IsClosed)
            {
                string enumDescription = IMPSEnums.GetEnumDescription<IVRParticipantStatus>(e.IVR.Status);
                string inviteInfo = "";
                switch (e.IVR.Status)
                {
                    case IVRParticipantStatus.Cancel:
                    case IVRParticipantStatus.Decline:
                        inviteInfo = string.Format("{0}拒绝了您的语音邀请!", e.IVR.Contact.DisplayName);
                        base.OwnerDialog.IsCanceled = true;
                        this.picWait.Image = ThemeManager.GetImage("IVR_Refuse.png");
                        break;

                    case IVRParticipantStatus.Accept:
                        inviteInfo = string.Format("{0}已经接受邀请,请稍后接听来自{1} 的电话。", e.IVR.Contact.DisplayName, base.CurrentUser.Configuration.SystemSetting.SvcNoSetting.SvcNoIVR.ToString() + base.CurrentUser.Sid);
                        base.OwnerDialog.StartIVR();
                        base.OwnerDialog.IsAccepted = true;
                        this.picWait.Image = ThemeManager.GetImage("IVR_OnThePhone.gif");
                        break;

                    case IVRParticipantStatus.OverTime:
                        base.OwnerDialog.IsOvertime = true;
                        inviteInfo = "您的邀请已超时,请关闭后重新邀请!";
                        break;
                }
                this.FormatForm(enumDescription, inviteInfo);
            }
        }

        private void PersonalInfo_PropertiesChanged(object sender, PropertiesChangedEventArgs ev)
        {
            if (ev.ContainsProperty("Portrait"))
            {
                ControlHelper.FadeinImage(this.PicOwner, base.CurrentUser.PersonalInfo.Portrait);
            }
            this.ShowMyNameInfo();
        }

        private void picContact_Click(object sender, EventArgs e)
        {
            UiErrorHelper.HandEventSafely(base.FrameworkWindow, delegate {
                this.FrameworkWindow.ContactManager.ShowContactDetail(this, (sender as DisplayPortrait).Tag as string);
            });
        }

        private void PicCurrentUser_Click(object sender, EventArgs e)
        {
            UiErrorHelper.HandEventSafely(base.FrameworkWindow, delegate {
                base.FrameworkWindow.ShowOptions(this, "PsGeneral");
            });
        }

        private void Presence_PropertiesChanged(object sender, PropertiesChangedEventArgs e)
        {
            this.ShowMyNameInfo();
        }

        private void ShowContactInfo(Imps.Client.Core.Contact contact)
        {
            this.picContact.Image = contact.PersonalInfo.Portrait;
            this.picContact.Tag = contact.Uri.Raw;
            this.ShowContactNameInfo(contact);
            contact.PersonalInfo.PropertiesChanged += new EventHandler<PropertiesChangedEventArgs>(this.Contact_PropertiesChanged);
            contact.Presence.PropertiesChanged += new EventHandler<PropertiesChangedEventArgs>(this.Contact_Presence_PropertiesChanged);
        }

        private void ShowContactNameInfo(Imps.Client.Core.Contact contact)
        {
            string displayName = contact.DisplayName;
            if ((contact.Presence.MoodPhrase != null) && (contact.Presence.MoodPhrase != ""))
            {
                displayName = displayName + "-" + contact.Presence.MoodPhrase;
            }
            this.lblContact.Text = StringHelper.EncodString(displayName);
        }

        private void ShowInviteTime(object sender, EventArgs e)
        {
            UiErrorHelper.HandEventSafely(base.FrameworkWindow, delegate {
                int num = Convert.ToInt32(Math.Round((double) (((double) (Environment.TickCount - this._startTickets)) / 1000.0)));
                this.btnCancel.Text = string.Format("点击这里可以取消通话({0}秒后自动取消)", base.WaitTime - num);
                if ((base.WaitTime - num) <= 0)
                {
                    GlobalTimer.Unregister(new EventHandler(this.ShowInviteTime));
                    base.OwnerDialog.IVRList[0].Status = IVRParticipantStatus.OverTime;
                    base.OwnerDialog.IsOvertime = true;
                }
            });
        }

        private void ShowMyInfo()
        {
            this.PicOwner.Image = base.CurrentUser.PersonalInfo.Portrait;
            this.ShowMyNameInfo();
            base.CurrentUser.PersonalInfo.PropertiesChanged += new EventHandler<PropertiesChangedEventArgs>(this.PersonalInfo_PropertiesChanged);
            base.CurrentUser.Presence.PropertiesChanged += new EventHandler<PropertiesChangedEventArgs>(this.Presence_PropertiesChanged);
        }

        private void ShowMyNameInfo()
        {
            string nickname = base.CurrentUser.Nickname;
            if ((base.CurrentUser.Presence.MoodPhrase != null) && (base.CurrentUser.Presence.MoodPhrase != ""))
            {
                nickname = nickname + "-" + ((string) base.CurrentUser.Presence.MoodPhrase);
            }
            this.lblCurrentUser.Text = StringHelper.EncodString(nickname);
        }
    }
}

⌨️ 快捷键说明

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