-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ShareCommunity.
- Loading branch information
Showing
30 changed files
with
684 additions
and
121 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<ResourceDictionary | ||
x:Class="SimpleList.Controls.ItemCard" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:data="using:SimpleList.Models"> | ||
<DataTemplate x:Key="CardItemControlTemplate" x:DataType="data:ToolItem"> | ||
<UserControl> | ||
<Grid | ||
x:Name="controlRoot" | ||
Width="360" | ||
Height="90" | ||
Padding="8" | ||
HorizontalAlignment="Stretch" | ||
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}" | ||
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}" | ||
BorderThickness="1" | ||
CornerRadius="{StaticResource ControlCornerRadius}"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="Auto" /> | ||
<ColumnDefinition Width="*" /> | ||
<ColumnDefinition Width="Auto" /> | ||
</Grid.ColumnDefinitions> | ||
|
||
<VisualStateManager.VisualStateGroups> | ||
<VisualStateGroup x:Name="LayoutVisualStates"> | ||
<VisualState x:Name="WideLayout"> | ||
<VisualState.StateTriggers> | ||
<AdaptiveTrigger MinWindowWidth="{StaticResource Breakpoint640Plus}" /> | ||
</VisualState.StateTriggers> | ||
<VisualState.Setters /> | ||
</VisualState> | ||
<VisualState x:Name="NarrowLayout"> | ||
<VisualState.StateTriggers> | ||
<AdaptiveTrigger MinWindowWidth="0" /> | ||
</VisualState.StateTriggers> | ||
<VisualState.Setters> | ||
<Setter Target="controlRoot.Width" Value="Auto" /> | ||
<Setter Target="controlRoot.Height" Value="120" /> | ||
</VisualState.Setters> | ||
</VisualState> | ||
</VisualStateGroup> | ||
</VisualStateManager.VisualStateGroups> | ||
|
||
<Grid Width="72" CornerRadius="{ThemeResource ControlCornerRadius}"> | ||
<Image | ||
x:Name="gridImage" | ||
Width="48" | ||
VerticalAlignment="Center" | ||
Source="{x:Bind ImagePath}" | ||
Stretch="Uniform" /> | ||
</Grid> | ||
<StackPanel | ||
Grid.Column="1" | ||
Grid.ColumnSpan="2" | ||
Margin="16,0,0,0" | ||
VerticalAlignment="Center" | ||
Orientation="Vertical" | ||
Spacing="2"> | ||
<TextBlock | ||
x:Name="titleText" | ||
Style="{StaticResource BodyStrongTextBlockStyle}" | ||
Text="{x:Bind Name}" | ||
TextLineBounds="TrimToCapHeight" | ||
TextWrapping="NoWrap" /> | ||
<TextBlock | ||
Foreground="{ThemeResource TextFillColorSecondaryBrush}" | ||
RelativePanel.Below="titleText" | ||
Style="{StaticResource CaptionTextBlockStyle}" | ||
Text="{x:Bind Description}" | ||
TextTrimming="CharacterEllipsis" /> | ||
</StackPanel> | ||
|
||
<InfoBadge | ||
Grid.Column="2" | ||
Width="10" | ||
Margin="4" | ||
VerticalAlignment="Top" | ||
Visibility="Collapsed"/> | ||
</Grid> | ||
</UserControl> | ||
</DataTemplate> | ||
|
||
</ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using Microsoft.UI.Xaml; | ||
|
||
namespace SimpleList.Controls | ||
{ | ||
public sealed partial class ItemCard : ResourceDictionary | ||
{ | ||
public ItemCard() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace SimpleList.Models | ||
{ | ||
public class ToolItem | ||
{ | ||
public string Name { get; set; } | ||
public string Description { get; set; } | ||
public string ImagePath { get; set; } | ||
public string FileName { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using Microsoft.VisualBasic; | ||
using System; | ||
|
||
namespace SimpleList.Models | ||
{ | ||
public class Link | ||
{ | ||
public int ID { get; set; } | ||
public DateTime CreatedAt { get; set; } | ||
public DateTime UpdatedAt { get; set; } | ||
public DateTime? DeletedAt { get; set; } | ||
public string title { get; set; } | ||
public string content { get; set; } | ||
public string password { get; set; } | ||
public DateTime expire_date { get; set; } | ||
public int user_id { get; set; } | ||
public int category_id { get; set; } | ||
public int views { get; set; } | ||
} | ||
|
||
public class LinkResponse | ||
{ | ||
public int code { get; set; } | ||
public Link data { get; set; } | ||
} | ||
|
||
public class LinksResponse | ||
{ | ||
public int code { get; set; } | ||
public Link[] data { get; set; } | ||
} | ||
|
||
public class CreateLinkResponse : LinkResponse | ||
{ | ||
public string msg { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Page | ||
x:Class="SimpleList.Pages.ToolPage" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:controls="using:SimpleList.Controls" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" | ||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> | ||
|
||
<Page.Resources> | ||
<controls:ItemCard /> | ||
</Page.Resources> | ||
|
||
<Grid x:Name="HeaderGrid" CornerRadius="8,0,0,0"> | ||
<GridView | ||
Padding="24,36,24,36" | ||
IsItemClickEnabled="True" | ||
IsSwipeEnabled="False" | ||
ItemTemplate="{StaticResource CardItemControlTemplate}" | ||
ItemsSource="{x:Bind Items, Mode=OneWay}" | ||
ItemClick="OnToolItemClick" | ||
SelectionMode="None" /> | ||
</Grid> | ||
</Page> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using Microsoft.UI.Xaml.Controls; | ||
using SimpleList.Models; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Runtime.CompilerServices; | ||
|
||
namespace SimpleList.Pages | ||
{ | ||
public partial class ToolPage : Page, INotifyPropertyChanged | ||
{ | ||
public ToolPage() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null) | ||
{ | ||
if (Equals(storage, value)) return false; | ||
|
||
storage = value; | ||
NotifyPropertyChanged(propertyName); | ||
return true; | ||
} | ||
|
||
protected void NotifyPropertyChanged([CallerMemberName] string propertyName = null) | ||
{ | ||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); | ||
} | ||
|
||
private IEnumerable<ToolItem> _items = new List<ToolItem> { | ||
new ToolItem | ||
{ | ||
Name = "Share Community", | ||
Description = "Share and browse OneDrive files", | ||
ImagePath = "/Assets/link-share.png", | ||
FileName = "ShareCommunity" | ||
}, | ||
}; | ||
public IEnumerable<ToolItem> Items | ||
{ | ||
get => _items; | ||
set => SetProperty(ref _items, value); | ||
} | ||
|
||
public event PropertyChangedEventHandler PropertyChanged; | ||
|
||
private void OnToolItemClick(object sender, ItemClickEventArgs e) | ||
{ | ||
ToolItem item = (ToolItem)e.ClickedItem; | ||
Type pageType = Type.GetType("SimpleList.Pages.Tools." + item.FileName); | ||
(App.StartupWindow as MainWindow).Navigate(pageType); | ||
} | ||
} | ||
} |
Oops, something went wrong.