Skip to content

Instantly share code, notes, and snippets.

@factormystic
Forked from Ell/form.cs
Last active October 31, 2015 00:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save factormystic/d6717d78efa0a226529e to your computer and use it in GitHub Desktop.
Save factormystic/d6717d78efa0a226529e to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace tosproxy
{
/// <summary>
/// Interaction logic for ProcessChooser.xaml
/// </summary>
public partial class ProcessChooser : Window
{
public List<Process> ProcessList {get; private set;}
public ProcessChooser()
{
GetProcessList();
this.DataContext = this;
InitializeComponent();
}
private void GetProcessList()
{
ProcessList = Process.GetProcesses().ToList();
Trace.WriteLine("PROCESS LIST:\n");
Trace.WriteLine(ProcessList.First().Id);
}
}
}
<Window x:Class="tosproxy.ProcessChooser"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:tosproxy"
xmlns:diagnostics="clr-namespace:System.Diagnostics;assembly=System"
Title="ProcessChooser" Height="300" Width="300">
<Grid>
<DataGrid x:Name="ProcessListView" VerticalAlignment="Top" ItemsSource="{Binding ProcessList}"
AutoGenerateColumns="False" CanUserResizeColumns="True">
<DataGrid.Columns>
<DataGridTextColumn Width="40" Header="PID" Binding="{Binding Id}" />
<DataGridTextColumn Width="*" Header="Name" Binding="{Binding ProcessName}" />
</DataGrid.Columns>
</DataGrid>
</Grid>
</Window>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment