FrmSetPlus - 复制.cs 3.5 KB
using Asa.FaceControl;
using BLL;
using Model;
using SmartScan.PlusSettingFrm;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace SmartScan
{
    public partial class FrmSetPlus2 : System.Windows.Forms.Form
    {
        private readonly Dictionary<FaceButton, Model.ISetMenu> menu = new();     
        public FrmSetPlus2()
        {
            InitializeComponent();
            return;
            //Language.SetLanguage(this);
           // this.SizeChanged += FrmSetPlus_SizeChanged;
           // this.FormClosing += FrmSetPlus_FormClosing;
            //this.Width = 1024;
            //this.Height = 738;
            this.Top = 15;
            this.Left = 0;
            WebService.Open(BLLCommon.config.WebService);//启动条码匹配服务
            LogNet.log = log4net.LogManager.GetLogger("SmartScan");
        }

        private void FrmSetPlus_FormClosing(object sender, FormClosingEventArgs e)
        {
            return;
            e.Cancel = true;
            ShowWindow(this.Handle, SW_HIDE);
            //this.WindowState = FormWindowState.Minimized;
            //this.Hide();
        }

        private void FrmSetPlus_SizeChanged(object sender, EventArgs e)
        {
            return;
            if (WindowState == FormWindowState.Minimized)
            {
                this.Hide();
            }
        }

        private void FrmSet_Load(object sender, EventArgs e)
        {
            return;
            
        }

        private void BtnMenu_Click(object sender, EventArgs e)
        {
            foreach (FaceButton button in menu.Keys)
            {
                bool rtn = button == sender;
                button.HoldPress = rtn;
                menu[button].GetPanel().Visible = rtn;
            }
        }

        private void BtnOK_Click(object sender, EventArgs e)
        {
            foreach (FaceButton button in menu.Keys)
                menu[button].Save();
            string text = Language.Dialog(Model.LanguageDialogKey.SAVE_SUCCEED);
            new FaceMessageBox("", text, MessageBoxButtons.OK).ShowDialog();
            BLLCommon.extension.Update();
            DialogResult = DialogResult.OK;
            //WindowState = FormWindowState.Minimized;
            ShowWindow(this.Handle, SW_HIDE);
        }
        public const int SW_HIDE = 0;
        [DllImport("user32.dll", EntryPoint = "ShowWindow", CharSet = CharSet.Auto)]
        public static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
        private void BtnCancel_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
            FrmSet_Load(this, EventArgs.Empty);
            WindowState = FormWindowState.Minimized;
            Hide();
        }

        private void BtnApply_Click(object sender, EventArgs e)
        {
            foreach (FaceButton button in menu.Keys)
                menu[button].Save();
            string text = Language.Dialog(Model.LanguageDialogKey.SAVE_SUCCEED);
            new FaceMessageBox("", text, MessageBoxButtons.OK).ShowDialog();
            BLLCommon.extension.Update();
        }

        private void CboLanguage_SelectedIndexChanged(object sender, EventArgs e)
        {
            return;
        }

        private void BtnHistory_Click(object sender, EventArgs e)
        {
            FrmRetrospect frm = new FrmRetrospect();
            frm.WindowState = FormWindowState.Maximized;
            frm.Show();
        }
    }
}