Example #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            FolderConfiguration save = new FolderConfiguration();

            save.Title   = txtTitle.Text;
            save.Enabled = chkEnabled.Checked;

            foreach (DataGridViewRow row in grdFolders.Rows)
            {
                if (row.Cells["Path"].Value == null || string.IsNullOrWhiteSpace(row.Cells["Path"].Value.ToString()))
                {
                    continue;
                }

                FolderItemConfiguration config = new FolderItemConfiguration();
                config.Path      = row.Cells["Path"].Value.ToString();
                config.Filter    = row.Cells["Filter"].Value.ToString();
                config.Log       = row.Cells["Log"].Value.ToString();
                config.Recursive = row.Cells["Recursive"].Value == null ? false : row.Cells["Recursive"].Value.ToString().Equals("true", StringComparison.CurrentCultureIgnoreCase);

                save.Folders.Add(config);
            }

            save.Save();

            this.Close();
        }