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

📄 sssoundcontrol.cs

📁 飞信的收发使用csharp进行开发
💻 CS
📖 第 1 页 / 共 2 页
字号:
            this.xtbFilePath.BackColor = Color.FromArgb(240, 240, 240);
            this.xtbFilePath.BorderStyle = BorderStyle.FixedSingle;
            this.xtbFilePath.Location = new Point(0x13, 0xac);
            this.xtbFilePath.Name = "xtbFilePath";
            this.xtbFilePath.ReadOnly = true;
            this.xtbFilePath.Size = new Size(0x147, 20);
            this.xtbFilePath.TabIndex = 4;
            this.openFileDialogSound.Filter = "wave files (*.wav)|*.wav";
            this.rbAllYes.AutoSize = true;
            this.rbAllYes.Checked = true;
            this.rbAllYes.Location = new Point(0x24, 0x100);
            this.rbAllYes.Name = "rbAllYes";
            this.rbAllYes.Size = new Size(0x79, 0x11);
            this.rbAllYes.TabIndex = 8;
            this.rbAllYes.TabStop = true;
            this.rbAllYes.Text = "好友上线时通知我";
            this.rbAllYes.UseVisualStyleBackColor = true;
            this.rbAllNo.AutoSize = true;
            this.rbAllNo.Location = new Point(0x24, 280);
            this.rbAllNo.Name = "rbAllNo";
            this.rbAllNo.Size = new Size(0x85, 0x11);
            this.rbAllNo.TabIndex = 9;
            this.rbAllNo.Text = "不显示好友上线通知";
            this.rbAllNo.UseVisualStyleBackColor = true;
            this.rbByContact.AutoSize = true;
            this.rbByContact.Location = new Point(0x24, 0x12e);
            this.rbByContact.Name = "rbByContact";
            this.rbByContact.Size = new Size(0x79, 0x11);
            this.rbByContact.TabIndex = 10;
            this.rbByContact.Text = "每个好友单独设置";
            this.rbByContact.UseVisualStyleBackColor = true;
            this.label1.AutoEllipsis = false;
            this.label1.AutoSize = true;
            this.label1.BorderColor = Color.Black;
            this.label1.BorderStyle = BorderStyle.None;
            this.label1.ButtonBorderStyle = ButtonBorderStyle.Solid;
            this.label1.Location = new Point(0x10, 0xec);
            this.label1.Name = "label1";
            this.label1.Size = new Size(80, 14);
            this.label1.TabIndex = 7;
            this.label1.Text = "好友上线通知";
            this.label1.TextAlign = ContentAlignment.TopLeft;
            this.label1.UseMnemonic = false;
            this.pbPreview.ErrorImage = null;
            this.pbPreview.InitialImage = null;
            this.pbPreview.Location = new Point(0x81, 0x1f);
            this.pbPreview.Name = "pbPreview";
            this.pbPreview.Size = new Size(0x10, 0x11);
            this.pbPreview.TabIndex = 12;
            this.pbPreview.TabStop = false;
            this.lbPreTip.AutoEllipsis = false;
            this.lbPreTip.AutoSize = true;
            this.lbPreTip.BorderColor = Color.Black;
            this.lbPreTip.BorderStyle = BorderStyle.None;
            this.lbPreTip.ButtonBorderStyle = ButtonBorderStyle.Solid;
            this.lbPreTip.Location = new Point(0x91, 0x22);
            this.lbPreTip.Name = "lbPreTip";
            this.lbPreTip.Size = new Size(0x54, 14);
            this.lbPreTip.TabIndex = 13;
            this.lbPreTip.Text = "可以预览声音)";
            this.lbPreTip.TextAlign = ContentAlignment.TopLeft;
            this.lbPreTip.UseMnemonic = false;
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.Controls.Add(this.lbPreTip);
            base.Controls.Add(this.pbPreview);
            base.Controls.Add(this.label1);
            base.Controls.Add(this.rbByContact);
            base.Controls.Add(this.rbAllNo);
            base.Controls.Add(this.rbAllYes);
            base.Controls.Add(this.xtbFilePath);
            base.Controls.Add(this.dgvSound);
            base.Controls.Add(this.chkMsgNotify);
            base.Controls.Add(this.lbNotify);
            base.Controls.Add(label2);
            base.Controls.Add(this.ckEnableSound);
            base.Controls.Add(this.lbSound);
            base.Controls.Add(label);
            base.Name = "SsSoundControl";
            base.Size = new Size(0x16b, 0x1b1);
            ((ISupportInitialize) this.dgvSound).EndInit();
            ((ISupportInitialize) this.pbPreview).EndInit();
            base.ResumeLayout(false);
            base.PerformLayout();
        }

        private void initSoundList()
        {
            this._soundList = new Dictionary<int, SoundFile>();
            this._soundList.Add(0, new SoundFile(StringTable.Configuration.Sound_OnlineNotify, (string) this._user.Configuration.UserSetting.SoundSetting.OnlineNotify));
            this._soundList.Add(1, new SoundFile(StringTable.Configuration.Sound_MsgNotify, (string) this._user.Configuration.UserSetting.SoundSetting.MsgNotify));
            this._soundList.Add(2, new SoundFile(StringTable.Configuration.Sound_SysNotify, (string) this._user.Configuration.UserSetting.SoundSetting.SysNotify));
        }

        private void initSoundUIList()
        {
            for (int i = 0; i < this._soundList.Count; i++)
            {
                if ((this._soundList[i].Path == null) || (this._soundList[i].Path.Length == 0))
                {
                    this.dgvSound.Rows.Add(new object[] { this._playPic, this._soundList[i].Text, StringTable.Common.Delete, StringTable.Common.Modify });
                }
                else
                {
                    this.dgvSound.Rows.Add(new object[] { this._playPic, this._soundList[i].Text, StringTable.Common.Delete, StringTable.Common.Modify });
                }
            }
        }

        private void modifySound(int index)
        {
            string path = this._soundList[index].Path;
            if ((path.Length > 0) && File.Exists(path))
            {
                this.openFileDialogSound.InitialDirectory = Path.GetDirectoryName(path);
            }
            else
            {
                this.openFileDialogSound.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic);
            }
            if (this.openFileDialogSound.ShowDialog() == DialogResult.OK)
            {
                string fileName = this.openFileDialogSound.FileName;
                if (!File.Exists(fileName))
                {
                    this._iFrameworkWnd.UnifiedMessageBox.ShowError(StringTable.Configuration.FileNotExist_Sound);
                }
                else
                {
                    this.xtbFilePath.Text = fileName;
                    this.dgvSound.Rows[index].Cells[0].Value = this._playPic;
                    this._soundList[index].Path = fileName;
                }
            }
        }

        private void playSound(int index)
        {
            string path = this._soundList[index].Path;
            if (string.IsNullOrEmpty(path))
            {
                this._iFrameworkWnd.UnifiedMessageBox.ShowError(base.FindForm(), "您尚未指定声音文件!");
            }
            else if (!File.Exists(path))
            {
                this._iFrameworkWnd.UnifiedMessageBox.ShowError(base.FindForm(), "指定的声音文件不存在!");
            }
            else
            {
                try
                {
                    using (SoundPlayer player = new SoundPlayer(path))
                    {
                        player.Play();
                    }
                }
                catch (Exception exception)
                {
                    this._iFrameworkWnd.UnifiedMessageBox.ShowError(base.FindForm(), "无法播放指定的声音文件!");
                    ClientLogger.WriteException(exception);
                }
            }
        }

        private void uiData_Changed(object sender, EventArgs e)
        {
            UiErrorHelper.HandEventSafely(this._iFrameworkWnd, delegate {
                base.Modified = true;
            });
        }

        public override bool UpdateData(bool update)
        {
            try
            {
                if (update)
                {
                    if (!this.CheckUserInput())
                    {
                        return false;
                    }
                    Suspender suspender = new Suspender(this._ns);
                    try
                    {
                        this._ns.NewMessageNotify.ProposedValue = this.chkMsgNotify.Checked;
                        if (this.rbAllYes.Checked)
                        {
                            this._ns.OnlineNotify.ProposedValue = 0;
                        }
                        else if (this.rbAllNo.Checked)
                        {
                            this._ns.OnlineNotify.ProposedValue = 1;
                        }
                        else if (this.rbByContact.Checked)
                        {
                            this._ns.OnlineNotify.ProposedValue = 2;
                        }
                        else
                        {
                            this._ns.OnlineNotify.ProposedValue = 0;
                        }
                    }
                    finally
                    {
                        suspender.Dispose();
                    }
                    Suspender suspender2 = new Suspender(this.ss);
                    try
                    {
                        this.ss.SoundEnabled.ProposedValue = this.ckEnableSound.Checked;
                        if (this._soundList[0].Path != null)
                        {
                            this.ss.OnlineNotify.ProposedValue = this._soundList[0].Path;
                        }
                        if (this._soundList[1].Path != null)
                        {
                            this.ss.MsgNotify.ProposedValue = this._soundList[1].Path;
                        }
                        if (this._soundList[2].Path != null)
                        {
                            this.ss.SysNotify.ProposedValue = this._soundList[2].Path;
                        }
                    }
                    finally
                    {
                        suspender2.Dispose();
                    }
                }
                else
                {
                    this._soundList[0].Path = this.ss.OnlineNotify.Value;
                    this._soundList[1].Path = this.ss.MsgNotify.Value;
                    this._soundList[2].Path = this.ss.SysNotify.Value;
                    this.xtbFilePath.Text = this._soundList[0].Path;
                    this.dgvSound.Rows[0].Selected = true;
                    this.ckEnableSound.Checked = (bool) this.ss.SoundEnabled;
                    this.dgvSound.Enabled = this.ckEnableSound.Checked;
                    if (this._ns.OnlineNotify == null)
                    {
                        this.rbAllYes.Checked = true;
                    }
                    else if (this._ns.OnlineNotify == 1)
                    {
                        this.rbAllNo.Checked = true;
                    }
                    else if (this._ns.OnlineNotify == 2)
                    {
                        this.rbByContact.Checked = true;
                    }
                    else
                    {
                        this.rbAllYes.Checked = true;
                    }
                    this.chkMsgNotify.Checked = (bool) this._ns.NewMessageNotify;
                }
                base.Modified = false;
                return true;
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException(exception);
                return false;
            }
        }

        private Imps.Client.Core.User _user
        {
            get
            {
                return this._iFrameworkWnd.AccountManager.CurrentUser;
            }
        }
    }
}

⌨️ 快捷键说明

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