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

📄 ssgeneralcontrol.cs

📁 破解的飞信源代码
💻 CS
字号:
namespace Imps.Client.Pc.Options
{
    using Imps.Client;
    using Imps.Client.Core;
    using Imps.Client.Pc;
    using Imps.Client.Pc.Controls;
    using Imps.Client.Pc.Utils;
    using Imps.Client.Resource;
    using Imps.Client.Utils;
    using Imps.Client.Utils.Win32;
    using System;
    using System.Drawing;
    using System.Windows.Forms;

    internal class SsGeneralControl : OptionsControlBase
    {
        private IFrameworkWindow _frameworkWnd;
        private CheckBox checkBoxImprove;
        private CheckBox ctlAutoHide;
        private XNumericUpDown ctlAutoHideSeconds;
        private CheckBox ctlAutoLogin;
        private CheckBox ctlAutoStartup;
        private CheckBox ctlPopupMainWnd;
        private CheckBox ctlTopMost;
        private GroupBox groupBox1;
        private XLabel lbAutoHide;
        private Panel panelImprove;

        public SsGeneralControl(IFrameworkWindow frameworkWnd)
        {
            this._frameworkWnd = frameworkWnd;
            this.InitializeComponent();
            this.handleUiEvent();
        }

        public override bool CheckUserInput()
        {
            return true;
        }

        private void ctlAutoHide_CheckedChanged(object sender, EventArgs e)
        {
            this.ctlAutoHideSeconds.Enabled = this.ctlAutoHide.Checked;
        }

        private void ctlAutoHideSeconds_OnValueOutOfRange(object sender, EventArgs e)
        {
            BalloonHelper.ShowBallon(this.ctlAutoHideSeconds, string.Format(StringTable.Options.ValueOutOfRange, this.ctlAutoHideSeconds.Minimum, this.ctlAutoHideSeconds.Maximum), "错误", 3, 0x3e8);
        }

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

        private void handleUiEvent()
        {
            this.ctlAutoHide.Click += new EventHandler(this.uiData_Changed);
            this.ctlAutoHideSeconds.ValueChanged += new EventHandler(this.uiData_Changed);
            this.ctlAutoHideSeconds.KeyPress += new KeyPressEventHandler(this.uiData_Changed);
            this.ctlAutoLogin.Click += new EventHandler(this.uiData_Changed);
            this.ctlAutoStartup.Click += new EventHandler(this.uiData_Changed);
            this.ctlPopupMainWnd.Click += new EventHandler(this.uiData_Changed);
            this.ctlTopMost.Click += new EventHandler(this.uiData_Changed);
            this.checkBoxImprove.CheckedChanged += new EventHandler(this.uiData_Changed);
        }

        private void InitializeComponent()
        {
            this.ctlAutoHide = new CheckBox();
            this.ctlPopupMainWnd = new CheckBox();
            this.ctlAutoStartup = new CheckBox();
            this.ctlAutoLogin = new CheckBox();
            this.ctlAutoHideSeconds = new XNumericUpDown();
            this.lbAutoHide = new XLabel();
            this.ctlTopMost = new CheckBox();
            this.panelImprove = new Panel();
            this.checkBoxImprove = new CheckBox();
            this.groupBox1 = new GroupBox();
            XLabel label = new XLabel();
            XLabel label2 = new XLabel();
            this.ctlAutoHideSeconds.BeginInit();
            this.panelImprove.SuspendLayout();
            this.groupBox1.SuspendLayout();
            base.SuspendLayout();
            label.set_AutoSize(true);
            label.BorderColor = Color.Empty;
            label.ButtonBorderStyle = ButtonBorderStyle.None;
            label.ForeColor = Color.Black;
            label.Location = new System.Drawing.Point(3, 2);
            label.Name = "xLabel1";
            label.Size = new Size(0x35, 12);
            label.TabIndex = 11;
            label.Text = "体验改进";
            label.UseMnemonic = false;
            label2.BorderColor = Color.Empty;
            label2.BorderStyle = BorderStyle.Fixed3D;
            label2.ButtonBorderStyle = ButtonBorderStyle.None;
            label2.Location = new System.Drawing.Point(0x29, 9);
            label2.Name = "xLabel2";
            label2.Size = new Size(300, 2);
            label2.TabIndex = 12;
            label2.Text = "label2";
            label2.UseMnemonic = false;
            this.ctlAutoHide.set_AutoSize(true);
            this.ctlAutoHide.Location = new System.Drawing.Point(6, 0x12);
            this.ctlAutoHide.Name = "ctlAutoHide";
            this.ctlAutoHide.Size = new Size(90, 0x10);
            this.ctlAutoHide.TabIndex = 2;
            this.ctlAutoHide.Text = "ctlAutoHide";
            this.ctlAutoHide.set_UseVisualStyleBackColor(true);
            this.ctlAutoHide.Visible = false;
            this.ctlAutoHide.CheckedChanged += new EventHandler(this.ctlAutoHide_CheckedChanged);
            this.ctlPopupMainWnd.set_AutoSize(true);
            this.ctlPopupMainWnd.Location = new System.Drawing.Point(6, 0x12);
            this.ctlPopupMainWnd.Name = "ctlPopupMainWnd";
            this.ctlPopupMainWnd.Size = new Size(0x72, 0x10);
            this.ctlPopupMainWnd.TabIndex = 0;
            this.ctlPopupMainWnd.Text = "ctlPopupMainWnd";
            this.ctlPopupMainWnd.set_UseVisualStyleBackColor(true);
            this.ctlAutoStartup.set_AutoSize(true);
            this.ctlAutoStartup.Location = new System.Drawing.Point(6, 40);
            this.ctlAutoStartup.Name = "ctlAutoStartup";
            this.ctlAutoStartup.Size = new Size(0x6c, 0x10);
            this.ctlAutoStartup.TabIndex = 2;
            this.ctlAutoStartup.Text = "ctlAutoStartup";
            this.ctlAutoStartup.set_UseVisualStyleBackColor(true);
            this.ctlAutoLogin.set_AutoSize(true);
            this.ctlAutoLogin.Location = new System.Drawing.Point(6, 0x3f);
            this.ctlAutoLogin.Name = "ctlAutoLogin";
            this.ctlAutoLogin.Size = new Size(0x60, 0x10);
            this.ctlAutoLogin.TabIndex = 3;
            this.ctlAutoLogin.Text = "ctlAutoLogin";
            this.ctlAutoLogin.set_UseVisualStyleBackColor(true);
            this.ctlAutoLogin.CheckedChanged += new EventHandler(this.ctlAutoLogin_CheckedChanged);
            this.ctlAutoHideSeconds.Location = new System.Drawing.Point(100, 15);
            int[] bits = new int[4];
            bits[0] = 300;
            this.ctlAutoHideSeconds.Maximum = new decimal(bits);
            this.ctlAutoHideSeconds.MaxLength = 0x7fff;
            int[] numArray2 = new int[4];
            numArray2[0] = 1;
            this.ctlAutoHideSeconds.Minimum = new decimal(numArray2);
            this.ctlAutoHideSeconds.Name = "ctlAutoHideSeconds";
            this.ctlAutoHideSeconds.Size = new Size(0x30, 0x15);
            this.ctlAutoHideSeconds.TabIndex = 1;
            int[] numArray3 = new int[4];
            numArray3[0] = 30;
            this.ctlAutoHideSeconds.Value = new decimal(numArray3);
            this.ctlAutoHideSeconds.Visible = false;
            this.lbAutoHide.set_AutoSize(true);
            this.lbAutoHide.BorderColor = Color.Empty;
            this.lbAutoHide.ButtonBorderStyle = ButtonBorderStyle.None;
            this.lbAutoHide.Location = new System.Drawing.Point(0x95, 0x13);
            this.lbAutoHide.Name = "lbAutoHide";
            this.lbAutoHide.Size = new Size(0x41, 12);
            this.lbAutoHide.TabIndex = 4;
            this.lbAutoHide.Text = "lbAutoHide";
            this.lbAutoHide.UseMnemonic = false;
            this.lbAutoHide.Visible = false;
            this.ctlTopMost.set_AutoSize(true);
            this.ctlTopMost.Location = new System.Drawing.Point(20, 0x133);
            this.ctlTopMost.Name = "ctlTopMost";
            this.ctlTopMost.Size = new Size(0x54, 0x10);
            this.ctlTopMost.TabIndex = 10;
            this.ctlTopMost.Text = "ctlTopMost";
            this.ctlTopMost.set_UseVisualStyleBackColor(true);
            this.panelImprove.Controls.Add(label);
            this.panelImprove.Controls.Add(this.checkBoxImprove);
            this.panelImprove.Controls.Add(label2);
            this.panelImprove.Location = new System.Drawing.Point(3, 0x5f);
            this.panelImprove.Name = "panelImprove";
            this.panelImprove.Size = new Size(0x182, 0x2e);
            this.panelImprove.TabIndex = 0x10;
            this.checkBoxImprove.set_AutoSize(true);
            this.checkBoxImprove.Location = new System.Drawing.Point(0x11, 0x16);
            this.checkBoxImprove.Name = "checkBoxImprove";
            this.checkBoxImprove.Size = new Size(0xe4, 0x10);
            this.checkBoxImprove.TabIndex = 13;
            this.checkBoxImprove.Text = "允许记录操作日志,以改善用户体验。";
            this.checkBoxImprove.set_UseVisualStyleBackColor(true);
            this.groupBox1.Controls.Add(this.ctlPopupMainWnd);
            this.groupBox1.Controls.Add(this.ctlAutoHide);
            this.groupBox1.Controls.Add(this.ctlAutoStartup);
            this.groupBox1.Controls.Add(this.lbAutoHide);
            this.groupBox1.Controls.Add(this.ctlAutoLogin);
            this.groupBox1.Controls.Add(this.ctlAutoHideSeconds);
            this.groupBox1.Location = new System.Drawing.Point(3, 3);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new Size(0x19e, 0x56);
            this.groupBox1.TabIndex = 0;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "基本设置";
            base.Controls.Add(this.groupBox1);
            base.Controls.Add(this.panelImprove);
            base.Controls.Add(this.ctlTopMost);
            base.Name = "SsGeneralControl";
            base.Size = new Size(420, 480);
            base.DoubleClick += new EventHandler(this.SsGeneralControl_DoubleClick);
            base.Load += new EventHandler(this.SsGeneralControl_Load);
            this.ctlAutoHideSeconds.EndInit();
            this.panelImprove.ResumeLayout(false);
            this.panelImprove.PerformLayout();
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            base.ResumeLayout(false);
            base.PerformLayout();
        }

        private void SsGeneralControl_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                if ((Imps.Client.Utils.Win32.NativeMethods.GetKeyState(0x11) & 0x8000) != 0)
                {
                    this.panelImprove.Visible = true;
                }
            }
            catch
            {
            }
        }

        private void SsGeneralControl_Load(object sender, EventArgs e)
        {
            this.ctlTopMost.Text = StringTable.GerneralSetting.CkTopMost;
            this.ctlAutoHide.Text = StringTable.GerneralSetting.CkAutoHide;
            this.ctlPopupMainWnd.Text = StringTable.GerneralSetting.CkPopupMainWnd;
            this.ctlAutoStartup.Text = StringTable.GerneralSetting.CkAutoStartup;
            this.ctlAutoLogin.Text = StringTable.GerneralSetting.CkAutoLogin;
            this.lbAutoHide.Text = StringTable.GerneralSetting.lbAutoHide;
            this.ctlAutoHideSeconds.Left = this.ctlAutoHide.Right;
            this.ctlAutoHideSeconds.OnValueOutOfRange += new EventHandler(this.ctlAutoHideSeconds_OnValueOutOfRange);
            this.lbAutoHide.Left = this.ctlAutoHideSeconds.Right;
            this.ctlTopMost.Visible = false;
            int num = this.ctlAutoHide.Top - this.ctlTopMost.Top;
            foreach (Control control in base.Controls)
            {
                if (control.Top > this.ctlTopMost.Top)
                {
                    control.Top -= num;
                }
            }
            this.panelImprove.Visible = false;
        }

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

        public override bool UpdateData(bool update)
        {
            Imps.Client.Core.MainWindowSetting host = this.CurrentUser.Configuration.UserSetting.MainWindowSetting;
            if (update)
            {
                if (!this.CheckUserInput())
                {
                    return false;
                }
                Suspender suspender = new Suspender(host);
                try
                {
                    host.TopMost = this.ctlTopMost.Visible && this.ctlTopMost.Checked;
                    host.AutoHide = this.ctlAutoHide.Checked;
                    host.AutoHideSeconds = Convert.ToInt32(this.ctlAutoHideSeconds.Value);
                    if (this.ctlAutoLogin.Enabled)
                    {
                        UserAccounts.LatestAccountAutoLogin = this.ctlAutoLogin.Checked;
                    }
                    if (this.ctlAutoStartup.Checked)
                    {
                        RegistryHelper.RegStartUp(Imps.Client.Core.Configuration.FixedClientSetting.AppEnglishName, this._frameworkWnd.MainAppPath);
                    }
                    else
                    {
                        RegistryHelper.UnregStartUp(Imps.Client.Core.Configuration.FixedClientSetting.AppEnglishName);
                    }
                    UserAccounts.LatestAccountAutoLogin = this.ctlAutoLogin.Checked;
                    try
                    {
                        ((EntryPointControl) this._frameworkWnd.AccountManager.EntryPointControl).AutoLogin = this.ctlAutoLogin.Checked;
                    }
                    catch (Exception)
                    {
                    }
                    this.CurrentUser.Configuration.SystemSetting.RecordMyLog = this.checkBoxImprove.Checked;
                    host.AutoPopup = this.ctlPopupMainWnd.Checked;
                }
                finally
                {
                    suspender.Dispose();
                }
            }
            else
            {
                this.ctlTopMost.Checked = host.TopMost;
                this.ctlAutoHide.Checked = host.AutoHide;
                this.ctlAutoHideSeconds.Enabled = host.AutoHide;
                this.ctlAutoHideSeconds.Value = Convert.ToDecimal(host.AutoHideSeconds);
                this.ctlAutoLogin.Enabled = (this._frameworkWnd.AccountManager.CurrentUser.Status == UserAccountStatus.Logon) && UserAccounts.AutoLoginEnabled;
                this.ctlAutoLogin.Checked = UserAccounts.LatestAccountAutoLogin;
                this.ctlAutoStartup.Checked = RegistryHelper.IsAppStartUp(Imps.Client.Core.Configuration.FixedClientSetting.AppEnglishName, this._frameworkWnd.MainAppPath);
                this.ctlPopupMainWnd.Checked = host.AutoPopup;
                this.checkBoxImprove.Checked = this.CurrentUser.Configuration.SystemSetting.RecordMyLog;
            }
            base.Modified = false;
            return true;
        }

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

⌨️ 快捷键说明

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