AnimeDownloader.MultiSelect.MultiSelect C# (CSharp) Method

MultiSelect() public method

public MultiSelect ( bool follow, string showname ) : System
follow bool
showname string
return System
        public MultiSelect(bool follow, string showname)
        {
            InitializeComponent();
            _follow = follow;
            this.Text = (follow ? " Follow " : string.Empty) + showname+" - "+(follow ? "Select additional Episodes to download..." : "Select Episodes to download...");
            butOk.Text = follow ? "Follow" : "Download";
            olvFile.AspectGetter = (d) =>
            {
                Episode e = (Episode) d;
                return TemplateParser.FilenameFromEpisode(e,_quality,Settings.Instance.DownloadTemplate);
            };
            foreach (Quality q in Enum.GetValues(typeof(Quality)))
                cmbQuality.Items.Add(q.ToText());
            cmbQuality.SelectedIndexChanged += (a, b) =>
            {
                if (cmbQuality.SelectedIndex != -1)
                    FileQuality = (Quality)cmbQuality.SelectedIndex;
            };
            int tl = 0;
            foreach (ADBaseLibrary.Format f in Enum.GetValues(typeof(ADBaseLibrary.Format)))
            {
                tl += 18;
                chkListBox.Items.Add(f.ToText(), false);
            }
            chkListBox.Height = tl;
            chkListBox.ItemCheck += (a, b) =>
            {
                ADBaseLibrary.Format[] fmts = Enum.GetValues(typeof(ADBaseLibrary.Format)).Cast<ADBaseLibrary.Format>().ToArray();
                if (b.NewValue == CheckState.Checked)
                {
                    _formats |= fmts[b.Index];
                }
                else if (b.NewValue == CheckState.Unchecked)
                {
                    _formats &= ~fmts[b.Index];
                }
            };
        }