コード例 #1
0
        private void btn_apply_Click(object sender, EventArgs e)
        {
            string message   = "";
            bool   validated = ValidateFields(out message);

            if (message != "" && validated == false)
            {
                MessageBox.Show(message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (message != "" && validated == true)
            {
                MessageBox.Show(message, "WARNING", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                if (!XMLSettings.XMLBatchClassElementExists(XMLPath, BatchClass.Name.Replace(" ", "")))
                {
                    XMLSettings.CreateNewBatchClassNodes(XMLPath, BatchClass.Name.Replace(" ", ""));
                }

                XMLSettings.SaveXMLSettings(XMLPath, BatchClass.Name.Replace(" ", ""), g_aNewMethodOrder,
                                            txt_shortdateformat.Text, txt_longdateformat.Text, txt_shorttimeformat.Text,
                                            txt_longtimeformat.Text, txt_localizationvalue.Text, txt_stringtoformat.Text,
                                            txt_formatteddate.Text, txt_formattedtime.Text, txt_targetdateformat.Text,
                                            txt_targettimeformat.Text, txt_usewaterfallformatter.Text, txt_usedistancerule.Text,
                                            txt_ruledays.Text, txt_distancerulefuture.Text);
                ApplyState(false);
            }
            else
            {
                if (!XMLSettings.XMLBatchClassElementExists(XMLPath, BatchClass.Name.Replace(" ", "")))
                {
                    XMLSettings.CreateNewBatchClassNodes(XMLPath, BatchClass.Name.Replace(" ", ""));
                }

                XMLSettings.SaveXMLSettings(XMLPath, BatchClass.Name.Replace(" ", ""), g_aNewMethodOrder,
                                            txt_shortdateformat.Text, txt_longdateformat.Text, txt_shorttimeformat.Text,
                                            txt_longtimeformat.Text, txt_localizationvalue.Text, txt_stringtoformat.Text,
                                            txt_formatteddate.Text, txt_formattedtime.Text, txt_targetdateformat.Text,
                                            txt_targettimeformat.Text, txt_usewaterfallformatter.Text, txt_usedistancerule.Text,
                                            txt_ruledays.Text, txt_distancerulefuture.Text);
                ApplyState(false);
            }
        }