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

📄 ssthemecontrol.cs

📁 飞信的收发使用csharp进行开发
💻 CS
字号:
namespace Imps.Client.Pc.Options
{
    using Imps.Client.Core;
    using Imps.Client.Pc;
    using Imps.Client.Pc.Controls;
    using Imps.Client.Pc.Theme;
    using Imps.Client.Resource;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class SsThemeControl : OptionsControlBase
    {
        private IFrameworkWindow _iFrameworkWnd;
        private IContainer components;
        private XComboBox dlThemes;
        private XLabel lbTheme;
        private XLabel lbThemeTip;
        private PictureBox pbPreview;

        public SsThemeControl(IFrameworkWindow frmWnd)
        {
            this._iFrameworkWnd = frmWnd;
            this.InitializeComponent();
            this.LoadResource();
            this.InitThemeList();
            this.dlThemes.SelectedIndexChanged += new EventHandler(this.dlThemes_SelectedIndexChanged);
        }

        public override bool CheckUserInput()
        {
            return true;
        }

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

        private void dlThemes_SelectedIndexChanged(object sender, EventArgs e)
        {
            base.Modified = true;
            this.pbPreview.Image = ThemeManager.GetPreviewImage(ThemeManager.Themes[this.dlThemes.Text]);
        }

        private void InitializeComponent()
        {
            this.lbTheme = new XLabel();
            this.lbThemeTip = new XLabel();
            this.pbPreview = new PictureBox();
            this.dlThemes = new XComboBox();
            XLabel label = new XLabel();
            ((ISupportInitialize) this.pbPreview).BeginInit();
            base.SuspendLayout();
            label.BorderStyle = BorderStyle.Fixed3D;
            label.Location = new Point(0x37, 15);
            label.Name = "lbLine";
            label.Size = new Size(300, 2);
            label.TabIndex = 1;
            this.lbTheme.AutoSize = true;
            this.lbTheme.Location = new Point(5, 9);
            this.lbTheme.Name = "lbTheme";
            this.lbTheme.Size = new Size(0x30, 13);
            this.lbTheme.TabIndex = 0;
            this.lbTheme.Text = "lbTheme";
            this.lbThemeTip.AutoSize = true;
            this.lbThemeTip.Location = new Point(0x10, 0x1d);
            this.lbThemeTip.Name = "lbThemeTip";
            this.lbThemeTip.Size = new Size(0x3f, 13);
            this.lbThemeTip.TabIndex = 2;
            this.lbThemeTip.Text = "lbThemeTip";
            this.pbPreview.BackgroundImageLayout = ImageLayout.Zoom;
            this.pbPreview.ErrorImage = null;
            this.pbPreview.InitialImage = null;
            this.pbPreview.Location = new Point(0x12, 90);
            this.pbPreview.Name = "pbPreview";
            this.pbPreview.Size = new Size(0x14d, 0x14c);
            this.pbPreview.TabIndex = 9;
            this.pbPreview.TabStop = false;
            this.dlThemes.BackColor = Color.White;
            this.dlThemes.DropDownStyle = ComboBoxStyle.DropDownList;
            this.dlThemes.FormattingEnabled = true;
            this.dlThemes.Location = new Point(0x12, 0x37);
            this.dlThemes.Name = "dlThemes";
            this.dlThemes.Size = new Size(0x146, 0x15);
            this.dlThemes.TabIndex = 3;
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.Controls.Add(this.dlThemes);
            base.Controls.Add(this.pbPreview);
            base.Controls.Add(this.lbThemeTip);
            base.Controls.Add(this.lbTheme);
            base.Controls.Add(label);
            base.Name = "SsThemeControl";
            base.Size = new Size(0x16b, 0x1b1);
            base.Load += new EventHandler(this.SsThemeControl_Load);
            ((ISupportInitialize) this.pbPreview).EndInit();
            base.ResumeLayout(false);
            base.PerformLayout();
        }

        private void InitThemeList()
        {
            foreach (KeyValuePair<string, string> pair in ThemeManager.Themes)
            {
                if (pair.Key != ThemeManager.ThemeName)
                {
                    this.dlThemes.Items.Add(pair.Key);
                    continue;
                }
                this.dlThemes.Items.Insert(0, pair.Key);
            }
        }

        private void LoadResource()
        {
            this.lbTheme.Text = StringTable.Theme.lbTheme;
            this.lbThemeTip.Text = StringTable.Theme.lbThemeTip;
        }

        private void SsThemeControl_Load(object sender, EventArgs e)
        {
        }

        public override bool UpdateData(bool update)
        {
            if (update)
            {
                if (!this.CheckUserInput())
                {
                    return false;
                }
                ThemeManager.ApplyTheme(ThemeManager.Themes[this.dlThemes.Text]);
                this._user.Configuration.UserSetting.SkinSetting.CurrentSkinName.ProposedValue = ThemeManager.Themes[this.dlThemes.Text];
            }
            else
            {
                foreach (KeyValuePair<string, string> pair in ThemeManager.Themes)
                {
                    if (pair.Value == this._user.Configuration.UserSetting.SkinSetting.CurrentSkinName.Value)
                    {
                        this.dlThemes.SelectedItem = pair.Key;
                        break;
                    }
                }
            }
            base.Modified = false;
            return true;
        }

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

⌨️ 快捷键说明

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