XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEToolBox

【WPF】XFE工具箱

公开
关注 0 Fork 0 Star 0
UTF-8
<Page x:Class="XFEToolBox.Client.Views.Pages.ToolWorkshopPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:gif="http://wpfanimatedgif.codeplex.com"
      xmlns:controls="clr-namespace:XFEToolBox.WpfCore.Controls;assembly=XFEToolBox.WpfCore"
      Title="ToolWorkshopPage" Loaded="Page_Loaded">
    <Page.Resources>
        <Style x:Key="ProjectCardStyle" TargetType="Button" BasedOn="{StaticResource ToolBoxButtonStyle}">
            <Setter Property="Height" Value="60"/>
            <Setter Property="Margin" Value="2,2,2,3"/>
            <Setter Property="Padding" Value="11,7"/>
            <Setter Property="Background" Value="White"/>
            <Setter Property="BorderBrush" Value="#E2E2EE"/>
            <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
            <Setter Property="VerticalContentAlignment" Value="Stretch"/>
            <Setter Property="controls:ButtonAssist.CornerRadius" Value="11"/>
            <Setter Property="controls:ButtonAssist.HoverBackground" Value="#F1F1FB"/>
            <Setter Property="controls:ButtonAssist.HoverBorderBrush" Value="#BDBDEB"/>
        </Style>
    </Page.Resources>
    <Grid>
        <controls:SmoothScrollViewer Padding="18,14,18,18">
            <StackPanel>
                <Border Padding="22" CornerRadius="18" BorderBrush="#55FFFFFF" BorderThickness="1">
                    <Border.Background>
                        <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                            <GradientStop Color="#665D62D8"/>
                            <GradientStop Color="#366E4BC8" Offset="1"/>
                        </LinearGradientBrush>
                    </Border.Background>
                    <Grid>
                        <Grid.ColumnDefinitions><ColumnDefinition Width="*"/><ColumnDefinition Width="Auto"/></Grid.ColumnDefinitions>
                        <StackPanel>
                            <TextBlock Text="工具工坊" Foreground="White" FontSize="23" FontWeight="Bold"/>
                            <TextBlock Text="使用 Code Studio 创建、预览、运行和导出 WPF 工具" Foreground="#DFFFFFFF" FontSize="11" Margin="0,7,0,0"/>
                        </StackPanel>
                        <StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
                            <Button Content="控件画廊" Height="36" Margin="0,0,8,0" Click="OpenGalleryButton_Click"/>
                            <Button Content="打开项目" Height="36" Margin="0,0,8,0" Click="OpenProjectsButton_Click"/>
                            <Button Content="新建工具" Height="36" controls:ButtonAssist.IsPrimary="True" Click="NewProjectButton_Click"/>
                        </StackPanel>
                    </Grid>
                </Border>

                <Grid Margin="4,18,4,8">
                    <StackPanel>
                        <TextBlock Text="最近项目" Foreground="White" FontSize="16" FontWeight="SemiBold"/>
                        <TextBlock Text="左键直接打开,右键可固定、移除记录或复制路径" Foreground="#C9FFFFFF" FontSize="9.5" Margin="0,3,0,0"/>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center">
                        <TextBlock x:Name="StatusText" Foreground="#D8FFFFFF" FontSize="9.5" Margin="0,0,10,0" VerticalAlignment="Center"/>
                        <Button Content="刷新" Height="30" Click="RefreshButton_Click"/>
                    </StackPanel>
                </Grid>

                <Border Background="#F8F8FD" BorderBrush="#65FFFFFF" BorderThickness="1" CornerRadius="17" Padding="6" MinHeight="150">
                    <Grid>
                        <ItemsControl x:Name="ProjectList" ItemsSource="{Binding}">
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <Button Style="{StaticResource ProjectCardStyle}" CommandParameter="{Binding}" Click="ProjectCard_Click">
                                        <Button.ContextMenu>
                                            <ContextMenu DataContext="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource Self}}">
                                                <MenuItem Header="{Binding PinText}" Click="TogglePinnedProjectMenuItem_Click"/>
                                                <MenuItem Header="移除此项" Click="RemoveProjectMenuItem_Click"/>
                                                <Separator/>
                                                <MenuItem Header="复制路径" Click="CopyProjectPathMenuItem_Click"/>
                                            </ContextMenu>
                                        </Button.ContextMenu>
                                        <Grid>
                                            <Grid.ColumnDefinitions><ColumnDefinition Width="42"/><ColumnDefinition Width="*"/><ColumnDefinition Width="Auto"/></Grid.ColumnDefinitions>
                                            <Border Width="36" Height="36" CornerRadius="10" Background="#EEEEFB" VerticalAlignment="Center">
                                                <Image gif:ImageBehavior.AnimatedSource="{Binding IconSource}" gif:ImageBehavior.RepeatBehavior="Forever"
                                                       Width="25" Height="25" Stretch="Uniform"/>
                                            </Border>
                                            <StackPanel Grid.Column="1" Margin="9,0" VerticalAlignment="Center">
                                                <TextBlock Text="{Binding Name}" Foreground="#44445A" FontSize="11.5" FontWeight="SemiBold" TextTrimming="CharacterEllipsis"/>
                                                <TextBlock Text="{Binding ProjectPath}" Foreground="#9090A2" FontSize="9" TextTrimming="CharacterEllipsis" Margin="0,3,0,0"/>
                                            </StackPanel>
                                            <StackPanel Grid.Column="2" VerticalAlignment="Center" Margin="8,0,0,0">
                                                <TextBlock Text="{Binding StateText}" Foreground="#7272C7" FontSize="9.2" HorizontalAlignment="Right"/>
                                                <TextBlock Text="{Binding LastOpenedText}" Foreground="#A0A0AF" FontSize="8.2" Margin="0,3,0,0"/>
                                            </StackPanel>
                                        </Grid>
                                    </Button>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                        </ItemsControl>
                        <StackPanel x:Name="EmptyState" HorizontalAlignment="Center" VerticalAlignment="Center">
                            <TextBlock Text="还没有工具项目" Foreground="#5B5B70" FontSize="13" FontWeight="SemiBold" HorizontalAlignment="Center"/>
                            <TextBlock Text="新建一个项目,或打开包含 manifest.json 的目录" Foreground="#9797A8" FontSize="10" Margin="0,5,0,12"/>
                            <Button Content="新建第一个工具" controls:ButtonAssist.IsPrimary="True" Click="NewProjectButton_Click"/>
                        </StackPanel>
                    </Grid>
                </Border>
            </StackPanel>
        </controls:SmoothScrollViewer>
    </Grid>
</Page>