Ejemplo n.º 1
0
        /// <summary>
        /// Configure After Capture Tasks UI
        /// </summary>
        /// <param name="config">Initial config</param>
        /// <param name="chkAfterCaptureTask_CheckedChanged">Event handler of the parent form</param>
        public void ConfigUI(Subtask config, EventHandler chkAfterCaptureTask_CheckedChanged)
        {
            var tasks = Enum.GetValues(typeof(Subtask)).Cast<Subtask>().Select(x => new
            {
                Description = x.GetDescription(),
                Enum = x
            });

            flpTasks.Controls.Clear();

            foreach (var job in tasks)
            {
                switch (job.Enum)
                {
                    case Subtask.None:
                        continue;
                }

                CheckBox chkAfterCaptureTask = new CheckBox();
                chkAfterCaptureTask.Tag = job.Enum;
                chkAfterCaptureTask.Text = job.Description;
                chkAfterCaptureTask.AutoSize = true;
                chkAfterCaptureTask.CheckedChanged += chkAfterCaptureTask_CheckedChanged;
                chkAfterCaptureTask.Checked = config.HasFlag(job.Enum);
                flpTasks.Controls.Add(chkAfterCaptureTask);
            }
        }