/
Logris
/
FileWatchService
Обзор
Документация
Войти
/
Logris
/
FileWatchService
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
AdminTools/Service/Extensions/FilePolling/FilePollingControl.xaml
287 строк
12 KB
Logrus
picker, UI, Args
20 апр 2025, 20:54
20 апр 2025, 20:54
d90f143
Код
Авторство
О чём код?
<UserControl x:Class="FilePolling.FilePollingControl" 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:local="clr-namespace:FilePolling" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:DesignHeight="450" d:DesignWidth="800" mc:Ignorable="d"> <UserControl.Resources> <FontFamily x:Key="Font.Icons">Resource/#Icons</FontFamily> <SolidColorBrush x:Key="Brush.Border" Color="#353535" /> <SolidColorBrush x:Key="Brush.Foreground" Color="#c0c0c0" /> <CornerRadius x:Key="CornerRadius.Border">5</CornerRadius> <Style TargetType="{x:Type TextBlock}"> <Setter Property="SnapsToDevicePixels" Value="true" /> <Setter Property="OverridesDefaultStyle" Value="true" /> <Setter Property="Focusable" Value="False" /> <Setter Property="Background" Value="Transparent" /> <Setter Property="Foreground" Value="#c0c0c0" /> <Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="HorizontalAlignment" Value="Right" /> <Setter Property="Margin" Value="0,0,10,0" /> <Setter Property="TextWrapping" Value="Wrap" /> </Style> <Style TargetType="{x:Type TextBox}"> <Setter Property="SnapsToDevicePixels" Value="true" /> <Setter Property="OverridesDefaultStyle" Value="true" /> <Setter Property="Background" Value="#151515" /> <Setter Property="BorderBrush" Value="{StaticResource Brush.Border}" /> <Setter Property="Foreground" Value="{StaticResource Brush.Foreground}" /> <Setter Property="Margin" Value="0,1" /> <Setter Property="Padding" Value="2,2" /> <Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type TextBox}"> <Border x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" CornerRadius="{StaticResource CornerRadius.Border}"> <Grid> <ScrollViewer x:Name="PART_ContentHost" Margin="{TemplateBinding Padding}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Background="{x:Null}" BorderThickness="0" IsTabStop="False" /> <TextBlock x:Name="PlaceHolder" Margin="5,0,0,0" VerticalAlignment="Center" Foreground="{TemplateBinding BorderBrush}" IsHitTestVisible="False" Text="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}" Visibility="Collapsed" /> </Grid> </Border> <ControlTemplate.Triggers> <Trigger Property="Text" Value=""> <Setter TargetName="PlaceHolder" Property="Visibility" Value="Visible" /> </Trigger> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="BorderBrush" Value="#606060" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style TargetType="{x:Type Button}"> <Setter Property="SnapsToDevicePixels" Value="true" /> <Setter Property="OverridesDefaultStyle" Value="true" /> <Setter Property="IsTabStop" Value="True" /> <Setter Property="Focusable" Value="False" /> <Setter Property="Background" Value="#151515" /> <Setter Property="BorderBrush" Value="#151515" /> <Setter Property="Foreground" Value="#909090" /> <Setter Property="Margin" Value="5,1" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" CornerRadius="5"> <TextBlock Margin="5" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{TemplateBinding Foreground}" Text="{TemplateBinding Content}" /> </Border> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Foreground" Value="#c0c0c0" /> </Trigger> <Trigger Property="IsPressed" Value="True"> <Setter Property="Foreground" Value="#d0d0d0" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <!-- CheckBox --> <ControlTemplate x:Key="Template.CheckBox" TargetType="{x:Type CheckBox}"> <StackPanel Background="#01000000" Orientation="Horizontal"> <Border x:Name="rect" Width="20" Height="20" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2"> <TextBlock x:Name="check" HorizontalAlignment="Center" VerticalAlignment="Center" FontFamily="{StaticResource Font.Icons}" FontSize="12" Foreground="#00B7E9" Text="S" Visibility="Hidden" /> </Border> <ContentPresenter x:Name="content" Margin="5,0,0,0" VerticalAlignment="Center" /> </StackPanel> <ControlTemplate.Triggers> <Trigger Property="IsChecked" Value="True"> <Setter TargetName="check" Property="Visibility" Value="Visible" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> <Style BasedOn="{StaticResource {x:Type ContentControl}}" TargetType="CheckBox"> <Setter Property="OverridesDefaultStyle" Value="True" /> <Setter Property="Background" Value="Transparent" /> <Setter Property="BorderBrush" Value="{StaticResource Brush.Border}" /> <Setter Property="Foreground" Value="{StaticResource Brush.Foreground}" /> <Setter Property="BorderThickness" Value="1" /> <Setter Property="HorizontalContentAlignment" Value="Left" /> <Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="Padding" Value="6,0,0,0" /> <Setter Property="UseLayoutRounding" Value="True" /> <Setter Property="Template" Value="{StaticResource Template.CheckBox}" /> </Style> </UserControl.Resources> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="199*" /> <ColumnDefinition Width="537*" /> <ColumnDefinition Width="57*" /> <ColumnDefinition Width="7*" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="5" /> <RowDefinition Height="30" /> <RowDefinition Height="30" /> <RowDefinition Height="30" /> <RowDefinition Height="30" /> <RowDefinition Height="30*" /> </Grid.RowDefinitions> <TextBlock x:Name="folder" Grid.Row="1" Margin="0,0,5,0" HorizontalAlignment="Right" Text="Watch Folder" /> <TextBox Grid.Row="1" Grid.Column="1" Margin="0,1,0,1" IsReadOnly="True" Tag="Select Folder ..." Text="{Binding NetworkPath}" /> <Button Grid.Row="1" Grid.Column="2" Margin="2,1,10,1" Background="Transparent" BorderBrush="Transparent" BorderThickness="0" Command="{Binding PickFolderCommand}" Content="ꀁ" FontFamily="{StaticResource Font.Icons}" FontSize="23px" /> <TextBlock x:Name="filter" Grid.Row="2" Margin="0,0,5,0" HorizontalAlignment="Right" Text="Filter Watch" /> <TextBox Grid.Row="2" Grid.Column="1" Margin="0,1,0,1" Tag="*.*" Text="{Binding FilterWatch, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" /> <TextBlock x:Name="Cmd" Grid.Row="4" Margin="0,0,5,0" HorizontalAlignment="Right" Text="Command" /> <TextBox Grid.Row="4" Grid.Column="1" Margin="0,0,0,1" IsReadOnly="True" Tag="Path to FME.exe" Text="{Binding AppPath, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" /> <Button Grid.Row="4" Grid.Column="2" Margin="2,1,10,1" Background="Transparent" BorderBrush="Transparent" BorderThickness="0" Command="{Binding PickAppCommand}" Content="ꀁ" FontFamily="{StaticResource Font.Icons}" FontSize="23px" /> <TextBox x:Name="DelayBox" Grid.Row="3" Grid.Column="1" Margin="0,2,0,0" Tag="3000" Text="{Binding PollingInterval, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" /> <TextBlock x:Name="DelayTitle" Grid.Row="3" Margin="0,0,5,0" HorizontalAlignment="Right" Text="Polling Interval" ToolTip="Период опроса директории в секундах." /> <TextBlock x:Name="CmdArgs" Grid.Row="5" Margin="0,5,5,0" HorizontalAlignment="Right" VerticalAlignment="Top" Text="Command Args" /> <StackPanel Grid.Row="5" Grid.Column="1"> <TextBox MinHeight="30" MaxHeight="110" VerticalContentAlignment="Top" AcceptsReturn="True" Tag="Arguments for FME.exe" Text="{Binding CommandArgs, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" TextAlignment="Left" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" /> </StackPanel> </Grid> </UserControl>