孙世强
2025-10-10 52380826389a6584a4f05c800d6007ea8ec6fe19
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
using directPacking;
using System;
using System.Windows.Forms;
 
namespace MyGlassEdit.配置
{
    public partial class 使用设置 : Form
    {
        public 使用设置()
        {
            InitializeComponent();
        }
 
        public 使用设置(参数设定 f)
        {
            switch (Setting.language)
            {
                case 1://英语
                    System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en");
 
                    break;
                case 2:
                    System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("ru");
 
                    break;
                default:
                    //System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("");
                    break;
            }
            InitializeComponent();
            parent = f;
        }
        参数设定 parent;
 
        public void loadSettings()
        {
 
            rBtnNoBHXB.Checked = !globel.IsContainCutEdge;
            rBtnBHXB.Checked = globel.IsContainCutEdge;
 
            rBtnArea.Checked = globel.MesUnit == "面积";
            rBtnPian.Checked = globel.MesUnit == "片";
 
            rBtnZXSQL.Checked = globel.CarryOutInfoSource == "数据库";
            rBtnZXFile.Checked = globel.CarryOutInfoSource == "优化文件";
 
            rBtnPolysList.Checked = globel.SaveResultSource == "成品列表";
            rBtnOptimaResult.Checked = globel.SaveResultSource == "优化结果";
 
            txtDefaultDisplayDays.Text = globel.DefaultDisplayDays.ToString();
 
            txtPolyEdge.Text = globel.PolyEdgeGreaterThanNumRemind.ToString();
 
            txtAlertDuration.Text = globel.AlertDuration.ToString();
 
 
            rBtnReStream.Checked = globel.DataReportMode == "数据流";
            rBtnReOffice.Checked = !rBtnReStream.Checked;
 
/*
            if (globel.ShapeOptima)
            {
                rBtnOptima.Checked = globel.ShapeOptima;
                rBtnNoOptima.Checked = !rBtnOptima.Checked;
 
                tableLayoutPanel5.Visible = true;
                label12.Visible = true;
            }
            else {
                tableLayoutPanel5.Visible = radioButton4.Checked;
                label12.Visible = radioButton4.Checked;
            }*/
        }
 
        public bool  save()
        {
            try
            {
 
                if (Utility.StringUtil.IsValidDecimal(txtDefaultDisplayDays.Text.Trim()))
                {
                    globel.DefaultDisplayDays = Convert.ToInt32(txtDefaultDisplayDays.Text.Trim());
                }
                else
                {
 
                    globel.ShowFromWarningMessage("默认显示几天内的已优化工程,请输入大于 0 的正整数!",false);
                    return false;
                }
 
                if (Utility.StringUtil.IsValidDecimal(txtPolyEdge.Text.Trim()))
                {
                    globel.PolyEdgeGreaterThanNumRemind = Convert.ToInt32(txtPolyEdge.Text.Trim());
                }
                else
                {
                    globel.ShowFromWarningMessage("优化时,成品存在单边大于多少的成品时提醒设置参数需输入大于等于零的整数!设置为0时,不启动功能");
                    return false;
                }
 
                if (Utility.StringUtil.IsValidDecimal(txtAlertDuration.Text.Trim()))
                {
                    if (Convert.ToInt32(txtAlertDuration.Text.Trim())<1)
                    {
                        globel.ShowFromWarningMessage("消息提示框的默认显示时长需设置为大于等于1的正整数,建议为 3 秒");
 
                        txtAlertDuration.Text = globel.AlertDuration.ToString();
                        return false;
                    }
                    
                    globel.AlertDuration = Convert.ToInt32(txtAlertDuration.Text.Trim());
                }
                else
                {
                    globel.ShowFromWarningMessage("消息提示框的默认显示时长需设置为大于等于1的正整数,建议为 3 秒");
                    return false;
                }
 
                globel.IsContainCutEdge = rBtnBHXB.Checked;
                globel.MesUnit = rBtnArea.Checked ? "面积" : "片";
                globel.SaveResultSource = rBtnPolysList.Checked ? "成品列表" : "优化结果";
                globel.CarryOutInfoSource = rBtnZXSQL.Checked ? "数据库" : "优化文件";
                globel.DataReportMode = rBtnReStream.Checked ? "数据流" : "Office插件";
                return true;
            }
            catch (Exception ex)
            {
                globel.ShowErrorMessage(Sentences.canshucuowu + ":" + ex.Message);
                return false;
            }
 
        }
 
        private void 使用设置_Load(object sender, EventArgs e)
        {
            loadSettings();
        }
 
    }
}