Files
OpenBullet/OpenBullet/Pages/Main/Stacker.xaml
T
2019-03-31 12:18:26 +02:00

319 lines
21 KiB
XML

<Page x:Class="OpenBullet.Stacker"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:OpenBullet"
xmlns:avalonEdit="http://icsharpcode.net/sharpdevelop/avalonedit"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="900"
Title="Stacker" KeyDown="Page_KeyDown">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<TabControl x:Name="stackerTabControl" Grid.Column="0" Background="Transparent" BorderThickness="0">
<TabControl.ItemContainerStyle>
<Style TargetType="{x:Type TabItem}">
<Setter Property="Visibility" Value="Collapsed"/>
</Style>
</TabControl.ItemContainerStyle>
<TabItem x:Name="codeTab">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="*"/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.ColumnSpan="2" Content="LoliScript Code" Foreground="{DynamicResource ForegroundToCheck}" FontFamily="pack://application:,,,/Fonts/#Century Gothic" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<avalonEdit:TextEditor Grid.Row="1" Grid.ColumnSpan="2" x:Name="loliScriptEditor"
FontFamily="Consolas"
FontSize="10pt" Foreground="Gainsboro" Background="#111" LostFocus="loliScriptEditor_LostFocus" HorizontalAlignment="Stretch" MaxHeight="{Binding ActualHeight, ElementName=dockParent}"/>
<Button x:Name="stackButton" Grid.Row="2" Click="stackButton_Click">
<StackPanel Orientation="Horizontal">
<Image Source="/Images/Icons/stack.png" Width="15" />
<TextBlock VerticalAlignment="Center" Margin="5 0">SWITCH TO STACK VIEW</TextBlock>
</StackPanel>
</Button>
<Button x:Name="openDocButton" Grid.Row="2" Grid.Column="1" Click="openDocButton_Click" >
<StackPanel Orientation="Horizontal">
<Image Source="/Images/Icons/book.png" Width="20" />
<TextBlock VerticalAlignment="Center" Margin="5 0">Documentation</TextBlock>
</StackPanel>
</Button>
</Grid>
</TabItem>
<TabItem x:Name="stackTab">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="*"/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="Current Stack" Foreground="{DynamicResource ForegroundToCheck}" FontFamily="pack://application:,,,/Fonts/#Century Gothic" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<Label Grid.Row="0" Grid.Column="1" Content="Block Info" Foreground="{DynamicResource ForegroundGood}" FontFamily="pack://application:,,,/Fonts/#Century Gothic" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<DockPanel Grid.Row="1" Grid.Column="1" Margin="5 0">
<Label DockPanel.Dock="Left" Content="Label:" VerticalAlignment="Center"/>
<TextBox IsEnabled="{Binding ControlsEnabled}" DockPanel.Dock="Left" x:Name="labelTextbox" TextChanged="labelTextbox_TextChanged"/>
</DockPanel>
<Grid Grid.Column="0" Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.Resources>
<Style TargetType="Image">
<Setter Property="Width" Value="20"/>
<Setter Property="Height" Value="20"/>
<Setter Property="Margin" Value="3 0"/>
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
</Grid.Resources>
<Image Grid.Column="0" IsEnabled="{Binding ControlsEnabled}" Source="/Images/Icons/plus.png" MouseDown="AddBlock_MouseDown" MouseEnter="Image_MouseEnter" MouseLeave="Image_MouseLeave" ToolTip="Add a new block"/>
<Image Grid.Column="1" IsEnabled="{Binding ControlsEnabled}" Source="/Images/Icons/minus.png" MouseDown="RemoveBlock_MouseDown" MouseEnter="Image_MouseEnter" MouseLeave="Image_MouseLeave" ToolTip="Remove the selected block(s)"/>
<Image Grid.Column="2" IsEnabled="{Binding ControlsEnabled}" Source="/Images/Icons/disable.png" MouseDown="DisableBlock_MouseDown" MouseEnter="Image_MouseEnter" MouseLeave="Image_MouseLeave" ToolTip="Disable / Enable the selected block(s)"/>
<Image Grid.Column="3" IsEnabled="{Binding ControlsEnabled}" Source="/Images/Icons/clone.png" MouseDown="CloneBlock_MouseDown" MouseEnter="Image_MouseEnter" MouseLeave="Image_MouseLeave" ToolTip="Clone the selected block(s)"/>
<Image Grid.Column="4" IsEnabled="{Binding ControlsEnabled}" Source="/Images/Icons/up.png" MouseDown="MoveUpBlock_MouseDown" MouseEnter="Image_MouseEnter" MouseLeave="Image_MouseLeave" ToolTip="Move the selected block(s) up"/>
<Image Grid.Column="5" IsEnabled="{Binding ControlsEnabled}" Source="/Images/Icons/down.png" MouseDown="MoveDownBlock_MouseDown" MouseEnter="Image_MouseEnter" MouseLeave="Image_MouseLeave" ToolTip="Move the selected block(s) down"/>
<Image Grid.Column="6" IsEnabled="{Binding ControlsEnabled}" Source="/Images/Icons/save.png" MouseDown="SaveConfig_MouseDown" MouseEnter="Image_MouseEnter" MouseLeave="Image_MouseLeave" ToolTip="Save the config"/>
</Grid>
<ScrollViewer Grid.Row="3" Grid.Column="0" VerticalScrollBarVisibility="auto">
<ListBox x:Name="stackListView" ItemsSource="{Binding Stack}" SelectedItem="{Binding SelectedItem}" Background="Transparent">
<ListBox.ItemContainerStyle>
<!-- Style to get rid of the selection visual -->
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<ContentPresenter />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<ToggleButton Tag="{Binding Id}" IsEnabled="{Binding ControlsEnabled}"
Content="{Binding Block.Label}" FontFamily="pack://application:,,,/Fonts/#Century Gothic"
FontWeight="Regular" Height="{Binding Height}" FontSize="{Binding FontSize}"
Foreground="{Binding Foreground}" Click="blockClicked">
<ToggleButton.Style>
<Style TargetType="{x:Type ToggleButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border BorderBrush="{Binding BorderColor}"
Background="{Binding Color}" BorderThickness="2">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Background" Value="{Binding Color}" />
</Trigger>
</Style.Triggers>
</Style>
</ToggleButton.Style>
<!-- Binding IsChecked to IsSelected requires no support code -->
<ToggleButton.IsChecked>
<Binding Path="IsSelected"
RelativeSource="{RelativeSource AncestorType=ListBoxItem}"
Mode="TwoWay" />
</ToggleButton.IsChecked>
</ToggleButton>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</ScrollViewer>
<ScrollViewer Grid.Column="1" Grid.Row="3" Grid.RowSpan="2" Margin="10 0">
<Frame x:Name="BlockInfo"/>
</ScrollViewer>
<Button x:Name="loliScriptButton" Grid.Row="4" Click="loliScriptButton_Click">
<StackPanel Orientation="Horizontal">
<Image Source="/Images/Icons/code.png" Width="20" />
<TextBlock VerticalAlignment="Center" Margin="5 0">SWITCH TO LOLISCRIPT</TextBlock>
</StackPanel>
</Button>
</Grid>
</TabItem>
</TabControl>
<!-- DEBUGGER -->
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Content="Debugger" Foreground="{DynamicResource ForegroundCustom}" FontFamily="pack://application:,,,/Fonts/#Century Gothic" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<DockPanel Grid.Row="1" Margin="5 0">
<Button DockPanel.Dock="Left" x:Name="startDebuggerButton" Content="Start" Click="startDebuggerButton_Click" ToolTip="Start the Debugger"/>
<CheckBox DockPanel.Dock="Left" IsEnabled="{Binding ControlsEnabled}" Content="SBS" IsChecked="{Binding SBS}" VerticalContentAlignment="Center" ToolTip="Step By Step"/>
<Button DockPanel.Dock="Left" IsEnabled="{Binding SBSEnabled}" x:Name="nextStepButton" Content="Step" Click="nextStepButton_Click" Margin="5 0 0 0" ToolTip="Take another Step"/>
<Label DockPanel.Dock="Left" Content="Data:" VerticalAlignment="Center"/>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0" IsEnabled="{Binding ControlsEnabled}" DockPanel.Dock="Left" Text="{Binding TestData}" />
<ComboBox x:Name="testDataTypeCombobox" Grid.Column="1" IsEnabled="{Binding ControlsEnabled}" Text="{Binding TestDataType}" DockPanel.Dock="Left" SelectionChanged="testDataTypeCombobox_SelectionChanged" />
</Grid>
</DockPanel>
<DockPanel Grid.Row="2" Margin="5 0">
<Label DockPanel.Dock="Left" Content="Proxy:" VerticalAlignment="Center"/>
<CheckBox DockPanel.Dock="Left" IsEnabled="{Binding ControlsEnabled}" VerticalContentAlignment="Center" IsChecked="{Binding UseProxy}" ToolTip="Enable/Disable the Proxy" Content="{Binding UseProxyString}" Margin="2 0 5 0" Foreground="{Binding UseProxyColor}" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0" IsEnabled="{Binding ControlsEnabled}" Text="{Binding TestProxy}">
<TextBox.ToolTip>
<TextBlock>In order to use Auth or Chain, start the line with the proxy type between round brackets.<LineBreak/>Auth:<LineBreak/>(http)127.0.0.1:8888:username:password<LineBreak/>Chain:<LineBreak/>(socks4)127.0.0.1:8000->(http)127.0.0.1:8888</TextBlock>
</TextBox.ToolTip>
</TextBox>
<ComboBox Grid.Column="1" IsEnabled="{Binding ControlsEnabled}" x:Name="proxyTypeCombobox" SelectionChanged="proxyTypeCombobox_SelectionChanged" />
</Grid>
</DockPanel>
<TabControl x:Name="debuggerTabControl" Grid.Row="3">
<TabControl.Resources>
<Style TargetType="TabItem">
<Setter Property="Background" Value="{DynamicResource BackgroundMain}"/>
<Setter Property="Foreground" Value="{DynamicResource ForegroundMain}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}">
<Grid>
<Border
Name="Border"
Margin="0,0,-4,0"
Background="{DynamicResource BackgroundMain}"
BorderBrush="{DynamicResource ForegroundMain}"
BorderThickness="1,1,1,1"
CornerRadius="2,12,0,0" >
<ContentPresenter x:Name="ContentSite"
VerticalAlignment="Center"
HorizontalAlignment="Center"
ContentSource="Header"
Margin="12,2,12,2"
RecognizesAccessKey="True"/>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Panel.ZIndex" Value="100" />
<Setter TargetName="Border" Property="Background" Value="{DynamicResource BackgroundSecondary}" />
<Setter TargetName="Border" Property="BorderThickness" Value="1,1,1,0" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource BackgroundMain}" />
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ForegroundMain}" />
<Setter Property="Foreground" Value="{DynamicResource ForegroundMain}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="TabPanel">
<Setter Property="Background" Value="{DynamicResource BackgroundMain}"/>
</Style>
</TabControl.Resources>
<TabItem Header="Data">
<RichTextBox x:Name="dataRTB" FontSize="14" FontFamily="Consolas" IsReadOnly="True" Background="#111" VerticalScrollBarVisibility="Visible" >
<RichTextBox.Resources>
<Style TargetType="{x:Type Paragraph}">
<Setter Property="Margin" Value="0"/>
</Style>
</RichTextBox.Resources>
</RichTextBox>
</TabItem>
<TabItem Header="Log">
<Grid Background="{DynamicResource BackgroundMain}" x:Name="logGrid">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<WindowsFormsHost Grid.Row="0">
<wf:RichTextBox x:Name="logRTB" Dock="Fill" ForeColor="Gainsboro" BackColor="Black" ReadOnly="True" ScrollBars="Vertical" BorderStyle="None" DetectUrls="False"/>
</WindowsFormsHost>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Content="Search:" VerticalAlignment="Center"/>
<TextBox Grid.Column="1" Text="{Binding SearchString}"/>
<Button Grid.Column="2" x:Name="searchButton" Content="Go" Click="searchButton_Click" />
<Image Grid.Column="3" x:Name="previousMatchButton" Source="/Images/Icons/left.png" Margin="5 0" Width="20" Height="20" MouseDown="previousMatchButton_MouseDown" />
<Label Grid.Column="4" Content="{Binding CurrentSearchMatch}"/>
<Label Grid.Column="5" Content="of"/>
<Label Grid.Column="6" Content="{Binding TotalSearchMatches}"/>
<Image Grid.Column="7" x:Name="nextMatchButton" Source="/Images/Icons/right.png" Margin="5 0" Width="20" Height="20" MouseDown="nextMatchButton_MouseDown" />
</Grid>
</Grid>
</TabItem>
<TabItem Header="HTML View">
<WindowsFormsHost>
<wf:WebBrowser x:Name="htmlViewBrowser" ScriptErrorsSuppressed="True"/>
</WindowsFormsHost>
</TabItem>
</TabControl>
</Grid>
</Grid>
</Page>