Beispiel #1
0
        private void apply()
        {
            // 1.获取亮度调整参数
            Common.Config.Alpha = (byte)this.tbAlpha.Value;

            // 2.获取多屏设置参数:自动更新

            // 3.获取软件设置参数
            Common.Config.AutoHidden    = this.ckxAutoHidden.Checked;
            Common.Config.AutoShowShade = this.ckxAutoShowShade.Checked;
            Common.Config.AutoAdjust    = this.ckxAutoAdjust.Checked;

            // 4.持久化配置
            Common.Config.UpdateTime = DateTime.Now;
            Common.Config.Save();

            /*
             * 5.调整屏幕亮度
             */
            if (this.tabMain.SelectedIndex == 1)
            {
                if (!this.ckxAlpha.Checked)
                {
                    this.ckxAlpha.Checked = true;
                }
                else
                {
                    this.showShade(this.ckxAlpha.Checked);
                }
            }

            // 6.收集屏幕亮度
            Brightness.Save(this.ckxAlpha.Checked ? Common.Config.Alpha : (byte)0, true);
        }
Beispiel #2
0
        /// <summary>
        /// 设置遮罩亮度
        /// </summary>
        private void setBrightness()
        {
            for (var i = 0; i < this._shades.Count; i++)
            {
                this._shades[i].AdjustBrightness(Common.Config.Monitors[i].Alpha);
            }

            if (this.ckxAlpha.Checked) // TODO:收集屏幕亮度,未实现单屏亮度收集
            {
                Brightness.Save(Common.Config.Alpha);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 显示遮罩
        /// </summary>
        /// <param name="isShow">是否显示遮罩</param>
        private void showShade(bool isShow = true)
        {
            if (isShow)
            {
                this._shades.ForEach(m => m.AdjustShade(Common.Config.Monitors[this._shades.IndexOf(m)]));
            }
            else
            {
                this._shades.ForEach(m => m.Visible = false);
            }

            this.menuItemHidden.Text = isShow ? "隐藏(&H)" : "显示(&D)";

            Brightness.Save(isShow ? Common.Config.Alpha : (byte)0); // 收集屏幕亮度
        }
Beispiel #4
0
 private void FormMain_FormClosed(object sender, FormClosedEventArgs e)
 {
     Brightness.Save(Common.Config.Alpha, true); // 收集屏幕亮度
     this._dataDriver.Stop();                    // 关闭数据驱
 }