BolterV2.MainWindow.ProcessListBox_OnSelectionChanged C# (CSharp) Method

ProcessListBox_OnSelectionChanged() private method

private ProcessListBox_OnSelectionChanged ( object sender, System.Windows.Controls.SelectionChangedEventArgs e ) : void
sender object
e System.Windows.Controls.SelectionChangedEventArgs
return void
        private void ProcessListBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (_pidMenu)
            {
                _pidMenu = false;
                _pid =
                    int.Parse(
                        Regex.Match(((ListImg)ProcessListBox.SelectedItem).Str, @"\s[0-9]+").Captures[0].Value
                            .Substring(1));
                var newimg = (ImageSource)CreateBitmapSourceFromBitmap(Properties.Resources.plug);
                ProcessListBox.SelectionChanged -= ProcessListBox_OnSelectionChanged;
                ProcessListBox.Items.Clear();
                foreach (
                    var file in
                        Directory.EnumerateFiles(Directory.GetCurrentDirectory() + "\\Plugins")
                            .Where(file => file.EndsWith(".dll") && !file.Contains("BolterLibrary")))
                    ProcessListBox.Items.Add(
                        new ListImg(
                            new string(file.Skip((Directory.GetCurrentDirectory() + "\\Plugins").Length + 1).ToArray())
                                .Replace(".dll", ""), newimg));
                ProcessListBox.SelectionChanged += ProcessListBox_OnSelectionChanged;
                DebugButton.Visibility = Visibility.Visible;
            }
            else
            {
                SelectedpluginName = ((ListImg)ProcessListBox.SelectedItem).Str;
            }
        }