void BtnApplyFilterClick(object sender, EventArgs e) { var ctx = new Context(registry, PreferenceManager.Config.RemoteRegistry, PreferenceManager.Config.Translation); localPackageListBox.Items.Clear(); localPackageListBox.SelectedIndex = -1; localPackageListBox.SelectedItem = null; contextActionPanel.Hide(); localPackageListBox.Items.AddRange( registry.ListPackages(ctx).Where( p => (textKeyword.Text == "" || p.PlainName.ToLowerInvariant().Contains(textKeyword.Text.ToLowerInvariant())) && (comboCategory.SelectedIndex == 0 || p.Category == comboCategory.SelectedItem.ToString())) .ToArray() ); localPackageListBox.Invalidate(); }
public ManipulationForm(ILocalRegistry registry, bool callInstallDlg = false, Identifier idToInstall = default(Identifier)) { this.Font = new Font(SystemFonts.CaptionFont.FontFamily, 12F, FontStyle.Regular, GraphicsUnit.Pixel); InitializeComponent(); this.registry = registry; var ctx = new Context(registry, PreferenceManager.Config.RemoteRegistry, PreferenceManager.Config.Translation); comboCategory.Items.Add("(ALL)"); // TODO: I18n foreach (var package in registry.ListPackages(ctx)) { if (!comboCategory.Items.Contains(package.Category)) { comboCategory.Items.Add(package.Category); } localPackageListBox.Items.Add(package); } comboCategory.SelectedIndex = 0; progCtrl = new ProgressControl() { BoxColor = Color.FromArgb(55, 57, 46), BarFillColor = Color.FromArgb(80, 205, 206), ForeColor = Color.FromArgb(250, 250, 250), LogLevel = LogLevel.Debug, Dock = DockStyle.Fill }; progCtrl.btnOK.Text = I._("bpmgui_mainform_ok"); progCtrl.btnCancel.Text = I._("bpmgui_mainform_cancel"); progCtrl.progressBar.TextColor = Color.Black; pushLog = (level, msg) => Invoke((Action <LogLevel, string>)progCtrl.PushList, level, msg); pushProgress = (total, finished, ratio) => BeginInvoke((Action <long?, long?, double?>)progCtrl.PushBar, total, finished, ratio); this.callInstallDlg = callInstallDlg; this.idToInstall = idToInstall; }