initial commit
407
.gitignore
vendored
Normal file
@ -0,0 +1,407 @@
|
|||||||
|
Ref/*.snk
|
||||||
|
|
||||||
|
# globs
|
||||||
|
Makefile.in
|
||||||
|
*.userprefs
|
||||||
|
*.usertasks
|
||||||
|
config.make
|
||||||
|
config.status
|
||||||
|
aclocal.m4
|
||||||
|
install-sh
|
||||||
|
autom4te.cache/
|
||||||
|
*.tar.gz
|
||||||
|
tarballs/
|
||||||
|
test-results/
|
||||||
|
|
||||||
|
# Mac bundle stuff
|
||||||
|
*.dmg
|
||||||
|
*.app
|
||||||
|
|
||||||
|
# content below from: https://github.com/github/gitignore/blob/main/Global/macOS.gitignore
|
||||||
|
# General
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
# Icon must end with two \r
|
||||||
|
Icon
|
||||||
|
|
||||||
|
|
||||||
|
# Thumbnails
|
||||||
|
._*
|
||||||
|
|
||||||
|
# Files that might appear in the root of a volume
|
||||||
|
.DocumentRevisions-V100
|
||||||
|
.fseventsd
|
||||||
|
.Spotlight-V100
|
||||||
|
.TemporaryItems
|
||||||
|
.Trashes
|
||||||
|
.VolumeIcon.icns
|
||||||
|
.com.apple.timemachine.donotpresent
|
||||||
|
|
||||||
|
# Directories potentially created on remote AFP share
|
||||||
|
.AppleDB
|
||||||
|
.AppleDesktop
|
||||||
|
Network Trash Folder
|
||||||
|
Temporary Items
|
||||||
|
.apdisk
|
||||||
|
|
||||||
|
# content below from: https://github.com/github/gitignore/blob/main/Global/Windows.gitignore
|
||||||
|
# Windows thumbnail cache files
|
||||||
|
Thumbs.db
|
||||||
|
ehthumbs.db
|
||||||
|
ehthumbs_vista.db
|
||||||
|
|
||||||
|
# Dump file
|
||||||
|
*.stackdump
|
||||||
|
|
||||||
|
# Folder config file
|
||||||
|
[Dd]esktop.ini
|
||||||
|
|
||||||
|
# Recycle Bin used on file shares
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
|
||||||
|
# Windows Installer files
|
||||||
|
*.cab
|
||||||
|
*.msi
|
||||||
|
*.msix
|
||||||
|
*.msm
|
||||||
|
*.msp
|
||||||
|
|
||||||
|
# Windows shortcuts
|
||||||
|
*.lnk
|
||||||
|
|
||||||
|
# content below from: https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||||
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
##
|
||||||
|
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
|
*.userprefs
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Dd]ebugPublic/
|
||||||
|
[Rr]elease/
|
||||||
|
[Rr]eleases/
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
|
bld/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
[Ll]og/
|
||||||
|
|
||||||
|
# Visual Studio 2015/2017 cache/options directory
|
||||||
|
.vs/
|
||||||
|
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||||
|
#wwwroot/
|
||||||
|
|
||||||
|
# Visual Studio 2017 auto generated files
|
||||||
|
Generated\ Files/
|
||||||
|
|
||||||
|
# MSTest test Results
|
||||||
|
[Tt]est[Rr]esult*/
|
||||||
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
|
# NUNIT
|
||||||
|
*.VisualState.xml
|
||||||
|
TestResult.xml
|
||||||
|
|
||||||
|
# Build Results of an ATL Project
|
||||||
|
[Dd]ebugPS/
|
||||||
|
[Rr]eleasePS/
|
||||||
|
dlldata.c
|
||||||
|
|
||||||
|
# Benchmark Results
|
||||||
|
BenchmarkDotNet.Artifacts/
|
||||||
|
|
||||||
|
# .NET Core
|
||||||
|
project.lock.json
|
||||||
|
project.fragment.lock.json
|
||||||
|
artifacts/
|
||||||
|
|
||||||
|
# StyleCop
|
||||||
|
StyleCopReport.xml
|
||||||
|
|
||||||
|
# Files built by Visual Studio
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*_h.h
|
||||||
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.obj
|
||||||
|
*.iobj
|
||||||
|
*.pch
|
||||||
|
*.pdb
|
||||||
|
*.ipdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.tmp_proj
|
||||||
|
*_wpftmp.csproj
|
||||||
|
*.log
|
||||||
|
*.vspscc
|
||||||
|
*.vssscc
|
||||||
|
.builds
|
||||||
|
*.pidb
|
||||||
|
*.svclog
|
||||||
|
*.scc
|
||||||
|
|
||||||
|
# Chutzpah Test files
|
||||||
|
_Chutzpah*
|
||||||
|
|
||||||
|
# Visual C++ cache files
|
||||||
|
ipch/
|
||||||
|
*.aps
|
||||||
|
*.ncb
|
||||||
|
*.opendb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.cachefile
|
||||||
|
*.VC.db
|
||||||
|
*.VC.VC.opendb
|
||||||
|
|
||||||
|
# Visual Studio profiler
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
*.vspx
|
||||||
|
*.sap
|
||||||
|
|
||||||
|
# Visual Studio Trace Files
|
||||||
|
*.e2e
|
||||||
|
|
||||||
|
# TFS 2012 Local Workspace
|
||||||
|
$tf/
|
||||||
|
|
||||||
|
# Guidance Automation Toolkit
|
||||||
|
*.gpState
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*/
|
||||||
|
*.[Rr]e[Ss]harper
|
||||||
|
*.DotSettings.user
|
||||||
|
|
||||||
|
# JustCode is a .NET coding add-in
|
||||||
|
.JustCode
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_TeamCity*
|
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
# AxoCover is a Code Coverage Tool
|
||||||
|
.axoCover/*
|
||||||
|
!.axoCover/settings.json
|
||||||
|
|
||||||
|
# Visual Studio code coverage results
|
||||||
|
*.coverage
|
||||||
|
*.coveragexml
|
||||||
|
|
||||||
|
# NCrunch
|
||||||
|
_NCrunch_*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
nCrunchTemp_*
|
||||||
|
|
||||||
|
# MightyMoose
|
||||||
|
*.mm.*
|
||||||
|
AutoTest.Net/
|
||||||
|
|
||||||
|
# Web workbench (sass)
|
||||||
|
.sass-cache/
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress/
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish/
|
||||||
|
|
||||||
|
# Publish Web Output
|
||||||
|
*.[Pp]ublish.xml
|
||||||
|
*.azurePubxml
|
||||||
|
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||||
|
# but database connection strings (with potential passwords) will be unencrypted
|
||||||
|
*.pubxml
|
||||||
|
*.publishproj
|
||||||
|
|
||||||
|
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||||
|
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||||
|
# in these scripts will be unencrypted
|
||||||
|
PublishScripts/
|
||||||
|
|
||||||
|
# NuGet Packages
|
||||||
|
*.nupkg
|
||||||
|
# The packages folder can be ignored because of Package Restore
|
||||||
|
**/[Pp]ackages/*
|
||||||
|
# except build/, which is used as an MSBuild target.
|
||||||
|
!**/[Pp]ackages/build/
|
||||||
|
# Uncomment if necessary however generally it will be regenerated when needed
|
||||||
|
#!**/[Pp]ackages/repositories.config
|
||||||
|
# NuGet v3's project.json files produces more ignorable files
|
||||||
|
*.nuget.props
|
||||||
|
*.nuget.targets
|
||||||
|
|
||||||
|
# Microsoft Azure Build Output
|
||||||
|
csx/
|
||||||
|
*.build.csdef
|
||||||
|
|
||||||
|
# Microsoft Azure Emulator
|
||||||
|
ecf/
|
||||||
|
rcf/
|
||||||
|
|
||||||
|
# Windows Store app package directories and files
|
||||||
|
AppPackages/
|
||||||
|
BundleArtifacts/
|
||||||
|
Package.StoreAssociation.xml
|
||||||
|
_pkginfo.txt
|
||||||
|
*.appx
|
||||||
|
|
||||||
|
# Visual Studio cache files
|
||||||
|
# files ending in .cache can be ignored
|
||||||
|
*.[Cc]ache
|
||||||
|
# but keep track of directories ending in .cache
|
||||||
|
!*.[Cc]ache/
|
||||||
|
|
||||||
|
# Others
|
||||||
|
ClientBin/
|
||||||
|
~$*
|
||||||
|
*~
|
||||||
|
*.dbmdl
|
||||||
|
*.dbproj.schemaview
|
||||||
|
*.jfm
|
||||||
|
*.pfx
|
||||||
|
*.publishsettings
|
||||||
|
orleans.codegen.cs
|
||||||
|
|
||||||
|
# Including strong name files can present a security risk
|
||||||
|
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||||
|
#*.snk
|
||||||
|
|
||||||
|
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||||
|
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||||
|
#bower_components/
|
||||||
|
|
||||||
|
# RIA/Silverlight projects
|
||||||
|
Generated_Code/
|
||||||
|
|
||||||
|
# Backup & report files from converting an old project file
|
||||||
|
# to a newer Visual Studio version. Backup files are not needed,
|
||||||
|
# because we have git ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
UpgradeLog*.htm
|
||||||
|
ServiceFabricBackup/
|
||||||
|
*.rptproj.bak
|
||||||
|
|
||||||
|
# SQL Server files
|
||||||
|
*.mdf
|
||||||
|
*.ldf
|
||||||
|
*.ndf
|
||||||
|
|
||||||
|
# Business Intelligence projects
|
||||||
|
*.rdl.data
|
||||||
|
*.bim.layout
|
||||||
|
*.bim_*.settings
|
||||||
|
*.rptproj.rsuser
|
||||||
|
|
||||||
|
# Microsoft Fakes
|
||||||
|
FakesAssemblies/
|
||||||
|
|
||||||
|
# GhostDoc plugin setting file
|
||||||
|
*.GhostDoc.xml
|
||||||
|
|
||||||
|
# Node.js Tools for Visual Studio
|
||||||
|
.ntvs_analysis.dat
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# Visual Studio 6 build log
|
||||||
|
*.plg
|
||||||
|
|
||||||
|
# Visual Studio 6 workspace options file
|
||||||
|
*.opt
|
||||||
|
|
||||||
|
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||||
|
*.vbw
|
||||||
|
|
||||||
|
# Visual Studio LightSwitch build output
|
||||||
|
**/*.HTMLClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/ModelManifest.xml
|
||||||
|
**/*.Server/GeneratedArtifacts
|
||||||
|
**/*.Server/ModelManifest.xml
|
||||||
|
_Pvt_Extensions
|
||||||
|
|
||||||
|
# Paket dependency manager
|
||||||
|
.paket/paket.exe
|
||||||
|
paket-files/
|
||||||
|
|
||||||
|
# FAKE - F# Make
|
||||||
|
.fake/
|
||||||
|
|
||||||
|
# JetBrains Rider
|
||||||
|
.idea/
|
||||||
|
*.sln.iml
|
||||||
|
|
||||||
|
# CodeRush personal settings
|
||||||
|
.cr/personal
|
||||||
|
|
||||||
|
# Python Tools for Visual Studio (PTVS)
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
|
||||||
|
# Cake - Uncomment if you are using it
|
||||||
|
# tools/**
|
||||||
|
# !tools/packages.config
|
||||||
|
|
||||||
|
# Tabs Studio
|
||||||
|
*.tss
|
||||||
|
|
||||||
|
# Telerik's JustMock configuration file
|
||||||
|
*.jmconfig
|
||||||
|
|
||||||
|
# BizTalk build output
|
||||||
|
*.btp.cs
|
||||||
|
*.btm.cs
|
||||||
|
*.odx.cs
|
||||||
|
*.xsd.cs
|
||||||
|
|
||||||
|
# OpenCover UI analysis results
|
||||||
|
OpenCover/
|
||||||
|
|
||||||
|
# Azure Stream Analytics local run output
|
||||||
|
ASALocalRun/
|
||||||
|
|
||||||
|
# MSBuild Binary and Structured Log
|
||||||
|
*.binlog
|
||||||
|
|
||||||
|
# NVidia Nsight GPU debugger configuration file
|
||||||
|
*.nvuser
|
||||||
|
|
||||||
|
# MFractors (Xamarin productivity tool) working folder
|
||||||
|
.mfractor/
|
||||||
|
|
||||||
|
# Local History for Visual Studio
|
||||||
|
.localhistory/
|
32
Gallery.Share/App.xaml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<Application xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
x:Class="Gallery.App">
|
||||||
|
<!--
|
||||||
|
Define global resources and styles here, that apply to all pages in your app.
|
||||||
|
-->
|
||||||
|
<Application.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<Color x:Key="Primary">#2196F3</Color>
|
||||||
|
<Style TargetType="Button">
|
||||||
|
<Setter Property="TextColor" Value="White"></Setter>
|
||||||
|
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||||
|
<VisualStateGroupList>
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
<VisualState x:Name="Normal">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Property="BackgroundColor" Value="{StaticResource Primary}" />
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="Disabled">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Property="BackgroundColor" Value="#332196F3" />
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateGroupList>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
32
Gallery.Share/App.xaml.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
using System;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
using Xamarin.Forms.Xaml;
|
||||||
|
using Gallery.Services;
|
||||||
|
using Gallery.Views;
|
||||||
|
|
||||||
|
namespace Gallery
|
||||||
|
{
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
|
||||||
|
public App()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
DependencyService.Register<MockDataStore>();
|
||||||
|
MainPage = new AppShell();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnStart()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnSleep()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnResume()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
136
Gallery.Share/AppShell.xaml
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Shell xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
xmlns:local="clr-namespace:Gallery.Views"
|
||||||
|
Title="Gallery"
|
||||||
|
x:Class="Gallery.AppShell">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
The overall app visual hierarchy is defined here, along with navigation.
|
||||||
|
|
||||||
|
https://docs.microsoft.com/xamarin/xamarin-forms/app-fundamentals/shell/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<Shell.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<Style x:Key="BaseStyle" TargetType="Element">
|
||||||
|
<Setter Property="Shell.BackgroundColor" Value="{StaticResource Primary}" />
|
||||||
|
<Setter Property="Shell.ForegroundColor" Value="White" />
|
||||||
|
<Setter Property="Shell.TitleColor" Value="White" />
|
||||||
|
<Setter Property="Shell.DisabledColor" Value="#B4FFFFFF" />
|
||||||
|
<Setter Property="Shell.UnselectedColor" Value="#95FFFFFF" />
|
||||||
|
<Setter Property="Shell.TabBarBackgroundColor" Value="{StaticResource Primary}" />
|
||||||
|
<Setter Property="Shell.TabBarForegroundColor" Value="White"/>
|
||||||
|
<Setter Property="Shell.TabBarUnselectedColor" Value="#95FFFFFF"/>
|
||||||
|
<Setter Property="Shell.TabBarTitleColor" Value="White"/>
|
||||||
|
</Style>
|
||||||
|
<Style TargetType="TabBar" BasedOn="{StaticResource BaseStyle}" />
|
||||||
|
<Style TargetType="FlyoutItem" BasedOn="{StaticResource BaseStyle}" />
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Default Styles for all Flyout Items
|
||||||
|
https://docs.microsoft.com/xamarin/xamarin-forms/app-fundamentals/shell/flyout#flyoutitem-and-menuitem-style-classes
|
||||||
|
-->
|
||||||
|
<Style Class="FlyoutItemLabelStyle" TargetType="Label">
|
||||||
|
<Setter Property="TextColor" Value="White"></Setter>
|
||||||
|
</Style>
|
||||||
|
<Style Class="FlyoutItemLayoutStyle" TargetType="Layout" ApplyToDerivedTypes="True">
|
||||||
|
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||||
|
<VisualStateGroupList>
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
<VisualState x:Name="Normal">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Property="BackgroundColor" Value="{x:OnPlatform UWP=Transparent, iOS=White}" />
|
||||||
|
<Setter TargetName="FlyoutItemLabel" Property="Label.TextColor" Value="{StaticResource Primary}" />
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="Selected">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Property="BackgroundColor" Value="{StaticResource Primary}" />
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateGroupList>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Custom Style you can apply to any Flyout Item
|
||||||
|
-->
|
||||||
|
<Style Class="MenuItemLayoutStyle" TargetType="Layout" ApplyToDerivedTypes="True">
|
||||||
|
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||||
|
<VisualStateGroupList>
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
<VisualState x:Name="Normal">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter TargetName="FlyoutItemLabel" Property="Label.TextColor" Value="{StaticResource Primary}" />
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateGroupList>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</Shell.Resources>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
When the Flyout is visible this defines the content to display in the flyout.
|
||||||
|
FlyoutDisplayOptions="AsMultipleItems" will create a separate flyout item for each child element
|
||||||
|
https://docs.microsoft.com/dotnet/api/xamarin.forms.shellgroupitem.flyoutdisplayoptions?view=xamarin-forms
|
||||||
|
-->
|
||||||
|
<FlyoutItem Title="About" Icon="icon_about.png">
|
||||||
|
<ShellContent Route="AboutPage" ContentTemplate="{DataTemplate local:AboutPage}" />
|
||||||
|
</FlyoutItem>
|
||||||
|
<FlyoutItem Title="Browse" Icon="icon_feed.png">
|
||||||
|
<ShellContent Route="ItemsPage" ContentTemplate="{DataTemplate local:ItemsPage}" />
|
||||||
|
</FlyoutItem>
|
||||||
|
|
||||||
|
<!-- When the Flyout is visible this will be a menu item you can tie a click behavior to -->
|
||||||
|
<MenuItem Text="Logout" StyleClass="MenuItemLayoutStyle" Clicked="OnMenuItemClicked">
|
||||||
|
</MenuItem>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
TabBar lets you define content that won't show up in a flyout menu. When this content is active
|
||||||
|
the flyout menu won't be available. This is useful for creating areas of the application where
|
||||||
|
you don't want users to be able to navigate away from. If you would like to navigate to this
|
||||||
|
content you can do so by calling
|
||||||
|
await Shell.Current.GoToAsync("//LoginPage");
|
||||||
|
-->
|
||||||
|
<TabBar>
|
||||||
|
<ShellContent Route="LoginPage" ContentTemplate="{DataTemplate local:LoginPage}" />
|
||||||
|
</TabBar>
|
||||||
|
|
||||||
|
<!-- Optional Templates
|
||||||
|
// These may be provided inline as below or as separate classes.
|
||||||
|
|
||||||
|
// This header appears at the top of the Flyout.
|
||||||
|
// https://docs.microsoft.com/xamarin/xamarin-forms/app-fundamentals/shell/flyout#flyout-header
|
||||||
|
<Shell.FlyoutHeaderTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid>ContentHere</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</Shell.FlyoutHeaderTemplate>
|
||||||
|
|
||||||
|
// ItemTemplate is for ShellItems as displayed in a Flyout
|
||||||
|
// https://docs.microsoft.com/xamarin/xamarin-forms/app-fundamentals/shell/flyout#define-flyoutitem-appearance
|
||||||
|
<Shell.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<ContentView>
|
||||||
|
Bindable Properties: Title, Icon
|
||||||
|
</ContentView>
|
||||||
|
</DataTemplate>
|
||||||
|
</Shell.ItemTemplate>
|
||||||
|
|
||||||
|
// MenuItemTemplate is for MenuItems as displayed in a Flyout
|
||||||
|
// https://docs.microsoft.com/xamarin/xamarin-forms/app-fundamentals/shell/flyout#define-menuitem-appearance
|
||||||
|
<Shell.MenuItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<ContentView>
|
||||||
|
Bindable Properties: Text, Icon
|
||||||
|
</ContentView>
|
||||||
|
</DataTemplate>
|
||||||
|
</Shell.MenuItemTemplate>
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
|
</Shell>
|
23
Gallery.Share/AppShell.xaml.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Gallery.ViewModels;
|
||||||
|
using Gallery.Views;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
namespace Gallery
|
||||||
|
{
|
||||||
|
public partial class AppShell : Xamarin.Forms.Shell
|
||||||
|
{
|
||||||
|
public AppShell()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
Routing.RegisterRoute(nameof(ItemDetailPage), typeof(ItemDetailPage));
|
||||||
|
Routing.RegisterRoute(nameof(NewItemPage), typeof(NewItemPage));
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnMenuItemClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
await Shell.Current.GoToAsync("//LoginPage");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
79
Gallery.Share/Gallery.Share.projitems
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||||
|
<HasSharedItems>true</HasSharedItems>
|
||||||
|
<SharedGUID>{E72B5C40-090B-4A1C-9170-BD33C14A9A91}</SharedGUID>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Label="Configuration">
|
||||||
|
<Import_RootNamespace>Gallery.Share</Import_RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Models\Item.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Services\IDataStore.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Services\MockDataStore.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\AboutViewModel.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\BaseViewModel.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\ItemDetailViewModel.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\ItemsViewModel.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\LoginViewModel.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\NewItemViewModel.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Views\AboutPage.xaml.cs">
|
||||||
|
<DependentUpon>Views\AboutPage.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Views\ItemDetailPage.xaml.cs">
|
||||||
|
<DependentUpon>Views\ItemDetailPage.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Views\ItemsPage.xaml.cs">
|
||||||
|
<DependentUpon>Views\ItemsPage.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Views\LoginPage.xaml.cs">
|
||||||
|
<DependentUpon>Views\LoginPage.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Views\NewItemPage.xaml.cs">
|
||||||
|
<DependentUpon>Views\NewItemPage.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)App.xaml.cs">
|
||||||
|
<DependentUpon>App.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)AppShell.xaml.cs">
|
||||||
|
<DependentUpon>AppShell.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="$(MSBuildThisFileDirectory)Models\" />
|
||||||
|
<Folder Include="$(MSBuildThisFileDirectory)Services\" />
|
||||||
|
<Folder Include="$(MSBuildThisFileDirectory)ViewModels\" />
|
||||||
|
<Folder Include="$(MSBuildThisFileDirectory)Views\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Views\AboutPage.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Views\ItemDetailPage.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Views\ItemsPage.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Views\LoginPage.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Views\NewItemPage.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="$(MSBuildThisFileDirectory)App.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="$(MSBuildThisFileDirectory)AppShell.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
11
Gallery.Share/Gallery.Share.shproj
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ProjectGuid>{E72B5C40-090B-4A1C-9170-BD33C14A9A91}</ProjectGuid>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
|
||||||
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
|
||||||
|
<Import Project="Gallery.Share.projitems" Label="Shared" />
|
||||||
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
|
||||||
|
</Project>
|
34
Gallery.Share/GettingStarted.txt
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
Welcome to Xamarin.Forms! Here are some tips to get started building your app.
|
||||||
|
|
||||||
|
Building Your App UI
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
XAML Hot Reload quickly applies UI changes as you make them to your running app.
|
||||||
|
This is the most productive way to preview and iteratively create your UI.
|
||||||
|
|
||||||
|
Try it out:
|
||||||
|
|
||||||
|
1. Run the app by clicking the Start Debugging (play) button in the above toolbar.
|
||||||
|
2. Open <MainProject>\Views\AboutPage.xaml.
|
||||||
|
Don't stop the app - keep it running while making changes.
|
||||||
|
3. Change something! Hint: change the Accent color on line 14 from "#96d1ff" to "Pink".
|
||||||
|
4. Watch the About screen update on the device or emulator, with the logo background now pink.
|
||||||
|
|
||||||
|
Keep going and try more changes!
|
||||||
|
|
||||||
|
QuickStart Guide
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Learn more of the fundamentals for building apps with Xamarin here: https://aka.ms/xamarin-quickstart
|
||||||
|
|
||||||
|
Your App Shell
|
||||||
|
--------------
|
||||||
|
|
||||||
|
This template uses Shell, an app container that reduces the complexity of your apps by providing fundamental features including:
|
||||||
|
|
||||||
|
- A single place to describe the app's visual hierarchy.
|
||||||
|
- Common navigation such as a flyout menu and tabs.
|
||||||
|
- A URI-based navigation scheme that permits navigation to any page in the application.
|
||||||
|
- An integrated search handler.
|
||||||
|
|
||||||
|
Open AppShell.xaml to begin exploring. To learn more about Shell visit: https://docs.microsoft.com/xamarin/xamarin-forms/app-fundamentals/shell/introduction
|
11
Gallery.Share/Models/Item.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Gallery.Models
|
||||||
|
{
|
||||||
|
public class Item
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
public string Text { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
}
|
||||||
|
}
|
15
Gallery.Share/Services/IDataStore.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Gallery.Services
|
||||||
|
{
|
||||||
|
public interface IDataStore<T>
|
||||||
|
{
|
||||||
|
Task<bool> AddItemAsync(T item);
|
||||||
|
Task<bool> UpdateItemAsync(T item);
|
||||||
|
Task<bool> DeleteItemAsync(string id);
|
||||||
|
Task<T> GetItemAsync(string id);
|
||||||
|
Task<IEnumerable<T>> GetItemsAsync(bool forceRefresh = false);
|
||||||
|
}
|
||||||
|
}
|
60
Gallery.Share/Services/MockDataStore.cs
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Gallery.Models;
|
||||||
|
|
||||||
|
namespace Gallery.Services
|
||||||
|
{
|
||||||
|
public class MockDataStore : IDataStore<Item>
|
||||||
|
{
|
||||||
|
readonly List<Item> items;
|
||||||
|
|
||||||
|
public MockDataStore()
|
||||||
|
{
|
||||||
|
items = new List<Item>()
|
||||||
|
{
|
||||||
|
new Item { Id = Guid.NewGuid().ToString(), Text = "First item", Description="This is an item description." },
|
||||||
|
new Item { Id = Guid.NewGuid().ToString(), Text = "Second item", Description="This is an item description." },
|
||||||
|
new Item { Id = Guid.NewGuid().ToString(), Text = "Third item", Description="This is an item description." },
|
||||||
|
new Item { Id = Guid.NewGuid().ToString(), Text = "Fourth item", Description="This is an item description." },
|
||||||
|
new Item { Id = Guid.NewGuid().ToString(), Text = "Fifth item", Description="This is an item description." },
|
||||||
|
new Item { Id = Guid.NewGuid().ToString(), Text = "Sixth item", Description="This is an item description." }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> AddItemAsync(Item item)
|
||||||
|
{
|
||||||
|
items.Add(item);
|
||||||
|
|
||||||
|
return await Task.FromResult(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> UpdateItemAsync(Item item)
|
||||||
|
{
|
||||||
|
var oldItem = items.Where((Item arg) => arg.Id == item.Id).FirstOrDefault();
|
||||||
|
items.Remove(oldItem);
|
||||||
|
items.Add(item);
|
||||||
|
|
||||||
|
return await Task.FromResult(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> DeleteItemAsync(string id)
|
||||||
|
{
|
||||||
|
var oldItem = items.Where((Item arg) => arg.Id == id).FirstOrDefault();
|
||||||
|
items.Remove(oldItem);
|
||||||
|
|
||||||
|
return await Task.FromResult(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Item> GetItemAsync(string id)
|
||||||
|
{
|
||||||
|
return await Task.FromResult(items.FirstOrDefault(s => s.Id == id));
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<Item>> GetItemsAsync(bool forceRefresh = false)
|
||||||
|
{
|
||||||
|
return await Task.FromResult(items);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
18
Gallery.Share/ViewModels/AboutViewModel.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using Xamarin.Essentials;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
namespace Gallery.ViewModels
|
||||||
|
{
|
||||||
|
public class AboutViewModel : BaseViewModel
|
||||||
|
{
|
||||||
|
public AboutViewModel()
|
||||||
|
{
|
||||||
|
Title = "About";
|
||||||
|
OpenWebCommand = new Command(async () => await Browser.OpenAsync("https://aka.ms/xamarin-quickstart"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICommand OpenWebCommand { get; }
|
||||||
|
}
|
||||||
|
}
|
56
Gallery.Share/ViewModels/BaseViewModel.cs
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
using Gallery.Models;
|
||||||
|
using Gallery.Services;
|
||||||
|
|
||||||
|
namespace Gallery.ViewModels
|
||||||
|
{
|
||||||
|
public class BaseViewModel : INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
public IDataStore<Item> DataStore => DependencyService.Get<IDataStore<Item>>();
|
||||||
|
|
||||||
|
bool isBusy = false;
|
||||||
|
public bool IsBusy
|
||||||
|
{
|
||||||
|
get { return isBusy; }
|
||||||
|
set { SetProperty(ref isBusy, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
string title = string.Empty;
|
||||||
|
public string Title
|
||||||
|
{
|
||||||
|
get { return title; }
|
||||||
|
set { SetProperty(ref title, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
protected bool SetProperty<T>(ref T backingStore, T value,
|
||||||
|
[CallerMemberName] string propertyName = "",
|
||||||
|
Action onChanged = null)
|
||||||
|
{
|
||||||
|
if (EqualityComparer<T>.Default.Equals(backingStore, value))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
backingStore = value;
|
||||||
|
onChanged?.Invoke();
|
||||||
|
OnPropertyChanged(propertyName);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region INotifyPropertyChanged
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
protected void OnPropertyChanged([CallerMemberName] string propertyName = "")
|
||||||
|
{
|
||||||
|
var changed = PropertyChanged;
|
||||||
|
if (changed == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
changed.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
57
Gallery.Share/ViewModels/ItemDetailViewModel.cs
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Gallery.Models;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
namespace Gallery.ViewModels
|
||||||
|
{
|
||||||
|
[QueryProperty(nameof(ItemId), nameof(ItemId))]
|
||||||
|
public class ItemDetailViewModel : BaseViewModel
|
||||||
|
{
|
||||||
|
private string itemId;
|
||||||
|
private string text;
|
||||||
|
private string description;
|
||||||
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
public string Text
|
||||||
|
{
|
||||||
|
get => text;
|
||||||
|
set => SetProperty(ref text, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Description
|
||||||
|
{
|
||||||
|
get => description;
|
||||||
|
set => SetProperty(ref description, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string ItemId
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return itemId;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
itemId = value;
|
||||||
|
LoadItemId(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void LoadItemId(string itemId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var item = await DataStore.GetItemAsync(itemId);
|
||||||
|
Id = item.Id;
|
||||||
|
Text = item.Text;
|
||||||
|
Description = item.Description;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
Debug.WriteLine("Failed to Load Item");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
86
Gallery.Share/ViewModels/ItemsViewModel.cs
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
using Gallery.Models;
|
||||||
|
using Gallery.Views;
|
||||||
|
|
||||||
|
namespace Gallery.ViewModels
|
||||||
|
{
|
||||||
|
public class ItemsViewModel : BaseViewModel
|
||||||
|
{
|
||||||
|
private Item _selectedItem;
|
||||||
|
|
||||||
|
public ObservableCollection<Item> Items { get; }
|
||||||
|
public Command LoadItemsCommand { get; }
|
||||||
|
public Command AddItemCommand { get; }
|
||||||
|
public Command<Item> ItemTapped { get; }
|
||||||
|
|
||||||
|
public ItemsViewModel()
|
||||||
|
{
|
||||||
|
Title = "Browse";
|
||||||
|
Items = new ObservableCollection<Item>();
|
||||||
|
LoadItemsCommand = new Command(async () => await ExecuteLoadItemsCommand());
|
||||||
|
|
||||||
|
ItemTapped = new Command<Item>(OnItemSelected);
|
||||||
|
|
||||||
|
AddItemCommand = new Command(OnAddItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
async Task ExecuteLoadItemsCommand()
|
||||||
|
{
|
||||||
|
IsBusy = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Items.Clear();
|
||||||
|
var items = await DataStore.GetItemsAsync(true);
|
||||||
|
foreach (var item in items)
|
||||||
|
{
|
||||||
|
Items.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Debug.WriteLine(ex);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
IsBusy = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnAppearing()
|
||||||
|
{
|
||||||
|
IsBusy = true;
|
||||||
|
SelectedItem = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Item SelectedItem
|
||||||
|
{
|
||||||
|
get => _selectedItem;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _selectedItem, value);
|
||||||
|
OnItemSelected(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnAddItem(object obj)
|
||||||
|
{
|
||||||
|
await Shell.Current.GoToAsync(nameof(NewItemPage));
|
||||||
|
}
|
||||||
|
|
||||||
|
async void OnItemSelected(Item item)
|
||||||
|
{
|
||||||
|
if (item == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// This will push the ItemDetailPage onto the navigation stack
|
||||||
|
await Shell.Current.GoToAsync($"{nameof(ItemDetailPage)}?{nameof(ItemDetailViewModel.ItemId)}={item.Id}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
24
Gallery.Share/ViewModels/LoginViewModel.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using Gallery.Views;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
namespace Gallery.ViewModels
|
||||||
|
{
|
||||||
|
public class LoginViewModel : BaseViewModel
|
||||||
|
{
|
||||||
|
public Command LoginCommand { get; }
|
||||||
|
|
||||||
|
public LoginViewModel()
|
||||||
|
{
|
||||||
|
LoginCommand = new Command(OnLoginClicked);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnLoginClicked(object obj)
|
||||||
|
{
|
||||||
|
// Prefixing with `//` switches to a different navigation stack instead of pushing to the active one
|
||||||
|
await Shell.Current.GoToAsync($"//{nameof(AboutPage)}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
65
Gallery.Share/ViewModels/NewItemViewModel.cs
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using Gallery.Models;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
namespace Gallery.ViewModels
|
||||||
|
{
|
||||||
|
public class NewItemViewModel : BaseViewModel
|
||||||
|
{
|
||||||
|
private string text;
|
||||||
|
private string description;
|
||||||
|
|
||||||
|
public NewItemViewModel()
|
||||||
|
{
|
||||||
|
SaveCommand = new Command(OnSave, ValidateSave);
|
||||||
|
CancelCommand = new Command(OnCancel);
|
||||||
|
this.PropertyChanged +=
|
||||||
|
(_, __) => SaveCommand.ChangeCanExecute();
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ValidateSave()
|
||||||
|
{
|
||||||
|
return !String.IsNullOrWhiteSpace(text)
|
||||||
|
&& !String.IsNullOrWhiteSpace(description);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Text
|
||||||
|
{
|
||||||
|
get => text;
|
||||||
|
set => SetProperty(ref text, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Description
|
||||||
|
{
|
||||||
|
get => description;
|
||||||
|
set => SetProperty(ref description, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Command SaveCommand { get; }
|
||||||
|
public Command CancelCommand { get; }
|
||||||
|
|
||||||
|
private async void OnCancel()
|
||||||
|
{
|
||||||
|
// This will pop the current page off the navigation stack
|
||||||
|
await Shell.Current.GoToAsync("..");
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnSave()
|
||||||
|
{
|
||||||
|
Item newItem = new Item()
|
||||||
|
{
|
||||||
|
Id = Guid.NewGuid().ToString(),
|
||||||
|
Text = Text,
|
||||||
|
Description = Description
|
||||||
|
};
|
||||||
|
|
||||||
|
await DataStore.AddItemAsync(newItem);
|
||||||
|
|
||||||
|
// This will pop the current page off the navigation stack
|
||||||
|
await Shell.Current.GoToAsync("..");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
52
Gallery.Share/Views/AboutPage.xaml
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
x:Class="Gallery.Views.AboutPage"
|
||||||
|
xmlns:vm="clr-namespace:Gallery.ViewModels"
|
||||||
|
Title="{Binding Title}">
|
||||||
|
|
||||||
|
<ContentPage.BindingContext>
|
||||||
|
<vm:AboutViewModel />
|
||||||
|
</ContentPage.BindingContext>
|
||||||
|
|
||||||
|
<ContentPage.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<Color x:Key="Accent">#96d1ff</Color>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</ContentPage.Resources>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<StackLayout BackgroundColor="{StaticResource Accent}" VerticalOptions="FillAndExpand" HorizontalOptions="Fill">
|
||||||
|
<StackLayout Orientation="Horizontal" HorizontalOptions="Center" VerticalOptions="Center">
|
||||||
|
<ContentView Padding="0,40,0,40" VerticalOptions="FillAndExpand">
|
||||||
|
<Image Source="xamarin_logo.png" VerticalOptions="Center" HeightRequest="64" />
|
||||||
|
</ContentView>
|
||||||
|
</StackLayout>
|
||||||
|
</StackLayout>
|
||||||
|
<ScrollView Grid.Row="1">
|
||||||
|
<StackLayout Orientation="Vertical" Padding="30,24,30,24" Spacing="10">
|
||||||
|
<Label Text="Start developing now" FontSize="Title"/>
|
||||||
|
<Label Text="Make changes to your XAML file and save to see your UI update in the running app with XAML Hot Reload. Give it a try!" FontSize="16" Padding="0,0,0,0"/>
|
||||||
|
<Label FontSize="16" Padding="0,24,0,0">
|
||||||
|
<Label.FormattedText>
|
||||||
|
<FormattedString>
|
||||||
|
<FormattedString.Spans>
|
||||||
|
<Span Text="Learn more at "/>
|
||||||
|
<Span Text="https://aka.ms/xamarin-quickstart" FontAttributes="Bold"/>
|
||||||
|
</FormattedString.Spans>
|
||||||
|
</FormattedString>
|
||||||
|
</Label.FormattedText>
|
||||||
|
</Label>
|
||||||
|
<Button Margin="0,10,0,0" Text="Learn more"
|
||||||
|
Command="{Binding OpenWebCommand}"
|
||||||
|
BackgroundColor="{StaticResource Primary}"
|
||||||
|
TextColor="White" />
|
||||||
|
</StackLayout>
|
||||||
|
</ScrollView>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
</ContentPage>
|
15
Gallery.Share/Views/AboutPage.xaml.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
using Xamarin.Forms.Xaml;
|
||||||
|
|
||||||
|
namespace Gallery.Views
|
||||||
|
{
|
||||||
|
public partial class AboutPage : ContentPage
|
||||||
|
{
|
||||||
|
public AboutPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
14
Gallery.Share/Views/ItemDetailPage.xaml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
x:Class="Gallery.Views.ItemDetailPage"
|
||||||
|
Title="{Binding Title}">
|
||||||
|
|
||||||
|
<StackLayout Spacing="20" Padding="15">
|
||||||
|
<Label Text="Text:" FontSize="Medium" />
|
||||||
|
<Label Text="{Binding Text}" FontSize="Small"/>
|
||||||
|
<Label Text="Description:" FontSize="Medium" />
|
||||||
|
<Label Text="{Binding Description}" FontSize="Small"/>
|
||||||
|
</StackLayout>
|
||||||
|
|
||||||
|
</ContentPage>
|
15
Gallery.Share/Views/ItemDetailPage.xaml.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System.ComponentModel;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
using Gallery.ViewModels;
|
||||||
|
|
||||||
|
namespace Gallery.Views
|
||||||
|
{
|
||||||
|
public partial class ItemDetailPage : ContentPage
|
||||||
|
{
|
||||||
|
public ItemDetailPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
BindingContext = new ItemDetailViewModel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
44
Gallery.Share/Views/ItemsPage.xaml
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
x:Class="Gallery.Views.ItemsPage"
|
||||||
|
Title="{Binding Title}"
|
||||||
|
xmlns:local="clr-namespace:Gallery.ViewModels"
|
||||||
|
xmlns:model="clr-namespace:Gallery.Models"
|
||||||
|
x:Name="BrowseItemsPage">
|
||||||
|
|
||||||
|
<ContentPage.ToolbarItems>
|
||||||
|
<ToolbarItem Text="Add" Command="{Binding AddItemCommand}" />
|
||||||
|
</ContentPage.ToolbarItems>
|
||||||
|
<!--
|
||||||
|
x:DataType enables compiled bindings for better performance and compile time validation of binding expressions.
|
||||||
|
https://docs.microsoft.com/xamarin/xamarin-forms/app-fundamentals/data-binding/compiled-bindings
|
||||||
|
-->
|
||||||
|
<RefreshView x:DataType="local:ItemsViewModel" Command="{Binding LoadItemsCommand}" IsRefreshing="{Binding IsBusy, Mode=TwoWay}">
|
||||||
|
<CollectionView x:Name="ItemsListView"
|
||||||
|
ItemsSource="{Binding Items}"
|
||||||
|
SelectionMode="None">
|
||||||
|
<CollectionView.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<StackLayout Padding="10" x:DataType="model:Item">
|
||||||
|
<Label Text="{Binding Text}"
|
||||||
|
LineBreakMode="NoWrap"
|
||||||
|
Style="{DynamicResource ListItemTextStyle}"
|
||||||
|
FontSize="16" />
|
||||||
|
<Label Text="{Binding Description}"
|
||||||
|
LineBreakMode="NoWrap"
|
||||||
|
Style="{DynamicResource ListItemDetailTextStyle}"
|
||||||
|
FontSize="13" />
|
||||||
|
<StackLayout.GestureRecognizers>
|
||||||
|
<TapGestureRecognizer
|
||||||
|
NumberOfTapsRequired="1"
|
||||||
|
Command="{Binding Source={RelativeSource AncestorType={x:Type local:ItemsViewModel}}, Path=ItemTapped}"
|
||||||
|
CommandParameter="{Binding .}">
|
||||||
|
</TapGestureRecognizer>
|
||||||
|
</StackLayout.GestureRecognizers>
|
||||||
|
</StackLayout>
|
||||||
|
</DataTemplate>
|
||||||
|
</CollectionView.ItemTemplate>
|
||||||
|
</CollectionView>
|
||||||
|
</RefreshView>
|
||||||
|
</ContentPage>
|
33
Gallery.Share/Views/ItemsPage.xaml.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
using Xamarin.Forms.Xaml;
|
||||||
|
|
||||||
|
using Gallery.Models;
|
||||||
|
using Gallery.Views;
|
||||||
|
using Gallery.ViewModels;
|
||||||
|
|
||||||
|
namespace Gallery.Views
|
||||||
|
{
|
||||||
|
public partial class ItemsPage : ContentPage
|
||||||
|
{
|
||||||
|
ItemsViewModel _viewModel;
|
||||||
|
|
||||||
|
public ItemsPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
BindingContext = _viewModel = new ItemsViewModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAppearing()
|
||||||
|
{
|
||||||
|
base.OnAppearing();
|
||||||
|
_viewModel.OnAppearing();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
14
Gallery.Share/Views/LoginPage.xaml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
x:Class="Gallery.Views.LoginPage"
|
||||||
|
Shell.NavBarIsVisible="False">
|
||||||
|
<ContentPage.Content>
|
||||||
|
<StackLayout Padding="10,0,10,0" VerticalOptions="Center">
|
||||||
|
<Button VerticalOptions="Center" Text="Login" Command="{Binding LoginCommand}"/>
|
||||||
|
</StackLayout>
|
||||||
|
</ContentPage.Content>
|
||||||
|
</ContentPage>
|
21
Gallery.Share/Views/LoginPage.xaml.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Gallery.ViewModels;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
using Xamarin.Forms.Xaml;
|
||||||
|
|
||||||
|
namespace Gallery.Views
|
||||||
|
{
|
||||||
|
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||||
|
public partial class LoginPage : ContentPage
|
||||||
|
{
|
||||||
|
public LoginPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
this.BindingContext = new LoginViewModel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
22
Gallery.Share/Views/NewItemPage.xaml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
x:Class="Gallery.Views.NewItemPage"
|
||||||
|
Shell.PresentationMode="ModalAnimated"
|
||||||
|
Title="New Item"
|
||||||
|
xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
|
||||||
|
ios:Page.UseSafeArea="true">
|
||||||
|
<ContentPage.Content>
|
||||||
|
<StackLayout Spacing="3" Padding="15">
|
||||||
|
<Label Text="Text" FontSize="Medium" />
|
||||||
|
<Entry Text="{Binding Text, Mode=TwoWay}" FontSize="Medium" />
|
||||||
|
<Label Text="Description" FontSize="Medium" />
|
||||||
|
<Editor Text="{Binding Description, Mode=TwoWay}" AutoSize="TextChanges" FontSize="Medium" Margin="0" />
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<Button Text="Cancel" Command="{Binding CancelCommand}" HorizontalOptions="FillAndExpand"></Button>
|
||||||
|
<Button Text="Save" Command="{Binding SaveCommand}" HorizontalOptions="FillAndExpand"></Button>
|
||||||
|
</StackLayout>
|
||||||
|
</StackLayout>
|
||||||
|
</ContentPage.Content>
|
||||||
|
|
||||||
|
</ContentPage>
|
22
Gallery.Share/Views/NewItemPage.xaml.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
using Xamarin.Forms.Xaml;
|
||||||
|
|
||||||
|
using Gallery.Models;
|
||||||
|
using Gallery.ViewModels;
|
||||||
|
|
||||||
|
namespace Gallery.Views
|
||||||
|
{
|
||||||
|
public partial class NewItemPage : ContentPage
|
||||||
|
{
|
||||||
|
public Item Item { get; set; }
|
||||||
|
|
||||||
|
public NewItemPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
BindingContext = new NewItemViewModel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
95
Gallery.Util/Converter.cs
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using Gallery.Util.Model;
|
||||||
|
|
||||||
|
namespace Gallery.Util
|
||||||
|
{
|
||||||
|
public class GalleryItemConverter : JsonConverter<GalleryItem>
|
||||||
|
{
|
||||||
|
public override GalleryItem Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||||
|
{
|
||||||
|
reader.Read();
|
||||||
|
if (reader.TokenType != JsonTokenType.StartObject)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var item = new GalleryItem();
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
if (reader.TokenType == JsonTokenType.PropertyName)
|
||||||
|
{
|
||||||
|
var name = reader.GetString();
|
||||||
|
reader.Read();
|
||||||
|
switch (name)
|
||||||
|
{
|
||||||
|
case nameof(GalleryItem.Id): item.Id = reader.GetInt64(); break;
|
||||||
|
case nameof(GalleryItem.Tags):
|
||||||
|
if (reader.TokenType == JsonTokenType.StartArray)
|
||||||
|
{
|
||||||
|
var tags = new List<string>();
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
if (reader.TokenType == JsonTokenType.EndArray)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (reader.TokenType == JsonTokenType.String)
|
||||||
|
{
|
||||||
|
tags.Add(reader.GetString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
item.Tags = tags.ToArray();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case nameof(GalleryItem.CreatedTime): item.CreatedTime = reader.GetDateTime(); break;
|
||||||
|
case nameof(GalleryItem.UpdatedTime): item.UpdatedTime = reader.GetDateTime(); break;
|
||||||
|
case nameof(GalleryItem.UserId): item.UserId = reader.GetString(); break;
|
||||||
|
case nameof(GalleryItem.UserName): item.UserName = reader.GetString(); break;
|
||||||
|
case nameof(GalleryItem.Source): item.Source = reader.GetString(); break;
|
||||||
|
case nameof(GalleryItem.PreviewUrl): item.PreviewUrl = reader.GetString(); break;
|
||||||
|
case nameof(GalleryItem.RawUrl): item.RawUrl = reader.GetString(); break;
|
||||||
|
case nameof(GalleryItem.Width): item.Width = reader.GetInt32(); break;
|
||||||
|
case nameof(GalleryItem.Height): item.Height = reader.GetInt32(); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Write(Utf8JsonWriter writer, GalleryItem value, JsonSerializerOptions options)
|
||||||
|
{
|
||||||
|
if (value == null)
|
||||||
|
{
|
||||||
|
writer.WriteNullValue();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.WriteStartObject();
|
||||||
|
|
||||||
|
writer.WriteNumber(nameof(GalleryItem.Id), value.Id);
|
||||||
|
if (value.Tags != null)
|
||||||
|
{
|
||||||
|
writer.WritePropertyName(nameof(GalleryItem.Tags));
|
||||||
|
writer.WriteStartArray();
|
||||||
|
for (var i = 0; i < value.Tags.Length; i++)
|
||||||
|
{
|
||||||
|
writer.WriteStringValue(value.Tags[i]);
|
||||||
|
}
|
||||||
|
writer.WriteEndArray();
|
||||||
|
}
|
||||||
|
writer.WriteString(nameof(GalleryItem.CreatedTime), value.CreatedTime);
|
||||||
|
writer.WriteString(nameof(GalleryItem.UpdatedTime), value.UpdatedTime);
|
||||||
|
writer.WriteString(nameof(GalleryItem.UserId), value.UserId);
|
||||||
|
writer.WriteString(nameof(GalleryItem.UserName), value.UserName);
|
||||||
|
writer.WriteString(nameof(GalleryItem.Source), value.Source);
|
||||||
|
writer.WriteString(nameof(GalleryItem.PreviewUrl), value.PreviewUrl);
|
||||||
|
writer.WriteString(nameof(GalleryItem.RawUrl), value.RawUrl);
|
||||||
|
writer.WriteNumber(nameof(GalleryItem.Width), value.Width);
|
||||||
|
writer.WriteNumber(nameof(GalleryItem.Height), value.Height);
|
||||||
|
|
||||||
|
writer.WriteEndObject();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
23
Gallery.Util/Gallery.Util.csproj
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
|
<SignAssembly>true</SignAssembly>
|
||||||
|
<AssemblyOriginatorKeyFile>..\Ref\Tsanie.snk</AssemblyOriginatorKeyFile>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Remove="System.Text.Json" />
|
||||||
|
<None Remove="Xamarin.Forms" />
|
||||||
|
<None Remove="Interface\" />
|
||||||
|
<None Remove="Model\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="System.Text.Json" Version="5.0.2" />
|
||||||
|
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2083" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Interface\" />
|
||||||
|
<Folder Include="Model\" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
11
Gallery.Util/Interface/IGallerySource.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using Gallery.Util.Model;
|
||||||
|
|
||||||
|
namespace Gallery.Util.Interface
|
||||||
|
{
|
||||||
|
public interface IGallerySource
|
||||||
|
{
|
||||||
|
string GetCookie();
|
||||||
|
|
||||||
|
GalleryItem[] GetRecentItems(int page);
|
||||||
|
}
|
||||||
|
}
|
79
Gallery.Util/Model/GalleryItem.cs
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
using System;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
namespace Gallery.Util.Model
|
||||||
|
{
|
||||||
|
[JsonConverter(typeof(GalleryItemConverter))]
|
||||||
|
public class GalleryItem : BindableObject
|
||||||
|
{
|
||||||
|
const double PREVIEW_WIDTH = 200.0;
|
||||||
|
|
||||||
|
public static readonly BindableProperty TagDescriptionProperty = BindableProperty.Create(nameof(TagDescription), typeof(string), typeof(GalleryItem));
|
||||||
|
public static readonly BindableProperty PreviewImageProperty = BindableProperty.Create(nameof(PreviewImage), typeof(ImageSource), typeof(GalleryItem));
|
||||||
|
public static readonly BindableProperty UserNameProperty = BindableProperty.Create(nameof(UserName), typeof(string), typeof(GalleryItem));
|
||||||
|
public static readonly BindableProperty CreatedTimeProperty = BindableProperty.Create(nameof(CreatedTime), typeof(DateTime), typeof(GalleryItem));
|
||||||
|
public static readonly BindableProperty UpdatedTimeProperty = BindableProperty.Create(nameof(UpdatedTime), typeof(DateTime), typeof(GalleryItem));
|
||||||
|
public static readonly BindableProperty ImageHeightProperty = BindableProperty.Create(nameof(ImageHeight), typeof(GridLength), typeof(GalleryItem), GridLength.Auto);
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public string TagDescription { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public ImageSource PreviewImage { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public GridLength ImageHeight { get; set; }
|
||||||
|
|
||||||
|
public long Id { get; internal set; }
|
||||||
|
private string[] tags;
|
||||||
|
public string[] Tags
|
||||||
|
{
|
||||||
|
get => tags;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
tags = value;
|
||||||
|
if (value != null)
|
||||||
|
{
|
||||||
|
TagDescription = string.Join(' ', tags);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TagDescription = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public DateTime CreatedTime { get; set; }
|
||||||
|
public DateTime UpdatedTime { get; set; }
|
||||||
|
public string UserId { get; set; }
|
||||||
|
public string UserName { get; set; }
|
||||||
|
public string Source { get; set; }
|
||||||
|
public string PreviewUrl { get; set; }
|
||||||
|
public string RawUrl { get; set; }
|
||||||
|
|
||||||
|
private int width;
|
||||||
|
private int height;
|
||||||
|
public int Width
|
||||||
|
{
|
||||||
|
get => width;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
width = value;
|
||||||
|
if (width > 0 && height > 0)
|
||||||
|
{
|
||||||
|
ImageHeight = new GridLength(PREVIEW_WIDTH * height / width);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public int Height
|
||||||
|
{
|
||||||
|
get => height;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
height = value;
|
||||||
|
if (width > 0 && height > 0)
|
||||||
|
{
|
||||||
|
ImageHeight = new GridLength(PREVIEW_WIDTH * height / width);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
27
Gallery.iOS/AppDelegate.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using Foundation;
|
||||||
|
using UIKit;
|
||||||
|
|
||||||
|
namespace Gallery.iOS
|
||||||
|
{
|
||||||
|
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||||
|
// User Interface of the application, as well as listening (and optionally responding) to
|
||||||
|
// application events from iOS.
|
||||||
|
[Register("AppDelegate")]
|
||||||
|
public partial class AppDelegate : Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// This method is invoked when the application has loaded and is ready to run. In this
|
||||||
|
// method you should instantiate the window, load the UI into it and then make the window
|
||||||
|
// visible.
|
||||||
|
//
|
||||||
|
// You have 17 seconds to return from this method, or iOS will terminate your application.
|
||||||
|
//
|
||||||
|
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
|
||||||
|
{
|
||||||
|
Xamarin.Forms.Forms.Init();
|
||||||
|
LoadApplication(new App());
|
||||||
|
|
||||||
|
return base.FinishedLaunching(app, options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
117
Gallery.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
{
|
||||||
|
"images": [
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"size": "20x20",
|
||||||
|
"idiom": "iphone",
|
||||||
|
"filename": "Icon40.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "3x",
|
||||||
|
"size": "20x20",
|
||||||
|
"idiom": "iphone",
|
||||||
|
"filename": "Icon60.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"size": "29x29",
|
||||||
|
"idiom": "iphone",
|
||||||
|
"filename": "Icon58.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "3x",
|
||||||
|
"size": "29x29",
|
||||||
|
"idiom": "iphone",
|
||||||
|
"filename": "Icon87.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"size": "40x40",
|
||||||
|
"idiom": "iphone",
|
||||||
|
"filename": "Icon80.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "3x",
|
||||||
|
"size": "40x40",
|
||||||
|
"idiom": "iphone",
|
||||||
|
"filename": "Icon120.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"size": "60x60",
|
||||||
|
"idiom": "iphone",
|
||||||
|
"filename": "Icon120.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "3x",
|
||||||
|
"size": "60x60",
|
||||||
|
"idiom": "iphone",
|
||||||
|
"filename": "Icon180.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"size": "20x20",
|
||||||
|
"idiom": "ipad",
|
||||||
|
"filename": "Icon20.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"size": "20x20",
|
||||||
|
"idiom": "ipad",
|
||||||
|
"filename": "Icon40.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"size": "29x29",
|
||||||
|
"idiom": "ipad",
|
||||||
|
"filename": "Icon29.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"size": "29x29",
|
||||||
|
"idiom": "ipad",
|
||||||
|
"filename": "Icon58.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"size": "40x40",
|
||||||
|
"idiom": "ipad",
|
||||||
|
"filename": "Icon40.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"size": "40x40",
|
||||||
|
"idiom": "ipad",
|
||||||
|
"filename": "Icon80.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"size": "76x76",
|
||||||
|
"idiom": "ipad",
|
||||||
|
"filename": "Icon76.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"size": "76x76",
|
||||||
|
"idiom": "ipad",
|
||||||
|
"filename": "Icon152.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"size": "83.5x83.5",
|
||||||
|
"idiom": "ipad",
|
||||||
|
"filename": "Icon167.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"size": "1024x1024",
|
||||||
|
"idiom": "ios-marketing",
|
||||||
|
"filename": "Icon1024.png"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {},
|
||||||
|
"info": {
|
||||||
|
"version": 1,
|
||||||
|
"author": "xcode"
|
||||||
|
}
|
||||||
|
}
|
BIN
Gallery.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png
Normal file
After Width: | Height: | Size: 69 KiB |
BIN
Gallery.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
Gallery.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
Gallery.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
Gallery.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
Gallery.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
Gallery.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png
Normal file
After Width: | Height: | Size: 845 B |
BIN
Gallery.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
Gallery.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
Gallery.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
Gallery.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
Gallery.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
Gallery.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
7
Gallery.iOS/Entitlements.plist
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
|
|
157
Gallery.iOS/Gallery.iOS.csproj
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
|
||||||
|
<ProductVersion>8.0.30703</ProductVersion>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<ProjectGuid>{94E59D2C-9083-4BAB-9567-A0B0C4B4266D}</ProjectGuid>
|
||||||
|
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<TemplateGuid>{89a4fe7c-635d-49c9-8d8c-5cd363c0d68d}</TemplateGuid>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<RootNamespace>Gallery.iOS</RootNamespace>
|
||||||
|
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||||
|
<AssemblyName>Gallery.iOS</AssemblyName>
|
||||||
|
<MtouchEnableSGenConc>true</MtouchEnableSGenConc>
|
||||||
|
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
|
||||||
|
<ProvisioningType>automatic</ProvisioningType>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>portable</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
|
||||||
|
<DefineConstants>DEBUG</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<MtouchArch>x86_64</MtouchArch>
|
||||||
|
<MtouchLink>None</MtouchLink>
|
||||||
|
<MtouchDebug>true</MtouchDebug>
|
||||||
|
<CodesignProvision>Gallery.Dev</CodesignProvision>
|
||||||
|
<CodesignKey>Apple Development: Li Chen (5559SN7Z38)</CodesignKey>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
||||||
|
<DebugType>none</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<MtouchLink>None</MtouchLink>
|
||||||
|
<MtouchArch>x86_64</MtouchArch>
|
||||||
|
<CodesignProvision>Gallery.Ad-Hoc</CodesignProvision>
|
||||||
|
<CodesignKey>Apple Distribution: Li Chen (7HSM5CKPJ2)</CodesignKey>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>portable</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\iPhone\Debug</OutputPath>
|
||||||
|
<DefineConstants>DEBUG</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<MtouchArch>ARM64</MtouchArch>
|
||||||
|
<CodesignKey>Apple Development: Li Chen (5559SN7Z38)</CodesignKey>
|
||||||
|
<MtouchDebug>true</MtouchDebug>
|
||||||
|
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||||
|
<MtouchLink>None</MtouchLink>
|
||||||
|
<MtouchInterpreter>-all</MtouchInterpreter>
|
||||||
|
<CodesignProvision>Gallery.Dev</CodesignProvision>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
|
||||||
|
<DebugType>none</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\iPhone\Release</OutputPath>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<MtouchArch>ARM64</MtouchArch>
|
||||||
|
<CodesignKey>Apple Distribution: Li Chen (7HSM5CKPJ2)</CodesignKey>
|
||||||
|
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||||
|
<CodesignProvision>Gallery.Ad-Hoc</CodesignProvision>
|
||||||
|
<MtouchLink>SdkOnly</MtouchLink>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Main.cs" />
|
||||||
|
<Compile Include="AppDelegate.cs" />
|
||||||
|
<None Include="Entitlements.plist" />
|
||||||
|
<None Include="Info.plist" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon1024.png">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon180.png">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon167.png">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon152.png">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon120.png">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon87.png">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon80.png">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon76.png">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon60.png">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon58.png">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon40.png">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon29.png">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon20.png">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
<BundleResource Include="Resources\icon_about.png" />
|
||||||
|
<BundleResource Include="Resources\icon_about%402x.png" />
|
||||||
|
<BundleResource Include="Resources\icon_about%403x.png" />
|
||||||
|
<BundleResource Include="Resources\icon_feed.png" />
|
||||||
|
<BundleResource Include="Resources\icon_feed%402x.png" />
|
||||||
|
<BundleResource Include="Resources\icon_feed%403x.png" />
|
||||||
|
<BundleResource Include="Resources\xamarin_logo.png" />
|
||||||
|
<BundleResource Include="Resources\xamarin_logo%402x.png" />
|
||||||
|
<BundleResource Include="Resources\xamarin_logo%403x.png" />
|
||||||
|
<InterfaceDefinition Include="Resources\LaunchScreen.storyboard" />
|
||||||
|
<BundleResource Include="Resources\fa-light-300.ttf" />
|
||||||
|
<BundleResource Include="Resources\fa-regular-400.ttf" />
|
||||||
|
<BundleResource Include="Resources\fa-solid-900.ttf" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="Xamarin.iOS" />
|
||||||
|
<Reference Include="System.Numerics" />
|
||||||
|
<Reference Include="System.Numerics.Vectors" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2083" />
|
||||||
|
<PackageReference Include="Xamarin.Essentials" Version="1.7.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Gallery.Util\Gallery.Util.csproj">
|
||||||
|
<Project>{222C22EC-3A47-4CF5-B9FB-CA28DE9F4BC8}</Project>
|
||||||
|
<Name>Gallery.Util</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="..\Gallery.Share\Gallery.Share.projitems" Label="Shared" Condition="Exists('..\Gallery.Share\Gallery.Share.projitems')" />
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||||
|
</Project>
|
52
Gallery.iOS/Info.plist
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>UIDeviceFamily</key>
|
||||||
|
<array>
|
||||||
|
<integer>1</integer>
|
||||||
|
<integer>2</integer>
|
||||||
|
</array>
|
||||||
|
<key>UISupportedInterfaceOrientations</key>
|
||||||
|
<array>
|
||||||
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
|
</array>
|
||||||
|
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||||
|
<array>
|
||||||
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
|
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
|
</array>
|
||||||
|
<key>MinimumOSVersion</key>
|
||||||
|
<string>13.0</string>
|
||||||
|
<key>CFBundleDisplayName</key>
|
||||||
|
<string>Gallery</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>org.tsanie.gallery</string>
|
||||||
|
<key>UILaunchStoryboardName</key>
|
||||||
|
<string>LaunchScreen</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>Gallery</string>
|
||||||
|
<key>XSAppIconAssets</key>
|
||||||
|
<string>Assets.xcassets/AppIcon.appiconset</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>1.0.805</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>1</string>
|
||||||
|
<key>UIAppFonts</key>
|
||||||
|
<array>
|
||||||
|
<string>fa-light-300.ttf</string>
|
||||||
|
<string>fa-regular-400.ttf</string>
|
||||||
|
<string>fa-solid-900.ttf</string>
|
||||||
|
</array>
|
||||||
|
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||||
|
<true/>
|
||||||
|
<key>UIStatusBarStyle</key>
|
||||||
|
<string>UIStatusBarStyleDefault</string>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>China</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
15
Gallery.iOS/Main.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using UIKit;
|
||||||
|
|
||||||
|
namespace Gallery.iOS
|
||||||
|
{
|
||||||
|
public class Application
|
||||||
|
{
|
||||||
|
// This is the main entry point of the application.
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||||
|
// you can specify it here.
|
||||||
|
UIApplication.Main(args, null, "AppDelegate");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
38
Gallery.iOS/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using Xamarin.Forms.Xaml;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("Gallery.iOS")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("Gallery.iOS")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © Tsanie.Org 2021")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("72bdc44f-c588-44f3-b6df-9aace7daafdd")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
|
|
||||||
|
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
|
BIN
Gallery.iOS/Resources/Default-568h@2x.png
Normal file
After Width: | Height: | Size: 8.7 KiB |
BIN
Gallery.iOS/Resources/Default-Portrait.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
Gallery.iOS/Resources/Default-Portrait@2x.png
Normal file
After Width: | Height: | Size: 34 KiB |
BIN
Gallery.iOS/Resources/Default.png
Normal file
After Width: | Height: | Size: 7.1 KiB |
BIN
Gallery.iOS/Resources/Default@2x.png
Normal file
After Width: | Height: | Size: 8.2 KiB |
39
Gallery.iOS/Resources/LaunchScreen.storyboard
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6245" systemVersion="13F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="X5k-f2-b5h">
|
||||||
|
<dependencies>
|
||||||
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
|
||||||
|
</dependencies>
|
||||||
|
<scenes>
|
||||||
|
<!--View Controller-->
|
||||||
|
<scene sceneID="gAE-YM-kbH">
|
||||||
|
<objects>
|
||||||
|
<viewController id="X5k-f2-b5h" sceneMemberID="viewController">
|
||||||
|
<layoutGuides>
|
||||||
|
<viewControllerLayoutGuide type="top" id="Y8P-hJ-Z43"/>
|
||||||
|
<viewControllerLayoutGuide type="bottom" id="9ZL-r4-8FZ"/>
|
||||||
|
</layoutGuides>
|
||||||
|
<view key="view" contentMode="scaleToFill" id="yd7-JS-zBw">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
|
<subviews>
|
||||||
|
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" misplaced="YES" image="Icon-60.png" translatesAutoresizingMaskIntoConstraints="NO" id="23">
|
||||||
|
<rect key="frame" x="270" y="270" width="60" height="60"/>
|
||||||
|
<rect key="contentStretch" x="0.0" y="0.0" width="0.0" height="0.0"/>
|
||||||
|
</imageView>
|
||||||
|
</subviews>
|
||||||
|
<color key="backgroundColor" red="0.20392156862745098" green="0.59607843137254901" blue="0.85882352941176465" alpha="1" colorSpace="calibratedRGB"/>
|
||||||
|
<constraints>
|
||||||
|
<constraint firstItem="23" firstAttribute="centerY" secondItem="yd7-JS-zBw" secondAttribute="centerY" priority="1" id="39"/>
|
||||||
|
<constraint firstItem="23" firstAttribute="centerX" secondItem="yd7-JS-zBw" secondAttribute="centerX" priority="1" id="41"/>
|
||||||
|
</constraints>
|
||||||
|
</view>
|
||||||
|
</viewController>
|
||||||
|
<placeholder placeholderIdentifier="IBFirstResponder" id="XAI-xm-WK6" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
|
</objects>
|
||||||
|
<point key="canvasLocation" x="349" y="339"/>
|
||||||
|
</scene>
|
||||||
|
</scenes>
|
||||||
|
<resources>
|
||||||
|
<image name="Icon-60.png" width="180" height="180"/>
|
||||||
|
</resources>
|
||||||
|
</document>
|
BIN
Gallery.iOS/Resources/fa-light-300.ttf
Normal file
BIN
Gallery.iOS/Resources/fa-regular-400.ttf
Normal file
BIN
Gallery.iOS/Resources/fa-solid-900.ttf
Normal file
BIN
Gallery.iOS/Resources/icon_about.png
Normal file
After Width: | Height: | Size: 518 B |
BIN
Gallery.iOS/Resources/icon_about@2x.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
Gallery.iOS/Resources/icon_about@3x.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
Gallery.iOS/Resources/icon_feed.png
Normal file
After Width: | Height: | Size: 415 B |
BIN
Gallery.iOS/Resources/icon_feed@2x.png
Normal file
After Width: | Height: | Size: 863 B |
BIN
Gallery.iOS/Resources/icon_feed@3x.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
Gallery.iOS/Resources/xamarin_logo.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
Gallery.iOS/Resources/xamarin_logo@2x.png
Normal file
After Width: | Height: | Size: 9.1 KiB |
BIN
Gallery.iOS/Resources/xamarin_logo@3x.png
Normal file
After Width: | Height: | Size: 21 KiB |
53
Gallery.sln
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 16
|
||||||
|
VisualStudioVersion = 16.0.810.6
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gallery.iOS", "Gallery.iOS\Gallery.iOS.csproj", "{94E59D2C-9083-4BAB-9567-A0B0C4B4266D}"
|
||||||
|
EndProject
|
||||||
|
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Gallery.Share", "Gallery.Share\Gallery.Share.shproj", "{E72B5C40-090B-4A1C-9170-BD33C14A9A91}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gallery.Util", "Gallery.Util\Gallery.Util.csproj", "{222C22EC-3A47-4CF5-B9FB-CA28DE9F4BC8}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|iPhoneSimulator = Debug|iPhoneSimulator
|
||||||
|
Release|iPhoneSimulator = Release|iPhoneSimulator
|
||||||
|
Debug|iPhone = Debug|iPhone
|
||||||
|
Release|iPhone = Release|iPhone
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{94E59D2C-9083-4BAB-9567-A0B0C4B4266D}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
|
||||||
|
{94E59D2C-9083-4BAB-9567-A0B0C4B4266D}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
|
||||||
|
{94E59D2C-9083-4BAB-9567-A0B0C4B4266D}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
|
||||||
|
{94E59D2C-9083-4BAB-9567-A0B0C4B4266D}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
|
||||||
|
{94E59D2C-9083-4BAB-9567-A0B0C4B4266D}.Debug|iPhone.ActiveCfg = Debug|iPhone
|
||||||
|
{94E59D2C-9083-4BAB-9567-A0B0C4B4266D}.Debug|iPhone.Build.0 = Debug|iPhone
|
||||||
|
{94E59D2C-9083-4BAB-9567-A0B0C4B4266D}.Release|iPhone.ActiveCfg = Release|iPhone
|
||||||
|
{94E59D2C-9083-4BAB-9567-A0B0C4B4266D}.Release|iPhone.Build.0 = Release|iPhone
|
||||||
|
{94E59D2C-9083-4BAB-9567-A0B0C4B4266D}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
|
||||||
|
{94E59D2C-9083-4BAB-9567-A0B0C4B4266D}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
|
||||||
|
{94E59D2C-9083-4BAB-9567-A0B0C4B4266D}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator
|
||||||
|
{94E59D2C-9083-4BAB-9567-A0B0C4B4266D}.Release|Any CPU.Build.0 = Release|iPhoneSimulator
|
||||||
|
{222C22EC-3A47-4CF5-B9FB-CA28DE9F4BC8}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||||
|
{222C22EC-3A47-4CF5-B9FB-CA28DE9F4BC8}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||||
|
{222C22EC-3A47-4CF5-B9FB-CA28DE9F4BC8}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||||
|
{222C22EC-3A47-4CF5-B9FB-CA28DE9F4BC8}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||||
|
{222C22EC-3A47-4CF5-B9FB-CA28DE9F4BC8}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||||
|
{222C22EC-3A47-4CF5-B9FB-CA28DE9F4BC8}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||||
|
{222C22EC-3A47-4CF5-B9FB-CA28DE9F4BC8}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||||
|
{222C22EC-3A47-4CF5-B9FB-CA28DE9F4BC8}.Release|iPhone.Build.0 = Release|Any CPU
|
||||||
|
{222C22EC-3A47-4CF5-B9FB-CA28DE9F4BC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{222C22EC-3A47-4CF5-B9FB-CA28DE9F4BC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{222C22EC-3A47-4CF5-B9FB-CA28DE9F4BC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{222C22EC-3A47-4CF5-B9FB-CA28DE9F4BC8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {A969B750-3E3E-4815-B336-02B32908D0C4}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|