Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.60 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows;
  6. using System.Windows.Controls;
  7. using System.Windows.Data;
  8. using System.Windows.Documents;
  9. using System.Windows.Input;
  10. using System.Windows.Media;
  11. using System.Windows.Media.Imaging;
  12. using System.Windows.Navigation;
  13. using System.Windows.Shapes;
  14. using System.Diagnostics;
  15. using System.ComponentModel;
  16. using System.IO;
  17. using Microsoft.Win32;
  18.  
  19. namespace iWoW_Premium
  20. {
  21.     /// <summary>
  22.     /// Interaktionslogik fΓΌr MainWindow.xaml
  23.     /// </summary>
  24.     public partial class MainWindow : Window
  25.     {
  26.         public MainWindow()
  27.         {
  28.             InitializeComponent();
  29.             comboBoxProcesses.Items.Clear();
  30.             String s = "Select a process";
  31.             int i = comboBoxProcesses.Items.Add(s);
  32.             comboBoxProcesses.SelectedIndex = i;
  33.         }
  34.  
  35.         private void comboBoxProcesses_DropDownOpened(object sender, EventArgs e)
  36.         {
  37.            
  38.             comboBoxProcesses.Items.Clear();
  39.  
  40.             foreach (Process p in Process.GetProcesses())
  41.             {
  42.                 ComboBoxItem cbi = new ComboBoxItem();
  43.                 cbi.Content = p.ProcessName + " : " + p.Id;
  44.                 cbi.Tag = p.Id;
  45.                 comboBoxProcesses.Items.Add(cbi);
  46.             }
  47.  
  48.             if (comboBoxProcesses.HasItems)
  49.             {
  50.                 SortDescription sd = new SortDescription("Content", ListSortDirection.Ascending);
  51.                 comboBoxProcesses.Items.SortDescriptions.Add(sd);
  52.             }
  53.            
  54.         }
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement