MOD: Frontend SearchWindow
This commit is contained in:
		@@ -1,126 +1,153 @@
 | 
			
		||||
<mah:MetroWindow xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
 | 
			
		||||
                   x:Class="PrototypWPFHAG.SearchWindow"
 | 
			
		||||
                   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 | 
			
		||||
                   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 | 
			
		||||
                   xmlns:local="clr-namespace:PrototypWPFHAG"
 | 
			
		||||
                   Title="PDF-Verwaltung (Admin)" Height="600" Width="1000"
 | 
			
		||||
                   WindowTitleBrush="FireBrick"
 | 
			
		||||
                   Icon="pack://application:,,,/Images/databaseicon.png"
 | 
			
		||||
                   ResizeMode="CanResizeWithGrip">
 | 
			
		||||
    <!-- Gesamt‑Layout: Zwei Spalten – linke Seite (jetzt 600px) und rechte Seite (flexibel) -->
 | 
			
		||||
    <Border BorderBrush="FireBrick" BorderThickness="3" Padding="0">
 | 
			
		||||
                 x:Class="PrototypWPFHAG.SearchWindow"
 | 
			
		||||
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 | 
			
		||||
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 | 
			
		||||
                 xmlns:local="clr-namespace:PrototypWPFHAG"
 | 
			
		||||
                 Title="PDF-Verwaltung (Admin)" 
 | 
			
		||||
                 Height="600" Width="1000"
 | 
			
		||||
                 MinWidth="800" MinHeight="500"
 | 
			
		||||
                 WindowTitleBrush="FireBrick"
 | 
			
		||||
                 Icon="pack://application:,,,/Images/databaseicon.png"
 | 
			
		||||
                 ResizeMode="CanResizeWithGrip"
 | 
			
		||||
                 WindowStartupLocation="CenterScreen">
 | 
			
		||||
 | 
			
		||||
    <Border BorderBrush="FireBrick" BorderThickness="3">
 | 
			
		||||
        <Grid>
 | 
			
		||||
            <Grid.ColumnDefinitions>
 | 
			
		||||
                <!-- Breitere linke Seite: -->
 | 
			
		||||
                <ColumnDefinition Width="500"/>
 | 
			
		||||
                <ColumnDefinition Width="500" MinWidth="400"/>
 | 
			
		||||
                <ColumnDefinition Width="*"/>
 | 
			
		||||
            </Grid.ColumnDefinitions>
 | 
			
		||||
            <Grid.RowDefinitions>
 | 
			
		||||
                <RowDefinition Height="*"/>
 | 
			
		||||
            </Grid.RowDefinitions>
 | 
			
		||||
 | 
			
		||||
            <!-- Linke Seite -->
 | 
			
		||||
            <Border Grid.Column="0" Margin="10,10,0,10" Padding="20">
 | 
			
		||||
                <!-- Untergliederung: zwei Spalten (links: Upload/Steuerelemente, rechts: Suchergebnisse) -->
 | 
			
		||||
            <Border Grid.Column="0" Margin="10" Padding="10">
 | 
			
		||||
                <Grid>
 | 
			
		||||
                    <Grid.ColumnDefinitions>
 | 
			
		||||
                        <ColumnDefinition Width="250"/>
 | 
			
		||||
                        <ColumnDefinition Width="*"/>
 | 
			
		||||
                    </Grid.ColumnDefinitions>
 | 
			
		||||
                    <Grid.RowDefinitions>
 | 
			
		||||
                        <!-- Upload-/Such‑Steuerelemente in mehreren Zeilen -->
 | 
			
		||||
                        <RowDefinition Height="Auto"/>
 | 
			
		||||
                        <!-- Drag & Drop -->
 | 
			
		||||
                        <RowDefinition Height="Auto"/>
 | 
			
		||||
                        <!-- Upload-Button -->
 | 
			
		||||
                        <!-- Upload/Auswahl-Buttons -->
 | 
			
		||||
                        <RowDefinition Height="Auto"/>
 | 
			
		||||
                        <!-- RadioButtons für Suchmodus -->
 | 
			
		||||
                        <!-- Suchmodus -->
 | 
			
		||||
                        <RowDefinition Height="Auto"/>
 | 
			
		||||
                        <!-- Suchtext und Suchen-Button -->
 | 
			
		||||
                        <RowDefinition Height="Auto"/>
 | 
			
		||||
                        <!-- Status & Progress -->
 | 
			
		||||
                        <!-- Suchfeld -->
 | 
			
		||||
                        <RowDefinition Height="*"/>
 | 
			
		||||
                        <!-- eventuell Füllraum -->
 | 
			
		||||
                        <!-- Suchergebnisse -->
 | 
			
		||||
                        <RowDefinition Height="Auto"/>
 | 
			
		||||
                        <!-- Status -->
 | 
			
		||||
                        <RowDefinition Height="Auto"/>
 | 
			
		||||
                        <!-- Zurück-Button -->
 | 
			
		||||
                    </Grid.RowDefinitions>
 | 
			
		||||
 | 
			
		||||
                    <!-- Obere Zeile: Drag & Drop-Bereich -->
 | 
			
		||||
                    <Border Grid.ColumnSpan="2" Height="75" BorderBrush="Gray" BorderThickness="1">
 | 
			
		||||
                    <!-- Drag & Drop Bereich -->
 | 
			
		||||
                    <Border Grid.Row="0" Height="75" Margin="0,5"
 | 
			
		||||
                            BorderBrush="Gray" BorderThickness="1">
 | 
			
		||||
                        <Grid Background="Transparent" AllowDrop="True"
 | 
			
		||||
                              DragEnter="PdfDropCanvas_DragEnter" Drop="PdfDropCanvas_Drop" Margin="0,0,9,0">
 | 
			
		||||
                            <!-- Hinweistext und ggf. Vorschau (zunächst unsichtbar) -->
 | 
			
		||||
                            <Button Grid.Column="0" Content="Wähle PDF aus" Background="LightBlue" Click="ChoosePdfButton_Click" 
 | 
			
		||||
                                        Margin="296,-2,-15,0"/>
 | 
			
		||||
                              DragEnter="PdfDropCanvas_DragEnter" 
 | 
			
		||||
                              Drop="PdfDropCanvas_Drop">
 | 
			
		||||
                            <TextBlock x:Name="DropHintText" Text="PDF hier rein ziehen" 
 | 
			
		||||
                                       Foreground="Gray" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5"/>
 | 
			
		||||
                            <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,30,0,0">
 | 
			
		||||
                                       VerticalAlignment="Center" HorizontalAlignment="Center"/>
 | 
			
		||||
                            <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
 | 
			
		||||
                                <Image x:Name="PdfIcon" Source="pack://application:,,,/Images/pdf-icon.png" 
 | 
			
		||||
                                       Width="25" Height="25" Visibility="Collapsed"/>
 | 
			
		||||
                                <TextBlock x:Name="PdfFileNameText" Margin="10,0,0,0" Visibility="Collapsed"/>
 | 
			
		||||
                                <TextBlock x:Name="PdfFileNameText" Margin="10" 
 | 
			
		||||
                                           TextWrapping="Wrap" Visibility="Collapsed"/>
 | 
			
		||||
                            </StackPanel>
 | 
			
		||||
                        </Grid>
 | 
			
		||||
                    </Border>
 | 
			
		||||
 | 
			
		||||
                    <!-- Linke Spalte, 2. Zeile: PDF hochladen Button -->
 | 
			
		||||
                    <Button Grid.Row="1" Grid.Column="0" Content="PDF hochladen" 
 | 
			
		||||
                            Width="235" Height="30" Background="LightGreen" Click="UploadButton_Click" 
 | 
			
		||||
                            Margin="0,10,0,0"/>
 | 
			
		||||
                    <!-- Upload/Auswahl-Buttons -->
 | 
			
		||||
                    <StackPanel Grid.Row="1" Orientation="Horizontal" Margin="0,10">
 | 
			
		||||
                        <Button Content="PDF hochladen" 
 | 
			
		||||
                                Width="210" Height="30"
 | 
			
		||||
                                Background="LightGreen" 
 | 
			
		||||
                                Click="UploadButton_Click"/>
 | 
			
		||||
 | 
			
		||||
                    <!-- Linke Spalte, 3. Zeile: RadioButtons für Suchmodus -->
 | 
			
		||||
                    <StackPanel Grid.Row="2" Grid.Column="0" Orientation="Horizontal" Margin="0,10,0,0">
 | 
			
		||||
                        <RadioButton x:Name="SearchByIdRadio" Content="ID" IsChecked="True" Margin="0,0,10,0"/>
 | 
			
		||||
                        <RadioButton x:Name="SearchByTextRadio" Content="Text"/>
 | 
			
		||||
                        <Button Content="PDF auswählen" 
 | 
			
		||||
                                Width="210" Height="30" Margin="40,0,0,0"
 | 
			
		||||
                                Background="Firebrick" 
 | 
			
		||||
                                Click="ChoosePdfButton_Click"/>
 | 
			
		||||
                    </StackPanel>
 | 
			
		||||
 | 
			
		||||
                    <!-- Linke Spalte, 4. Zeile: Suchfeld und Suchbutton -->
 | 
			
		||||
                    <StackPanel Grid.Row="3" Grid.Column="0" Orientation="Vertical" Margin="0,10,0,0">
 | 
			
		||||
                        <TextBox x:Name="SearchTextBox" Width="232" />
 | 
			
		||||
                        <Button Content="Suchen" x:Name="SearchButton" Click="SearchButton_Click" 
 | 
			
		||||
                                Width="118" Margin="0,5,0,0"/>
 | 
			
		||||
                    <!-- Suchmodus-Auswahl -->
 | 
			
		||||
                    <StackPanel Grid.Row="2" Orientation="Horizontal" Margin="0,10">
 | 
			
		||||
                        <RadioButton x:Name="SearchByIdRadio" 
 | 
			
		||||
                                    Content="ID" 
 | 
			
		||||
                                    Margin="5" 
 | 
			
		||||
                                    IsChecked="True"/>
 | 
			
		||||
                        <RadioButton x:Name="SearchByTextRadio" 
 | 
			
		||||
                                   Content="Text" 
 | 
			
		||||
                                   Margin="5"/>
 | 
			
		||||
                    </StackPanel>
 | 
			
		||||
 | 
			
		||||
                    <!-- Linke Spalte, 5. Zeile: Upload-Status und Fortschrittsanzeige -->
 | 
			
		||||
                    <StackPanel Grid.Row="4" Grid.Column="0" Orientation="Vertical" Margin="0,10,0,0">
 | 
			
		||||
                        <TextBlock x:Name="UploadStatusText" TextAlignment="Center" Height="27"/>
 | 
			
		||||
                        <ProgressBar x:Name="UploadProgressBar" Height="10" Minimum="0" Maximum="100" 
 | 
			
		||||
                                     Visibility="Collapsed" Margin="0,5,0,0"/>
 | 
			
		||||
                    <!-- Suchfeld -->
 | 
			
		||||
                    <StackPanel Grid.Row="3" Margin="0,10">
 | 
			
		||||
                        <TextBox x:Name="SearchTextBox" 
 | 
			
		||||
                               Margin="0,0,0,5"
 | 
			
		||||
                               HorizontalAlignment="Stretch"/>
 | 
			
		||||
                        <Button Content="Suchen" 
 | 
			
		||||
                              x:Name="SearchButton" 
 | 
			
		||||
                              Height="30"
 | 
			
		||||
                              HorizontalAlignment="Stretch"
 | 
			
		||||
                              Click="SearchButton_Click"/>
 | 
			
		||||
                    </StackPanel>
 | 
			
		||||
 | 
			
		||||
                    <!-- Rechte Spalte: Suchergebnisse ListBox -->
 | 
			
		||||
                    <ListBox Grid.Row="1" Grid.RowSpan="5" Grid.Column="1" 
 | 
			
		||||
                             x:Name="SearchResultsListBox" DisplayMemberPath="DocumentName" 
 | 
			
		||||
                             ItemsSource="{Binding}" SelectionMode="Extended" 
 | 
			
		||||
                             SelectionChanged="SearchResultsListBox_SelectionChanged" Margin="10,10,0,0"/>
 | 
			
		||||
                    <!-- Suchergebnisse -->
 | 
			
		||||
                    <ListBox Grid.Row="4" 
 | 
			
		||||
                           x:Name="SearchResultsListBox" 
 | 
			
		||||
                           Margin="0,10"
 | 
			
		||||
                           DisplayMemberPath="DocumentName"
 | 
			
		||||
                           ScrollViewer.VerticalScrollBarVisibility="Auto"
 | 
			
		||||
                           SelectionMode="Extended"
 | 
			
		||||
                           SelectionChanged="SearchResultsListBox_SelectionChanged"/>
 | 
			
		||||
 | 
			
		||||
                    <!-- Linke Spalte, untere Zeile: Button "Zurück zur Anmeldung" -->
 | 
			
		||||
                    <Button Grid.Row="6" Grid.Column="0" Content="Zurück zur Anmeldung" 
 | 
			
		||||
                            Click="BackToLogIn_Click" Height="30" Background="#ffd64f" Margin="0,10,0,0"/>
 | 
			
		||||
                    <!-- Status & Fortschritt -->
 | 
			
		||||
                    <StackPanel Grid.Row="5" Orientation="Vertical" Margin="0,10">
 | 
			
		||||
                        <TextBlock x:Name="UploadStatusText" TextAlignment="Center"/>
 | 
			
		||||
                        <ProgressBar x:Name="UploadProgressBar" 
 | 
			
		||||
                                   Height="10" 
 | 
			
		||||
                                   Minimum="0" 
 | 
			
		||||
                                   Maximum="100"
 | 
			
		||||
                                   Visibility="Collapsed"/>
 | 
			
		||||
                    </StackPanel>
 | 
			
		||||
 | 
			
		||||
                    <!-- Zurück-Button -->
 | 
			
		||||
                    <Button Grid.Row="6" 
 | 
			
		||||
                          Content="Zurück zur Anmeldung" 
 | 
			
		||||
                          Height="30" Margin="0,10"
 | 
			
		||||
                          HorizontalAlignment="Stretch"
 | 
			
		||||
                          Background="#ffd64f" 
 | 
			
		||||
                          Click="BackToLogIn_Click"/>
 | 
			
		||||
                </Grid>
 | 
			
		||||
            </Border>
 | 
			
		||||
 | 
			
		||||
            <!-- Rechte Seite -->
 | 
			
		||||
            <Border Grid.Column="1" Margin="43,10,10,10" Padding="10">
 | 
			
		||||
            <Border Grid.Column="1" Margin="10">
 | 
			
		||||
                <Grid>
 | 
			
		||||
                    <Grid.RowDefinitions>
 | 
			
		||||
                        <RowDefinition Height="Auto"/>
 | 
			
		||||
                        <!-- Überschrift -->
 | 
			
		||||
                        <RowDefinition Height="*"/>
 | 
			
		||||
                        <!-- PDF-Inhalt -->
 | 
			
		||||
                        <RowDefinition Height="Auto"/>
 | 
			
		||||
                        <!-- Lösch-Button -->
 | 
			
		||||
                    </Grid.RowDefinitions>
 | 
			
		||||
                    <Label Grid.Row="0" Content="PDF-Inhalt:" Margin="0,0,0,5"/>
 | 
			
		||||
                    <!-- Für den Inhalt wird ein TextBox genutzt, der bei Bedarf automatisch Scrollbars anzeigt -->
 | 
			
		||||
                    <TextBox Grid.Row="1" x:Name="ContentTextBox" 
 | 
			
		||||
                             Text="{Binding SelectedDocument.Content}"
 | 
			
		||||
                             IsReadOnly="True" TextWrapping="Wrap" AcceptsReturn="True"
 | 
			
		||||
                             VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"/>
 | 
			
		||||
                    <Button Grid.Row="2" Content="Löschen" Width="100" Height="30" 
 | 
			
		||||
                            Background="Firebrick" Click="DeleteButton_Click" 
 | 
			
		||||
                            HorizontalAlignment="Center" Margin="0,10,0,0"/>
 | 
			
		||||
 | 
			
		||||
                    <Label Content="PDF-Inhalt:" Margin="0,0,0,5"/>
 | 
			
		||||
 | 
			
		||||
                    <TextBox Grid.Row="1" 
 | 
			
		||||
                           x:Name="ContentTextBox" 
 | 
			
		||||
                           TextWrapping="Wrap" 
 | 
			
		||||
                           AcceptsReturn="True"
 | 
			
		||||
                           VerticalScrollBarVisibility="Auto" 
 | 
			
		||||
                           HorizontalScrollBarVisibility="Auto"
 | 
			
		||||
                           IsReadOnly="True"/>
 | 
			
		||||
 | 
			
		||||
                    <Button Grid.Row="2" 
 | 
			
		||||
                          Content="Löschen" 
 | 
			
		||||
                          Width="100" Height="30" 
 | 
			
		||||
                          Margin="0,10"
 | 
			
		||||
                          HorizontalAlignment="Center"
 | 
			
		||||
                          Background="Firebrick" 
 | 
			
		||||
                          Click="DeleteButton_Click"/>
 | 
			
		||||
                </Grid>
 | 
			
		||||
            </Border>
 | 
			
		||||
        </Grid>
 | 
			
		||||
    </Border>
 | 
			
		||||
</mah:MetroWindow>
 | 
			
		||||
</mah:MetroWindow>
 | 
			
		||||
		Reference in New Issue
	
	Block a user