FrmSetPlus.cs
4.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using Asa.FaceControl;
using System.Windows.Forms;
using BLL;
namespace SmartScan
{
public partial class FrmSetPlus : FaceFormNormal
{
private readonly Dictionary<FaceButton, Model.ISetMenu> menu = new();
public FrmSetPlus()
{
InitializeComponent();
//Language.SetLanguage(this);
this.SizeChanged += FrmSetPlus_SizeChanged;
this.FormClosing += FrmSetPlus_FormClosing;
this.Width = 1024;
this.Height = 738;
this.Top = 15;
this.Left = 0;
}
private void FrmSetPlus_FormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = true;
this.WindowState = FormWindowState.Minimized;
this.Hide();
}
private void FrmSetPlus_SizeChanged(object sender, EventArgs e)
{
if (WindowState == FormWindowState.Minimized)
{
this.Hide();
}
else {
}
}
private void FrmSet_Load(object sender, EventArgs e)
{
foreach (FaceButton button in menu.Keys)
{
Controls.Remove(menu[button].GetPanel());
}
menu.Clear();
menu.Add(BtnWorkMode, new UsrWorkMode2());
//menu.Add(BtnLabel, new UsrPrintTemplate());
menu.Add(BtnMaterial, new UsrMaterialTemplate());
menu.Add(BtnKeyword, new UsrMacro());
foreach (FaceButton button in menu.Keys)
{
FacePanel pnl = menu[button].GetPanel();
pnl.Left = PnlTemp.Left;
pnl.Top = PnlTemp.Top;
pnl.Width = PnlTemp.Width;
pnl.Height = PnlTemp.Height;
pnl.Anchor = PnlTemp.Anchor;
pnl.Visible = false;
Controls.Add(pnl);
}
BtnMaterial.HoldPress = true;
menu[BtnMaterial].GetPanel().Visible = true;
//语言
CboLanguage.Items.Clear();
CboLanguage.Items.AddRange(Language.Name.ToArray());
CboLanguage.SelectedText = BLLCommon.config.Language;
}
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 BtnUnlock_Click(object sender, EventArgs e)
{
//if (BtnUnlock.HoldPress)
//{
// BtnUnlock.HoldPress = false;
//}
//else
//{
// DialogResult dr = new FrmUnlock().ShowDialog();
// if (dr == DialogResult.OK)
// BtnUnlock.HoldPress = true;
// else
// return;
//}
//foreach (FaceButton button in menu.Keys)
// menu[button].SetUnlock(BtnUnlock.HoldPress);
}
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;
}
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)
{
if (BLLCommon.config.Language != CboLanguage.Text)
{
Language.LoadLanguage(CboLanguage.Text);
BLLCommon.config.Language = CboLanguage.Text;
BLLCommon.config.Save();
FrmSet_Load(this, EventArgs.Empty);
}
}
private void BtnHistory_Click(object sender, EventArgs e)
{
new FrmRetrospect().ShowDialog();
}
}
}