move PCL project to shared

This commit is contained in:
Tsanie Lily 2020-05-11 00:44:12 +08:00
parent 8b891cc692
commit 98007c98e4
11 changed files with 191 additions and 122 deletions

View File

@ -6,3 +6,5 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Style", "IDE0066:Convert switch statement to expression", Justification = "<Pending>")] [assembly: SuppressMessage("Style", "IDE0066:Convert switch statement to expression", Justification = "<Pending>")]
[assembly: SuppressMessage("Style", "IDE0057:Use range operator", Justification = "<Pending>")]
[assembly: SuppressMessage("Style", "IDE0063:Use simple 'using' statement", Justification = "<Pending>")]

View File

@ -139,17 +139,16 @@
<Reference Include="Xamarin.iOS" /> <Reference Include="Xamarin.iOS" />
<Reference Include="System.Numerics" /> <Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors" /> <Reference Include="System.Numerics.Vectors" />
<Reference Include="System.Net.Http" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.6.0.726" /> <PackageReference Include="Xamarin.Forms" Version="4.6.0.726" />
<PackageReference Include="Xamarin.Essentials" Version="1.5.3.1" /> <PackageReference Include="Xamarin.Essentials" Version="1.5.3.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup> </ItemGroup>
<Import Project="..\Pixiview\Pixiview.projitems" Label="Shared" Condition="Exists('..\Pixiview\Pixiview.projitems')" />
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Pixiview\Pixiview.csproj">
<Project>{7F310047-BCBB-45F5-BD16-F246BA72AF73}</Project>
<Name>Pixiview</Name>
</ProjectReference>
<ProjectReference Include="..\Pixiview.iOS.OpenExtension\Pixiview.iOS.OpenExtension.csproj"> <ProjectReference Include="..\Pixiview.iOS.OpenExtension\Pixiview.iOS.OpenExtension.csproj">
<IsAppExtension>true</IsAppExtension> <IsAppExtension>true</IsAppExtension>
<Project>{618D8350-495C-42D0-9DAC-87ADD36AC727}</Project> <Project>{618D8350-495C-42D0-9DAC-87ADD36AC727}</Project>

View File

@ -3,12 +3,12 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15 # Visual Studio 15
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pixiview.iOS", "Pixiview.iOS\Pixiview.iOS.csproj", "{0CDD279E-3CAB-4CCA-A7C4-BC499724D051}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pixiview.iOS", "Pixiview.iOS\Pixiview.iOS.csproj", "{0CDD279E-3CAB-4CCA-A7C4-BC499724D051}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pixiview", "Pixiview\Pixiview.csproj", "{7F310047-BCBB-45F5-BD16-F246BA72AF73}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pixiview", "Pixiview\Pixiview.shproj", "{57C27E64-049B-4EE8-9308-BCAFE329E8E8}"
EndProject
Project("{9344BDBB-3E7F-41FC-A0DD-8665D75EE146}") = "Pixiview.Android", "Pixiview.Android\Pixiview.Android.csproj", "{EEE719E5-36B4-4024-84F5-F71DF07B3308}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pixiview.iOS.OpenExtension", "Pixiview.iOS.OpenExtension\Pixiview.iOS.OpenExtension.csproj", "{618D8350-495C-42D0-9DAC-87ADD36AC727}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pixiview.iOS.OpenExtension", "Pixiview.iOS.OpenExtension\Pixiview.iOS.OpenExtension.csproj", "{618D8350-495C-42D0-9DAC-87ADD36AC727}"
EndProject EndProject
Project("{9344BDBB-3E7F-41FC-A0DD-8665D75EE146}") = "Pixiview.Android", "Pixiview.Android\Pixiview.Android.csproj", "{FBB80F2B-0C2B-4BE5-A578-853AA0AF9F4A}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -31,30 +31,6 @@ Global
{0CDD279E-3CAB-4CCA-A7C4-BC499724D051}.Debug|iPhone.Build.0 = 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.ActiveCfg = Release|iPhone
{0CDD279E-3CAB-4CCA-A7C4-BC499724D051}.Release|iPhone.Build.0 = 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
{EEE719E5-36B4-4024-84F5-F71DF07B3308}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EEE719E5-36B4-4024-84F5-F71DF07B3308}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EEE719E5-36B4-4024-84F5-F71DF07B3308}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EEE719E5-36B4-4024-84F5-F71DF07B3308}.Release|Any CPU.Build.0 = Release|Any CPU
{EEE719E5-36B4-4024-84F5-F71DF07B3308}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{EEE719E5-36B4-4024-84F5-F71DF07B3308}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{EEE719E5-36B4-4024-84F5-F71DF07B3308}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{EEE719E5-36B4-4024-84F5-F71DF07B3308}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{EEE719E5-36B4-4024-84F5-F71DF07B3308}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{EEE719E5-36B4-4024-84F5-F71DF07B3308}.Debug|iPhone.Build.0 = Debug|Any CPU
{EEE719E5-36B4-4024-84F5-F71DF07B3308}.Release|iPhone.ActiveCfg = Release|Any CPU
{EEE719E5-36B4-4024-84F5-F71DF07B3308}.Release|iPhone.Build.0 = Release|Any CPU
{618D8350-495C-42D0-9DAC-87ADD36AC727}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {618D8350-495C-42D0-9DAC-87ADD36AC727}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
{618D8350-495C-42D0-9DAC-87ADD36AC727}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator {618D8350-495C-42D0-9DAC-87ADD36AC727}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
{618D8350-495C-42D0-9DAC-87ADD36AC727}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator {618D8350-495C-42D0-9DAC-87ADD36AC727}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator
@ -67,5 +43,17 @@ Global
{618D8350-495C-42D0-9DAC-87ADD36AC727}.Debug|iPhone.Build.0 = Debug|iPhone {618D8350-495C-42D0-9DAC-87ADD36AC727}.Debug|iPhone.Build.0 = Debug|iPhone
{618D8350-495C-42D0-9DAC-87ADD36AC727}.Release|iPhone.ActiveCfg = Release|iPhone {618D8350-495C-42D0-9DAC-87ADD36AC727}.Release|iPhone.ActiveCfg = Release|iPhone
{618D8350-495C-42D0-9DAC-87ADD36AC727}.Release|iPhone.Build.0 = Release|iPhone {618D8350-495C-42D0-9DAC-87ADD36AC727}.Release|iPhone.Build.0 = Release|iPhone
{FBB80F2B-0C2B-4BE5-A578-853AA0AF9F4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FBB80F2B-0C2B-4BE5-A578-853AA0AF9F4A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FBB80F2B-0C2B-4BE5-A578-853AA0AF9F4A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FBB80F2B-0C2B-4BE5-A578-853AA0AF9F4A}.Release|Any CPU.Build.0 = Release|Any CPU
{FBB80F2B-0C2B-4BE5-A578-853AA0AF9F4A}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{FBB80F2B-0C2B-4BE5-A578-853AA0AF9F4A}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{FBB80F2B-0C2B-4BE5-A578-853AA0AF9F4A}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{FBB80F2B-0C2B-4BE5-A578-853AA0AF9F4A}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{FBB80F2B-0C2B-4BE5-A578-853AA0AF9F4A}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{FBB80F2B-0C2B-4BE5-A578-853AA0AF9F4A}.Debug|iPhone.Build.0 = Debug|Any CPU
{FBB80F2B-0C2B-4BE5-A578-853AA0AF9F4A}.Release|iPhone.ActiveCfg = Release|Any CPU
{FBB80F2B-0C2B-4BE5-A578-853AA0AF9F4A}.Release|iPhone.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View File

@ -1,9 +0,0 @@
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Style", "IDE0063:Use simple 'using' statement", Justification = "<Pending>")]
[assembly: SuppressMessage("Style", "IDE0066:Convert switch statement to expression", Justification = "<Pending>")]

View File

@ -1,32 +0,0 @@
<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" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>
<ItemGroup>
<Folder Include="UI\" />
<Folder Include="Utils\" />
<Folder Include="UI\Theme\" />
<Folder Include="Resources\" />
<Folder Include="Resources\Languages\" />
<Folder Include="Illust\" />
</ItemGroup>
<ItemGroup>
<None Remove="Resources\Languages\zh-CN.xml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\Languages\zh-CN.xml" />
</ItemGroup>
</Project>

102
Pixiview/Pixiview.projitems Normal file
View File

@ -0,0 +1,102 @@
<?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>{57C27E64-049B-4EE8-9308-BCAFE329E8E8}</SharedGUID>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<Import_RootNamespace>Pixiview</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)AppShell.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)OptionPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Illust\FavoritesPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Illust\MainPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Illust\RankingPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Illust\RecommendsPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Illust\UserIllustPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Illust\ViewIllustPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Resources\Languages\zh-CN.xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)App.cs" />
<Compile Include="$(MSBuildThisFileDirectory)AppShell.xaml.cs">
<DependentUpon>AppShell.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)AssemblyInfo.cs" />
<Compile Include="$(MSBuildThisFileDirectory)OptionPage.xaml.cs">
<DependentUpon>OptionPage.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Illust\FavoritesPage.xaml.cs">
<DependentUpon>FavoritesPage.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Illust\IllustCollectionPage.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Illust\MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Illust\RankingPage.xaml.cs">
<DependentUpon>RankingPage.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Illust\RecommendsPage.xaml.cs">
<DependentUpon>RecommendsPage.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Illust\UserIllustPage.xaml.cs">
<DependentUpon>UserIllustPage.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Illust\ViewIllustPage.xaml.cs">
<DependentUpon>ViewIllustPage.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Utils\Converters.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Utils\Extensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Utils\IEnvironmentService.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Utils\IFileStore.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Utils\IllustData.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Utils\LongPressEffect.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Utils\Stores.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Resources\PlatformCulture.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Resources\ResourceHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\AdaptedPage.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\CardView.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\CircleUIs.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\FlowLayout.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\OptionCell.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\SegmentedControl.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\StyleDefinition.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\Theme\DarkTheme.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\Theme\LightTheme.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\Theme\ThemeBase.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="$(MSBuildThisFileDirectory)Illust\" />
<Folder Include="$(MSBuildThisFileDirectory)Utils\" />
<Folder Include="$(MSBuildThisFileDirectory)Resources\" />
<Folder Include="$(MSBuildThisFileDirectory)Resources\Languages\" />
<Folder Include="$(MSBuildThisFileDirectory)UI\" />
<Folder Include="$(MSBuildThisFileDirectory)UI\Theme\" />
</ItemGroup>
</Project>

11
Pixiview/Pixiview.shproj Normal file
View 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>{57C27E64-049B-4EE8-9308-BCAFE329E8E8}</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="Pixiview.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
</Project>

View File

@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Xml.Linq; using System.Xml;
using Xamarin.Forms; using Xamarin.Forms;
using Xamarin.Forms.Xaml; using Xamarin.Forms.Xaml;
@ -65,29 +65,41 @@ namespace Pixiview.Resources
{ {
try try
{ {
#if __IOS__
var langId = $"Pixiview.iOS.Resources.Languages.{lang.Language}.xml";
var langCodeId = $"Pixiview.iOS.Resources.Languages.{lang.LanguageCode}.xml";
#else
var langId = $"Pixiview.Android.Resources.Languages.{lang.Language}.xml";
var langCodeId = $"Pixiview.Android.Resources.Languages.{lang.LanguageCode}.xml";
#endif
var assembly = IntrospectionExtensions.GetTypeInfo(typeof(LanguageResource)).Assembly; var assembly = IntrospectionExtensions.GetTypeInfo(typeof(LanguageResource)).Assembly;
var names = assembly.GetManifestResourceNames(); var names = assembly.GetManifestResourceNames();
var name = names.FirstOrDefault(n var name = names.FirstOrDefault(n
=> string.Equals(n, $"Pixiview.Resources.Languages.{lang.Language}.xml", StringComparison.OrdinalIgnoreCase) => string.Equals(n, langId, StringComparison.OrdinalIgnoreCase)
|| string.Equals(n, $"Pixiview.Resources.Languages.{lang.LanguageCode}.xml", StringComparison.OrdinalIgnoreCase)); || string.Equals(n, langCodeId, StringComparison.OrdinalIgnoreCase));
if (name == null) if (name == null)
{ {
name = "Pixiview.Resources.Languages.zh-CN.xml"; #if __IOS__
name = "Pixiview.iOS.Resources.Languages.zh-CN.xml";
#else
name = "Pixiview.Android.Resources.Languages.zh-CN.xml";
#endif
} }
XDocument xml; var xml = new XmlDocument();
using (var stream = assembly.GetManifestResourceStream(name)) using (var stream = assembly.GetManifestResourceStream(name))
{ {
xml = XDocument.Load(stream); xml.Load(stream);
} }
strings = new Dictionary<string, string>(); strings = new Dictionary<string, string>();
foreach (var ele in xml.Root.Elements()) foreach (XmlElement ele in xml.DocumentElement) // .Root.Elements()
{ {
strings[ele.Name.LocalName] = ele.Value; strings[ele.Name] = ele.InnerText; // .LocalName Value
} }
} }
catch catch (Exception ex)
{ {
// load failed // load failed
App.DebugError("language.ctor", $"failed to load xml resource: {ex.Message}");
} }
} }
} }

View File

@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using Xamarin.Forms; using Xamarin.Forms;
namespace Pixiview.UI namespace Pixiview.UI
@ -48,7 +47,7 @@ namespace Pixiview.UI
public event EventHandler<ValueChangedEventArgs> ValueChanged; public event EventHandler<ValueChangedEventArgs> ValueChanged;
[EditorBrowsable(EditorBrowsableState.Never)] //[EditorBrowsable(EditorBrowsableState.Never)]
public void SendValueChanged() public void SendValueChanged()
{ {
ValueChanged?.Invoke(this, new ValueChangedEventArgs { NewValue = SelectedSegmentIndex }); ValueChanged?.Invoke(this, new ValueChangedEventArgs { NewValue = SelectedSegmentIndex });

View File

@ -57,57 +57,54 @@ namespace Pixiview.UI
{ {
return _isFullscreenDevice.Value; return _isFullscreenDevice.Value;
} }
if (Device.RuntimePlatform == Device.iOS) #if __IOS__
try
{ {
try var model = DeviceInfo.Model;
if (model == "iPhone10,3")
{ {
var model = DeviceInfo.Model; // iPhone X
if (model == "iPhone10,3") _isFullscreenDevice = true;
}
else if (model.StartsWith("iPhone"))
{
var vs = model.Substring(6).Split(',');
if (vs.Length == 2 && int.TryParse(vs[0], out int main) && int.TryParse(vs[1], out int sub))
{ {
// iPhone X // iPhone X/XS/XR or iPhone 11
_isFullscreenDevice = true; _isFullscreenDevice = (main == 10 && sub >= 6) || (main > 10);
} }
else if (model.StartsWith("iPhone"))
{
var vs = model.Substring(6).Split(',');
if (vs.Length == 2 && int.TryParse(vs[0], out int main) && int.TryParse(vs[1], out int sub))
{
// iPhone X/XS/XR or iPhone 11
_isFullscreenDevice = (main == 10 && sub >= 6) || (main > 10);
}
else
{
_isFullscreenDevice = false;
}
}
else if (model.StartsWith("iPad8,"))
{
// iPad 11-inch or 12.9-inch (3rd+)
_isFullscreenDevice = true;
}
#if DEBUG
else else
{ {
// iPad or Simulator _isFullscreenDevice = false;
var name = DeviceInfo.Name;
_isFullscreenDevice = name.StartsWith("iPhone X")
|| name.StartsWith("iPhone 11")
|| name.StartsWith("iPad Pro (11-inch)")
|| name.StartsWith("iPad Pro (12.9-inch) (3rd generation)")
|| name.StartsWith("iPad Pro (12.9-inch) (4th generation)");
} }
#endif
} }
catch (Exception ex) else if (model.StartsWith("iPad8,"))
{ {
App.DebugError("device.get", $"failed to get the device model. {ex.Message}"); // iPad 11-inch or 12.9-inch (3rd+)
_isFullscreenDevice = true;
} }
#if DEBUG
else
{
// iPad or Simulator
var name = DeviceInfo.Name;
_isFullscreenDevice = name.StartsWith("iPhone X")
|| name.StartsWith("iPhone 11")
|| name.StartsWith("iPad Pro (11-inch)")
|| name.StartsWith("iPad Pro (12.9-inch) (3rd generation)")
|| name.StartsWith("iPad Pro (12.9-inch) (4th generation)");
}
#endif
} }
else catch (Exception ex)
{ {
// TODO: App.DebugError("device.get", $"failed to get the device model. {ex.Message}");
_isFullscreenDevice = false;
} }
#else
// TODO:
_isFullscreenDevice = false;
#endif
if (_isFullscreenDevice == null) if (_isFullscreenDevice == null)
{ {
_isFullscreenDevice = false; _isFullscreenDevice = false;

View File

@ -36,7 +36,7 @@ namespace Pixiview.Utils
{ {
try try
{ {
return Connectivity.NetworkAccess == NetworkAccess.Internet; return Connectivity.NetworkAccess == Xamarin.Essentials.NetworkAccess.Internet;
} }
catch catch
{ {