예제 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (lstConfig == null || lstConfig.Count == 0)
            {
                return;
            }

            try
            {
                if (String.IsNullOrEmpty(txtConfigTag.Text.Trim()))
                {
                    var folderDlg = new FolderBrowserDialog();
                    folderDlg.ShowNewFolderButton = true;
                    // Show the FolderBrowserDialog.
                    var result = folderDlg.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        string pathFile = Path.Combine(folderDlg.SelectedPath.Trim(), "UiPath_Is_Funny_Config_" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".config");
                        txtConfigTag.Text = pathFile;
                    }
                }

                if (!String.IsNullOrEmpty(txtConfigTag.Text.Trim()))
                {
                    configBusiness.SaveAll(lstConfig, txtConfigTag.Text.Trim());
                    MessageBox.Show("Save to config file successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Oops", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }