add banner page
This commit is contained in:
parent
0361f68f87
commit
e7e2af2a65
|
@ -3,9 +3,9 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace PCUT.Entities
|
||||
namespace PCUT.Entities.ApiResponse
|
||||
{
|
||||
public class Pagination
|
||||
public class Pagination
|
||||
{
|
||||
[JsonProperty("page")]
|
||||
public int Page { get; set; }
|
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace PCUT.Entities
|
||||
{
|
||||
public class Banner
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Content { get; set; }
|
||||
}
|
||||
}
|
|
@ -186,6 +186,9 @@
|
|||
<Compile Include="Pages\AppOutdatedDialog.xaml.cs">
|
||||
<DependentUpon>AppOutdatedDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\BannerManagement\BannerViewPage.xaml.cs">
|
||||
<DependentUpon>BannerViewPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\CategoriesManagement\CategoryUpsertDialog.xaml.cs">
|
||||
<DependentUpon>CategoryUpsertDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
@ -253,6 +256,7 @@
|
|||
<DependentUpon>UserListPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ViewModels\BannerViewModel.cs" />
|
||||
<Compile Include="ViewModels\CutDialogViewModel.cs" />
|
||||
<Compile Include="ViewModels\LogViewModel.cs" />
|
||||
<Compile Include="ViewModels\UpsertMetadataViewModel.cs" />
|
||||
|
@ -363,6 +367,10 @@
|
|||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\BannerManagement\BannerViewPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\CategoriesManagement\CategoryUpsertDialog.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
|
|
@ -0,0 +1,149 @@
|
|||
<Page
|
||||
x:Class="PCUT.Pages.BannerManagement.BannerPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:PCUT.Pages.BannerManagement"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:viewmodels="using:PCUT.ViewModels"
|
||||
mc:Ignorable="d"
|
||||
Loaded="Page_Loaded">
|
||||
<Page.DataContext>
|
||||
<viewmodels:BannerViewModel/>
|
||||
</Page.DataContext>
|
||||
|
||||
<Page.Transitions>
|
||||
<TransitionCollection>
|
||||
<EntranceThemeTransition />
|
||||
</TransitionCollection>
|
||||
</Page.Transitions>
|
||||
|
||||
<Page.Background>
|
||||
<SolidColorBrush Color="White" />
|
||||
</Page.Background>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="0.1*"/>
|
||||
<RowDefinition Height="0.85*"/>
|
||||
<RowDefinition Height="0.05*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Button Content="Add" Width="120"
|
||||
Background="{ThemeResource SystemAccentColor}"
|
||||
CornerRadius="20"
|
||||
HorizontalAlignment="Right"
|
||||
Height="35"
|
||||
Click="AddBanner_Click"
|
||||
VerticalAlignment="Bottom"/>
|
||||
<TextBox
|
||||
Grid.Row="1"
|
||||
x:Name="Search"
|
||||
PlaceholderText="Search"
|
||||
MinWidth="300" MaxHeight="32" CornerRadius="20"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
|
||||
<ListView Grid.Row="1" x:Name="BannerListView" IsItemClickEnabled="False">
|
||||
<ListView.ItemContainerStyle>
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ListViewItem">
|
||||
<ListViewItemPresenter ContentMargin="0" Padding="0"/>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>
|
||||
<ListView.Header>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.05*"/>
|
||||
<ColumnDefinition Width="0.2*"/>
|
||||
<ColumnDefinition Width="0.55*"/>
|
||||
<ColumnDefinition Width="0.2*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Grid.Column="0" BorderBrush="Black" BorderThickness="1,1,0,1" Background="Gray">
|
||||
<TextBlock Grid.Column="0" Text="No." Margin="10" Foreground="Black" FontFamily="/Fonts/#Rubik Medium" FontSize="20"/>
|
||||
</Border>
|
||||
<Border Grid.Column="1" BorderBrush="Black" BorderThickness="1,1,0,1" Background="Gray">
|
||||
<TextBlock Grid.Column="1" Text="Name" Margin="10" Foreground="Black" FontFamily="/Fonts/#Rubik Medium" FontSize="20"
|
||||
HorizontalAlignment="Center"/>
|
||||
</Border>
|
||||
<Border Grid.Column="2" BorderBrush="Black" BorderThickness="1,1,0,1" Background="Gray">
|
||||
<TextBlock Text="Content" Margin="10" Foreground="Black" FontFamily="/Fonts/#Rubik Medium" FontSize="20"
|
||||
HorizontalAlignment="Center"/>
|
||||
</Border>
|
||||
<Border Grid.Column="5" BorderBrush="Black" BorderThickness="1,1,1,1" Background="Gray">
|
||||
<TextBlock Text="Action" Margin="10" Foreground="Black" FontFamily="/Fonts/#Rubik Medium" FontSize="20"
|
||||
HorizontalAlignment="Center"/>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
</ListView.Header>
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.05*"/>
|
||||
<ColumnDefinition Width="0.25*"/>
|
||||
<ColumnDefinition Width="0.5*"/>
|
||||
<ColumnDefinition Width="0.2*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Grid.Column="0" BorderBrush="Black" BorderThickness="1,0,0,1">
|
||||
<TextBlock Text="{Binding DisplayId, Mode=OneWay}" Margin="10" Foreground="Black" TextWrapping="Wrap" HorizontalAlignment="Center"/>
|
||||
</Border>
|
||||
<Border Grid.Column="1" BorderBrush="Black" BorderThickness="1,0,0,1">
|
||||
<TextBlock Text="{Binding Name, Mode=OneWay}" Foreground="Black" TextWrapping="Wrap"/>
|
||||
</Border>
|
||||
<Border Grid.Column="2" BorderBrush="Black" BorderThickness="1,0,0,1">
|
||||
<TextBlock Text="{Binding Content , Mode=OneWay}" Foreground="Black" TextWrapping="Wrap"/>
|
||||
</Border>
|
||||
<Border Grid.Column="3" BorderBrush="Black" BorderThickness="1,0,1,1">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" >
|
||||
<Button Margin="5" Click="EditBanner_Click" CommandParameter="{Binding Id}" HorizontalAlignment="Center">
|
||||
<FontIcon Glyph=""/>
|
||||
</Button>
|
||||
|
||||
<Button Margin="5" Click="DeleteBanner_Click" CommandParameter="{Binding Id}">
|
||||
<FontIcon Glyph=""/>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
|
||||
<Grid Grid.Row="2">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<Button x:Name="btnFirst" Content="First" Click="btnFirst_Click"/>
|
||||
<Button x:Name="btnPrevious" Content="Previous" Click="btnPrevious_Click"/>
|
||||
<TextBlock x:Name="txtPageNumber" VerticalAlignment="Center" Margin="10">
|
||||
<Run Text="{Binding Pagination.Page, Mode=OneWay}" />
|
||||
<Run Text="/" />
|
||||
<Run Text="{Binding Pagination.TotalPage, Mode=OneWay}" />
|
||||
</TextBlock>
|
||||
<Button x:Name="btnNext" Content="Next" Click="btnNext_Click"/>
|
||||
<Button x:Name="btnLast" Content="Last" Click="btnLast_Click"/>
|
||||
<ComboBox
|
||||
VerticalAlignment="Center"
|
||||
ItemsSource="{Binding Pagination.AvailablePageSizes}"
|
||||
SelectedItem="{Binding Pagination.PageSize, Mode=TwoWay}" />
|
||||
<TextBlock VerticalAlignment="Center" Text="records/page"/>
|
||||
<TextBlock VerticalAlignment="Center">
|
||||
<Run Text=" (total" />
|
||||
<Run Text="{Binding Pagination.TotalRecords, Mode=TwoWay}" />
|
||||
<Run Text="records)" />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Page>
|
|
@ -0,0 +1,83 @@
|
|||
using PCUT.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
namespace PCUT.Pages.BannerManagement
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class BannerPage : Page
|
||||
{
|
||||
public BannerViewModel ViewModels { get; set; }
|
||||
|
||||
public BannerPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
}
|
||||
|
||||
private void Page_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedFrom(e);
|
||||
}
|
||||
|
||||
private void AddBanner_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void EditBanner_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void DeleteBanner_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void btnFirst_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ViewModels.Pagination.Page = 1;
|
||||
}
|
||||
|
||||
private void btnLast_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ViewModels.Pagination.Page = ViewModels.Pagination.TotalPage;
|
||||
}
|
||||
|
||||
private void btnPrevious_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ViewModels.Pagination.Page--;
|
||||
}
|
||||
|
||||
private void btnNext_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ViewModels.Pagination.Page++;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
using PCUT.Entities;
|
||||
using PCUT.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PCUT.ViewModels
|
||||
{
|
||||
public class BannerViewModel : NotificationBase
|
||||
{
|
||||
public PaginationViewModel Pagination { get; } = new PaginationViewModel(withSearch: true);
|
||||
public SelectableCollection<BannerModel> FilteredBanners { get; }
|
||||
|
||||
public class BannerModel : Banner
|
||||
{
|
||||
public string DisplayId { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue