Skip to content

Commit

Permalink
创建简单的界面
Browse files Browse the repository at this point in the history
  • Loading branch information
lindexi committed Dec 20, 2023
1 parent 3290035 commit ffffd70
Show file tree
Hide file tree
Showing 3 changed files with 246 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,254 @@
NavigationCacheMode="Required"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:models="using:UnoFileDownloader.Business.Models"
mc:Ignorable="d"
Background="{ThemeResource BackgroundBrush}" d:DataContext="{d:DesignInstance local:BindableMainModel}">

<Grid utu:SafeArea.Insets="VisibleBounds">
<Page.Resources>
<Style x:Key="TitleBarButtonStyle" BasedOn="{StaticResource PrimaryButtonStyle}" TargetType="Button">
<Setter Property="Padding" Value="0,0,0,0"></Setter>
<Setter Property="Width" Value="44" />
<Setter Property="VerticalAlignment" Value="Stretch"></Setter>
<Setter Property="HorizontalAlignment" Value="Stretch"></Setter>
</Style>
</Page.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>

<StackPanel Grid.Row="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Spacing="16">
<TextBox Text="{Binding Name, Mode=TwoWay}"
PlaceholderText="Enter your name:" />
<Button Content="Go to Second Page"
AutomationProperties.AutomationId="SecondPageButton"
Command="{Binding GoToSecond}" />
<utu:NavigationBar Content="{Binding Title}" />

<ContentControl uen:Region.Attached="true" Height="200"/>

</StackPanel>

<Grid Grid.Row="0" Height="44">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<AutoSuggestBox
x:Uid="/MainPage/SearchBox"
Grid.Column="0"
Margin="4,0"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
PlaceholderText="[Search Downloads]"
IsEnabled="False"/>
<Button
x:Uid="/MainPage/NewTaskButton"
Grid.Column="1"
Style="{StaticResource TitleBarButtonStyle}"
AutomationProperties.Name="[New Task Button]"
ToolTipService.ToolTip="[New Task]">
<Button.Content>
<SymbolIcon Symbol="Add" />
</Button.Content>
</Button>
<Button
x:Uid="/MainPage/StartAllButton"
Grid.Column="2"
Style="{StaticResource TitleBarButtonStyle}"
AutomationProperties.Name="[Start All Button]"
IsEnabled="False"
ToolTipService.ToolTip="[Start All]">
<Button.Content>
<SymbolIcon Symbol="Play" />
</Button.Content>
</Button>
<Button
x:Uid="/MainPage/PauseAllButton"
Grid.Column="3"
Style="{StaticResource TitleBarButtonStyle}"
AutomationProperties.Name="[Pause All Button]"
IsEnabled="False"
ToolTipService.ToolTip="[Pause All]">
<Button.Content>
<SymbolIcon Symbol="Pause" />
</Button.Content>
</Button>
<Button
x:Uid="/MainPage/ClearListButton"
Grid.Column="4"
Style="{StaticResource TitleBarButtonStyle}"
AutomationProperties.Name="[Clear List Button]"
ToolTipService.ToolTip="[Clear List]">
<Button.Content>
<SymbolIcon Symbol="Delete" />
</Button.Content>
</Button>
<Button
x:Uid="/MainPage/MoreButton"
Grid.Column="5"
Style="{StaticResource TitleBarButtonStyle}"
AutomationProperties.Name="[More Button]"
ToolTipService.ToolTip="[More]"
IsEnabled="False">
<Button.Content>
<SymbolIcon Symbol="More" />
</Button.Content>
<!--<Button.Flyout>
<MenuFlyout Placement="BottomEdgeAlignedRight">
<MenuFlyoutItem
x:Uid="/MainPage/OpenDownloadsFolderButton"
Click="OpenDownloadsFolderButtonClick"
Icon="Folder"
Text="[Open Downloads Folder]" />
<MenuFlyoutItem
x:Uid="/MainPage/SettingsButton"
Click="SettingsButtonClick"
Icon="Setting"
Text="[Settings]" />
<MenuFlyoutItem
x:Uid="/MainPage/AboutButton"
Click="AboutButtonClick"
Icon="Help"
Text="[About]" />
</MenuFlyout>
</Button.Flyout>-->
</Button>
</Grid>
<ListView
x:Name="TaskList"
Grid.Row="1"
>
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="Padding" Value="1,0" />
<Setter Property="Margin" Value="-1,0,-1,-1" />
<Setter Property="BorderBrush" Value="Gray" />
<Setter Property="BorderThickness" Value="1" />
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate x:DataType="models:DownloadFileInfo">
<Grid Height="44">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<Grid
Grid.Column="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*" />
<ColumnDefinition Width="6*" />
<ColumnDefinition Width="44" />
<ColumnDefinition Width="44" />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Column="0"
Margin="12,0"
VerticalAlignment="Center"
Text="{x:Bind FileName, Mode=OneWay}"
FontFamily="Microsoft YaHei UI"
TextTrimming="CharacterEllipsis" />
<StackPanel Grid.Column="1" VerticalAlignment="Center">
<!-- <TextBlock Text="{x:Bind StatusText, Mode=OneWay}" /> -->
<!-- <ProgressBar -->
<!-- Height="4" -->
<!-- BorderThickness="0" -->
<!-- Foreground="{x:Bind Status, Converter={StaticResource TaskItemConverter}, ConverterParameter=TaskStatusToProgressBarForegroundColor, Mode=OneWay}" -->
<!-- Maximum="{x:Bind TotalBytesToReceive, Converter={StaticResource TaskItemConverter}, ConverterParameter=UInt64ToDouble, Mode=OneWay}" -->
<!-- Value="{x:Bind BytesReceived, Converter={StaticResource TaskItemConverter}, ConverterParameter=UInt64ToDouble, Mode=OneWay}" /> -->
</StackPanel>
<Button
x:Uid="/MainPage/TaskItemRetryButton"
Grid.Column="2"
VerticalAlignment="Stretch"
AutomationProperties.Name="[Retry Button]"
Background="Transparent"
BorderBrush="Transparent"
ToolTipService.ToolTip="[Retry]"
Visibility="Collapsed">
<Button.Content>
<SymbolIcon Symbol="Refresh" />
</Button.Content>
</Button>
<Button
x:Uid="/MainPage/TaskItemResumeButton"
Grid.Column="2"
VerticalAlignment="Stretch"
AutomationProperties.Name="[Resume Button]"
Background="Transparent"
BorderBrush="Transparent"
ToolTipService.ToolTip="[Resume]"
Visibility="Collapsed">
<Button.Content>
<SymbolIcon Symbol="Play" />
</Button.Content>
</Button>
<Button
x:Uid="/MainPage/TaskItemPauseButton"
Grid.Column="2"
VerticalAlignment="Stretch"
AutomationProperties.Name="[Pause Button]"
Background="Transparent"
BorderBrush="Transparent"
ToolTipService.ToolTip="[Pause]"
Visibility="Collapsed">
<Button.Content>
<SymbolIcon Symbol="Pause" />
</Button.Content>
</Button>
<Button
x:Uid="/MainPage/TaskItemMoreButton"
Grid.Column="3"
VerticalAlignment="Stretch"
AutomationProperties.Name="[More Button]"
Background="Transparent"
BorderBrush="Transparent"
ToolTipService.ToolTip="[More]" IsEnabled="False">
<Button.Content>
<SymbolIcon Symbol="More" />
</Button.Content>
<!--<Button.Flyout>
<MenuFlyout Placement="BottomEdgeAlignedRight">
<MenuFlyoutItem
x:Uid="/MainPage/TaskItemCopyLinkButton"
Icon="Link"
Text="[Copy Link]" />
<MenuFlyoutItem
x:Uid="/MainPage/TaskItemOpenFolderButton"
Click="TaskItemOpenFolderButtonClick"
Icon="OpenLocal"
Text="[Open Folder]" />
<MenuFlyoutItem
x:Uid="/MainPage/TaskItemCancelButton"
Icon="Cancel"
Text="[Cancel]"
Visibility="{x:Bind Status, Converter={StaticResource TaskItemConverter}, ConverterParameter=TaskStatusToCancelButtonVisible, Mode=OneWay}" />
<MenuFlyoutItem
x:Uid="/MainPage/TaskItemRemoveButton"
Icon="Delete"
Text="[Remove]"
Visibility="{x:Bind Status, Converter={StaticResource TaskItemConverter}, ConverterParameter=TaskStatusToRemoveButtonVisible, Mode=OneWay}" />
</MenuFlyout>
</Button.Flyout>-->
</Button>
</Grid>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<TextBlock
x:Name="TaskListNoItemsTextBlock"
x:Uid="/MainPage/TaskListNoItemsTextBlock"
Grid.Row="1"
Margin="16"
Text="[No Downloads]"
TextAlignment="Center" />
<TextBlock
x:Name="GlobalStatusTextBlock"
Grid.Row="2"
Height="32"
Padding="4"
VerticalAlignment="Bottom"
FontSize="15"
Text="&#x2193; 0 Byte/s &#x2191; 0 Byte/s" />
</Grid>
</Page>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public ShellModel(INavigator navigator, DownloadFileListManager downloadFileList
public async Task Start()
{
await _downloadFileListManager.InitAsync();
await _navigator.NavigateViewModelAsync<NewTaskModel>(this);
await _navigator.NavigateViewModelAsync<MainModel>(this);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Expand Down Expand Up @@ -129,4 +128,4 @@
<data name="Main" xml:space="preserve">
<value>主界面</value>
</data>
</root>
</root>

0 comments on commit ffffd70

Please sign in to comment.