<Window  x:Class="ScratchNet.MainWindow"
        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"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:ScratchNet"
        xmlns:editor="clr-namespace:ScratchNet;assembly=ScriptEditor"
        xmlns:fc="http://schemas.fontawesome.io/icons/"
        xmlns:loc="clr-namespace:ScratchNet.Properties;assembly=VisualCodeEditor"
        mc:Ignorable="d" WindowState="Maximized"
        Title="{x:Static loc:Resources.VisualCodeEditor}" Height="450" Width="800">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Row="0" Orientation="Horizontal">
            <Button Margin="5" Grid.Column="2" Click="OnNew" Name="ButtonNew" ToolTip="{x:Static loc:Resources.CreateNew}" Focusable="True" Width="24">
                <Button.Template>
                    <ControlTemplate>
                        <fc:FontAwesome x:Name="Icon" Icon="FileCodeOutline" Foreground="DarkBlue" FontSize="24" VerticalAlignment="Center"/>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="Icon" Property="Foreground" Value="Green"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Button.Template>
            </Button>
            <Button Margin="5" Grid.Column="2" Click="OnOpen" Name="ButtonOpen" IsEnabled="True" ToolTip="{x:Static loc:Resources.Open}" Width="24">
                <Button.Template>
                    <ControlTemplate>
                        <fc:FontAwesome x:Name="Icon" Icon="FolderOutlinepenOutline" Foreground="DarkBlue" FontSize="24" VerticalAlignment="Center"/>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="Icon" Property="Foreground" Value="Green"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Button.Template>
            </Button>
            <Button Margin="5" Grid.Column="2" Click="OnSave" Name="ButtonSave" IsEnabled="False" ToolTip="{x:Static loc:Resources.Save}" Width="24">
                <Button.Template>
                    <ControlTemplate>
                        <fc:FontAwesome x:Name="Icon" Icon="Save" Foreground="DarkBlue" FontSize="24" VerticalAlignment="Center"/>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="Icon" Property="Foreground" Value="Green"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Button.Template>
            </Button>
            <Button Margin="5" Grid.Column="2" Name="ButtonSaveAs" IsEnabled="False" ToolTip="{x:Static loc:Resources.SaveAs}" Width="24" Click="OnSaveAs">
                <Button.Template>
                    <ControlTemplate>
                        <fc:FontAwesome x:Name="Icon" Icon="Archive" Foreground="DarkBlue" FontSize="24" VerticalAlignment="Center"/>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="Icon" Property="Foreground" Value="Green"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Button.Template>
            </Button>
            <Button Margin="5" Grid.Column="2" Name="ButtonPrint" IsEnabled="False" ToolTip="{x:Static loc:Resources.Print}" Width="24" Visibility="Collapsed" Click="OnPrint">
                <Button.Template>
                    <ControlTemplate>
                        <fc:FontAwesome x:Name="Icon" Icon="Print" Foreground="DarkBlue" FontSize="24" VerticalAlignment="Center"/>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="Icon" Property="Foreground" Value="Green"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Button.Template>
            </Button>
            <Separator  Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}"/>
            <Button Margin="5" Grid.Column="2" Name="ButtonCopy" IsEnabled="{Binding ElementName=Editor, Path=IsCopyEnabled}" ToolTip="{x:Static loc:Resources.Copy}" Width="24" Click="OnCopy">
                <Button.Template>
                    <ControlTemplate>
                        <fc:FontAwesome x:Name="Icon" Icon="Copy" Foreground="DarkBlue" FontSize="24" VerticalAlignment="Center"/>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="Icon" Property="Foreground" Value="Green"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Button.Template>
            </Button>
            <Button Margin="5" Grid.Column="2" Name="ButtonPaste" IsEnabled="{Binding ElementName=Editor, Path=IsPasteEnabled}" ToolTip="{x:Static loc:Resources.Paste}" Width="24" Click="OnPaste">
                <Button.Template>
                    <ControlTemplate>
                        <fc:FontAwesome x:Name="Icon" Icon="Paste" Foreground="DarkBlue" FontSize="24" VerticalAlignment="Center"/>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="Icon" Property="Foreground" Value="Green"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Button.Template>
            </Button>
            <Separator  Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}"/>
            <Button Margin="5" Grid.Column="2" Click="OnStartRun" Name="ButtonStart" IsEnabled="False" ToolTip="{x:Static loc:Resources.Run}" Width="24">
                <Button.Template>
                    <ControlTemplate>
                        <fc:FontAwesome x:Name="Icon" Icon="Play" Foreground="Green" FontSize="24" VerticalAlignment="Center"/>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="Icon" Property="Foreground" Value="DarkBlue"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Button.Template>
            </Button>
            <Button Margin="5" Grid.Column="3" Click="OnStopRun" Name="ButtonStop" IsEnabled="False" Visibility="Visible" ToolTip="{x:Static loc:Resources.Stop}">
                <Button.Template>
                    <ControlTemplate TargetType="Button">
                        <fc:FontAwesome x:Name="Icon" Icon="Stop" Foreground="Red" FontSize="24" VerticalAlignment="Center"/>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="Icon" Property="Foreground" Value="DarkBlue"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Button.Template>
            </Button>
            <Button Margin="5" Grid.Column="3" Click="OnClearError" IsEnabled="False" Name="ButtonClearError" Visibility="Visible" ToolTip="{x:Static loc:Resources.ClearError}" Width="24">
                <Button.Template>
                    <ControlTemplate TargetType="Button">
                        <fc:FontAwesome x:Name="Icon" Icon="Remove" Spin="True" Foreground="Red" FontSize="24" VerticalAlignment="Center"/>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
                                <Setter TargetName="Icon" Property="Spin" Value="False"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Button.Template>
            </Button>
            <ToggleButton Name="ButtonHighligh" ToolTip="{x:Static loc:Resources.Highlight}" IsChecked="False" Width="24"
                          Click="OnHighlightClicked">
                <ToggleButton.Template>
                    <ControlTemplate TargetType="ToggleButton">
                        <fc:FontAwesome x:Name="Icon" Icon="Flag" Foreground="DarkBlue" FontSize="24" VerticalAlignment="Center"/>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
                            </Trigger>
                            <Trigger Property="IsChecked" Value="True">
                                <Setter TargetName="Icon" Property="Foreground" Value="Green"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </ToggleButton.Template>
            </ToggleButton>
            <Slider ToolTip="{x:Static loc:Resources.Speed}" Minimum="0" Maximum="100" Margin="15, 0" Value="20" Name="SliderSpeeder"
                    Width="150" VerticalAlignment="Center" ValueChanged="OnSpeedValueChanged"/>
        </StackPanel>
        <StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Right">
            <Button Margin="5" Grid.Column="2" ToolTip="{x:Static loc:Resources.LanguageTooltip}" Name="ButtonLanguage" Focusable="True" Width="24" Click="OnLanguage">
                <Button.Template>
                    <ControlTemplate>
                        <fc:FontAwesome x:Name="Icon" Icon="Language" Foreground="DarkBlue" FontSize="24" VerticalAlignment="Center"/>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="Icon" Property="Foreground" Value="Green"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Button.Template>
                <Button.ContextMenu>
                    <ContextMenu Name="LanguageMenu">
                        <MenuItem Header="{x:Static loc:Resources.English}" Name="EnglishCommand">
                            <MenuItem.Icon>
                                <fc:FontAwesome Icon="Copy"/>
                            </MenuItem.Icon>
                        </MenuItem>
                        <MenuItem Header="{x:Static loc:Resources.Chinese}" Name="ChineseCommand" >
                            <MenuItem.Icon>
                                <fc:FontAwesome Icon="Paste"/>
                            </MenuItem.Icon>
                        </MenuItem>
                    </ContextMenu>
                </Button.ContextMenu>
            </Button>
            <Button Margin="5" Grid.Column="2" Name="ButtonExample" ToolTip="{x:Static loc:Resources.Example}" Focusable="True" Width="24" Click="OnExample">
                <Button.Template>
                    <ControlTemplate>
                        <fc:FontAwesome x:Name="Icon" Icon="MapSigns" Foreground="DarkBlue" FontSize="24" VerticalAlignment="Center"/>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="Icon" Property="Foreground" Value="Green"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Button.Template>
            </Button>
            <Button Margin="5" Grid.Column="2" Name="ButtonSetting" ToolTip="{x:Static loc:Resources.Setting}" Visibility="Collapsed" Focusable="True" Width="24" Click="OnSetting">
                <Button.Template>
                    <ControlTemplate>
                        <fc:FontAwesome x:Name="Icon" Icon="Gear" Foreground="DarkBlue" FontSize="24" VerticalAlignment="Center"/>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="Icon" Property="Foreground" Value="Green"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Button.Template>
            </Button>
            <Button Margin="5" Grid.Column="2" ToolTip="{x:Static loc:Resources.Help}" Focusable="True" Width="24" Click="OnHelp" >
                <Button.Template>
                    <ControlTemplate>
                        <fc:FontAwesome x:Name="Icon" Icon="QuestionCircleOutline" Foreground="DarkBlue" FontSize="24" VerticalAlignment="Center"/>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="Icon" Property="Foreground" Value="Green"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Button.Template>
            </Button>
            <Button Margin="5" Grid.Column="2" Name="ButtonAbout" ToolTip="{x:Static loc:Resources.About}" Focusable="True" Width="24" Click="OnAbout">
                <Button.Template>
                    <ControlTemplate>
                        <fc:FontAwesome x:Name="Icon" Icon="InfoCircle" Foreground="DarkBlue" FontSize="24" VerticalAlignment="Center"/>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="Icon" Property="Foreground" Value="Green"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Button.Template>
            </Button>
        </StackPanel>
        <editor:GraphicScriptEditor Grid.Row="1" Grid.ColumnSpan="2" Name="Editor"/>
    </Grid>
</Window>
