<UserControl x:Class="WowUp.WPF.Views.OptionsView"
             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:i="http://schemas.microsoft.com/xaml/behaviors"
             xmlns:local="clr-namespace:WowUp.WPF.Views"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800">

    <UserControl.Resources>
        <ResourceDictionary >
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Styles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <ScrollViewer VerticalScrollBarVisibility="Auto"
                  Background="{StaticResource Dark3}">
        <StackPanel MaxWidth="1024">
            <!--WOW SECTION-->
            <Label FontSize="17">World of Warcraft</Label>
            <Border Background="{StaticResource Dark4}" Padding="10">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <!--RE-SCAN-->
                    <Label Grid.Column="0" Grid.Row="0" FontWeight="Bold" HorizontalAlignment="Right" >Re-Scan</Label>
                    <StackPanel Grid.Column="1" Grid.Row="0" Margin="0 0 0 10">
                        <Button Command="{Binding RescanFoldersCommand}" Style="{StaticResource purpleButton}">Re-Scan World of Warcraft Clients</Button>
                        <Label>Scan your World of Warcraft install locations from the battle.net app.</Label>
                    </StackPanel>
                    <!--RETAIL LOCATION-->
                    <Label FontWeight="Bold" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Right">Retail</Label>
                    <Grid Grid.Column="1" Grid.Row="1" Margin="0 0 0 10">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <TextBox Grid.Column="0" Grid.Row="0" 
                                 Margin="0 0 10 0" Text="{Binding WowRetailLocation}" IsEnabled="False" FontSize="14"/>
                        <Button  Grid.Column="1" Grid.Row="0" 
                                 Margin="0" Command="{Binding SetRetailLocationCommand}" Style="{StaticResource purpleButton}">Select Location</Button>
                        <Label Grid.ColumnSpan="2" Grid.Column="0" Grid.Row="1" 
                               Margin="0" Padding="0" Foreground="{StaticResource White2Brush}" FontSize="13">The folder that contains the retail client folder __retail_</Label>
                    </Grid>
                    <!--RETAIL PTR LOCATION-->
                    <Label FontWeight="Bold" Grid.Column="0" Grid.Row="2" HorizontalAlignment="Right">Retail PTR</Label>
                    <Grid Grid.Column="1" Grid.Row="2" Margin="0 0 0 10">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <TextBox Grid.Column="0" Grid.Row="0" Margin="0 0 10 0" VerticalAlignment="Center" Text="{Binding WowRetailPtrLocation}" IsEnabled="False" FontSize="14"/>
                        <Button  Grid.Column="1" Grid.Row="0"  Command="{Binding SetRetailPtrLocationCommand}" Style="{StaticResource purpleButton}">Select Location</Button>
                        <Label Grid.ColumnSpan="2" Grid.Row="1" Margin="0" Padding="0" Foreground="{StaticResource White2Brush}" FontSize="13">The folder that contains the retail PTR client folder __ptr_</Label>
                    </Grid>
                    <!--CLASSIC LOCATION-->
                    <Label FontWeight="Bold" Grid.Column="0" Grid.Row="3" HorizontalAlignment="Right">Classic</Label>
                    <Grid Grid.Column="1" Grid.Row="3" Margin="0 0 0 10">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <TextBox Grid.Column="0" Grid.Row="0" Margin="0 0 10 0" VerticalAlignment="Center" Text="{Binding WowClassicLocation}" IsEnabled="False" FontSize="14"/>
                        <Button  Grid.Column="1" Grid.Row="0" Command="{Binding SetClassicLocationCommand}" Style="{StaticResource purpleButton}">Select Location</Button>
                        <Label Grid.ColumnSpan="2" Grid.Row="1" Margin="0" Padding="0" Foreground="{StaticResource White2Brush}" FontSize="13">The folder that contains the classic client folder __classic_</Label>
                    </Grid>
                    <!--CLASSIC PTR LOCATION-->
                    <Label FontWeight="Bold" Grid.Column="0" Grid.Row="4" HorizontalAlignment="Right">Classic PTR</Label>
                    <Grid Grid.Column="1" Grid.Row="4" Margin="0 0 0 10">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <TextBox Grid.Column="0" Grid.Row="0" Margin="0 0 10 0" VerticalAlignment="Center" Text="{Binding WowClassicPtrLocation}" IsEnabled="False" FontSize="14"/>
                        <Button  Grid.Column="1" Grid.Row="0" Command="{Binding SetClassicPtrLocationCommand}" Style="{StaticResource purpleButton}">Select Location</Button>
                        <Label Grid.ColumnSpan="2" Grid.Row="1" Margin="0" Padding="0" Foreground="{StaticResource White2Brush}" FontSize="13">The folder that contains the classic PTR client folder __classic_ptr_</Label>
                    </Grid>
                    <!--BETA LOCATION-->
                    <Label FontWeight="Bold" Grid.Column="0" Grid.Row="5" HorizontalAlignment="Right">Beta</Label>
                    <Grid Grid.Column="1" Grid.Row="5" Margin="0 0 0 10">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <TextBox Grid.Column="0" Grid.Row="0" Margin="0 0 10 0" VerticalAlignment="Center" Text="{Binding WowBetaLocation}" IsEnabled="False" FontSize="14"/>
                        <Label Grid.ColumnSpan="2" Grid.Row="1" Margin="0" Padding="0" Foreground="{StaticResource White2Brush}" FontSize="13">The folder that contains the beta client folder __beta_</Label>
                    </Grid>
                    <!--DEFAULT ADDON CHANNEL-->
                    <Label Grid.Column="0" Grid.Row="6" FontWeight="Bold" HorizontalAlignment="Right" >Default Addon Channel</Label>
                    <StackPanel Grid.Column="1" Grid.Row="6" Margin="0 0 0 10" Orientation="Horizontal">
                        <ComboBox x:Name="AddonChannelComboBox" 
                                              SelectedItem="{Binding SelectedAddonChannelType}"
                                              HorizontalAlignment="Left"
                                              Style="{StaticResource ComboBoxFlatStyle}"
                                              ItemsSource="{Binding AddonChannelNames}">
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="SelectionChanged">
                                    <i:InvokeCommandAction Command="{Binding AddonChannelChangeCommand}" 
                                                                       CommandParameter="{Binding ElementName=AddonChannelComboBox, Path=SelectedValue}"/>
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </ComboBox>
                        <TextBlock Padding="0" Margin="5 0 0 0" VerticalAlignment="Center">
                                        Newly installed addons will assume this release channel.
                        </TextBlock>
                    </StackPanel>
                </Grid>
            </Border>
            <!--APPLICATION SECTION-->
            <Label FontSize="17">Application</Label>
            <Border Background="{StaticResource Dark4}" Padding="10">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <!--RELEASE CHANNEL-->
                    <Label FontWeight="Bold" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right">WowUp Release Channel</Label>
                    <StackPanel Grid.Row="0" Grid.Column="1" Margin="0 5" Orientation="Horizontal">
                        <ComboBox x:Name="WowUpChannelComboBox" 
                                        SelectedItem="{Binding SelectedWowUpReleaseChannelType}"
                                        HorizontalAlignment="Left"
                                        Style="{StaticResource ComboBoxFlatStyle}"
                                        ItemsSource="{Binding WowUpChannelNames}">
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="SelectionChanged">
                                    <i:InvokeCommandAction Command="{Binding WowUpReleaseChannelChangedCommand}" 
                                                                CommandParameter="{Binding ElementName=WowUpChannelComboBox, Path=SelectedValue}"/>
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </ComboBox>
                        <TextBlock Padding="0" Margin="5 0 0 0" VerticalAlignment="Center">
                                Select Stable for a cleaner less buggy build. Select Beta to see the next wave of features as they come.
                        </TextBlock>
                    </StackPanel>
                    <!--TELEMETRY-->
                    <Label FontWeight="Bold" Grid.Row="1" Grid.Column="0" HorizontalAlignment="Right">Telemetry</Label>
                    <StackPanel Grid.Row="1" Grid.Column="1" Margin="0 5" Orientation="Horizontal">
                        <CheckBox IsChecked="{Binding IsTelemetryEnabled, Mode=TwoWay}"
                                          VerticalAlignment="Center"
                                      Command="{Binding TelemetryCheckCommand}" Grid.Row="0" Grid.Column="1">
                        </CheckBox>
                        <Label VerticalAlignment="Top">Help improve WowUp by sending anonymous install data and/or errors.</Label>
                    </StackPanel>
                    <!--MINIMIZE ON CLOSE-->
                    <Label FontWeight="Bold" Grid.Row="2" Grid.Column="0" HorizontalAlignment="Right">Minimize on close</Label>
                    <StackPanel Grid.Row="2" Grid.Column="1" Margin="0 5" Orientation="Horizontal">
                        <CheckBox IsChecked="{Binding CollapseToTrayEnabled, Mode=TwoWay}"
                                          VerticalAlignment="Center"
                                      Command="{Binding CollapseToTrayCheckCommand}" Grid.Row="0" Grid.Column="1">
                        </CheckBox>
                        <Label VerticalAlignment="Top">When closing the WowUp window, minimize to the system tray.</Label>
                    </StackPanel>
                </Grid>
            </Border>
            <!--DEBUG SECTION-->
            <Label FontSize="17">Debug</Label>
            <Border Background="{StaticResource Dark4}" Padding="10">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Label Grid.Column="0" Grid.Row="0" FontWeight="Bold" HorizontalAlignment="Right" >Log Files</Label>
                    <StackPanel Grid.Column="1" Grid.Row="0" Margin="0 0 0 10">
                        <Button Command="{Binding ShowLogsCommand}" 
                                        Style="{StaticResource purpleButton}">Show Log Files</Button>
                        <Label>Open the folder that contains your last couple of log files.</Label>
                    </StackPanel>
                    <Label Grid.Column="0" Grid.Row="1" FontWeight="Bold" HorizontalAlignment="Right" >Debug Data</Label>
                    <StackPanel Grid.Column="1" Grid.Row="1" Margin="0 0 0 10">
                        <Button Style="{StaticResource purpleButton}" Command="{Binding DumpDebugDataCommand}"
                                IsEnabled="{Binding IsBusy, Converter={StaticResource InverseBool}}">Dump Debug Data</Button>
                        <Label>Log debug data to help with diagnosing potential issues. This can be found in your latest log file for the curious.</Label>
                    </StackPanel>
                </Grid>
            </Border>
        </StackPanel>
    </ScrollViewer>
</UserControl>
