This commit is contained in:
Tsanie Lily 2020-05-03 23:46:08 +08:00
commit 67d4955664
34 changed files with 1295 additions and 0 deletions

405
.gitignore vendored Normal file
View File

@ -0,0 +1,405 @@
# 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/master/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/master/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/

View File

@ -0,0 +1,27 @@
using Foundation;
using UIKit;
namespace Pixiview.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);
}
}
}

View 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"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

View 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>

48
Pixiview.iOS/Info.plist Normal file
View File

@ -0,0 +1,48 @@
<?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>11.0</string>
<key>CFBundleDisplayName</key>
<string>Pixiview</string>
<key>CFBundleIdentifier</key>
<string>org.tsanie.Pixiview</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>CFBundleName</key>
<string>Pixiview</string>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/AppIcon.appiconset</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>
<false/>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleDefault</string>
</dict>
</plist>

15
Pixiview.iOS/Main.cs Normal file
View File

@ -0,0 +1,15 @@
using UIKit;
namespace Pixiview.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");
}
}
}

View File

@ -0,0 +1,147 @@
<?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>{0CDD279E-3CAB-4CCA-A7C4-BC499724D051}</ProjectGuid>
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TemplateGuid>{6143fdea-f3c2-4a09-aafa-6e230626515e}</TemplateGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Pixiview.iOS</RootNamespace>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
<AssemblyName>Pixiview.iOS</AssemblyName>
<MtouchEnableSGenConc>true</MtouchEnableSGenConc>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
<ProvisioningType>automatic</ProvisioningType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</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>
</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>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchArch>ARM64</MtouchArch>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>true</MtouchDebug>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<MtouchLink>None</MtouchLink>
<MtouchInterpreter>-all</MtouchInterpreter>
</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>iPhone Developer</CodesignKey>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
</PropertyGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<None Include="Entitlements.plist" />
<None Include="Info.plist" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Renderers\AdaptedPageRenderer.cs" />
<Compile Include="Services\EnvironmentService.cs" />
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="Resources\LaunchScreen.storyboard" />
<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>
</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="4.6.0.726" />
<PackageReference Include="Xamarin.Essentials" Version="1.5.3.1" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\Pixiview\Pixiview.csproj">
<Project>{7F310047-BCBB-45F5-BD16-F246BA72AF73}</Project>
<Name>Pixiview</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Renderers\" />
<Folder Include="Services\" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\fa-light-300.ttf" />
<BundleResource Include="Resources\fa-regular-400.ttf" />
<BundleResource Include="Resources\fa-solid-900.ttf" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.InteropServices;
// 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("Pixiview.iOS")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Pixiview.iOS")]
[assembly: AssemblyCopyright("Copyright © Tsanie 2014")]
[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")]

View File

@ -0,0 +1,68 @@
using System.Diagnostics.CodeAnalysis;
using Pixiview.iOS.Renderers;
using Pixiview.UI;
using Pixiview.Utils;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
[assembly: ExportRenderer(typeof(AdaptedPage), typeof(AdaptedPageRenderer))]
namespace Pixiview.iOS.Renderers
{
public class AdaptedPageRenderer : PageRenderer
{
public override void ViewDidLoad()
{
base.ViewDidLoad();
if (Element is AdaptedPage page)
{
page.OnLoad();
}
}
public override void ViewDidAppear(bool animated)
{
base.ViewDidAppear(animated);
var style = ConvertStyle(StatusBar.GetStatusBarStyle(Element));
if (UIApplication.SharedApplication.StatusBarStyle != style)
{
SetStatusBarStyle(style);
}
}
private void SetStatusBarStyle(UIStatusBarStyle style)
{
if (style == UIStatusBarStyle.BlackOpaque)
{
UIApplication.SharedApplication.SetStatusBarHidden(true, UIStatusBarAnimation.Fade);
}
else
{
UIApplication.SharedApplication.SetStatusBarStyle(style, true);
UIApplication.SharedApplication.SetStatusBarHidden(false, UIStatusBarAnimation.Fade);
}
SetNeedsStatusBarAppearanceUpdate();
}
[SuppressMessage("Code Notifications", "XI0002:Notifies you from using newer Apple APIs when targeting an older OS version", Justification = "<Pending>")]
[SuppressMessage("Style", "IDE0066:Convert switch statement to expression", Justification = "<Pending>")]
private UIStatusBarStyle ConvertStyle(StatusBarStyles style)
{
switch (style)
{
case StatusBarStyles.DarkText:
return UIStatusBarStyle.DarkContent;
case StatusBarStyles.WhiteText:
return UIStatusBarStyle.LightContent;
case StatusBarStyles.Hidden:
return UIStatusBarStyle.BlackOpaque;
case StatusBarStyles.Default:
default:
return UIStatusBarStyle.Default;
}
}
}
}

View File

@ -0,0 +1,26 @@
<?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="414" height="736"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace" white="0" alpha="1"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="XAI-xm-WK6" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="349" y="339"/>
</scene>
</scenes>
</document>

57
Pixiview.sln Normal file
View File

@ -0,0 +1,57 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pixiview.Android", "Pixiview.Android\Pixiview.Android.csproj", "{B695E0C4-084A-456D-B075-718E55BA1FD6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pixiview.iOS", "Pixiview.iOS\Pixiview.iOS.csproj", "{0CDD279E-3CAB-4CCA-A7C4-BC499724D051}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pixiview", "Pixiview\Pixiview.csproj", "{7F310047-BCBB-45F5-BD16-F246BA72AF73}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Debug|iPhoneSimulator = Debug|iPhoneSimulator
Release|iPhoneSimulator = Release|iPhoneSimulator
Debug|iPhone = Debug|iPhone
Release|iPhone = Release|iPhone
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B695E0C4-084A-456D-B075-718E55BA1FD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B695E0C4-084A-456D-B075-718E55BA1FD6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B695E0C4-084A-456D-B075-718E55BA1FD6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B695E0C4-084A-456D-B075-718E55BA1FD6}.Release|Any CPU.Build.0 = Release|Any CPU
{B695E0C4-084A-456D-B075-718E55BA1FD6}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{B695E0C4-084A-456D-B075-718E55BA1FD6}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{B695E0C4-084A-456D-B075-718E55BA1FD6}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{B695E0C4-084A-456D-B075-718E55BA1FD6}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{B695E0C4-084A-456D-B075-718E55BA1FD6}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{B695E0C4-084A-456D-B075-718E55BA1FD6}.Debug|iPhone.Build.0 = Debug|Any CPU
{B695E0C4-084A-456D-B075-718E55BA1FD6}.Release|iPhone.ActiveCfg = Release|Any CPU
{B695E0C4-084A-456D-B075-718E55BA1FD6}.Release|iPhone.Build.0 = Release|Any CPU
{0CDD279E-3CAB-4CCA-A7C4-BC499724D051}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
{0CDD279E-3CAB-4CCA-A7C4-BC499724D051}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
{0CDD279E-3CAB-4CCA-A7C4-BC499724D051}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator
{0CDD279E-3CAB-4CCA-A7C4-BC499724D051}.Release|Any CPU.Build.0 = Release|iPhoneSimulator
{0CDD279E-3CAB-4CCA-A7C4-BC499724D051}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{0CDD279E-3CAB-4CCA-A7C4-BC499724D051}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{0CDD279E-3CAB-4CCA-A7C4-BC499724D051}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{0CDD279E-3CAB-4CCA-A7C4-BC499724D051}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{0CDD279E-3CAB-4CCA-A7C4-BC499724D051}.Debug|iPhone.ActiveCfg = Debug|iPhone
{0CDD279E-3CAB-4CCA-A7C4-BC499724D051}.Debug|iPhone.Build.0 = Debug|iPhone
{0CDD279E-3CAB-4CCA-A7C4-BC499724D051}.Release|iPhone.ActiveCfg = Release|iPhone
{0CDD279E-3CAB-4CCA-A7C4-BC499724D051}.Release|iPhone.Build.0 = Release|iPhone
{7F310047-BCBB-45F5-BD16-F246BA72AF73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7F310047-BCBB-45F5-BD16-F246BA72AF73}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7F310047-BCBB-45F5-BD16-F246BA72AF73}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7F310047-BCBB-45F5-BD16-F246BA72AF73}.Release|Any CPU.Build.0 = Release|Any CPU
{7F310047-BCBB-45F5-BD16-F246BA72AF73}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{7F310047-BCBB-45F5-BD16-F246BA72AF73}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{7F310047-BCBB-45F5-BD16-F246BA72AF73}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{7F310047-BCBB-45F5-BD16-F246BA72AF73}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{7F310047-BCBB-45F5-BD16-F246BA72AF73}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{7F310047-BCBB-45F5-BD16-F246BA72AF73}.Debug|iPhone.Build.0 = Debug|Any CPU
{7F310047-BCBB-45F5-BD16-F246BA72AF73}.Release|iPhone.ActiveCfg = Release|Any CPU
{7F310047-BCBB-45F5-BD16-F246BA72AF73}.Release|iPhone.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

28
Pixiview/App.xaml Normal file
View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<Application 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="Pixiview.App">
<Application.Resources>
<Color x:Key="WindowColor">Black</Color>
<Color x:Key="TextColor">White</Color>
<Color x:Key="MainColor">#333333</Color>
<Color x:Key="MainTextColor">White</Color>
<Style x:Key="TitleLabel" TargetType="Label">
<Setter Property="VerticalOptions" Value="Center"/>
<Setter Property="HorizontalOptions" Value="Fill"/>
<Setter Property="HorizontalTextAlignment" Value="Center"/>
<Setter Property="FontSize" Value="{DynamicResource FontSizeTitle}"/>
<Setter Property="TextColor" Value="{DynamicResource MainTextColor}"/>
</Style>
<Style x:Key="TitleButton" TargetType="Button">
<Setter Property="BorderWidth" Value="0"/>
<Setter Property="BackgroundColor" Value="Transparent"/>
<Setter Property="FontFamily" Value="{DynamicResource IconSolidFontFamily}"/>
<Setter Property="FontSize" Value="{DynamicResource FontSizeTitleIcon}"/>
<Setter Property="TextColor" Value="{DynamicResource MainTextColor}"/>
</Style>
</Application.Resources>
</Application>

58
Pixiview/App.xaml.cs Normal file
View File

@ -0,0 +1,58 @@
using Pixiview.UI;
using Pixiview.Utils;
using Xamarin.Forms;
namespace Pixiview
{
public partial class App : Application
{
public const string TitleButton = nameof(TitleButton);
public const string TitleLabel = nameof(TitleLabel);
public const string WindowColor = nameof(WindowColor);
public const string TextColor = nameof(TextColor);
public const string MainColor = nameof(MainColor);
public const string MainTextColor = nameof(MainTextColor);
public const string IconLightFontFamily = nameof(IconLightFontFamily);
public const string IconRegularFontFamily = nameof(IconRegularFontFamily);
public const string IconSolidFontFamily = nameof(IconSolidFontFamily);
public const string IconLeft = nameof(IconLeft);
public const string FontSizeTitle = nameof(FontSizeTitle);
public const string FontSizeTitleIcon = nameof(FontSizeTitleIcon);
//public const string Horizon10 = nameof(Horizon10);
public App()
{
InitializeComponent();
InitResources();
}
private void InitResources()
{
var p = DependencyService.Get<IEnvironmentService>().GetEnvironment();
Resources.Add(IconLightFontFamily, p.IconLightFontFamily);
Resources.Add(IconRegularFontFamily, p.IconRegularFontFamily);
Resources.Add(IconSolidFontFamily, p.IconSolidFontFamily);
Resources.Add(IconLeft, p.IconLeft);
Resources.Add(FontSizeTitle, StyleDefinition.FontSizeTitle);
Resources.Add(FontSizeTitleIcon, StyleDefinition.FontSizeTitleIcon);
//Resources.Add(Horizon10, StyleDefinition.Horizon10);
}
protected override void OnStart()
{
MainPage = UIFactory.CreateNavigationPage(new MainPage());
}
protected override void OnSleep()
{
}
protected override void OnResume()
{
}
}
}

3
Pixiview/AssemblyInfo.cs Normal file
View File

@ -0,0 +1,3 @@
using Xamarin.Forms.Xaml;
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]

18
Pixiview/MainPage.xaml Normal file
View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<u:AdaptedPage 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"
xmlns:u="clr-namespace:Pixiview.UI"
mc:Ignorable="d"
x:Class="Pixiview.MainPage">
<NavigationPage.TitleView>
<u:NavigationTitle Title="Startup Name Generator"
IsLeftButtonVisible="True"
LeftButtonClicked="NavigationTitle_LeftButtonClicked"
RightButtonClicked="NavigationTitle_RightButtonClicked"/>
</NavigationPage.TitleView>
<Grid>
</Grid>
</u:AdaptedPage>

34
Pixiview/MainPage.xaml.cs Normal file
View File

@ -0,0 +1,34 @@
using System;
using System.ComponentModel;
using System.Diagnostics;
using Pixiview.UI;
using Pixiview.Utils;
namespace Pixiview
{
// Learn more about making custom code visible in the Xamarin.Forms previewer
// by visiting https://aka.ms/xamarinforms-previewer
[DesignTimeVisible(false)]
public partial class MainPage : AdaptedPage
{
public MainPage()
{
InitializeComponent();
BindingContext = this;
}
public override void OnLoad()
{
Debug.WriteLine(Stores.PersonalFolder);
}
void NavigationTitle_RightButtonClicked(object sender, EventArgs e)
{
}
void NavigationTitle_LeftButtonClicked(object sender, EventArgs e)
{
DisplayAlert("title", "message", "Ok");
}
}
}

21
Pixiview/Pixiview.csproj Normal file
View File

@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.6.0.726" />
<PackageReference Include="Xamarin.Essentials" Version="1.5.3.1" />
</ItemGroup>
<ItemGroup>
<Folder Include="UI\" />
<Folder Include="Utils\" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,20 @@
using System;
using Xamarin.Forms;
namespace Pixiview.UI
{
public class AdaptedPage : ContentPage
{
public event EventHandler Load;
public AdaptedPage()
{
SetDynamicResource(BackgroundColorProperty, App.WindowColor);
}
public virtual void OnLoad()
{
Load?.Invoke(this, EventArgs.Empty);
}
}
}

View File

@ -0,0 +1,104 @@
using System;
using Xamarin.Forms;
namespace Pixiview.UI
{
public class NavigationTitle : ContentView
{
public static readonly BindableProperty TitleProperty = BindableProperty.Create(
nameof(Title), typeof(string), typeof(NavigationTitle));
public static readonly BindableProperty IsLeftButtonVisibleProperty = BindableProperty.Create(
nameof(IsLeftButtonVisible), typeof(bool), typeof(NavigationTitle));
public static readonly BindableProperty IsRightButtonVisibleProperty = BindableProperty.Create(
nameof(IsRightButtonVisible), typeof(bool), typeof(NavigationTitle));
public static readonly BindableProperty RightButtonTextProperty = BindableProperty.Create(
nameof(RightButtonText), typeof(string), typeof(NavigationTitle));
public string Title
{
get => (string)GetValue(TitleProperty);
set => SetValue(TitleProperty, value);
}
public bool IsLeftButtonVisible
{
get => (bool)GetValue(IsLeftButtonVisibleProperty);
set => SetValue(IsLeftButtonVisibleProperty, value);
}
public bool IsRightButtonVisible
{
get => (bool)GetValue(IsRightButtonVisibleProperty);
set => SetValue(IsRightButtonVisibleProperty, value);
}
public string RightButtonText
{
get => (string)GetValue(RightButtonTextProperty);
set => SetValue(RightButtonTextProperty, value);
}
public event EventHandler LeftButtonClicked;
public event EventHandler RightButtonClicked;
public NavigationTitle()
{
BindingContext = this;
var left = GetLinkButton(nameof(IsLeftButtonVisible),
padding: StyleDefinition.HorizonRight10);
left.SetDynamicResource(Button.FontFamilyProperty, App.IconRegularFontFamily);
left.SetDynamicResource(Button.TextProperty, App.IconLeft);
left.Clicked += Left_Clicked;
var title = new Label();
title.SetDynamicResource(StyleProperty, App.TitleLabel);
title.SetBinding(Label.TextProperty, nameof(Title));
Grid.SetColumnSpan(title, 3);
var right = GetLinkButton(nameof(IsRightButtonVisible),
text: nameof(RightButtonText),
horizon: LayoutOptions.End,
padding: StyleDefinition.HorizonLeft10);
right.Clicked += Right_Clicked;
Grid.SetColumn(right, 2);
Content = new Grid
{
ColumnDefinitions =
{
new ColumnDefinition { Width = GridLength.Auto },
new ColumnDefinition(),
new ColumnDefinition { Width = GridLength.Auto }
},
ColumnSpacing = 0,
Children = { title, left, right }
};
}
private void Left_Clicked(object sender, EventArgs e)
{
LeftButtonClicked?.Invoke(sender, e);
}
private void Right_Clicked(object sender, EventArgs e)
{
RightButtonClicked?.Invoke(sender, e);
}
private Button GetLinkButton(string visibility, string text = null, LayoutOptions horizon = default, Thickness padding = default)
{
var button = new Button
{
VerticalOptions = LayoutOptions.Center,
HorizontalOptions = horizon,
Padding = padding
};
button.SetBinding(IsVisibleProperty, visibility);
if (text != null)
{
button.SetBinding(Button.TextProperty, text);
}
button.SetDynamicResource(StyleProperty, App.TitleButton);
return button;
}
}
}

View File

@ -0,0 +1,13 @@
using Xamarin.Forms;
namespace Pixiview.UI
{
public static class StyleDefinition
{
public static readonly double FontSizeTitle = 18.0;
public static readonly double FontSizeTitleIcon = 24.0;
public static readonly Thickness HorizonLeft10 = new Thickness(10, 0, 0, 0);
public static readonly Thickness HorizonRight10 = new Thickness(0, 0, 10, 0);
}
}

44
Pixiview/Utils/Stores.cs Normal file
View File

@ -0,0 +1,44 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
namespace Pixiview.Utils
{
public class Stores
{
public static readonly string PersonalFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
//public static readonly string CacheFolder = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache);
public const string ImageFolder = "images";
[SuppressMessage("Style", "IDE0063:Use simple 'using' statement", Justification = "<Pending>")]
public static async Task DownloadImage(string url)
{
var uri = new Uri(url);
var handler = new HttpClientHandler
{
Proxy = new WebProxy("10.0.10.100", 8088),
UseProxy = true
};
var client = new HttpClient(handler)
{
BaseAddress = new Uri($"{uri.Scheme}://{uri.Host}")
};
using (var request = new HttpRequestMessage(HttpMethod.Get, uri.PathAndQuery)
{
Version = new Version(2, 0)
})
{
request.Headers.Referrer = new Uri("https://www.pixiv.net/");
var file = Path.Combine(PersonalFolder, ImageFolder, Path.GetFileName(uri.LocalPath));
using (var response = await client.SendAsync(request))
using (var fs = File.OpenWrite(file))
{
await response.Content.CopyToAsync(fs);
}
}
}
}
}