<ui:ObservableWindow
	x:Class="TestConsole.MainWindow"
	x:Name="mainWindow"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:local="clr-namespace:TestConsole"
	xmlns:api="https://schemas.bytecode77.com/2019/xaml/api"
	xmlns:ui="https://schemas.bytecode77.com/2019/xaml/presentation"
	DataContext="{Binding ViewModel, ElementName=mainWindow}"
	Title="r77 Test Console" Width="870" Height="800" MinWidth="550" MinHeight="650" WindowStartupLocation="CenterScreen" ResizeMode="CanResizeWithGrip" UseLayoutRounding="True" LoadedOnce="MainWindow_LoadedOnce">
	<Grid>
		<DockPanel>
			<DockPanel.Effect>
				<BlurEffect Radius="{Binding IsAboutVisible, Converter={ui:IfConverter {ui:Double 20.0}, {ui:Double 0.0}}}" KernelType="Gaussian" />
			</DockPanel.Effect>
			<Menu DockPanel.Dock="Top">
				<MenuItem Header="_File">
					<MenuItem Header="Run as _administrator" ui:MenuItemService.ImageSource="/TestConsole;component/Resources/Uac16.png" Command="{Binding ElevateCommand}" />
				</MenuItem>
				<MenuItem Header="_Run">
					<MenuItem Header="$77-_Example.exe" ui:MenuItemService.ImageSource="/TestConsole;component/Resources/Example16.png" Command="{Binding RunCommand}" CommandParameter="Example" />
					<Separator />
					<MenuItem Header="Install.exe" ui:MenuItemService.ImageSource="/TestConsole;component/Resources/ExeUac16.png" Command="{Binding RunCommand}" CommandParameter="Install" />
					<MenuItem Header="Uninstall.exe" ui:MenuItemService.ImageSource="/TestConsole;component/Resources/ExeUac16.png" Command="{Binding RunCommand}" CommandParameter="Uninstall" />
				</MenuItem>
				<MenuItem Header="_Processes">
					<MenuItem Header="_Inject All" Command="{Binding InjectAllCommand}" />
					<MenuItem Header="_Detach All" Command="{Binding DetachAllCommand}" />
				</MenuItem>
				<MenuItem Header="_Help">
					<MenuItem Header="Technical _Documentation" ui:MenuItemService.ImageSource="/TestConsole;component/Resources/Pdf16.png" Command="{Binding HelpCommand}" CommandParameter="Documentation" />
					<Separator />
					<MenuItem Header="_About" ui:MenuItemService.ImageSource="/TestConsole;component/Resources/Information16.png" Command="{Binding HelpCommand}" CommandParameter="About" />
				</MenuItem>
			</Menu>
			<StatusBar DockPanel.Dock="Bottom">
				<StatusBarItem>
					<TextBlock Text="Version ">
						<Run Text="{Binding Source={x:Static api:ApplicationBase.Version}, Mode=OneWay, Converter={ui:VersionConverter 3}}" />
					</TextBlock>
				</StatusBarItem>
				<Separator />
				<StatusBarItem Visibility="{Binding Source={x:Static api:ApplicationBase+Process.IsElevated}, Converter={ui:BooleanConverter VisibilityInverse}}">
					<DockPanel>
						<Image Source="/TestConsole;component/Resources/Uac16.png" Stretch="None" Margin="0,0,5,0" IsEnabled="False" />
						<TextBlock Text="Not elevated" />
					</DockPanel>
				</StatusBarItem>
				<StatusBarItem Visibility="{Binding Source={x:Static api:ApplicationBase+Process.IsElevated}, Converter={ui:BooleanConverter Visibility}}">
					<DockPanel>
						<Image Source="/TestConsole;component/Resources/Uac16.png" Stretch="None" Margin="0,0,5,0" />
						<TextBlock Text="Elevated" />
					</DockPanel>
				</StatusBarItem>
			</StatusBar>
			<Grid>
				<Grid.RowDefinitions>
					<RowDefinition Height="*" MinHeight="100" />
					<RowDefinition Height="10" />
					<RowDefinition Height="200" MinHeight="100" />
				</Grid.RowDefinitions>
				<GridSplitter Grid.Row="1" />
				<ListView Name="lstProcesses" BorderThickness="0" ItemsSource="{Binding Processes}" SelectedItem="{Binding SelectedProcess}" TextSearch.TextPath="Name">
					<ListView.Resources>
						<Style TargetType="{x:Type GridViewColumnHeader}">
							<Setter Property="Padding" Value="6,3" />
							<Setter Property="HorizontalContentAlignment" Value="Left" />
						</Style>
						<Style TargetType="{x:Type TextBlock}">
							<Setter Property="TextTrimming" Value="CharacterEllipsis" />
						</Style>
					</ListView.Resources>
					<ListView.View>
						<GridView>
							<GridViewColumn Header="Process" Width="200">
								<GridViewColumn.CellTemplate>
									<DataTemplate>
										<DockPanel>
											<Image Source="{Binding Icon, Converter={ui:ImageSourceConverter}}" Width="16" Height="16" Margin="0,0,5,0" />
											<TextBlock Text="{Binding Name}" TextTrimming="CharacterEllipsis" />
										</DockPanel>
									</DataTemplate>
								</GridViewColumn.CellTemplate>
							</GridViewColumn>
							<GridViewColumn Header="PID" Width="60" DisplayMemberBinding="{Binding Id}" />
							<GridViewColumn Header="Platform" Width="60">
								<GridViewColumn.CellTemplate>
									<DataTemplate>
										<Grid>
											<TextBlock Text="32" TextTrimming="CharacterEllipsis" Visibility="{Binding Is64Bit, Converter={ui:EqualityConverter Equal, Visibility}, ConverterParameter={ui:Boolean False}}" />
											<TextBlock Text="64" TextTrimming="CharacterEllipsis" Visibility="{Binding Is64Bit, Converter={ui:EqualityConverter Equal, Visibility}, ConverterParameter={ui:Boolean True}}" />
										</Grid>
									</DataTemplate>
								</GridViewColumn.CellTemplate>
							</GridViewColumn>
							<GridViewColumn Header="Integrity" Width="80" DisplayMemberBinding="{Binding IntegrityLevel}" />
							<GridViewColumn Header="User" Width="120" DisplayMemberBinding="{Binding User}" />
							<GridViewColumn Header="Flags" Width="60">
								<GridViewColumn.CellTemplate>
									<DataTemplate>
										<StackPanel Orientation="Horizontal">
											<Image Source="/TestConsole;component/Resources/R77Service16.png" Margin="0,0,5,0" Visibility="{Binding IsR77Service, Converter={ui:BooleanConverter Visibility}}" ToolTip="r77 Service Process" />
											<Image Source="/TestConsole;component/Resources/R77Helper16.png" Margin="0,0,5,0" Visibility="{Binding IsHelper, Converter={ui:BooleanConverter Visibility}}" ToolTip="r77 Helper Process" />
											<Image Source="/TestConsole;component/Resources/Hidden16.png" Margin="0,0,5,0" Visibility="{Binding IsHiddenById, Converter={ui:BooleanConverter Visibility}}" ToolTip="Process is hidden by ID" />
										</StackPanel>
									</DataTemplate>
								</GridViewColumn.CellTemplate>
							</GridViewColumn>
							<GridViewColumn Header="Inject" Width="80">
								<GridViewColumn.CellTemplate>
									<DataTemplate>
										<Grid Visibility="{Binding CanInject, Converter={ui:BooleanConverter Visibility}}">
											<DockPanel Visibility="{Binding IsInjected, Converter={ui:BooleanConverter VisibilityInverse}}">
												<Image Source="/TestConsole;component/Resources/DllInject16.png" Width="16" Height="16" Margin="0,0,5,0" />
												<TextBlock TextTrimming="CharacterEllipsis"><Hyperlink PreviewMouseLeftButtonDown="lnkInject_PreviewMouseLeftButtonDown">Inject</Hyperlink></TextBlock>
											</DockPanel>
											<DockPanel Visibility="{Binding IsInjected, Converter={ui:BooleanConverter Visibility}}">
												<Image Source="/TestConsole;component/Resources/DllInjected16.png" Width="16" Height="16" Margin="0,0,5,0" />
												<TextBlock Text="Injected" TextTrimming="CharacterEllipsis" Foreground="#00a305" />
											</DockPanel>
										</Grid>
									</DataTemplate>
								</GridViewColumn.CellTemplate>
							</GridViewColumn>
							<GridViewColumn Header="Detach" Width="80">
								<GridViewColumn.CellTemplate>
									<DataTemplate>
										<DockPanel Visibility="{Binding IsInjected, Converter={ui:BooleanConverter Visibility}}">
											<Image Source="/TestConsole;component/Resources/DllDetach16.png" Width="16" Height="16" Margin="0,0,5,0" />
											<TextBlock TextTrimming="CharacterEllipsis"><Hyperlink PreviewMouseLeftButtonDown="lnkDetach_PreviewMouseLeftButtonDown">Detach</Hyperlink></TextBlock>
										</DockPanel>
									</DataTemplate>
								</GridViewColumn.CellTemplate>
							</GridViewColumn>
							<GridViewColumn Header="Hide by PID" Width="80">
								<GridViewColumn.CellTemplate>
									<DataTemplate>
										<Grid>
											<DockPanel Visibility="{Binding IsHiddenById, Converter={ui:BooleanConverter VisibilityInverse}}">
												<Image Source="/TestConsole;component/Resources/Unhidden16.png" Width="16" Height="16" Margin="0,0,5,0" />
												<TextBlock TextTrimming="CharacterEllipsis" ToolTip="Click to hide process by ID"><Hyperlink PreviewMouseLeftButtonDown="lnkHide_PreviewMouseLeftButtonDown">Hide</Hyperlink></TextBlock>
											</DockPanel>
											<DockPanel Visibility="{Binding IsHiddenById, Converter={ui:BooleanConverter Visibility}}">
												<Image Source="/TestConsole;component/Resources/Hidden16.png" Width="16" Height="16" Margin="0,0,5,0" />
												<TextBlock TextTrimming="CharacterEllipsis" ToolTip="Click to mark process as not hidden"><Hyperlink PreviewMouseLeftButtonDown="lnkUnhide_PreviewMouseLeftButtonDown">Unhide</Hyperlink></TextBlock>
											</DockPanel>
										</Grid>
									</DataTemplate>
								</GridViewColumn.CellTemplate>
							</GridViewColumn>
						</GridView>
					</ListView.View>
				</ListView>
				<RichTextBox Grid.Row="2" Name="txtLog" IsReadOnly="True" IsReadOnlyCaretVisible="True" FontFamily="Consolas" BorderThickness="0,1,0,0" BorderBrush="#30000000" Background="White" ScrollViewer.VerticalScrollBarVisibility="Visible">
					<RichTextBox.Resources>
						<Style TargetType="{x:Type Paragraph}">
							<Setter Property="Margin" Value="0,0,0,2" />
						</Style>
					</RichTextBox.Resources>
				</RichTextBox>
			</Grid>
		</DockPanel>
		<Grid Visibility="{Binding IsAboutVisible, Converter={ui:BooleanConverter Visibility}}">
			<local:AboutPopup />
		</Grid>
	</Grid>
</ui:ObservableWindow>