<UserControl x:Class="_1RM.View.Editor.Forms.VncFormView"
             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:controls="clr-namespace:Shawn.Utils.Wpf.Controls;assembly=Shawn.Utils.Wpf"
             xmlns:forms="clr-namespace:_1RM.View.Editor.Forms"
             xmlns:controls1="clr-namespace:_1RM.Controls"
             xmlns:s="https://github.com/canton7/Stylet"
             mc:Ignorable="d"
             d:DataContext="{d:DesignInstance forms:VncFormViewModel}"
             d:DesignHeight="1450" d:DesignWidth="800">
    <StackPanel>

        <StackPanel>

            <TextBlock Style="{StaticResource EditorGroupTextBlockTitle}" Text="{DynamicResource 'Connection Info'}"></TextBlock>

            <Grid Style="{StaticResource EditorRowGrid}">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Style="{StaticResource EditorRowGridTitle}" Text="{DynamicResource Hostname}"></TextBlock>
                    <Grid Style="{StaticResource EditorRowGridInput}">
                        <TextBox Text="{Binding New.Address, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True, ValidatesOnExceptions=True, ValidatesOnNotifyDataErrors=True}"
                                 Tag="e.g. 192.168.0.101"></TextBox>
                    </Grid>
                    <TextBlock Style="{StaticResource EditorRowGridTitleFollowing}" Width="60" Text="{DynamicResource Port}"></TextBlock>
                    <Grid Style="{StaticResource EditorRowGridInput}">
                        <TextBox MinWidth="50" Text="{Binding New.Port, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True, ValidatesOnExceptions=True, ValidatesOnNotifyDataErrors=True}"
                                 HorizontalAlignment="Left"
                                 InputMethod.IsInputMethodEnabled="False"
                                 InputScope="Number"
                        ></TextBox>
                    </Grid>
                </StackPanel>
            </Grid>

            <Grid Style="{StaticResource EditorRowGrid}">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Style="{StaticResource EditorRowGridTitle}" Text="{DynamicResource Password}"></TextBlock>
                    <Grid Style="{StaticResource EditorRowGridInput}">
                        <controls1:PasswordInput Height="28" Password="{Binding New.Password, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True, ValidatesOnExceptions=True, ValidatesOnNotifyDataErrors=True}"></controls1:PasswordInput>
                    </Grid>
                    <CheckBox Margin="5 0 0 0" Content="{DynamicResource 'Ask for password when open connect'}" IsChecked="{Binding New.AskPasswordWhenConnect}"></CheckBox>
                </StackPanel>
            </Grid>

            <ContentControl s:View.Model="{Binding AlternativeCredentialListViewModel}"></ContentControl>


            <Grid Style="{StaticResource EditorRowGrid}">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Style="{StaticResource EditorRowGridTitle}" Text="{DynamicResource Resolution}"></TextBlock>
                    <Grid Style="{StaticResource EditorRowGridInput}">
                        <Grid.Resources>
                            <forms:ConverterEVncWindowResizeMode x:Key="ConverterEVncWindowResizeMode" />
                        </Grid.Resources>
                        <ComboBox Name="ComboBoxResolution" SelectedIndex="{Binding New.VncWindowResizeMode, Converter={StaticResource ConverterEVncWindowResizeMode}}">
                            <ComboBoxItem Content="{DynamicResource 'Custom resolution (stretch)'}" />
                            <ComboBoxItem Content="{DynamicResource 'Custom resolution (fixed)'}" />
                            <ComboBoxItem Visibility="{Binding New.VncWindowResizeMode, Converter={StaticResource ConverterEqual2Visible}, ConverterParameter={x:Null}}" Content="{Binding New.ServerEditorDifferentOptions}" />
                        </ComboBox>
                    </Grid>
                </StackPanel>
            </Grid>

            <Grid Style="{StaticResource EditorRowGrid}">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Style="{StaticResource EditorRowGridTitle}" Text=""></TextBlock>
                    <Grid Style="{StaticResource EditorRowGridInput}">
                        <StackPanel>
                            <TextBlock Style="{StaticResource TextBlockBase}" TextWrapping="WrapWithOverflow" Foreground="{DynamicResource AccentMidBrush}">
                                <Run>Caution: RFB protocol over 3.8 are proprietary. If you would like using RFB 3.8+, you have to try your own VNC runner:</Run>
                                <Hyperlink NavigateUri="https://1remote.github.io/usage/protocol/runner/" TextDecorations="{x:Null}" controls:HyperlinkHelper.IsOpenExternal="True">
                                    [More details]
                                </Hyperlink>
                            </TextBlock>
                        </StackPanel>
                    </Grid>
                </StackPanel>
            </Grid>
        </StackPanel>
    </StackPanel>
</UserControl>