From 8309664bc53f72b0c808c339329cabcee87657c5 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 25 七月 2023 17:57:11 +0800
Subject: [PATCH] 移植库过来
---
Shared.IOS/UI/Application.cs | 435 +
HDL-ON_Android/Properties/AndroidManifest.xml | 2
Shared.IOS/UI/GestureLockView.cs | 243
Shared.IOS/Properties/AssemblyInfo.cs | 34
Shared.IOS/UI/Camera.cs | 281
Shared.IOS/UI/DiyImageVerticalSeekBar.cs | 398 +
Shared.IOS/UI/RowLayout.cs | 490 +
Shared.IOS/Utils/TouchIDUtils.cs | 110
HDL-ON_iOS/HDL-ON_iOS.csproj | 59
HDL_ON/Common/ApiUtlis.cs | 15
Shared.IOS/UI/Alert.cs | 107
Shared.IOS/UI/CurtainRollSeekBarOn.cs | 321
Shared.IOS/UI/DiyArcSeekBar.cs | 410 +
Shared.IOS/UI/Spinner.cs | 186
Shared.IOS/CommonClass.cs | 45
HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs | 4
Shared.IOS/UI/LongPressMoveVerticalScrolViewLayout.cs | 277
Shared.IOS/UI/UIPickerView.cs | 282
Shared.IOS/UI/EditText.cs | 616 +
Shared.IOS/BaseApplicationDelegate.cs | 357 +
Shared.IOS/Reachability.cs | 151
Shared.IOS/UI/CoverFlowLayout.cs | 356 +
Shared.IOS/UI/HorizontalPages.cs | 890 ++
Shared.IOS/UI/ArcSeekBar.cs | 419 +
Shared.IOS/Shared.IOS.userprefs | 9
Shared.IOS/UI/DateView.cs | 124
Shared.IOS/Ezviz.cs | 39
Shared.IOS/MusicInfo.cs | 228
Shared.IOS/Server.cs | 172
Shared.IOS/UI/Video.cs | 93
HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs | 10
Shared.IOS/UI/VerticalRefreshLayout.cs | 279
Shared.IOS/Net/WifiUtil.cs | 63
Shared.IOS/UI/HorizontalScrolViewLayout.cs | 232
Shared.IOS/UI/UrlMonitor.cs | 131
Shared.IOS/Utils/HDLUtils.cs | 80
Shared.IOS/UI/Scan.cs | 26
Shared.IOS/UI/UICoverFlowView.cs | 300
Shared.IOS/Native References/libMyLibrary.a | 0
Shared.IOS/UI/View.cs | 1082 +++
Shared.IOS/UI/Loading.cs | 310
Shared.IOS/UI/PageLayout.cs | 335
Shared.IOS/UI/DiyImageSeekBar.cs | 407 +
Shared.IOS/UI/CurtainSeekBar.cs | 322
Shared.IOS/Net/NetWiFi.cs | 43
Shared.IOS/Native References/libSmartLink.a | 0
Shared.IOS/BaseApplicationDelegateForOnPro.cs | 134
Shared.IOS/UI/Button.cs | 515 +
Shared.IOS/UI/EditTextView.cs | 625 +
Shared.IOS/Volume.cs | 77
Shared.IOS/UI/MyEchartsViewOn.cs | 148
Shared.IOS/BaseApplicationDelegateForHdlOn.cs | 134
Shared.IOS/UI/MyEchartsView.cs | 168
Shared.IOS/UI/CurtainSingleSeekBar.cs | 313
Shared.IOS/UI/TextView.cs | 467 +
Shared.IOS/Shared.IOS.csproj | 198
Shared.IOS/UI/ImageView.cs | 130
Shared.IOS/UI/WaveSeekBar.cs | 384 +
Shared.IOS/UI/Contacts.cs | 66
Shared.IOS/UI/MusicVerticalScrolViewLayout.cs | 262
Shared.IOS/UI/Tip.cs | 77
Shared.IOS/UI/CurtainRollSeekBar.cs | 327
Shared.IOS/UI/Dialog.cs | 183
Shared.IOS/UI/ColorPicker.cs | 164
Shared.IOS/IO/FileUtils.cs | 291
HDL_APP_Project.sln | 14
Shared.IOS/UI/Enum.cs | 85
Shared.IOS/UI/WebView.cs | 167
Shared.IOS/packages.config | 8
Shared.IOS/UI/WiimuUPnP.cs | 91
Shared.IOS/UI/GDMapView.cs | 43
Shared.IOS/UI/FrameLayout.cs | 104
Shared.IOS/UI/TimeView.cs | 113
Shared.IOS/UI/VerticalSeekBar.cs | 459 +
Shared.IOS/UI/CurtainSeekBarOn.cs | 310
Shared.IOS/UI/HorizontalSeekBar.cs | 340
Shared.IOS/UI/VerticalScrolViewLayout.cs | 246
Shared.IOS/UI/Lanuage.cs | 99
Shared.IOS/UI/WaveSeekBarOn.cs | 413 +
Shared.IOS/StructsAndEnums.cs | 47
Shared.IOS/UI/CropImage.cs | 115
Shared.IOS/UI/ArcScaleSeekBar.cs | 315
Shared.IOS/Native References/libxml2.tbd | 579 +
Shared.IOS/UI/GradientMaskView.cs | 292
Shared.IOS/UI/UIDrawerLayout.cs | 508 +
Shared.IOS/UI/ViewGroup.cs | 293
Shared.IOS/UI/PickerView.cs | 176
Shared.IOS/UI/ProgressLoading.cs | 418 +
Shared.IOS/ApiDefinition.cs | 365 +
Shared.IOS/BaseViewController.cs | 42
Shared.IOS/UI/BaseSeekBar.cs | 44
91 files changed, 21,083 insertions(+), 39 deletions(-)
diff --git a/HDL-ON_Android/Properties/AndroidManifest.xml b/HDL-ON_Android/Properties/AndroidManifest.xml
index 7a7f143..19c387b 100644
--- a/HDL-ON_Android/Properties/AndroidManifest.xml
+++ b/HDL-ON_Android/Properties/AndroidManifest.xml
@@ -1,5 +1,5 @@
锘�<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.9.0" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202307222">
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="2.0.0" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202307251">
<uses-sdk android:minSdkVersion="26" android:targetSdkVersion="29" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<!--鍙嬬洘-->
diff --git a/HDL-ON_iOS/HDL-ON_iOS.csproj b/HDL-ON_iOS/HDL-ON_iOS.csproj
index b24f3e4..b50a2b4 100644
--- a/HDL-ON_iOS/HDL-ON_iOS.csproj
+++ b/HDL-ON_iOS/HDL-ON_iOS.csproj
@@ -96,9 +96,6 @@
<Reference Include="HDL.Shared.IOS.ScanQRCode">
<HintPath>..\DLL\IOS\HDL.Shared.IOS.ScanQRCode.dll</HintPath>
</Reference>
- <Reference Include="Shared.IOS">
- <HintPath>..\DLL\Shared.IOS.dll</HintPath>
- </Reference>
<Reference Include="Shared.IOS.HDLLinphoneSDK">
<HintPath>..\DLL\Linphone\iOS\Shared.IOS.HDLLinphoneSDK.dll</HintPath>
</Reference>
@@ -1562,6 +1559,32 @@
<BundleResource Include="Resources\Phone\FunctionIcon\Light\ColorfulBar.png" />
<BundleResource Include="Resources\Phone\FunctionIcon\Icon\HomeIcon\groupControl_blue.png" />
<BundleResource Include="Resources\Phone\FunctionIcon\Icon\HomeIcon\groupControl_white.png" />
+ <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\DoorlockUserManager.png" />
+ <BundleResource Include="Resources\Phone\FunctionIcon\Icon\groupControl.png" />
+ <BundleResource Include="Resources\Phone\LogicIcon\SeriesIcon.png" />
+ <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\UserRightsManagement\NfcIcon.png" />
+ <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\UserRightsManagement\DigitalPasswordIcon.png" />
+ <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\UserRightsManagement\FingerprintIcon.png" />
+ <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\UserRightsManagement\DigitalPasswordOnIcon.png" />
+ <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\UserRightsManagement\FingerprintOnIcon.png" />
+ <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\UserRightsManagement\NfcOnIcon.png" />
+ <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\UserRightsManagement\FaceOnIcon.png" />
+ <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\UserRightsManagement\FaceIcon.png" />
+ <BundleResource Include="Resources\Phone\FunctionIcon\Icon\peephole.png" />
+ <BundleResource Include="Resources\Phone\FunctionIcon\Icon\securityipcamez.png" />
+ <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\AutomaitcTriggerIcon_blue.png" />
+ <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\AutomaitcTriggerIcon_white.png" />
+ <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\FaceUnlockImage.png" />
+ <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\ManualTriggerIcon_blue.png" />
+ <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\ManualTriggerIcon_white.png" />
+ <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\TouchUnlcokImage.png" />
+ <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\DoorlockHelpImage1.png" />
+ <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\DoorlockHelpImage2.png" />
+ <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\DoorlockHelpImage3.png" />
+ <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\DoorlockHelpImage4.png" />
+ <BundleResource Include="Resources\Phone\FunctionIcon\Icon\HorseRaceLampIcon.png" />
+ <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\VideoDoorlockBatteryManagementBg.png" />
+ <BundleResource Include="Resources\Phone\Classification\Room\HomePagebg.png" />
<BundleResource Include="Resources\h5\index.html" />
<BundleResource Include="Resources\h5\static\index.63b34199.css" />
<BundleResource Include="Resources\h5\static\images\coal-save-ic.png" />
@@ -1591,32 +1614,6 @@
<BundleResource Include="Resources\h5\static\img\equal-plant-ic.7ef6befa.png" />
<BundleResource Include="Resources\h5\static\img\coal-save-ic.6c5fd125.png" />
<BundleResource Include="Resources\h5\static\font\SourceHanSansCN-Normal.otf" />
- <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\DoorlockUserManager.png" />
- <BundleResource Include="Resources\Phone\FunctionIcon\Icon\groupControl.png" />
- <BundleResource Include="Resources\Phone\LogicIcon\SeriesIcon.png" />
- <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\UserRightsManagement\NfcIcon.png" />
- <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\UserRightsManagement\DigitalPasswordIcon.png" />
- <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\UserRightsManagement\FingerprintIcon.png" />
- <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\UserRightsManagement\DigitalPasswordOnIcon.png" />
- <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\UserRightsManagement\FingerprintOnIcon.png" />
- <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\UserRightsManagement\NfcOnIcon.png" />
- <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\UserRightsManagement\FaceOnIcon.png" />
- <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\UserRightsManagement\FaceIcon.png" />
- <BundleResource Include="Resources\Phone\FunctionIcon\Icon\peephole.png" />
- <BundleResource Include="Resources\Phone\FunctionIcon\Icon\securityipcamez.png" />
- <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\AutomaitcTriggerIcon_blue.png" />
- <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\AutomaitcTriggerIcon_white.png" />
- <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\FaceUnlockImage.png" />
- <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\ManualTriggerIcon_blue.png" />
- <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\ManualTriggerIcon_white.png" />
- <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\TouchUnlcokImage.png" />
- <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\DoorlockHelpImage1.png" />
- <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\DoorlockHelpImage2.png" />
- <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\DoorlockHelpImage3.png" />
- <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\DoorlockHelpImage4.png" />
- <BundleResource Include="Resources\Phone\FunctionIcon\Icon\HorseRaceLampIcon.png" />
- <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\VideoDoorlockBatteryManagementBg.png" />
- <BundleResource Include="Resources\Phone\Classification\Room\HomePagebg.png" />
</ItemGroup>
<ItemGroup>
<ITunesArtwork Include="iTunesArtwork" />
@@ -1661,6 +1658,10 @@
<Project>{2DDF4C3C-6998-432E-9F43-6786D82F0630}</Project>
<Name>Blufi</Name>
</ProjectReference>
+ <ProjectReference Include="..\Shared.IOS\Shared.IOS.csproj">
+ <Project>{0048AB87-2130-4437-8F01-8CADAB787004}</Project>
+ <Name>Shared.IOS</Name>
+ </ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Base.lproj\Intents.intentdefinition" />
diff --git a/HDL_APP_Project.sln b/HDL_APP_Project.sln
index 1426310..ddae6b7 100644
--- a/HDL_APP_Project.sln
+++ b/HDL_APP_Project.sln
@@ -20,6 +20,8 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AliyuLog", "AliyuLog\AliyuLog.csproj", "{3A0E9FF9-56B6-4323-9AE6-2B22975E399B}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared.IOS", "Shared.IOS\Shared.IOS.csproj", "{0048AB87-2130-4437-8F01-8CADAB787004}"
+EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
HDL_ON\HDL_ON.projitems*{09712674-2a38-407b-b1e2-560b2c352f9a}*SharedItemsImports = 4
@@ -133,6 +135,18 @@
{3A0E9FF9-56B6-4323-9AE6-2B22975E399B}.Release|iPhone.Build.0 = Release|Any CPU
{3A0E9FF9-56B6-4323-9AE6-2B22975E399B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{3A0E9FF9-56B6-4323-9AE6-2B22975E399B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {0048AB87-2130-4437-8F01-8CADAB787004}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0048AB87-2130-4437-8F01-8CADAB787004}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0048AB87-2130-4437-8F01-8CADAB787004}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {0048AB87-2130-4437-8F01-8CADAB787004}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {0048AB87-2130-4437-8F01-8CADAB787004}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {0048AB87-2130-4437-8F01-8CADAB787004}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {0048AB87-2130-4437-8F01-8CADAB787004}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0048AB87-2130-4437-8F01-8CADAB787004}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0048AB87-2130-4437-8F01-8CADAB787004}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {0048AB87-2130-4437-8F01-8CADAB787004}.Release|iPhone.Build.0 = Release|Any CPU
+ {0048AB87-2130-4437-8F01-8CADAB787004}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {0048AB87-2130-4437-8F01-8CADAB787004}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs
index 65288e4..e6f4a51 100644
--- a/HDL_ON/Common/ApiUtlis.cs
+++ b/HDL_ON/Common/ApiUtlis.cs
@@ -104,6 +104,11 @@
code = Ins.HttpRequest.RefreshToken();
if (code != StateCode.SUCCESS)
{
+ if (waitPage != null)
+ {
+ waitPage.RemoveFromParent();
+ waitPage = null;
+ }
MainPage.Log($"鍒锋柊token澶辫触");
return;
}
@@ -112,6 +117,11 @@
code = Ins.HttpRequest.GetHomePager();
if (code != StateCode.SUCCESS)
{
+ if (waitPage != null)
+ {
+ waitPage.RemoveFromParent();
+ waitPage = null;
+ }
MainPage.Log($"鍒锋柊浣忓畢淇℃伅澶辫触");
return;
}
@@ -120,6 +130,11 @@
code = Ins.HttpRequest.GetUserInfo();
if (code != StateCode.SUCCESS)
{
+ if (waitPage != null)
+ {
+ waitPage.RemoveFromParent();
+ waitPage = null;
+ }
MainPage.Log($"鍒锋柊涓汉淇℃伅澶辫触");
return;
}
diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
index 85c52d9..c75fe65 100644
--- a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
+++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
@@ -1452,13 +1452,13 @@
Inverter.Ins.H5Page.JSToNativeAction = (dictionary) =>
{
- //var jObj = dictionary;
- //JObject jObj = JObject.Parse(Newtonsoft.Json.JsonConvert.SerializeObject(dictionary));
-
+#if __IOS__
+ JObject jObj = JObject.Parse(Newtonsoft.Json.JsonConvert.SerializeObject(dictionary));
+#else
var valuePairs = "";
dictionary.TryGetValue("method", out valuePairs);
JObject jObj = JObject.Parse(valuePairs);
-
+#endif
if (!jObj.ContainsKey("method") || !jObj.ContainsKey("data"))
{
@@ -1511,7 +1511,7 @@
s1View.Height = s2View.Height = functionContentView.Height = functionContentViewHeight + Application.GetRealWidth(40);
- #endregion
+#endregion
}
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs
index ba10e47..3b9270e 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs
@@ -776,10 +776,6 @@
{ IsBackground = true }.Start();
}
}
-
-
- btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100);
- btnBrightnessText.Text = dimmerBar.Progress + "%";
};
diff --git a/Shared.IOS/ApiDefinition.cs b/Shared.IOS/ApiDefinition.cs
new file mode 100644
index 0000000..3c57975
--- /dev/null
+++ b/Shared.IOS/ApiDefinition.cs
@@ -0,0 +1,365 @@
+锘縰sing System;
+using CoreGraphics;
+using Foundation;
+using ObjCRuntime;
+using UIKit;
+
+
+namespace Shared
+{
+ // @interface GlobalInfo : NSObject
+ [BaseType(typeof(NSObject))]
+ interface GlobalInfo
+ {
+ // +(GlobalInfo *)sharedInstance;
+ [Static]
+ [Export("sharedInstance")]
+ //[Verify(MethodToProperty)]
+ GlobalInfo SharedInstance { get; }
+ }
+
+
+ //// @interface ZJPickerView : UIView
+ //[BaseType(typeof(UIView))]
+ //interface ZJPickerView
+ //{
+ // // +(void)zj_showWithDataList:(NSArray * _Nonnull)dataList propertyDict:(NSDictionary * _Nullable)propertyDict completion:(void (^ _Nullable)(NSString * _Nullable))completion;
+ // [Static]
+ // [Export("zj_showWithDataList:propertyDict:completion:")]
+ // //[Verify(StronglyTypedNSArray)]
+ // //void Zj_showWithDataList(NSString[] dataList, [NullAllowed] NSDictionary propertyDict, [NullAllowed] Action<NSString> completion);
+ // void Zj_showWithDataList(NSArray dataList, [NullAllowed] NSDictionary propertyDict, [NullAllowed] Action<NSString> completion);
+ //}
+
+ //[Static]
+ ////[Verify(ConstantsInterfaceAssociation)]
+ //partial interface Constants
+ //{
+ // // extern NSString *const _Nonnull ZJPickerViewPropertyCanceBtnTitleKey;
+ // [Field("ZJPickerViewPropertyCanceBtnTitleKey", "__Internal")]
+ // NSString ZJPickerViewPropertyCanceBtnTitleKey { get; }
+
+ // // extern NSString *const _Nonnull ZJPickerViewPropertySureBtnTitleKey;
+ // [Field("ZJPickerViewPropertySureBtnTitleKey", "__Internal")]
+ // NSString ZJPickerViewPropertySureBtnTitleKey { get; }
+
+ // // extern NSString *const _Nonnull ZJPickerViewPropertyTipLabelTextKey;
+ // [Field("ZJPickerViewPropertyTipLabelTextKey", "__Internal")]
+ // NSString ZJPickerViewPropertyTipLabelTextKey { get; }
+
+ // // extern NSString *const _Nonnull ZJPickerViewPropertyCanceBtnTitleColorKey;
+ // [Field("ZJPickerViewPropertyCanceBtnTitleColorKey", "__Internal")]
+ // NSString ZJPickerViewPropertyCanceBtnTitleColorKey { get; }
+
+ // // extern NSString *const _Nonnull ZJPickerViewPropertySureBtnTitleColorKey;
+ // [Field("ZJPickerViewPropertySureBtnTitleColorKey", "__Internal")]
+ // NSString ZJPickerViewPropertySureBtnTitleColorKey { get; }
+
+ // // extern NSString *const _Nonnull ZJPickerViewPropertyTipLabelTextColorKey;
+ // [Field("ZJPickerViewPropertyTipLabelTextColorKey", "__Internal")]
+ // NSString ZJPickerViewPropertyTipLabelTextColorKey { get; }
+
+ // // extern NSString *const _Nonnull ZJPickerViewPropertyLineViewBackgroundColorKey;
+ // [Field("ZJPickerViewPropertyLineViewBackgroundColorKey", "__Internal")]
+ // NSString ZJPickerViewPropertyLineViewBackgroundColorKey { get; }
+
+ // // extern NSString *const _Nonnull ZJPickerViewPropertyCanceBtnTitleFontKey;
+ // [Field("ZJPickerViewPropertyCanceBtnTitleFontKey", "__Internal")]
+ // NSString ZJPickerViewPropertyCanceBtnTitleFontKey { get; }
+
+ // // extern NSString *const _Nonnull ZJPickerViewPropertySureBtnTitleFontKey;
+ // [Field("ZJPickerViewPropertySureBtnTitleFontKey", "__Internal")]
+ // NSString ZJPickerViewPropertySureBtnTitleFontKey { get; }
+
+ // // extern NSString *const _Nonnull ZJPickerViewPropertyTipLabelTextFontKey;
+ // [Field("ZJPickerViewPropertyTipLabelTextFontKey", "__Internal")]
+ // NSString ZJPickerViewPropertyTipLabelTextFontKey { get; }
+
+ // // extern NSString *const _Nonnull ZJPickerViewPropertyPickerViewHeightKey;
+ // [Field("ZJPickerViewPropertyPickerViewHeightKey", "__Internal")]
+ // NSString ZJPickerViewPropertyPickerViewHeightKey { get; }
+
+ // // extern NSString *const _Nonnull ZJPickerViewPropertyOneComponentRowHeightKey;
+ // [Field("ZJPickerViewPropertyOneComponentRowHeightKey", "__Internal")]
+ // NSString ZJPickerViewPropertyOneComponentRowHeightKey { get; }
+
+ // // extern NSString *const _Nonnull ZJPickerViewPropertySelectRowTitleAttrKey;
+ // [Field("ZJPickerViewPropertySelectRowTitleAttrKey", "__Internal")]
+ // NSString ZJPickerViewPropertySelectRowTitleAttrKey { get; }
+
+ // // extern NSString *const _Nonnull ZJPickerViewPropertyUnSelectRowTitleAttrKey;
+ // [Field("ZJPickerViewPropertyUnSelectRowTitleAttrKey", "__Internal")]
+ // NSString ZJPickerViewPropertyUnSelectRowTitleAttrKey { get; }
+
+ // // extern NSString *const _Nonnull ZJPickerViewPropertyIsTouchBackgroundHideKey;
+ // [Field("ZJPickerViewPropertyIsTouchBackgroundHideKey", "__Internal")]
+ // NSString ZJPickerViewPropertyIsTouchBackgroundHideKey { get; }
+
+ // // extern NSString *const _Nonnull ZJPickerViewPropertyIsShowSelectContentKey;
+ // [Field("ZJPickerViewPropertyIsShowSelectContentKey", "__Internal")]
+ // NSString ZJPickerViewPropertyIsShowSelectContentKey { get; }
+
+ // // extern NSString *const _Nonnull ZJPickerViewPropertyIsScrollToSelectedRowKey;
+ // [Field("ZJPickerViewPropertyIsScrollToSelectedRowKey", "__Internal")]
+ // NSString ZJPickerViewPropertyIsScrollToSelectedRowKey { get; }
+
+ // // extern NSString *const _Nonnull ZJPickerViewPropertyIsAnimationShowKey;
+ // [Field("ZJPickerViewPropertyIsAnimationShowKey", "__Internal")]
+ // NSString ZJPickerViewPropertyIsAnimationShowKey { get; }
+
+ // // extern NSString *const _Nonnull ZJPickerViewPropertyBackgroundAlphaKey;
+ // [Field("ZJPickerViewPropertyBackgroundAlphaKey", "__Internal")]
+ // NSString ZJPickerViewPropertyBackgroundAlphaKey { get; }
+ //}
+
+
+
+ // @interface MyIpAddress : NSObject
+ [BaseType(typeof(NSObject))]
+ interface MyIpAddress
+ {
+ // +(NSString *)getIPAddress:(BOOL)preferIPv4;
+ [Static]
+ [Export("getCurrentLocalIP")]
+ string GetIPAddress();
+
+ [Static]
+ [Export("getCurrentBroadcastIP")]
+ string GetCurrentBroadcastIP();
+ }
+
+ #region AMPopTip
+ // @interface AMPopTip : UIView
+ [BaseType(typeof(UIView))]
+ internal interface AMPopTip
+ {
+ // +(instancetype)popTip;
+ [Static]
+ [Export("popTip")]
+ AMPopTip PopTip();
+
+ // -(void)showText:(NSString *)text direction:(AMPopTipDirection)direction maxWidth:(CGFloat)maxWidth inView:(UIView *)view fromFrame:(CGRect)frame;
+ [Export("showText:direction:maxWidth:inView:fromFrame:")]
+ void ShowText(string text, AMPopTipDirection direction, nfloat maxWidth, UIView view, CGRect frame);
+
+ // -(void)showAttributedText:(NSAttributedString *)text direction:(AMPopTipDirection)direction maxWidth:(CGFloat)maxWidth inView:(UIView *)view fromFrame:(CGRect)frame;
+ [Export("showAttributedText:direction:maxWidth:inView:fromFrame:")]
+ void ShowAttributedText(NSAttributedString text, AMPopTipDirection direction, nfloat maxWidth, UIView view, CGRect frame);
+
+ // -(void)showCustomView:(UIView *)customView direction:(AMPopTipDirection)direction inView:(UIView *)view fromFrame:(CGRect)frame;
+ [Export("showCustomView:direction:inView:fromFrame:")]
+ void ShowCustomView(UIView customView, AMPopTipDirection direction, UIView view, CGRect frame);
+
+ // -(void)showText:(NSString *)text direction:(AMPopTipDirection)direction maxWidth:(CGFloat)maxWidth inView:(UIView *)view fromFrame:(CGRect)frame duration:(NSTimeInterval)interval;
+ [Export("showText:direction:maxWidth:inView:fromFrame:duration:")]
+ void ShowText(string text, AMPopTipDirection direction, nfloat maxWidth, UIView view, CGRect frame, double interval);
+
+ // -(void)showAttributedText:(NSAttributedString *)text direction:(AMPopTipDirection)direction maxWidth:(CGFloat)maxWidth inView:(UIView *)view fromFrame:(CGRect)frame duration:(NSTimeInterval)interval;
+ [Export("showAttributedText:direction:maxWidth:inView:fromFrame:duration:")]
+ void ShowAttributedText(NSAttributedString text, AMPopTipDirection direction, nfloat maxWidth, UIView view, CGRect frame, double interval);
+
+ // -(void)showCustomView:(UIView *)customView direction:(AMPopTipDirection)direction inView:(UIView *)view fromFrame:(CGRect)frame duration:(NSTimeInterval)interval;
+ [Export("showCustomView:direction:inView:fromFrame:duration:")]
+ void ShowCustomView(UIView customView, AMPopTipDirection direction, UIView view, CGRect frame, double interval);
+
+ // -(void)hide;
+ [Export("hide")]
+ void Hide();
+
+ // -(void)updateText:(NSString *)text;
+ [Export("updateText:")]
+ void UpdateText(string text);
+
+ // -(void)startActionAnimation;
+ [Export("startActionAnimation")]
+ void StartActionAnimation();
+
+ // -(void)stopActionAnimation;
+ [Export("stopActionAnimation")]
+ void StopActionAnimation();
+
+ // @property (nonatomic, strong) UIFont * font __attribute__((annotate("ui_appearance_selector")));
+ [Export("font", ArgumentSemantic.Strong)]
+ UIFont Font { get; set; }
+
+ // @property (nonatomic, strong) UIColor * textColor __attribute__((annotate("ui_appearance_selector")));
+ [Export("textColor", ArgumentSemantic.Strong)]
+ UIColor TextColor { get; set; }
+
+ // @property (assign, nonatomic) NSTextAlignment textAlignment __attribute__((annotate("ui_appearance_selector")));
+ [Export("textAlignment", ArgumentSemantic.Assign)]
+ UITextAlignment TextAlignment { get; set; }
+
+ // @property (nonatomic, strong) UIColor * popoverColor __attribute__((annotate("ui_appearance_selector")));
+ [Export("popoverColor", ArgumentSemantic.Strong)]
+ UIColor PopoverColor { get; set; }
+
+ // @property (nonatomic, strong) UIColor * borderColor __attribute__((annotate("ui_appearance_selector")));
+ [Export("borderColor", ArgumentSemantic.Strong)]
+ UIColor BorderColor { get; set; }
+
+ // @property (assign, nonatomic) CGFloat borderWidth __attribute__((annotate("ui_appearance_selector")));
+ [Export("borderWidth")]
+ nfloat BorderWidth { get; set; }
+
+ // @property (assign, nonatomic) CGFloat radius __attribute__((annotate("ui_appearance_selector")));
+ [Export("radius")]
+ nfloat Radius { get; set; }
+
+ // @property (getter = isRounded, assign, nonatomic) BOOL rounded __attribute__((annotate("ui_appearance_selector")));
+ [Export("rounded")]
+ bool Rounded { [Bind("isRounded")] get; set; }
+
+ // @property (assign, nonatomic) CGFloat offset __attribute__((annotate("ui_appearance_selector")));
+ [Export("offset")]
+ nfloat Offset { get; set; }
+
+ // @property (assign, nonatomic) CGFloat padding __attribute__((annotate("ui_appearance_selector")));
+ [Export("padding")]
+ nfloat Padding { get; set; }
+
+ // @property (assign, nonatomic) UIEdgeInsets edgeInsets __attribute__((annotate("ui_appearance_selector")));
+ [Export("edgeInsets", ArgumentSemantic.Assign)]
+ UIEdgeInsets EdgeInsets { get; set; }
+
+ // @property (assign, nonatomic) CGSize arrowSize __attribute__((annotate("ui_appearance_selector")));
+ [Export("arrowSize", ArgumentSemantic.Assign)]
+ CGSize ArrowSize { get; set; }
+
+ // @property (assign, nonatomic) NSTimeInterval animationIn __attribute__((annotate("ui_appearance_selector")));
+ [Export("animationIn")]
+ double AnimationIn { get; set; }
+
+ // @property (assign, nonatomic) NSTimeInterval animationOut __attribute__((annotate("ui_appearance_selector")));
+ [Export("animationOut")]
+ double AnimationOut { get; set; }
+
+ // @property (assign, nonatomic) NSTimeInterval delayIn __attribute__((annotate("ui_appearance_selector")));
+ [Export("delayIn")]
+ double DelayIn { get; set; }
+
+ // @property (assign, nonatomic) NSTimeInterval delayOut __attribute__((annotate("ui_appearance_selector")));
+ [Export("delayOut")]
+ double DelayOut { get; set; }
+
+ // @property (assign, nonatomic) AMPopTipEntranceAnimation entranceAnimation __attribute__((annotate("ui_appearance_selector")));
+ [Export("entranceAnimation", ArgumentSemantic.Assign)]
+ AMPopTipEntranceAnimation EntranceAnimation { get; set; }
+
+ // @property (assign, nonatomic) AMPopTipActionAnimation actionAnimation __attribute__((annotate("ui_appearance_selector")));
+ [Export("actionAnimation", ArgumentSemantic.Assign)]
+ AMPopTipActionAnimation ActionAnimation { get; set; }
+
+ // @property (assign, nonatomic) CGFloat actionFloatOffset __attribute__((annotate("ui_appearance_selector")));
+ [Export("actionFloatOffset")]
+ nfloat ActionFloatOffset { get; set; }
+
+ // @property (assign, nonatomic) CGFloat actionBounceOffset __attribute__((annotate("ui_appearance_selector")));
+ [Export("actionBounceOffset")]
+ nfloat ActionBounceOffset { get; set; }
+
+ // @property (assign, nonatomic) CGFloat actionPulseOffset __attribute__((annotate("ui_appearance_selector")));
+ [Export("actionPulseOffset")]
+ nfloat ActionPulseOffset { get; set; }
+
+ // @property (assign, nonatomic) NSTimeInterval actionAnimationIn __attribute__((annotate("ui_appearance_selector")));
+ [Export("actionAnimationIn")]
+ double ActionAnimationIn { get; set; }
+
+ // @property (assign, nonatomic) NSTimeInterval actionAnimationOut __attribute__((annotate("ui_appearance_selector")));
+ [Export("actionAnimationOut")]
+ double ActionAnimationOut { get; set; }
+
+ // @property (assign, nonatomic) NSTimeInterval actionDelayIn __attribute__((annotate("ui_appearance_selector")));
+ [Export("actionDelayIn")]
+ double ActionDelayIn { get; set; }
+
+ // @property (assign, nonatomic) NSTimeInterval actionDelayOut __attribute__((annotate("ui_appearance_selector")));
+ [Export("actionDelayOut")]
+ double ActionDelayOut { get; set; }
+
+ // @property (assign, nonatomic) CGFloat edgeMargin __attribute__((annotate("ui_appearance_selector")));
+ [Export("edgeMargin")]
+ nfloat EdgeMargin { get; set; }
+
+ // @property (assign, nonatomic) CGRect fromFrame;
+ [Export("fromFrame", ArgumentSemantic.Assign)]
+ CGRect FromFrame { get; set; }
+
+ // @property (readonly, assign, nonatomic) BOOL isVisible;
+ [Export("isVisible")]
+ bool IsVisible { get; }
+
+ // @property (readonly, assign, nonatomic) BOOL isAnimating;
+ [Export("isAnimating")]
+ bool IsAnimating { get; }
+
+ // @property (assign, nonatomic) BOOL shouldDismissOnTap;
+ [Export("shouldDismissOnTap")]
+ bool ShouldDismissOnTap { get; set; }
+
+ // @property (assign, nonatomic) BOOL shouldDismissOnTapOutside;
+ [Export("shouldDismissOnTapOutside")]
+ bool ShouldDismissOnTapOutside { get; set; }
+
+ // @property (assign, nonatomic) BOOL shouldDismissOnSwipeOutside;
+ [Export("shouldDismissOnSwipeOutside")]
+ bool ShouldDismissOnSwipeOutside { get; set; }
+
+ // @property (assign, nonatomic) UISwipeGestureRecognizerDirection swipeRemoveGestureDirection;
+ [Export("swipeRemoveGestureDirection", ArgumentSemantic.Assign)]
+ UISwipeGestureRecognizerDirection SwipeRemoveGestureDirection { get; set; }
+
+ // @property (copy, nonatomic) void (^tapHandler)();
+ [Export("tapHandler", ArgumentSemantic.Copy)]
+ Action TapHandler { get; set; }
+
+ // @property (copy, nonatomic) void (^appearHandler)();
+ [Export("appearHandler", ArgumentSemantic.Copy)]
+ Action AppearHandler { get; set; }
+
+ // @property (copy, nonatomic) void (^dismissHandler)();
+ [Export("dismissHandler", ArgumentSemantic.Copy)]
+ Action DismissHandler { get; set; }
+
+ // @property (copy, nonatomic) void (^entranceAnimationHandler)(void (^)(void));
+ [Export("entranceAnimationHandler", ArgumentSemantic.Copy)]
+ Action<Action> EntranceAnimationHandler { get; set; }
+
+ // @property (readonly, nonatomic) CGPoint arrowPosition;
+ [Export("arrowPosition")]
+ CGPoint ArrowPosition { get; }
+
+ // @property (readonly, nonatomic, weak) UIView * _Nullable containerView;
+ [NullAllowed, Export("containerView", ArgumentSemantic.Weak)]
+ UIView ContainerView { get; }
+
+ // @property (readonly, assign, nonatomic) AMPopTipDirection direction;
+ [Export("direction", ArgumentSemantic.Assign)]
+ AMPopTipDirection Direction { get; }
+ }
+ #endregion
+
+ // typedef void (^CommunSmartPlugBolck)(NSString *);
+ delegate void CommunSmartPlugBolck(string arg0);
+
+ // @interface WiimuSmartlink : NSObject
+ [BaseType(typeof(NSObject))]
+ interface WiimuSmartlink
+ {
+ // +(id)sharedInstance;
+ [Static]
+ [Export("sharedInstance")]
+ WiimuSmartlink SharedInstance { get; }
+
+ // -(void)startProvision:(NSString *)ssidStr passwd:(NSString *)passwdStr result:(CommunSmartPlugBolck)block;
+ [Export("startProvision:passwd:result:")]
+ void StartProvision(string ssidStr, string passwdStr, CommunSmartPlugBolck block);
+
+ // -(void)stopProvision:(CommunSmartPlugBolck)block;
+ [Export("stopProvision:")]
+ void StopProvision(CommunSmartPlugBolck block);
+ }
+
+
+ }
\ No newline at end of file
diff --git a/Shared.IOS/BaseApplicationDelegate.cs b/Shared.IOS/BaseApplicationDelegate.cs
new file mode 100644
index 0000000..d25d707
--- /dev/null
+++ b/Shared.IOS/BaseApplicationDelegate.cs
@@ -0,0 +1,357 @@
+锘縰sing System;
+//using AVFoundation;
+using com.hdl.on;
+using CoreLocation;
+using Foundation;
+
+using UIKit;
+
+
+namespace Shared
+{
+ public class BaseApplicationDelegate : UIApplicationDelegate
+ {
+ public static Action<UIApplication, NSDictionary> FinishedLaunchingAction;
+ public static Action<UIApplication> OnResignActivationAction;
+ public static Action<UIApplication> DidEnterBackgroundAction;
+ public static Action<UIApplication> WillEnterForegroundAction;
+ public static Action<UIApplication> OnActivatedAction;
+ public static Action<UIApplication> WillTerminateAction;
+ public static Action<string> DeviceTokenAction;
+ public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
+ {
+ //registerForRemoteNotification(application);
+
+ //if (Shared.Application.IsMusicEnable)
+ //{
+ // var musicInfo = new MusicInfo { };
+ // Volume.Init();
+ //}
+
+ FinishedLaunchingAction?.Invoke(application, launchOptions);
+
+ return true;
+ }
+
+ /// <summary>
+ /// 娉ㄥ唽杩滅▼娑堟伅鎺ㄩ��
+ /// </summary>
+ /// <param name="application">Application.</param>
+ void registerForRemoteNotification(UIApplication application)
+ {
+ if (8 <= int.Parse(UIDevice.CurrentDevice.SystemVersion.Split('.')[0]))
+ {
+ // 1.娉ㄥ唽UserNotification,浠ヨ幏鍙栨帹閫侀�氱煡鐨勬潈闄�
+ var settings = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Sound | UIUserNotificationType.Alert | UIUserNotificationType.Badge, null);
+ application.RegisterUserNotificationSettings(settings);
+
+ // 2.娉ㄥ唽杩滅▼鎺ㄩ��
+ application.RegisterForRemoteNotifications();
+ }
+ else
+ {
+ application.RegisterForRemoteNotificationTypes(UIRemoteNotificationType.NewsstandContentAvailability | UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound);
+ }
+ }
+
+ class MyCLLocationManager : CLLocationManager
+ {
+ public static MyCLLocationManager Instance
+ {
+ get
+ {
+ if (locationManager == null)
+ {
+ locationManager = new MyCLLocationManager();
+ //璁剧疆鏄惁鍏佽绯荤粺鑷姩鏆傚仠瀹氫綅
+ locationManager.PausesLocationUpdatesAutomatically = false;
+ locationManager.AllowsBackgroundLocationUpdates = true;
+ //璁剧疆瀹氫綅绮惧害
+ locationManager.DesiredAccuracy = CLLocation.AccuracyKilometer;
+ locationManager.init();
+ }
+
+ return locationManager;
+ }
+ }
+
+ //鍒ゆ柇瀹氫綅鎿嶄綔鏄惁琚厑璁�
+ static MyCLLocationManager locationManager;
+ //鏈�灏忕殑绉诲姩閫熷害 m/s
+ float minSpeed = 3;
+
+ //鏈�灏忕殑绉诲姩璺濈 m
+ float minInteval = 100;
+ /// <summary>
+ /// 鐢ㄦ埛鏄惁鍏佽瀹氫綅鍔熻兘
+ /// </summary>
+ public bool IsLocationServicesEnabled => LocationServicesEnabled;
+ void init()
+ {
+ if (LocationServicesEnabled)
+ {
+ //璁剧疆瀹氫綅鏇存柊鐨勬渶灏忚窛绂�
+ locationManager.DistanceFilter = minInteval;
+
+ locationManager.LocationsUpdated += (sender, e) =>
+ {
+ var location = e.Locations[e.Locations.Length - 1];
+ //adjustDistanceFilter(location);
+ //Shared.HDLUtils.WriteLine($"浣嶇疆淇℃伅鍙樺寲 缁忓害{location.Coordinate.Longitude} 绾害{location.Coordinate.Latitude}");
+ uploadToServer(location);
+ };
+
+ }
+ }
+ /**
+ * 瑙勫垯: 濡傛灉閫熷害灏忎簬minSpeed m/s 鍒欐妸瑙﹀彂鑼冨洿璁惧畾涓�100m
+ * 鍚﹀垯灏嗚Е鍙戣寖鍥磋瀹氫负minSpeed*minInteval
+ * 姝ゆ椂鑻ラ�熷害鍙樺寲瓒呰繃10% 鍒欐洿鏂板綋鍓嶇殑瑙﹀彂鑼冨洿(杩欓噷闄愬埗鏄洜涓轰笉鑳戒笉鍋滅殑璁剧疆distanceFilter,
+ * 鍚﹀垯uploadLocation浼氫笉鍋滆瑙﹀彂)
+*/
+ void adjustDistanceFilter(CLLocation location)
+ {
+ // NSLog(@"adjust:%f",location.speed);
+ if (location.Speed < minSpeed)
+ {
+ if (Math.Abs(DistanceFilter - minInteval) > 0.1f)
+ {
+ DistanceFilter = minInteval;
+ }
+ }
+ else
+ {
+ var lastSpeed = DistanceFilter / minInteval;
+ if ((Math.Abs(lastSpeed - location.Speed) / lastSpeed > 0.1f) || (lastSpeed < 0))
+ {
+ float newSpeed = (int)(location.Speed + 0.5f);
+ float newFilter = newSpeed * minInteval;
+
+ DistanceFilter = newFilter;
+ }
+ }
+ }
+ nint taskIdentifier = UIApplication.BackgroundTaskInvalid;
+ void beingBackgroundUpdateTask()
+ {
+ taskIdentifier = UIApplication.SharedApplication.BeginBackgroundTask(() =>
+ {
+ endBackgroundUpdateTask();
+ });
+ }
+
+ void endBackgroundUpdateTask()
+ {
+ if (taskIdentifier != UIApplication.BackgroundTaskInvalid)
+ {
+ UIApplication.SharedApplication.EndBackgroundTask(taskIdentifier);
+ taskIdentifier = UIApplication.BackgroundTaskInvalid;
+ }
+ }
+
+ void uploadToServer(CLLocation location)
+ {
+#warning 濡傛灉鏈夎緝闀挎椂闂寸殑鎿嶄綔 姣斿HTTP涓婁紶 璇蜂娇鐢╞eginBackgroundTaskWithExpirationHandler
+ if (UIApplication.SharedApplication.ApplicationState == UIApplicationState.Active)
+ {
+ //HTTP upload
+ Shared.Application.LocationAction?.Invoke(location.Coordinate.Longitude, location.Coordinate.Latitude);
+
+ endBackgroundUpdateTask();
+ }
+ else//鍚庡彴瀹氫綅
+ {
+ //鍋囧涓婁竴娆$殑涓婁紶鎿嶄綔灏氭湭缁撴潫 鍒欑洿鎺eturn
+ if (taskIdentifier != UIApplication.BackgroundTaskInvalid)
+ {
+ return;
+ }
+
+ beingBackgroundUpdateTask();
+
+ //HTTP upload
+ Shared.Application.LocationAction?.Invoke(location.Coordinate.Longitude, location.Coordinate.Latitude);
+
+ //涓婁紶瀹屾垚璁板緱璋冪敤
+ endBackgroundUpdateTask();
+ }
+ }
+ }
+
+ public override void OnResignActivation(UIApplication application) => OnResignActivationAction?.Invoke(application);// Invoked when the application is about to move from active to inactive state.// This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) // or when the user quits the application and it begins the transition to the background state.// Games should use this method to pause the game.
+
+ public override void DidEnterBackground(UIApplication application) => DidEnterBackgroundAction?.Invoke(application);// Use this method to release shared resources, save user data, invalidate timers and store the application state.// If your application supports background exection this method is called instead of WillTerminate when the user quits.
+
+ public override void WillEnterForeground(UIApplication application) => WillEnterForegroundAction?.Invoke(application);// Called as part of the transiton from background to active state.// Here you can undo many of the changes made on entering the background.
+
+ public override void OnActivated(UIApplication application)
+ {
+ //AVAudioSession.SharedInstance().SetActive(true);
+ OnActivatedAction?.Invoke(application);
+ // Restart any tasks that were paused (or not yet started) while the application was inactive.
+ // If the application was previously in the background, optionally refresh the user interface.
+ }
+
+ public override void WillTerminate(UIApplication application) => WillTerminateAction?.Invoke(application);// Called when the application is about to terminate. Save data, if needed. See also DidEnterBackground.
+ /// <summary>
+ /// 娉ㄥ唽杩滅▼娑堟伅鎺ㄩ�佸洖璋冩柟娉�
+ /// </summary>
+ /// <param name="application">Application.</param>
+ /// <param name="deviceToken">Device token.</param>
+ public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
+ {
+ var bytes = new byte[deviceToken.Length];
+ System.Runtime.InteropServices.Marshal.Copy(deviceToken.Bytes, bytes, 0, bytes.Length);
+
+ var stringBuilder = new System.Text.StringBuilder();
+ for (int i = 0; i < bytes.Length; i++)
+ {
+ stringBuilder.AppendFormat("{0:x2}", bytes[i]);
+ }
+ var newDeviceToken = stringBuilder.ToString();
+
+ var oldDeviceToken = NSUserDefaults.StandardUserDefaults.StringForKey("PushDeviceToken");
+
+ if (oldDeviceToken != newDeviceToken)
+ {
+ // Save new device token
+ NSUserDefaults.StandardUserDefaults.SetString(newDeviceToken, "PushDeviceToken");
+ }
+ DeviceTokenAction?.Invoke(newDeviceToken);
+ }
+
+ public virtual void setHDLRootViewController()
+ {
+
+
+ }
+
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ public class MyCLLocationManager : CLLocationManager
+ {
+ public static MyCLLocationManager Instance
+ {
+ get
+ {
+ if (locationManager == null)
+ {
+ locationManager = new MyCLLocationManager();
+ //璁剧疆鏄惁鍏佽绯荤粺鑷姩鏆傚仠瀹氫綅
+ locationManager.PausesLocationUpdatesAutomatically = false;
+ locationManager.AllowsBackgroundLocationUpdates = true;
+ //璁剧疆瀹氫綅绮惧害
+ locationManager.DesiredAccuracy = CLLocation.AccuracyKilometer;
+ locationManager.init();
+ }
+
+ return locationManager;
+ }
+ }
+
+ //鍒ゆ柇瀹氫綅鎿嶄綔鏄惁琚厑璁�
+ static MyCLLocationManager locationManager;
+ //鏈�灏忕殑绉诲姩閫熷害 m/s
+ float minSpeed = 3;
+
+ //鏈�灏忕殑绉诲姩璺濈 m
+ float minInteval = 100;
+ /// <summary>
+ /// 鐢ㄦ埛鏄惁鍏佽瀹氫綅鍔熻兘
+ /// </summary>
+ public bool IsLocationServicesEnabled => LocationServicesEnabled;
+ void init()
+ {
+ if (LocationServicesEnabled)
+ {
+ //璁剧疆瀹氫綅鏇存柊鐨勬渶灏忚窛绂�
+ locationManager.DistanceFilter = minInteval;
+
+ locationManager.LocationsUpdated += (sender, e) =>
+ {
+ var location = e.Locations[e.Locations.Length - 1];
+ //adjustDistanceFilter(location);
+ //Shared.HDLUtils.WriteLine($"浣嶇疆淇℃伅鍙樺寲 缁忓害{location.Coordinate.Longitude} 绾害{location.Coordinate.Latitude}");
+ uploadToServer(location);
+ };
+
+ }
+ }
+ /**
+* 瑙勫垯: 濡傛灉閫熷害灏忎簬minSpeed m/s 鍒欐妸瑙﹀彂鑼冨洿璁惧畾涓�100m
+* 鍚﹀垯灏嗚Е鍙戣寖鍥磋瀹氫负minSpeed*minInteval
+* 姝ゆ椂鑻ラ�熷害鍙樺寲瓒呰繃10% 鍒欐洿鏂板綋鍓嶇殑瑙﹀彂鑼冨洿(杩欓噷闄愬埗鏄洜涓轰笉鑳戒笉鍋滅殑璁剧疆distanceFilter,
+* 鍚﹀垯uploadLocation浼氫笉鍋滆瑙﹀彂)
+*/
+ void adjustDistanceFilter(CLLocation location)
+ {
+ // NSLog(@"adjust:%f",location.speed);
+ if (location.Speed < minSpeed)
+ {
+ if (Math.Abs(DistanceFilter - minInteval) > 0.1f)
+ {
+ DistanceFilter = minInteval;
+ }
+ }
+ else
+ {
+ var lastSpeed = DistanceFilter / minInteval;
+ if ((Math.Abs(lastSpeed - location.Speed) / lastSpeed > 0.1f) || (lastSpeed < 0))
+ {
+ float newSpeed = (int)(location.Speed + 0.5f);
+ float newFilter = newSpeed * minInteval;
+
+ DistanceFilter = newFilter;
+ }
+ }
+ }
+ nint taskIdentifier = UIApplication.BackgroundTaskInvalid;
+ void beingBackgroundUpdateTask()
+ {
+ taskIdentifier = UIApplication.SharedApplication.BeginBackgroundTask(() =>
+ {
+ endBackgroundUpdateTask();
+ });
+ }
+
+ void endBackgroundUpdateTask()
+ {
+ if (taskIdentifier != UIApplication.BackgroundTaskInvalid)
+ {
+ UIApplication.SharedApplication.EndBackgroundTask(taskIdentifier);
+ taskIdentifier = UIApplication.BackgroundTaskInvalid;
+ }
+ }
+
+ void uploadToServer(CLLocation location)
+ {
+#warning 濡傛灉鏈夎緝闀挎椂闂寸殑鎿嶄綔 姣斿HTTP涓婁紶 璇蜂娇鐢╞eginBackgroundTaskWithExpirationHandler
+ if (UIApplication.SharedApplication.ApplicationState == UIApplicationState.Active)
+ {
+ //HTTP upload
+ Shared.Application.LocationAction?.Invoke(location.Coordinate.Longitude, location.Coordinate.Latitude);
+
+ endBackgroundUpdateTask();
+ }
+ else//鍚庡彴瀹氫綅
+ {
+ //鍋囧涓婁竴娆$殑涓婁紶鎿嶄綔灏氭湭缁撴潫 鍒欑洿鎺eturn
+ if (taskIdentifier != UIApplication.BackgroundTaskInvalid)
+ {
+ return;
+ }
+
+ beingBackgroundUpdateTask();
+
+ //HTTP upload
+ Shared.Application.LocationAction?.Invoke(location.Coordinate.Longitude, location.Coordinate.Latitude);
+
+ //涓婁紶瀹屾垚璁板緱璋冪敤
+ endBackgroundUpdateTask();
+ }
+ }
+ }
+}
diff --git a/Shared.IOS/BaseApplicationDelegateForHdlOn.cs b/Shared.IOS/BaseApplicationDelegateForHdlOn.cs
new file mode 100644
index 0000000..7d4eeab
--- /dev/null
+++ b/Shared.IOS/BaseApplicationDelegateForHdlOn.cs
@@ -0,0 +1,134 @@
+锘縰sing System;
+//using AVFoundation;
+using com.hdl.on;
+using CoreLocation;
+using Foundation;
+
+using UIKit;
+
+namespace Shared
+{
+ public class BaseApplicationDelegateForHdlOn : UIApplicationDelegate
+ {
+ public static Action<UIApplication, NSDictionary> FinishedLaunchingAction;
+ public static Action<UIApplication> OnResignActivationAction;
+ public static Action<UIApplication> DidEnterBackgroundAction;
+ public static Action<UIApplication> WillEnterForegroundAction;
+ public static Action<UIApplication> OnActivatedAction;
+ public static Action<UIApplication> WillTerminateAction;
+ public static Action<string> DeviceTokenAction;
+ public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
+ {
+ registerForRemoteNotification(application);
+ if (Shared.Application.IsMusicEnable)
+ {
+ var musicInfo = new MusicInfo { };
+ Volume.Init();
+ }
+
+ locate();
+ FinishedLaunchingAction?.Invoke(application, launchOptions);
+ return true;
+ }
+
+ /// <summary>
+ /// 娉ㄥ唽杩滅▼娑堟伅鎺ㄩ��
+ /// </summary>
+ /// <param name="application">Application.</param>
+ void registerForRemoteNotification(UIApplication application)
+ {
+ if (8 <= int.Parse(UIDevice.CurrentDevice.SystemVersion.Split('.')[0]))
+ {
+ // 1.娉ㄥ唽UserNotification,浠ヨ幏鍙栨帹閫侀�氱煡鐨勬潈闄�
+ var settings = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Sound | UIUserNotificationType.Alert | UIUserNotificationType.Badge, null);
+ application.RegisterUserNotificationSettings(settings);
+
+ // 2.娉ㄥ唽杩滅▼鎺ㄩ��
+ application.RegisterForRemoteNotifications();
+ }
+ else
+ {
+ application.RegisterForRemoteNotificationTypes(UIRemoteNotificationType.NewsstandContentAvailability | UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound);
+ }
+ }
+
+ #region GPS 瀹氫綅
+ // 鍒ゆ柇瀹氫綅鎿嶄綔鏄惁琚厑璁�
+ CLLocationManager locationManager;
+ void locate()
+ {
+ //if (CLLocationManager.LocationServicesEnabled)
+ {
+ //瀹氫綅鍒濆鍖�
+ locationManager = new CLLocationManager();
+ //璁剧疆瀹氫綅绮惧害
+ locationManager.DesiredAccuracy = 100;
+ //璁剧疆鏄惁鍏佽绯荤粺鑷姩鏆傚仠瀹氫綅
+ locationManager.PausesLocationUpdatesAutomatically = false;
+ //璁剧疆瀹氫綅鏇存柊鐨勬渶灏忚窛绂�
+ locationManager.DistanceFilter = 10;
+
+ locationManager.LocationsUpdated += (sender, e) =>
+ {
+ var location = e.Locations[e.Locations.Length - 1];
+ Shared.Application.LocationAction?.Invoke(location.Coordinate.Longitude, location.Coordinate.Latitude);
+ locationManager.StopUpdatingLocation();
+ };
+ if (8 <= int.Parse(UIDevice.CurrentDevice.SystemVersion.Split('.')[0]))
+ {
+ //瀹氫綅绠$悊鑰呴渶瑕佷竴鐩磋姹傚畾浣嶆湇鍔�
+ locationManager.RequestWhenInUseAuthorization();
+ }
+ //if (9 <= int.Parse(UIDevice.CurrentDevice.SystemVersion.Split('.')[0]))
+ //{
+ // //闇�瑕佸厑璁稿悗鍙版洿鏂版暟鎹洿鏂�
+ // //locationManager.AllowsBackgroundLocationUpdates = true;
+ // locationManager.RequestAlwaysAuthorization();
+ //}
+
+ locationManager.StartUpdatingLocation();//寮�鍚畾浣�
+ }
+ }
+
+ #endregion
+ public override void OnResignActivation(UIApplication application) => OnResignActivationAction?.Invoke(application);// Invoked when the application is about to move from active to inactive state.// This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) // or when the user quits the application and it begins the transition to the background state.// Games should use this method to pause the game.
+
+ public override void DidEnterBackground(UIApplication application) => DidEnterBackgroundAction?.Invoke(application);// Use this method to release shared resources, save user data, invalidate timers and store the application state.// If your application supports background exection this method is called instead of WillTerminate when the user quits.
+
+ public override void WillEnterForeground(UIApplication application) => WillEnterForegroundAction?.Invoke(application);// Called as part of the transiton from background to active state.// Here you can undo many of the changes made on entering the background.
+
+ public override void OnActivated(UIApplication application)
+ {
+ //AVAudioSession.SharedInstance ().SetActive (true);
+ OnActivatedAction?.Invoke(application);
+ // Restart any tasks that were paused (or not yet started) while the application was inactive.
+ // If the application was previously in the background, optionally refresh the user interface.
+ }
+
+ public override void WillTerminate(UIApplication application) => WillTerminateAction?.Invoke(application);// Called when the application is about to terminate. Save data, if needed. See also DidEnterBackground.
+ /// <summary>
+ /// 娉ㄥ唽杩滅▼娑堟伅鎺ㄩ�佸洖璋冩柟娉�
+ /// </summary>
+ /// <param name="application">Application.</param>
+ /// <param name="deviceToken">Device token.</param>
+ public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
+ {
+ var deviceTokenDescription = deviceToken.Description;
+ if (!string.IsNullOrWhiteSpace(deviceTokenDescription))
+ {
+ deviceTokenDescription = deviceTokenDescription.Trim('<').Trim('>').Replace(" ", "");
+ Shared.HDLUtils.WriteLine($"DeviceToken:{deviceTokenDescription}");
+ }
+ // Get previous device token
+ var oldDeviceTokenDescription = NSUserDefaults.StandardUserDefaults.StringForKey("PushDeviceToken");
+
+ // Has the token changed?
+ if (oldDeviceTokenDescription != deviceTokenDescription)
+ {
+ // Save new device token
+ NSUserDefaults.StandardUserDefaults.SetString(deviceTokenDescription, "PushDeviceToken");
+ }
+ DeviceTokenAction?.Invoke(deviceTokenDescription);
+ }
+ }
+}
diff --git a/Shared.IOS/BaseApplicationDelegateForOnPro.cs b/Shared.IOS/BaseApplicationDelegateForOnPro.cs
new file mode 100644
index 0000000..011931d
--- /dev/null
+++ b/Shared.IOS/BaseApplicationDelegateForOnPro.cs
@@ -0,0 +1,134 @@
+锘縰sing System;
+//using AVFoundation;
+using com.hdl.on;
+using CoreLocation;
+using Foundation;
+
+using UIKit;
+
+namespace Shared
+{
+ public class BaseApplicationDelegateForOnPro : UIApplicationDelegate
+ {
+ public static Action<UIApplication, NSDictionary> FinishedLaunchingAction;
+ public static Action<UIApplication> OnResignActivationAction;
+ public static Action<UIApplication> DidEnterBackgroundAction;
+ public static Action<UIApplication> WillEnterForegroundAction;
+ public static Action<UIApplication> OnActivatedAction;
+ public static Action<UIApplication> WillTerminateAction;
+ public static Action<string> DeviceTokenAction;
+ public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
+ {
+ registerForRemoteNotification(application);
+ if (Shared.Application.IsMusicEnable)
+ {
+ var musicInfo = new MusicInfo { };
+ Volume.Init();
+ }
+
+ locate();
+ FinishedLaunchingAction?.Invoke(application, launchOptions);
+ return true;
+ }
+
+ /// <summary>
+ /// 娉ㄥ唽杩滅▼娑堟伅鎺ㄩ��
+ /// </summary>
+ /// <param name="application">Application.</param>
+ void registerForRemoteNotification(UIApplication application)
+ {
+ if (8 <= int.Parse(UIDevice.CurrentDevice.SystemVersion.Split('.')[0]))
+ {
+ // 1.娉ㄥ唽UserNotification,浠ヨ幏鍙栨帹閫侀�氱煡鐨勬潈闄�
+ var settings = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Sound | UIUserNotificationType.Alert | UIUserNotificationType.Badge, null);
+ application.RegisterUserNotificationSettings(settings);
+
+ // 2.娉ㄥ唽杩滅▼鎺ㄩ��
+ application.RegisterForRemoteNotifications();
+ }
+ else
+ {
+ application.RegisterForRemoteNotificationTypes(UIRemoteNotificationType.NewsstandContentAvailability | UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound);
+ }
+ }
+
+ #region GPS 瀹氫綅
+ // 鍒ゆ柇瀹氫綅鎿嶄綔鏄惁琚厑璁�
+ CLLocationManager locationManager;
+ void locate()
+ {
+ //if (CLLocationManager.LocationServicesEnabled)
+ {
+ //瀹氫綅鍒濆鍖�
+ locationManager = new CLLocationManager();
+ //璁剧疆瀹氫綅绮惧害
+ locationManager.DesiredAccuracy = 100;
+ //璁剧疆鏄惁鍏佽绯荤粺鑷姩鏆傚仠瀹氫綅
+ locationManager.PausesLocationUpdatesAutomatically = false;
+ //璁剧疆瀹氫綅鏇存柊鐨勬渶灏忚窛绂�
+ locationManager.DistanceFilter = 10;
+
+ locationManager.LocationsUpdated += (sender, e) =>
+ {
+ var location = e.Locations[e.Locations.Length - 1];
+ Shared.Application.LocationAction?.Invoke(location.Coordinate.Longitude, location.Coordinate.Latitude);
+ locationManager.StopUpdatingLocation();
+ };
+ if (8 <= int.Parse(UIDevice.CurrentDevice.SystemVersion.Split('.')[0]))
+ {
+ //瀹氫綅绠$悊鑰呴渶瑕佷竴鐩磋姹傚畾浣嶆湇鍔�
+ locationManager.RequestWhenInUseAuthorization();
+ }
+ //if (9 <= int.Parse(UIDevice.CurrentDevice.SystemVersion.Split('.')[0]))
+ //{
+ // //闇�瑕佸厑璁稿悗鍙版洿鏂版暟鎹洿鏂�
+ // //locationManager.AllowsBackgroundLocationUpdates = true;
+ // locationManager.RequestAlwaysAuthorization();
+ //}
+
+ locationManager.StartUpdatingLocation();//寮�鍚畾浣�
+ }
+ }
+
+ #endregion
+ public override void OnResignActivation(UIApplication application) => OnResignActivationAction?.Invoke(application);// Invoked when the application is about to move from active to inactive state.// This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) // or when the user quits the application and it begins the transition to the background state.// Games should use this method to pause the game.
+
+ public override void DidEnterBackground(UIApplication application) => DidEnterBackgroundAction?.Invoke(application);// Use this method to release shared resources, save user data, invalidate timers and store the application state.// If your application supports background exection this method is called instead of WillTerminate when the user quits.
+
+ public override void WillEnterForeground(UIApplication application) => WillEnterForegroundAction?.Invoke(application);// Called as part of the transiton from background to active state.// Here you can undo many of the changes made on entering the background.
+
+ public override void OnActivated(UIApplication application)
+ {
+ //AVAudioSession.SharedInstance ().SetActive (true);
+ OnActivatedAction?.Invoke(application);
+ // Restart any tasks that were paused (or not yet started) while the application was inactive.
+ // If the application was previously in the background, optionally refresh the user interface.
+ }
+
+ public override void WillTerminate(UIApplication application) => WillTerminateAction?.Invoke(application);// Called when the application is about to terminate. Save data, if needed. See also DidEnterBackground.
+ /// <summary>
+ /// 娉ㄥ唽杩滅▼娑堟伅鎺ㄩ�佸洖璋冩柟娉�
+ /// </summary>
+ /// <param name="application">Application.</param>
+ /// <param name="deviceToken">Device token.</param>
+ public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
+ {
+ var deviceTokenDescription = deviceToken.Description;
+ if (!string.IsNullOrWhiteSpace(deviceTokenDescription))
+ {
+ deviceTokenDescription = deviceTokenDescription.Trim('<').Trim('>').Replace(" ", "");
+ Shared.HDLUtils.WriteLine($"DeviceToken:{deviceTokenDescription}");
+ }
+ // Get previous device token
+ var oldDeviceTokenDescription = NSUserDefaults.StandardUserDefaults.StringForKey("PushDeviceToken");
+
+ // Has the token changed?
+ if (oldDeviceTokenDescription != deviceTokenDescription)
+ {
+ // Save new device token
+ NSUserDefaults.StandardUserDefaults.SetString(deviceTokenDescription, "PushDeviceToken");
+ }
+ DeviceTokenAction?.Invoke(deviceTokenDescription);
+ }
+ }
+}
diff --git a/Shared.IOS/BaseViewController.cs b/Shared.IOS/BaseViewController.cs
new file mode 100644
index 0000000..8a75033
--- /dev/null
+++ b/Shared.IOS/BaseViewController.cs
@@ -0,0 +1,42 @@
+锘縰sing System;
+using AVFoundation;
+using CoreGraphics;
+using Foundation;
+using UIKit;
+
+namespace Shared
+{
+ public class BaseViewController : UIViewController
+ {
+ public BaseViewController() : base() { }
+ public BaseViewController(IntPtr intPtr) : base(intPtr) { }
+
+ public static MediaPlayer.MPVolumeView MPVolumeView
+ {
+ internal set;
+ get;
+ }
+ public override void ViewDidLoad()
+ {
+ Instance = this;
+ base.ViewDidLoad();
+ var mainUIView = new UIView(new CoreGraphics.CGRect(0, 0, View.Frame.Width, View.Frame.Height));
+ View.AddSubview(mainUIView);
+ Application.RootFrameLayout = mainUIView;
+
+ if (Application.IsMusicEnable)
+ {
+ MPVolumeView = new MediaPlayer.MPVolumeView(new CoreGraphics.CGRect(-100, -100, 0, 0)) { Hidden = false };
+ View.AddSubview(MPVolumeView);
+ }
+ }
+ public static BaseViewController Instance;
+
+ public override void DidReceiveMemoryWarning()
+ {
+ base.DidReceiveMemoryWarning();
+ // Release any cached data, images, etc that aren't in use.
+ }
+
+ }
+}
diff --git a/Shared.IOS/CommonClass.cs b/Shared.IOS/CommonClass.cs
new file mode 100644
index 0000000..7f21352
--- /dev/null
+++ b/Shared.IOS/CommonClass.cs
@@ -0,0 +1,45 @@
+锘縰sing System;
+using Foundation;
+
+namespace Shared
+{
+ /// <summary>
+ /// 閫氱敤绫�
+ /// </summary>
+ public static class CommonClass
+ {
+ /// <summary>
+ /// 鎵撳紑App
+ /// </summary>
+ /// <param name="packageName">Package name.</param>
+ public static void OpenApp (string packageName)
+ {
+ UIKit.UIApplication.SharedApplication.OpenUrl (new Foundation.NSUrl (packageName));
+ }
+ /// <summary>
+ /// 璋冪敤鐣岄潰
+ /// </summary>
+ /// <param name="action">Action.</param>
+ public static void OpenAction(string action)
+ {
+ UIKit.UIApplication.SharedApplication.OpenUrl(new Foundation.NSUrl(action));
+ }
+
+ public static Action<Exception> excptionAction;
+
+ public static bool isDebug = false;
+ /// <summary>
+ /// 鎺т欢寮傚父浜嬩欢
+ /// </summary>
+ public static void ExcptionEvent(Exception msg)
+ {
+ Exception showMsg = msg;
+ excptionAction?.Invoke(showMsg);
+ if (isDebug)
+ {
+ throw msg;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/Shared.IOS/Ezviz.cs b/Shared.IOS/Ezviz.cs
new file mode 100644
index 0000000..efe1cdf
--- /dev/null
+++ b/Shared.IOS/Ezviz.cs
@@ -0,0 +1,39 @@
+锘縰sing System;
+using Foundation;
+using UIKit;
+
+namespace Shared
+{
+ public class Ezviz
+ {
+ public static void OpenEzviz(string url)
+ {
+ // NSLog(@"娣诲姞鎽勫儚澶�");
+ // 1.鑾峰彇搴旂敤绋嬪簭App-B鐨刄RL Scheme
+ //var appBUrl = new NSUrl("com.hdl.ezviz-monitor://?com.hdl.i-Life-ezviz");
+ //if (language == "en")
+ {
+ //appBUrl = "";
+ }
+ // 2.鍒ゆ柇鎵嬫満涓槸鍚﹀畨瑁呬簡瀵瑰簲绋嬪簭
+ //if (UIApplication.SharedApplication.CanOpenUrl(appBUrl))
+ {
+ // 3. 鎵撳紑搴旂敤绋嬪簭App-B
+ UIApplication.SharedApplication.OpenUrl(new NSUrl(url));
+ }
+ //else
+ {
+ // //NSLog(@"娌℃湁瀹夎");
+ //appBUrl=[NSURL URLWithString:@"https://itunes.apple.com/cn/app/i-life-ezviz/id1232176145?mt=8"];
+ // UIAlertController* alertVC =[UIAlertController alertControllerWithTitle: @"Go to Apple Store" message: @"download the APP" preferredStyle: UIAlertControllerStyleAlert];
+ //[alertVC addAction:[UIAlertAction actionWithTitle:@"sure" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+ // [[UIApplication sharedApplication]
+ //openURL:appBUrl];
+ // }]];
+ // [alertVC addAction:[UIAlertAction actionWithTitle:@"cancel" style:UIAlertActionStyleCancel handler:nil]];
+ // [self presentViewController:alertVC animated:YES completion:nil];
+ //}
+ }
+ }
+ }
+}
diff --git a/Shared.IOS/IO/FileUtils.cs b/Shared.IOS/IO/FileUtils.cs
new file mode 100755
index 0000000..459e985
--- /dev/null
+++ b/Shared.IOS/IO/FileUtils.cs
@@ -0,0 +1,291 @@
+锘縰sing System;
+using System.IO;
+
+namespace Shared.IO
+{
+ /// <summary>
+ /// 鏂囦欢绫�
+ /// </summary>
+ public static class FileUtils
+ {
+ /// <summary>
+ /// 鍒犻櫎鏂囦欢
+ /// </summary>
+ /// <param name="path">Path.</param>
+ public static void DeleteFile(string path)
+ {
+ System.IO.File.Delete (path);
+ }
+
+ /// <summary>
+ /// 浠庤祫婧愭枃浠堕噷鑾峰彇鏂囦欢
+ /// </summary>
+ /// <returns>The stream from resource.</returns>
+ /// <param name="path">Path.</param>
+ public static System.IO.Stream GetStreamFromResource(string path)
+ {
+ return new FileStream (path, FileMode.Open, FileAccess.Read);
+ }
+
+ /// <summary>
+ /// 鏍圭洰褰曡矾寰�
+ /// </summary>
+ public static readonly string RootPath=Application.RootPath;
+
+ /// <summary>
+ /// Writes the file by bytes.
+ /// </summary>
+ /// <returns><c>true</c>, if file by bytes was writed, <c>false</c> otherwise.</returns>
+ /// <param name="fileName">File name.</param>
+ /// <param name="bytes">Bytes.</param>
+ public static bool WriteFileByBytes(string fileName, byte []bytes)
+ {
+ if (fileName == null || (fileName = fileName.Trim ()) == ("")) {
+ return false;
+ }
+ System.IO.FileStream fs = null;
+
+ try {
+ fs = new FileStream (System.IO.Path.Combine (RootPath, fileName), FileMode.Create, FileAccess.Write);
+ fs.Write (bytes, 0, bytes.Length);
+ fs.Flush ();
+ return true;
+ } catch {
+ return false;
+ } finally {
+ try {
+ if (fs != null) {
+ fs.Close ();
+ }
+ } catch {
+ }
+ }
+
+ }
+
+ /// <summary>
+ /// Writes the file by input stream.
+ /// </summary>
+ /// <returns><c>true</c>, if file by input stream was writed, <c>false</c> otherwise.</returns>
+ /// <param name="fileName">File name.</param>
+ /// <param name="inputStream">Input stream.</param>
+ public static bool WriteFileByInputStream(string fileName, System.IO.Stream inputStream)
+ {
+ if (fileName == null || (fileName = fileName.Trim ()) == ("")) {
+ return false;
+ }
+
+ System.IO.FileStream fs = null;
+
+ try {
+ fs = new FileStream (System.IO.Path.Combine (RootPath, fileName), FileMode.Create, FileAccess.Write);
+ byte[] buffer = new byte[4 * 1024];
+ int length = 0;
+ while ((length = inputStream.Read (buffer, 0, buffer.Length)) != 0) {
+ fs.Write (buffer, 0, length);
+ fs.Flush ();
+ }
+
+ return true;
+ } catch {
+ return false;
+ } finally {
+ try {
+ if (fs != null) {
+ fs.Close ();
+ }
+ } catch {
+ }
+ }
+ }
+
+ /// <summary>
+ /// 璇诲彇鍥剧墖鏂囦欢
+ /// </summary>
+ /// <returns>The file.</returns>
+ /// <param name="fileName">File name.</param>
+ public static byte []ReadImage1(string fileName)
+ {
+ string tempfileName = fileName;
+ //鏆傛椂涓嶅鐞唒ad鍥剧墖锛屽厛鐢╬hone鍥剧墖
+ //if (Shared.Application.IsPad)
+ // {
+ // fileName = "Pad/" + fileName;
+ //}
+ //else
+ {
+ fileName = "Phone/" + fileName;
+ }
+ System.IO.FileStream fs = null;
+ try {
+ var filePath = Foundation.NSBundle.MainBundle.PathForResource(fileName, null);
+ if (filePath!=null){
+ fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
+ }
+ else if (System.IO.File.Exists (System.IO.Path.Combine (Application.RootPath, tempfileName))) {
+ fs = new FileStream (System.IO.Path.Combine (Application.RootPath, tempfileName), FileMode.Open, FileAccess.Read);
+ }
+ //璧勬簮鏂囦欢閲岀殑鏂囦欢
+ else if (System.IO.File.Exists (fileName)) {
+ fs = new FileStream (fileName, FileMode.Open, FileAccess.Read);
+ } else {
+ return new byte[0];
+ }
+ byte[] bytes = new byte[fs.Length];
+ fs.Read (bytes, 0, bytes.Length);
+ return bytes;
+ } catch {
+ return new byte[0];
+ } finally {
+ try {
+ if (fs != null) {
+ fs.Close ();
+ }
+ } catch {
+
+ }
+ }
+ }
+
+ /// <summary>
+ /// 璇诲彇鍥剧墖鏂囦欢璺緞
+ /// </summary>
+ /// <returns>The file.</returns>
+ /// <param name="fileName">File name.</param>
+ public static string GetImageFilePath(string fileName)
+ {
+ if(fileName==null)
+ {
+ return "";
+ }
+
+
+ //鍙兘鏄彁浜や簡瀹屾暣鐨勮矾寰勮繃鏉�
+ if (System.IO.File.Exists(fileName))
+ {
+ return fileName;
+ }
+
+ // 鍏堟壘鏄惁鏄敤鎴峰凡缁忔洿鏀硅繃鐨勫浘鐗囷紝杩欎釜鏄紭鍏堥�夋嫨
+ if (System.IO.File.Exists(System.IO.Path.Combine(Application.RootPath, fileName)))
+ {
+ return System.IO.Path.Combine(Application.RootPath, fileName);
+ }
+
+ string newFileName = null;
+ if (Application.Skin == null)
+ {
+ newFileName = "Phone/" + fileName;
+ }
+ else
+ {
+ newFileName = Application.Skin + "/" + fileName;
+ }
+
+ //data 鐩綍涓嬫煡鎵� 锛屾湁鍙兘鏄鐨偆鐨勬暟鎹�
+ if (System.IO.File.Exists(System.IO.Path.Combine(Application.RootPath, newFileName)))
+ {
+ return System.IO.Path.Combine(Application.RootPath, newFileName);
+ }
+
+ //Resource鐩綍涓嬫煡鎵�
+ var filePath = Foundation.NSBundle.MainBundle.PathForResource(newFileName, null);
+ if (filePath != null)
+ {
+ return filePath;
+ }
+
+ return "";
+
+ ////璧勬簮鏂囦欢閲岀殑鏂囦欢
+ //else if (System.IO.File.Exists(fileName))
+ //{
+ // return fileName;
+ //}
+ //else
+ //{
+ // return "";
+ //}
+ }
+
+ /// <summary>
+ /// Reads the string list.
+ /// </summary>
+ /// <returns>The string list.</returns>
+ /// <param name="fileName">File name.</param>
+ /// <param name="encoding">Encoding.</param>
+ public static System.Collections.Generic.List<string> ReadStringList(string fileName,System.Text.Encoding encoding)
+ {
+ System.Collections.Generic.List<string> stringList = new System.Collections.Generic.List<string> ();
+ System.IO.StreamReader fs = null;
+ try {
+ var filePath = Foundation.NSBundle.MainBundle.PathForResource(fileName, null);
+ if (filePath != null)
+ {
+ fs = new StreamReader(filePath, encoding);
+ }
+ else if (System.IO.File.Exists (System.IO.Path.Combine (RootPath, fileName))) {
+ fs = new StreamReader (System.IO.Path.Combine (RootPath, fileName),encoding);
+ } else if (System.IO.File.Exists (fileName)) {
+ fs = new StreamReader (fileName,encoding);
+ } else {
+ return stringList;
+ }
+ string s;
+ while(null!=(s=fs.ReadLine()))
+ {
+ stringList.Add(s);
+ }
+ return stringList;
+ } catch {
+ return stringList;
+ } finally {
+ try {
+ if (fs != null) {
+ fs.Close ();
+ }
+ } catch {
+
+ }
+ }
+ }
+
+ /// <summary>
+ /// Reads the file.
+ /// </summary>
+ /// <returns>The file.</returns>
+ /// <param name="fileName">File name.</param>
+ public static byte []ReadFile(string fileName)
+ {
+ System.IO.FileStream fs = null;
+ try {
+ var filePath = Foundation.NSBundle.MainBundle.PathForResource(fileName, null);
+ if (filePath != null)
+ {
+ fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
+ }
+ else if (System.IO.File.Exists (System.IO.Path.Combine (RootPath, fileName))) {
+ fs = new FileStream (System.IO.Path.Combine (RootPath, fileName), FileMode.Open, FileAccess.Read);
+ } else if (System.IO.File.Exists (fileName)) {
+ fs = new FileStream (fileName, FileMode.Open, FileAccess.Read);
+ } else {
+ return new byte[0];
+ }
+ byte[] bytes = new byte[fs.Length];
+ fs.Read (bytes, 0, bytes.Length);
+ return bytes;
+ } catch {
+ return new byte[0];
+ } finally {
+ try {
+ if (fs != null) {
+ fs.Close ();
+ }
+ } catch {
+
+ }
+ }
+ }
+ }
+}
+
diff --git a/Shared.IOS/MusicInfo.cs b/Shared.IOS/MusicInfo.cs
new file mode 100755
index 0000000..0f64945
--- /dev/null
+++ b/Shared.IOS/MusicInfo.cs
@@ -0,0 +1,228 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Web;
+using AVFoundation;
+using Foundation;
+using MediaPlayer;
+
+namespace Shared
+{
+ [System.Serializable]
+ public class MusicInfo
+ {
+ static MusicInfo()
+ {
+ System.Threading.Tasks.Task.Run(() =>
+ {
+ chekcAuthOfMusic();
+ });
+ }
+ static void chekcAuthOfMusic()
+ {
+ var authStatus = MPMediaLibrary.AuthorizationStatus;
+ if (authStatus == MPMediaLibraryAuthorizationStatus.NotDetermined)
+ {
+ MPMediaLibrary.RequestAuthorization((status) =>
+ {
+ if (status == MPMediaLibraryAuthorizationStatus.Authorized)
+ {
+ getNativeSongs();
+ }
+ });
+ }
+ else if (authStatus == MPMediaLibraryAuthorizationStatus.Authorized)
+ {
+ getNativeSongs();
+ }
+ }
+ static void getNativeSongs()
+ {
+ var itemsFromGenericQuery = new MPMediaQuery().Items;
+ if (itemsFromGenericQuery == null)
+ {
+ return;
+ }
+ foreach (MPMediaItem song in itemsFromGenericQuery)
+ {
+ var musicInfo = new MusicInfo { SourceType = "Local", AlbumId = "0", };
+ musicInfo.Title = song.ValueForProperty(new NSString("title"))?.ToString().TrimStart('<').TrimEnd('>').Replace("&", "");
+ if (musicInfo.Title == null)
+ {
+ musicInfo.Title = "Unkown";
+ }
+ musicInfo.Artist = song.ValueForProperty(new NSString("artist"))?.ToString().TrimStart('<').TrimEnd('>').Replace("&", "");
+ if (musicInfo.Artist == null)
+ {
+ musicInfo.Artist = "Unkown";
+ }
+
+ var ipodUrl = song.ValueForProperty(new NSString("assetURL"))?.ToString().TrimStart('<').TrimEnd('>').Replace("&", "");
+ if (ipodUrl == null)
+ {
+ ipodUrl = "";
+ }
+ musicInfo.Album = song.ValueForProperty(new NSString("albumTitle"))?.ToString().TrimStart('<').TrimEnd('>').Replace("&", "");
+ if (musicInfo.Album == null)
+ {
+ musicInfo.Album = "Unkown";
+ }
+ musicInfo.Album = musicInfo.Album.Replace("&", "&");
+
+ musicInfo.Duration = song.ValueForProperty(new NSString("playbackDuration"))?.ToString().TrimStart('<').TrimEnd('>').Replace("&", "");
+ if (musicInfo.Duration == null)
+ {
+ musicInfo.Duration = "0";
+ }
+ else
+ {
+ musicInfo.Duration = ((int)(float.Parse(musicInfo.Duration) * 1000)).ToString();
+ }
+
+ //musicInfo.URL = getFileUrl(ipodUrl);
+ musicInfo.ID = getFileUrl(ipodUrl);
+
+ if (!string.IsNullOrEmpty(musicInfo.ID))
+ {
+ MusicInfoList.Add(musicInfo);
+ }
+ }
+ var sharedInstance = GlobalInfo.SharedInstance;
+ }
+ static string getTempPath()
+ {
+ var dirs = NSSearchPath.GetDirectories(NSSearchPathDirectory.CachesDirectory, NSSearchPathDomain.User, true);
+ //var dirs = NSSearchPath.GetDirectories(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomain.User, true);
+ if (dirs == null || dirs.Length == 0)
+ {
+ return "";
+ }
+ return dirs[0];
+ }
+ //Error MT5211: Native linking failed, undefined Objective-C class: HTTPServer.The symbol '_OBJC_CLASS_$_HTTPServer' could not be found in any of the libraries or frameworks linked with your application. (MT5211) (Demo.IOS)
+ static string getFileUrl(string theURL)
+ {
+ if (string.IsNullOrEmpty(theURL))
+ {
+ return "";
+ }
+ var range = theURL.IndexOf("ipod-library:");
+ var substring = theURL.Substring(range);
+
+ var nameRange = theURL.IndexOf("?id=");
+ var nameStringPart = theURL.Substring(nameRange + 4);
+
+ var fileName = /*"SongFile_" +*/ nameStringPart;
+ var filePath = getTempPath() + "/" + fileName;
+
+ if (!NSFileManager.DefaultManager.FileExists(filePath))
+ {
+ var theResourceURL = NSUrl.FromString(substring);
+ var songAsset = AVUrlAsset.Create(theResourceURL);// new AVUrlAsset(theResourceURL);// [AVURLAsset URLAssetWithURL: theResourceURL options: nil];
+
+ var exportSession = new AVAssetExportSession(songAsset, AVAssetExportSessionPreset.AppleM4A);
+ exportSession.OutputUrl = new NSUrl(filePath, false);// [NSURL fileURLWithPath: filePath];
+ exportSession.OutputFileType = "com.apple.m4a-audio";
+
+ exportSession.ExportAsynchronously(() =>
+ {
+ if (exportSession.Status == AVAssetExportSessionStatus.Completed)
+ {
+ Shared.HDLUtils.WriteLine("闊充箰鏂囦欢澶嶅埗瀹屾垚");
+ }
+ else
+ {
+ Shared.HDLUtils.WriteLine("闊充箰鏂囦欢澶嶅埗澶辫触");
+ }
+ });//248838
+ }
+ //return $"http://{new Net.NetWiFi().IpAddress}:9876/Path={fileName}";
+ return fileName;
+ }
+ /// <summary>
+ /// 姝屾洸鍚嶇О
+ /// </summary>
+ public string Title;
+ /// <summary>
+ /// 姝屾洸鐨勬瓕鎵嬪悕
+ /// </summary>
+ public string Artist;
+ /// <summary>
+ /// 姝屾洸鐨勪笓杈戝悕
+ /// </summary>
+ public string Album;
+ /// <summary>
+ /// 姝屾洸涓撹緫ID
+ /// </summary>
+ public string AlbumId;
+ /// <summary>
+ /// 姝屾洸鏂囦欢鐨勮矾寰�
+ /// </summary>
+ public string Data;
+ /// <summary>
+ /// 姝屾洸鐨勬�绘挱鏀炬椂闀�
+ /// </summary>
+ public string Size;
+ /// <summary>
+ /// 姝屾洸鐨勬�绘挱鏀炬椂闀�
+ /// </summary>
+ public string Duration;
+ /// <summary>
+ /// 闊充箰ID
+ /// </summary>
+ public string ID;
+ /// <summary>
+ /// 缃戠粶鍦板潃
+ /// </summary>
+ public string URL;
+ /// <summary>
+ /// 鏂囦欢鍚�
+ /// </summary>
+ public string filename;
+ /// <summary>
+ /// DLNA鍒楄〃鍚�
+ /// </summary>
+ public string dlnalistName;
+ /// <summary>
+ /// 鍥剧墖
+ /// </summary>
+ public string Image;
+ /// <summary>
+ /// 鐢靛彴绫诲瀷
+ /// </summary>
+ public string Cntype;
+ /// <summary>
+ /// 鐢靛彴绫诲瀷
+ /// </summary>
+ public string Cnkey;
+ /// <summary>
+ /// 鏄惁鏄洰褰�
+ /// </summary>
+ public bool IsDirectory = true;
+
+ /// <summary>
+ /// USB Local URL
+ /// </summary>
+ public string SourceType;
+ public string SourceName;
+
+
+ readonly static List<MusicInfo> musicInfoList = new List<MusicInfo> { };
+ /// <summary>
+ /// 鑾峰彇鎵�鏈夌殑
+ /// </summary>
+ public static List<MusicInfo> MusicInfoList
+ {
+ get
+ {
+ return musicInfoList;
+ }
+ }
+
+ public object Tag;
+ }
+
+}
+
+
diff --git a/Shared.IOS/Native References/libMyLibrary.a b/Shared.IOS/Native References/libMyLibrary.a
new file mode 100644
index 0000000..77c92ad
--- /dev/null
+++ b/Shared.IOS/Native References/libMyLibrary.a
Binary files differ
diff --git a/Shared.IOS/Native References/libSmartLink.a b/Shared.IOS/Native References/libSmartLink.a
new file mode 100644
index 0000000..216b86b
--- /dev/null
+++ b/Shared.IOS/Native References/libSmartLink.a
Binary files differ
diff --git a/Shared.IOS/Native References/libxml2.tbd b/Shared.IOS/Native References/libxml2.tbd
new file mode 100644
index 0000000..f482b5b
--- /dev/null
+++ b/Shared.IOS/Native References/libxml2.tbd
@@ -0,0 +1,579 @@
+--- !tapi-tbd-v3
+archs: [ armv7, armv7s, arm64, arm64e ]
+uuids: [ 'armv7: A91DF475-E870-3CE2-95AF-955AE436969F', 'armv7s: 2F4C2061-91FF-3680-A6D0-C3264089AA41',
+ 'arm64: F2BB2B9C-EF7E-3B6D-BE22-DD3CA368BBAA', 'arm64e: E6975F35-4E48-3451-950A-56DB308CF629' ]
+platform: ios
+install-name: '/usr/lib/libxml2.2.dylib'
+current-version: 10.9
+compatibility-version: 10
+exports:
+ - archs: [ armv7, armv7s ]
+ symbols: [ ___htmlParseContent, ___xmlErrEncoding, ___xmlGlobalInitMutexDestroy,
+ ___xmlGlobalInitMutexLock, ___xmlGlobalInitMutexUnlock, ___xmlIOErr,
+ ___xmlInitializeDict, ___xmlLoaderErr, ___xmlRaiseError, ___xmlRandom,
+ ___xmlRegisterCallbacks, ___xmlSimpleError, _compute_minrun,
+ _htmlDecodeEntities, _libxml_domnode_binary_insertion_sort,
+ _libxml_domnode_tim_sort, _xmlAllocOutputBufferInternal, _xmlAutomataSetFlags,
+ _xmlBufAdd, _xmlBufAddHead, _xmlBufAddLen, _xmlBufAttrSerializeTxtContent,
+ _xmlBufAvail, _xmlBufBackToBuffer, _xmlBufCCat, _xmlBufCat,
+ _xmlBufCreate, _xmlBufCreateSize, _xmlBufCreateStatic, _xmlBufDetach,
+ _xmlBufDump, _xmlBufDumpAttributeDecl, _xmlBufDumpElementDecl,
+ _xmlBufDumpEntityDecl, _xmlBufDumpNotationTable, _xmlBufEmpty,
+ _xmlBufErase, _xmlBufFree, _xmlBufFromBuffer, _xmlBufGetAllocationScheme,
+ _xmlBufGetInputBase, _xmlBufGrow, _xmlBufInflate, _xmlBufIsEmpty,
+ _xmlBufLength, _xmlBufMergeBuffer, _xmlBufResetInput, _xmlBufResize,
+ _xmlBufSetAllocationScheme, _xmlBufSetInputBaseCur, _xmlBufWriteCHAR,
+ _xmlBufWriteChar, _xmlBufWriteQuotedString, _xmlCharEncFirstLineInput,
+ _xmlCharEncFirstLineInt, _xmlCharEncInput, _xmlCharEncOutput,
+ _xmlEncodeAttributeEntities, _xmlErrMemory, _xmlEscapeFormatString,
+ _xmlGenericErrorDefaultFunc, _xmlMallocBreakpoint, _xmlNop,
+ _xmlNsListDumpOutput, _xmlUpgradeOldNs, _xmlXPtrAdvanceNode ]
+ - archs: [ armv7, armv7s, arm64, arm64e ]
+ symbols: [ _UTF8ToHtml, _UTF8Toisolat1, ___docbDefaultSAXHandler, ___htmlDefaultSAXHandler,
+ ___oldXMLWDcompatibility, ___xmlBufferAllocScheme, ___xmlDefaultBufferSize,
+ ___xmlDefaultSAXHandler, ___xmlDefaultSAXLocator, ___xmlDeregisterNodeDefaultValue,
+ ___xmlDoValidityCheckingDefaultValue, ___xmlGenericError,
+ ___xmlGenericErrorContext, ___xmlGetWarningsDefaultValue,
+ ___xmlIndentTreeOutput, ___xmlKeepBlanksDefaultValue, ___xmlLastError,
+ ___xmlLineNumbersDefaultValue, ___xmlLoadExtDtdDefaultValue,
+ ___xmlOutputBufferCreateFilename, ___xmlOutputBufferCreateFilenameValue,
+ ___xmlParserDebugEntities, ___xmlParserInputBufferCreateFilename,
+ ___xmlParserInputBufferCreateFilenameValue, ___xmlParserVersion,
+ ___xmlPedanticParserDefaultValue, ___xmlRegisterNodeDefaultValue,
+ ___xmlSaveNoEmptyTags, ___xmlStructuredError, ___xmlStructuredErrorContext,
+ ___xmlSubstituteEntitiesDefaultValue, ___xmlTreeIndentString,
+ _attribute, _attributeDecl, _cdataBlock, _characters, _checkNamespace,
+ _comment, _docbCreateFileParserCtxt, _docbCreatePushParserCtxt,
+ _docbDefaultSAXHandler, _docbDefaultSAXHandlerInit, _docbEncodeEntities,
+ _docbFreeParserCtxt, _docbParseChunk, _docbParseDoc, _docbParseDocument,
+ _docbParseFile, _docbSAXParseDoc, _docbSAXParseFile, _elementDecl,
+ _emptyExp, _endDocument, _endElement, _entityDecl, _externalSubset,
+ _forbiddenExp, _getColumnNumber, _getEntity, _getLineNumber,
+ _getNamespace, _getParameterEntity, _getPublicId, _getSystemId,
+ _globalNamespace, _hasExternalSubset, _hasInternalSubset,
+ _htmlAttrAllowed, _htmlAutoCloseTag, _htmlCreateFileParserCtxt,
+ _htmlCreateMemoryParserCtxt, _htmlCreatePushParserCtxt, _htmlCtxtReadDoc,
+ _htmlCtxtReadFd, _htmlCtxtReadFile, _htmlCtxtReadIO, _htmlCtxtReadMemory,
+ _htmlCtxtReset, _htmlCtxtUseOptions, _htmlDefaultSAXHandler,
+ _htmlDefaultSAXHandlerInit, _htmlDocContentDumpFormatOutput,
+ _htmlDocContentDumpOutput, _htmlDocDump, _htmlDocDumpMemory,
+ _htmlDocDumpMemoryFormat, _htmlElementAllowedHere, _htmlElementStatusHere,
+ _htmlEncodeEntities, _htmlEntityLookup, _htmlEntityValueLookup,
+ _htmlFreeParserCtxt, _htmlGetMetaEncoding, _htmlHandleOmittedElem,
+ _htmlInitAutoClose, _htmlIsAutoClosed, _htmlIsBooleanAttr,
+ _htmlIsScriptAttribute, _htmlNewDoc, _htmlNewDocNoDtD, _htmlNewParserCtxt,
+ _htmlNodeDump, _htmlNodeDumpFile, _htmlNodeDumpFileFormat,
+ _htmlNodeDumpFormatOutput, _htmlNodeDumpOutput, _htmlNodeStatus,
+ _htmlParseCharRef, _htmlParseChunk, _htmlParseDoc, _htmlParseDocument,
+ _htmlParseElement, _htmlParseEntityRef, _htmlParseFile, _htmlReadDoc,
+ _htmlReadFd, _htmlReadFile, _htmlReadIO, _htmlReadMemory,
+ _htmlSAXParseDoc, _htmlSAXParseFile, _htmlSaveFile, _htmlSaveFileEnc,
+ _htmlSaveFileFormat, _htmlSetMetaEncoding, _htmlTagLookup,
+ _ignorableWhitespace, _initGenericErrorDefaultFunc, _initdocbDefaultSAXHandler,
+ _inithtmlDefaultSAXHandler, _initxmlDefaultSAXHandler, _inputPop,
+ _inputPush, _internalSubset, _isStandalone, _isolat1ToUTF8,
+ _namePop, _namePush, _namespaceDecl, _nodePop, _nodePush,
+ _notationDecl, _oldXMLWDcompatibility, _processingInstruction,
+ _reference, _resolveEntity, _setDocumentLocator, _setNamespace,
+ _startDocument, _startElement, _unparsedEntityDecl, _valuePop,
+ _valuePush, _xlinkGetDefaultDetect, _xlinkGetDefaultHandler,
+ _xlinkIsLink, _xlinkSetDefaultDetect, _xlinkSetDefaultHandler,
+ _xmlACatalogAdd, _xmlACatalogDump, _xmlACatalogRemove, _xmlACatalogResolve,
+ _xmlACatalogResolvePublic, _xmlACatalogResolveSystem, _xmlACatalogResolveURI,
+ _xmlAddAttributeDecl, _xmlAddChild, _xmlAddChildList, _xmlAddDocEntity,
+ _xmlAddDtdEntity, _xmlAddElementDecl, _xmlAddEncodingAlias,
+ _xmlAddID, _xmlAddNextSibling, _xmlAddNotationDecl, _xmlAddPrevSibling,
+ _xmlAddRef, _xmlAddSibling, _xmlAllocOutputBuffer, _xmlAllocParserInputBuffer,
+ _xmlAttrSerializeTxtContent, _xmlAutomataCompile, _xmlAutomataGetInitState,
+ _xmlAutomataIsDeterminist, _xmlAutomataNewAllTrans, _xmlAutomataNewCountTrans,
+ _xmlAutomataNewCountTrans2, _xmlAutomataNewCountedTrans, _xmlAutomataNewCounter,
+ _xmlAutomataNewCounterTrans, _xmlAutomataNewEpsilon, _xmlAutomataNewNegTrans,
+ _xmlAutomataNewOnceTrans, _xmlAutomataNewOnceTrans2, _xmlAutomataNewState,
+ _xmlAutomataNewTransition, _xmlAutomataNewTransition2, _xmlAutomataSetFinalState,
+ _xmlBoolToText, _xmlBufContent, _xmlBufEnd, _xmlBufGetNodeContent,
+ _xmlBufNodeDump, _xmlBufShrink, _xmlBufUse, _xmlBufferAdd,
+ _xmlBufferAddHead, _xmlBufferAllocScheme, _xmlBufferCCat,
+ _xmlBufferCat, _xmlBufferContent, _xmlBufferCreate, _xmlBufferCreateSize,
+ _xmlBufferCreateStatic, _xmlBufferDetach, _xmlBufferDump,
+ _xmlBufferEmpty, _xmlBufferFree, _xmlBufferGrow, _xmlBufferLength,
+ _xmlBufferResize, _xmlBufferSetAllocationScheme, _xmlBufferShrink,
+ _xmlBufferWriteCHAR, _xmlBufferWriteChar, _xmlBufferWriteQuotedString,
+ _xmlBuildQName, _xmlBuildRelativeURI, _xmlBuildURI, _xmlByteConsumed,
+ _xmlC14NDocDumpMemory, _xmlC14NDocSave, _xmlC14NDocSaveTo,
+ _xmlC14NExecute, _xmlCanonicPath, _xmlCatalogAdd, _xmlCatalogAddLocal,
+ _xmlCatalogCleanup, _xmlCatalogConvert, _xmlCatalogDump, _xmlCatalogFreeLocal,
+ _xmlCatalogGetDefaults, _xmlCatalogGetPublic, _xmlCatalogGetSystem,
+ _xmlCatalogIsEmpty, _xmlCatalogLocalResolve, _xmlCatalogLocalResolveURI,
+ _xmlCatalogRemove, _xmlCatalogResolve, _xmlCatalogResolvePublic,
+ _xmlCatalogResolveSystem, _xmlCatalogResolveURI, _xmlCatalogSetDebug,
+ _xmlCatalogSetDefaultPrefer, _xmlCatalogSetDefaults, _xmlCharEncCloseFunc,
+ _xmlCharEncFirstLine, _xmlCharEncInFunc, _xmlCharEncOutFunc,
+ _xmlCharInRange, _xmlCharStrdup, _xmlCharStrndup, _xmlCheckFilename,
+ _xmlCheckHTTPInput, _xmlCheckLanguageID, _xmlCheckUTF8, _xmlCheckVersion,
+ _xmlChildElementCount, _xmlCleanupCharEncodingHandlers, _xmlCleanupEncodingAliases,
+ _xmlCleanupGlobals, _xmlCleanupInputCallbacks, _xmlCleanupMemory,
+ _xmlCleanupOutputCallbacks, _xmlCleanupParser, _xmlCleanupPredefinedEntities,
+ _xmlCleanupThreads, _xmlClearNodeInfoSeq, _xmlClearParserCtxt,
+ _xmlConvertSGMLCatalog, _xmlCopyAttributeTable, _xmlCopyChar,
+ _xmlCopyCharMultiByte, _xmlCopyDoc, _xmlCopyDocElementContent,
+ _xmlCopyDtd, _xmlCopyElementContent, _xmlCopyElementTable,
+ _xmlCopyEntitiesTable, _xmlCopyEnumeration, _xmlCopyError,
+ _xmlCopyNamespace, _xmlCopyNamespaceList, _xmlCopyNode, _xmlCopyNodeList,
+ _xmlCopyNotationTable, _xmlCopyProp, _xmlCopyPropList, _xmlCreateDocParserCtxt,
+ _xmlCreateEntitiesTable, _xmlCreateEntityParserCtxt, _xmlCreateEnumeration,
+ _xmlCreateFileParserCtxt, _xmlCreateIOParserCtxt, _xmlCreateIntSubset,
+ _xmlCreateMemoryParserCtxt, _xmlCreatePushParserCtxt, _xmlCreateURI,
+ _xmlCreateURLParserCtxt, _xmlCtxtGetLastError, _xmlCtxtReadDoc,
+ _xmlCtxtReadFd, _xmlCtxtReadFile, _xmlCtxtReadIO, _xmlCtxtReadMemory,
+ _xmlCtxtReset, _xmlCtxtResetLastError, _xmlCtxtResetPush,
+ _xmlCtxtUseOptions, _xmlCurrentChar, _xmlDOMWrapAdoptNode,
+ _xmlDOMWrapCloneNode, _xmlDOMWrapFreeCtxt, _xmlDOMWrapNewCtxt,
+ _xmlDOMWrapReconcileNamespaces, _xmlDOMWrapRemoveNode, _xmlDebugCheckDocument,
+ _xmlDebugDumpAttr, _xmlDebugDumpAttrList, _xmlDebugDumpDTD,
+ _xmlDebugDumpDocument, _xmlDebugDumpDocumentHead, _xmlDebugDumpEntities,
+ _xmlDebugDumpNode, _xmlDebugDumpNodeList, _xmlDebugDumpOneNode,
+ _xmlDebugDumpString, _xmlDecodeEntities, _xmlDefaultBufferSize,
+ _xmlDefaultSAXHandler, _xmlDefaultSAXHandlerInit, _xmlDefaultSAXLocator,
+ _xmlDelEncodingAlias, _xmlDeregisterNodeDefault, _xmlDeregisterNodeDefaultValue,
+ _xmlDetectCharEncoding, _xmlDictCleanup, _xmlDictCreate, _xmlDictCreateSub,
+ _xmlDictExists, _xmlDictFree, _xmlDictGetUsage, _xmlDictLookup,
+ _xmlDictOwns, _xmlDictQLookup, _xmlDictReference, _xmlDictSetLimit,
+ _xmlDictSize, _xmlDoValidityCheckingDefaultValue, _xmlDocCopyNode,
+ _xmlDocCopyNodeList, _xmlDocDump, _xmlDocDumpFormatMemory,
+ _xmlDocDumpFormatMemoryEnc, _xmlDocDumpMemory, _xmlDocDumpMemoryEnc,
+ _xmlDocFormatDump, _xmlDocGetRootElement, _xmlDocSetRootElement,
+ _xmlDumpAttributeDecl, _xmlDumpAttributeTable, _xmlDumpElementDecl,
+ _xmlDumpElementTable, _xmlDumpEntitiesTable, _xmlDumpEntityDecl,
+ _xmlDumpNotationDecl, _xmlDumpNotationTable, _xmlElemDump,
+ _xmlEncodeEntities, _xmlEncodeEntitiesReentrant, _xmlEncodeSpecialChars,
+ _xmlExpCtxtNbCons, _xmlExpCtxtNbNodes, _xmlExpDump, _xmlExpExpDerive,
+ _xmlExpFree, _xmlExpFreeCtxt, _xmlExpGetLanguage, _xmlExpGetStart,
+ _xmlExpIsNillable, _xmlExpMaxToken, _xmlExpNewAtom, _xmlExpNewCtxt,
+ _xmlExpNewOr, _xmlExpNewRange, _xmlExpNewSeq, _xmlExpParse,
+ _xmlExpRef, _xmlExpStringDerive, _xmlExpSubsume, _xmlFileClose,
+ _xmlFileMatch, _xmlFileOpen, _xmlFileRead, _xmlFindCharEncodingHandler,
+ _xmlFirstElementChild, _xmlFree, _xmlFreeAttributeTable, _xmlFreeAutomata,
+ _xmlFreeCatalog, _xmlFreeDoc, _xmlFreeDocElementContent, _xmlFreeDtd,
+ _xmlFreeElementContent, _xmlFreeElementTable, _xmlFreeEntitiesTable,
+ _xmlFreeEnumeration, _xmlFreeIDTable, _xmlFreeInputStream,
+ _xmlFreeMutex, _xmlFreeNode, _xmlFreeNodeList, _xmlFreeNotationTable,
+ _xmlFreeNs, _xmlFreeNsList, _xmlFreeParserCtxt, _xmlFreeParserInputBuffer,
+ _xmlFreePattern, _xmlFreePatternList, _xmlFreeProp, _xmlFreePropList,
+ _xmlFreeRMutex, _xmlFreeRefTable, _xmlFreeStreamCtxt, _xmlFreeTextReader,
+ _xmlFreeTextWriter, _xmlFreeURI, _xmlFreeValidCtxt, _xmlGcMemGet,
+ _xmlGcMemSetup, _xmlGenericError, _xmlGenericErrorContext,
+ _xmlGetBufferAllocationScheme, _xmlGetCharEncodingHandler,
+ _xmlGetCharEncodingName, _xmlGetCompressMode, _xmlGetDocCompressMode,
+ _xmlGetDocEntity, _xmlGetDtdAttrDesc, _xmlGetDtdElementDesc,
+ _xmlGetDtdEntity, _xmlGetDtdNotationDesc, _xmlGetDtdQAttrDesc,
+ _xmlGetDtdQElementDesc, _xmlGetEncodingAlias, _xmlGetExternalEntityLoader,
+ _xmlGetFeature, _xmlGetFeaturesList, _xmlGetGlobalState, _xmlGetID,
+ _xmlGetIntSubset, _xmlGetLastChild, _xmlGetLastError, _xmlGetLineNo,
+ _xmlGetNoNsProp, _xmlGetNodePath, _xmlGetNsList, _xmlGetNsProp,
+ _xmlGetParameterEntity, _xmlGetPredefinedEntity, _xmlGetProp,
+ _xmlGetRefs, _xmlGetThreadId, _xmlGetUTF8Char, _xmlGetWarningsDefaultValue,
+ _xmlHandleEntity, _xmlHasFeature, _xmlHasNsProp, _xmlHasProp,
+ _xmlHashAddEntry, _xmlHashAddEntry2, _xmlHashAddEntry3, _xmlHashCopy,
+ _xmlHashCreate, _xmlHashCreateDict, _xmlHashFree, _xmlHashLookup,
+ _xmlHashLookup2, _xmlHashLookup3, _xmlHashQLookup, _xmlHashQLookup2,
+ _xmlHashQLookup3, _xmlHashRemoveEntry, _xmlHashRemoveEntry2,
+ _xmlHashRemoveEntry3, _xmlHashScan, _xmlHashScan3, _xmlHashScanFull,
+ _xmlHashScanFull3, _xmlHashSize, _xmlHashUpdateEntry, _xmlHashUpdateEntry2,
+ _xmlHashUpdateEntry3, _xmlIOFTPClose, _xmlIOFTPMatch, _xmlIOFTPOpen,
+ _xmlIOFTPRead, _xmlIOHTTPClose, _xmlIOHTTPMatch, _xmlIOHTTPOpen,
+ _xmlIOHTTPOpenW, _xmlIOHTTPRead, _xmlIOParseDTD, _xmlIndentTreeOutput,
+ _xmlInitCharEncodingHandlers, _xmlInitGlobals, _xmlInitMemory,
+ _xmlInitNodeInfoSeq, _xmlInitParser, _xmlInitParserCtxt, _xmlInitThreads,
+ _xmlInitializeCatalog, _xmlInitializeDict, _xmlInitializeGlobalState,
+ _xmlInitializePredefinedEntities, _xmlIsBaseChar, _xmlIsBaseCharGroup,
+ _xmlIsBlank, _xmlIsBlankNode, _xmlIsChar, _xmlIsCharGroup,
+ _xmlIsCombining, _xmlIsCombiningGroup, _xmlIsDigit, _xmlIsDigitGroup,
+ _xmlIsExtender, _xmlIsExtenderGroup, _xmlIsID, _xmlIsIdeographic,
+ _xmlIsIdeographicGroup, _xmlIsLetter, _xmlIsMainThread, _xmlIsMixedElement,
+ _xmlIsPubidChar, _xmlIsPubidChar_tab, _xmlIsRef, _xmlIsXHTML,
+ _xmlKeepBlanksDefault, _xmlKeepBlanksDefaultValue, _xmlLastElementChild,
+ _xmlLastError, _xmlLineNumbersDefault, _xmlLineNumbersDefaultValue,
+ _xmlLinkGetData, _xmlListAppend, _xmlListClear, _xmlListCopy,
+ _xmlListCreate, _xmlListDelete, _xmlListDup, _xmlListEmpty,
+ _xmlListEnd, _xmlListFront, _xmlListInsert, _xmlListMerge,
+ _xmlListPopBack, _xmlListPopFront, _xmlListPushBack, _xmlListPushFront,
+ _xmlListRemoveAll, _xmlListRemoveFirst, _xmlListRemoveLast,
+ _xmlListReverse, _xmlListReverseSearch, _xmlListReverseWalk,
+ _xmlListSearch, _xmlListSize, _xmlListSort, _xmlListWalk,
+ _xmlLoadACatalog, _xmlLoadCatalog, _xmlLoadCatalogs, _xmlLoadExtDtdDefaultValue,
+ _xmlLoadExternalEntity, _xmlLoadSGMLSuperCatalog, _xmlLockLibrary,
+ _xmlLsCountNode, _xmlLsOneNode, _xmlMalloc, _xmlMallocAtomic,
+ _xmlMallocAtomicLoc, _xmlMallocLoc, _xmlMemBlocks, _xmlMemDisplay,
+ _xmlMemDisplayLast, _xmlMemFree, _xmlMemGet, _xmlMemMalloc,
+ _xmlMemRealloc, _xmlMemSetup, _xmlMemShow, _xmlMemStrdup,
+ _xmlMemStrdupLoc, _xmlMemUsed, _xmlMemoryDump, _xmlMemoryStrdup,
+ _xmlModuleClose, _xmlModuleFree, _xmlModuleOpen, _xmlModuleSymbol,
+ _xmlMutexLock, _xmlMutexUnlock, _xmlNamespaceParseNCName,
+ _xmlNamespaceParseNSDef, _xmlNamespaceParseQName, _xmlNanoFTPCheckResponse,
+ _xmlNanoFTPCleanup, _xmlNanoFTPClose, _xmlNanoFTPCloseConnection,
+ _xmlNanoFTPConnect, _xmlNanoFTPConnectTo, _xmlNanoFTPCwd,
+ _xmlNanoFTPDele, _xmlNanoFTPFreeCtxt, _xmlNanoFTPGet, _xmlNanoFTPGetConnection,
+ _xmlNanoFTPGetResponse, _xmlNanoFTPGetSocket, _xmlNanoFTPInit,
+ _xmlNanoFTPList, _xmlNanoFTPNewCtxt, _xmlNanoFTPOpen, _xmlNanoFTPProxy,
+ _xmlNanoFTPQuit, _xmlNanoFTPRead, _xmlNanoFTPScanProxy, _xmlNanoFTPUpdateURL,
+ _xmlNanoHTTPAuthHeader, _xmlNanoHTTPCleanup, _xmlNanoHTTPClose,
+ _xmlNanoHTTPContentLength, _xmlNanoHTTPEncoding, _xmlNanoHTTPFetch,
+ _xmlNanoHTTPInit, _xmlNanoHTTPMethod, _xmlNanoHTTPMethodRedir,
+ _xmlNanoHTTPMimeType, _xmlNanoHTTPOpen, _xmlNanoHTTPOpenRedir,
+ _xmlNanoHTTPRead, _xmlNanoHTTPRedir, _xmlNanoHTTPReturnCode,
+ _xmlNanoHTTPSave, _xmlNanoHTTPScanProxy, _xmlNewAutomata,
+ _xmlNewCDataBlock, _xmlNewCatalog, _xmlNewCharEncodingHandler,
+ _xmlNewCharRef, _xmlNewChild, _xmlNewComment, _xmlNewDoc,
+ _xmlNewDocComment, _xmlNewDocElementContent, _xmlNewDocFragment,
+ _xmlNewDocNode, _xmlNewDocNodeEatName, _xmlNewDocPI, _xmlNewDocProp,
+ _xmlNewDocRawNode, _xmlNewDocText, _xmlNewDocTextLen, _xmlNewDtd,
+ _xmlNewElementContent, _xmlNewEntity, _xmlNewEntityInputStream,
+ _xmlNewGlobalNs, _xmlNewIOInputStream, _xmlNewInputFromFile,
+ _xmlNewInputStream, _xmlNewMutex, _xmlNewNode, _xmlNewNodeEatName,
+ _xmlNewNs, _xmlNewNsProp, _xmlNewNsPropEatName, _xmlNewPI,
+ _xmlNewParserCtxt, _xmlNewProp, _xmlNewRMutex, _xmlNewReference,
+ _xmlNewStringInputStream, _xmlNewText, _xmlNewTextChild, _xmlNewTextLen,
+ _xmlNewTextReader, _xmlNewTextReaderFilename, _xmlNewTextWriter,
+ _xmlNewTextWriterDoc, _xmlNewTextWriterFilename, _xmlNewTextWriterMemory,
+ _xmlNewTextWriterPushParser, _xmlNewTextWriterTree, _xmlNewValidCtxt,
+ _xmlNextChar, _xmlNextElementSibling, _xmlNoNetExternalEntityLoader,
+ _xmlNodeAddContent, _xmlNodeAddContentLen, _xmlNodeBufGetContent,
+ _xmlNodeDump, _xmlNodeDumpOutput, _xmlNodeGetBase, _xmlNodeGetContent,
+ _xmlNodeGetLang, _xmlNodeGetSpacePreserve, _xmlNodeIsText,
+ _xmlNodeListGetRawString, _xmlNodeListGetString, _xmlNodeSetBase,
+ _xmlNodeSetContent, _xmlNodeSetContentLen, _xmlNodeSetLang,
+ _xmlNodeSetName, _xmlNodeSetSpacePreserve, _xmlNormalizeURIPath,
+ _xmlNormalizeWindowsPath, _xmlOutputBufferClose, _xmlOutputBufferCreateBuffer,
+ _xmlOutputBufferCreateFd, _xmlOutputBufferCreateFile, _xmlOutputBufferCreateFilename,
+ _xmlOutputBufferCreateFilenameDefault, _xmlOutputBufferCreateFilenameValue,
+ _xmlOutputBufferCreateIO, _xmlOutputBufferFlush, _xmlOutputBufferGetContent,
+ _xmlOutputBufferGetSize, _xmlOutputBufferWrite, _xmlOutputBufferWriteEscape,
+ _xmlOutputBufferWriteString, _xmlParseAttValue, _xmlParseAttribute,
+ _xmlParseAttributeListDecl, _xmlParseAttributeType, _xmlParseBalancedChunkMemory,
+ _xmlParseBalancedChunkMemoryRecover, _xmlParseCDSect, _xmlParseCatalogFile,
+ _xmlParseCharData, _xmlParseCharEncoding, _xmlParseCharRef,
+ _xmlParseChunk, _xmlParseComment, _xmlParseContent, _xmlParseCtxtExternalEntity,
+ _xmlParseDTD, _xmlParseDefaultDecl, _xmlParseDoc, _xmlParseDocTypeDecl,
+ _xmlParseDocument, _xmlParseElement, _xmlParseElementChildrenContentDecl,
+ _xmlParseElementContentDecl, _xmlParseElementDecl, _xmlParseElementMixedContentDecl,
+ _xmlParseEncName, _xmlParseEncodingDecl, _xmlParseEndTag,
+ _xmlParseEntity, _xmlParseEntityDecl, _xmlParseEntityRef,
+ _xmlParseEntityValue, _xmlParseEnumeratedType, _xmlParseEnumerationType,
+ _xmlParseExtParsedEnt, _xmlParseExternalEntity, _xmlParseExternalID,
+ _xmlParseExternalSubset, _xmlParseFile, _xmlParseInNodeContext,
+ _xmlParseMarkupDecl, _xmlParseMemory, _xmlParseMisc, _xmlParseName,
+ _xmlParseNamespace, _xmlParseNmtoken, _xmlParseNotationDecl,
+ _xmlParseNotationType, _xmlParsePEReference, _xmlParsePI,
+ _xmlParsePITarget, _xmlParsePubidLiteral, _xmlParseQuotedString,
+ _xmlParseReference, _xmlParseSDDecl, _xmlParseStartTag, _xmlParseSystemLiteral,
+ _xmlParseTextDecl, _xmlParseURI, _xmlParseURIRaw, _xmlParseURIReference,
+ _xmlParseVersionInfo, _xmlParseVersionNum, _xmlParseXMLDecl,
+ _xmlParserAddNodeInfo, _xmlParserDebugEntities, _xmlParserError,
+ _xmlParserFindNodeInfo, _xmlParserFindNodeInfoIndex, _xmlParserGetDirectory,
+ _xmlParserHandlePEReference, _xmlParserHandleReference, _xmlParserInputBufferCreateFd,
+ _xmlParserInputBufferCreateFile, _xmlParserInputBufferCreateFilename,
+ _xmlParserInputBufferCreateFilenameDefault, _xmlParserInputBufferCreateFilenameValue,
+ _xmlParserInputBufferCreateIO, _xmlParserInputBufferCreateMem,
+ _xmlParserInputBufferCreateStatic, _xmlParserInputBufferGrow,
+ _xmlParserInputBufferPush, _xmlParserInputBufferRead, _xmlParserInputGrow,
+ _xmlParserInputRead, _xmlParserInputShrink, _xmlParserMaxDepth,
+ _xmlParserPrintFileContext, _xmlParserPrintFileInfo, _xmlParserValidityError,
+ _xmlParserValidityWarning, _xmlParserVersion, _xmlParserWarning,
+ _xmlPathToURI, _xmlPatternFromRoot, _xmlPatternGetStreamCtxt,
+ _xmlPatternMatch, _xmlPatternMaxDepth, _xmlPatternMinDepth,
+ _xmlPatternStreamable, _xmlPatterncompile, _xmlPedanticParserDefault,
+ _xmlPedanticParserDefaultValue, _xmlPopInput, _xmlPopInputCallbacks,
+ _xmlPreviousElementSibling, _xmlPrintURI, _xmlPushInput, _xmlRMutexLock,
+ _xmlRMutexUnlock, _xmlReadDoc, _xmlReadFd, _xmlReadFile, _xmlReadIO,
+ _xmlReadMemory, _xmlReaderForDoc, _xmlReaderForFd, _xmlReaderForFile,
+ _xmlReaderForIO, _xmlReaderForMemory, _xmlReaderNewDoc, _xmlReaderNewFd,
+ _xmlReaderNewFile, _xmlReaderNewIO, _xmlReaderNewMemory, _xmlReaderNewWalker,
+ _xmlReaderWalker, _xmlRealloc, _xmlReallocLoc, _xmlReconciliateNs,
+ _xmlRecoverDoc, _xmlRecoverFile, _xmlRecoverMemory, _xmlRegExecErrInfo,
+ _xmlRegExecNextValues, _xmlRegExecPushString, _xmlRegExecPushString2,
+ _xmlRegFreeExecCtxt, _xmlRegFreeRegexp, _xmlRegNewExecCtxt,
+ _xmlRegexpCompile, _xmlRegexpExec, _xmlRegexpIsDeterminist,
+ _xmlRegexpPrint, _xmlRegisterCharEncodingHandler, _xmlRegisterDefaultInputCallbacks,
+ _xmlRegisterDefaultOutputCallbacks, _xmlRegisterHTTPPostCallbacks,
+ _xmlRegisterInputCallbacks, _xmlRegisterNodeDefault, _xmlRegisterNodeDefaultValue,
+ _xmlRegisterOutputCallbacks, _xmlRelaxNGCleanupTypes, _xmlRelaxNGDump,
+ _xmlRelaxNGDumpTree, _xmlRelaxNGFree, _xmlRelaxNGFreeParserCtxt,
+ _xmlRelaxNGFreeValidCtxt, _xmlRelaxNGGetParserErrors, _xmlRelaxNGGetValidErrors,
+ _xmlRelaxNGInitTypes, _xmlRelaxNGNewDocParserCtxt, _xmlRelaxNGNewMemParserCtxt,
+ _xmlRelaxNGNewParserCtxt, _xmlRelaxNGNewValidCtxt, _xmlRelaxNGParse,
+ _xmlRelaxNGSetParserErrors, _xmlRelaxNGSetParserStructuredErrors,
+ _xmlRelaxNGSetValidErrors, _xmlRelaxNGSetValidStructuredErrors,
+ _xmlRelaxNGValidateDoc, _xmlRelaxNGValidateFullElement, _xmlRelaxNGValidatePopElement,
+ _xmlRelaxNGValidatePushCData, _xmlRelaxNGValidatePushElement,
+ _xmlRelaxParserSetFlag, _xmlRemoveID, _xmlRemoveProp, _xmlRemoveRef,
+ _xmlReplaceNode, _xmlResetError, _xmlResetLastError, _xmlSAX2AttributeDecl,
+ _xmlSAX2CDataBlock, _xmlSAX2Characters, _xmlSAX2Comment, _xmlSAX2ElementDecl,
+ _xmlSAX2EndDocument, _xmlSAX2EndElement, _xmlSAX2EndElementNs,
+ _xmlSAX2EntityDecl, _xmlSAX2ExternalSubset, _xmlSAX2GetColumnNumber,
+ _xmlSAX2GetEntity, _xmlSAX2GetLineNumber, _xmlSAX2GetParameterEntity,
+ _xmlSAX2GetPublicId, _xmlSAX2GetSystemId, _xmlSAX2HasExternalSubset,
+ _xmlSAX2HasInternalSubset, _xmlSAX2IgnorableWhitespace, _xmlSAX2InitDefaultSAXHandler,
+ _xmlSAX2InitDocbDefaultSAXHandler, _xmlSAX2InitHtmlDefaultSAXHandler,
+ _xmlSAX2InternalSubset, _xmlSAX2IsStandalone, _xmlSAX2NotationDecl,
+ _xmlSAX2ProcessingInstruction, _xmlSAX2Reference, _xmlSAX2ResolveEntity,
+ _xmlSAX2SetDocumentLocator, _xmlSAX2StartDocument, _xmlSAX2StartElement,
+ _xmlSAX2StartElementNs, _xmlSAX2UnparsedEntityDecl, _xmlSAXDefaultVersion,
+ _xmlSAXParseDTD, _xmlSAXParseDoc, _xmlSAXParseEntity, _xmlSAXParseFile,
+ _xmlSAXParseFileWithData, _xmlSAXParseMemory, _xmlSAXParseMemoryWithData,
+ _xmlSAXUserParseFile, _xmlSAXUserParseMemory, _xmlSAXVersion,
+ _xmlSaveClose, _xmlSaveDoc, _xmlSaveFile, _xmlSaveFileEnc,
+ _xmlSaveFileTo, _xmlSaveFlush, _xmlSaveFormatFile, _xmlSaveFormatFileEnc,
+ _xmlSaveFormatFileTo, _xmlSaveNoEmptyTags, _xmlSaveSetAttrEscape,
+ _xmlSaveSetEscape, _xmlSaveToBuffer, _xmlSaveToFd, _xmlSaveToFilename,
+ _xmlSaveToIO, _xmlSaveTree, _xmlSaveUri, _xmlScanName, _xmlSchemaCheckFacet,
+ _xmlSchemaCleanupTypes, _xmlSchemaCollapseString, _xmlSchemaCompareValues,
+ _xmlSchemaCompareValuesWhtsp, _xmlSchemaCopyValue, _xmlSchemaDump,
+ _xmlSchemaFree, _xmlSchemaFreeFacet, _xmlSchemaFreeParserCtxt,
+ _xmlSchemaFreeType, _xmlSchemaFreeValidCtxt, _xmlSchemaFreeValue,
+ _xmlSchemaFreeWildcard, _xmlSchemaGetBuiltInListSimpleTypeItemType,
+ _xmlSchemaGetBuiltInType, _xmlSchemaGetCanonValue, _xmlSchemaGetCanonValueWhtsp,
+ _xmlSchemaGetFacetValueAsULong, _xmlSchemaGetParserErrors,
+ _xmlSchemaGetPredefinedType, _xmlSchemaGetValType, _xmlSchemaGetValidErrors,
+ _xmlSchemaInitTypes, _xmlSchemaIsBuiltInTypeFacet, _xmlSchemaIsValid,
+ _xmlSchemaNewDocParserCtxt, _xmlSchemaNewFacet, _xmlSchemaNewMemParserCtxt,
+ _xmlSchemaNewNOTATIONValue, _xmlSchemaNewParserCtxt, _xmlSchemaNewQNameValue,
+ _xmlSchemaNewStringValue, _xmlSchemaNewValidCtxt, _xmlSchemaParse,
+ _xmlSchemaSAXPlug, _xmlSchemaSAXUnplug, _xmlSchemaSetParserErrors,
+ _xmlSchemaSetParserStructuredErrors, _xmlSchemaSetValidErrors,
+ _xmlSchemaSetValidOptions, _xmlSchemaSetValidStructuredErrors,
+ _xmlSchemaValPredefTypeNode, _xmlSchemaValPredefTypeNodeNoNorm,
+ _xmlSchemaValidCtxtGetOptions, _xmlSchemaValidCtxtGetParserCtxt,
+ _xmlSchemaValidateDoc, _xmlSchemaValidateFacet, _xmlSchemaValidateFacetWhtsp,
+ _xmlSchemaValidateFile, _xmlSchemaValidateLengthFacet, _xmlSchemaValidateLengthFacetWhtsp,
+ _xmlSchemaValidateListSimpleTypeFacet, _xmlSchemaValidateOneElement,
+ _xmlSchemaValidatePredefinedType, _xmlSchemaValidateSetFilename,
+ _xmlSchemaValidateSetLocator, _xmlSchemaValidateStream, _xmlSchemaValueAppend,
+ _xmlSchemaValueGetAsBoolean, _xmlSchemaValueGetAsString, _xmlSchemaValueGetNext,
+ _xmlSchemaWhiteSpaceReplace, _xmlSchematronFree, _xmlSchematronFreeParserCtxt,
+ _xmlSchematronFreeValidCtxt, _xmlSchematronNewDocParserCtxt,
+ _xmlSchematronNewMemParserCtxt, _xmlSchematronNewParserCtxt,
+ _xmlSchematronNewValidCtxt, _xmlSchematronParse, _xmlSchematronSetValidStructuredErrors,
+ _xmlSchematronValidateDoc, _xmlSearchNs, _xmlSearchNsByHref,
+ _xmlSetBufferAllocationScheme, _xmlSetCompressMode, _xmlSetDocCompressMode,
+ _xmlSetEntityReferenceFunc, _xmlSetExternalEntityLoader, _xmlSetFeature,
+ _xmlSetGenericErrorFunc, _xmlSetListDoc, _xmlSetNs, _xmlSetNsProp,
+ _xmlSetProp, _xmlSetStructuredErrorFunc, _xmlSetTreeDoc, _xmlSetupParserForBuffer,
+ _xmlShell, _xmlShellBase, _xmlShellCat, _xmlShellDir, _xmlShellDu,
+ _xmlShellList, _xmlShellLoad, _xmlShellPrintNode, _xmlShellPrintXPathError,
+ _xmlShellPrintXPathResult, _xmlShellPwd, _xmlShellSave, _xmlShellValidate,
+ _xmlShellWrite, _xmlSkipBlankChars, _xmlSnprintfElementContent,
+ _xmlSplitQName, _xmlSplitQName2, _xmlSplitQName3, _xmlSprintfElementContent,
+ _xmlStopParser, _xmlStrEqual, _xmlStrPrintf, _xmlStrQEqual,
+ _xmlStrVPrintf, _xmlStrcasecmp, _xmlStrcasestr, _xmlStrcat,
+ _xmlStrchr, _xmlStrcmp, _xmlStrdup, _xmlStreamPop, _xmlStreamPush,
+ _xmlStreamPushAttr, _xmlStreamPushNode, _xmlStreamWantsAnyNode,
+ _xmlStringComment, _xmlStringCurrentChar, _xmlStringDecodeEntities,
+ _xmlStringGetNodeList, _xmlStringLenDecodeEntities, _xmlStringLenGetNodeList,
+ _xmlStringText, _xmlStringTextNoenc, _xmlStrlen, _xmlStrncasecmp,
+ _xmlStrncat, _xmlStrncatNew, _xmlStrncmp, _xmlStrndup, _xmlStrstr,
+ _xmlStrsub, _xmlStructuredError, _xmlStructuredErrorContext,
+ _xmlSubstituteEntitiesDefault, _xmlSubstituteEntitiesDefaultValue,
+ _xmlSwitchEncoding, _xmlSwitchInputEncoding, _xmlSwitchToEncoding,
+ _xmlTextConcat, _xmlTextMerge, _xmlTextReaderAttributeCount,
+ _xmlTextReaderBaseUri, _xmlTextReaderByteConsumed, _xmlTextReaderClose,
+ _xmlTextReaderConstBaseUri, _xmlTextReaderConstEncoding, _xmlTextReaderConstLocalName,
+ _xmlTextReaderConstName, _xmlTextReaderConstNamespaceUri,
+ _xmlTextReaderConstPrefix, _xmlTextReaderConstString, _xmlTextReaderConstValue,
+ _xmlTextReaderConstXmlLang, _xmlTextReaderConstXmlVersion,
+ _xmlTextReaderCurrentDoc, _xmlTextReaderCurrentNode, _xmlTextReaderDepth,
+ _xmlTextReaderExpand, _xmlTextReaderGetAttribute, _xmlTextReaderGetAttributeNo,
+ _xmlTextReaderGetAttributeNs, _xmlTextReaderGetErrorHandler,
+ _xmlTextReaderGetParserColumnNumber, _xmlTextReaderGetParserLineNumber,
+ _xmlTextReaderGetParserProp, _xmlTextReaderGetRemainder, _xmlTextReaderHasAttributes,
+ _xmlTextReaderHasValue, _xmlTextReaderIsDefault, _xmlTextReaderIsEmptyElement,
+ _xmlTextReaderIsNamespaceDecl, _xmlTextReaderIsValid, _xmlTextReaderLocalName,
+ _xmlTextReaderLocatorBaseURI, _xmlTextReaderLocatorLineNumber,
+ _xmlTextReaderLookupNamespace, _xmlTextReaderMoveToAttribute,
+ _xmlTextReaderMoveToAttributeNo, _xmlTextReaderMoveToAttributeNs,
+ _xmlTextReaderMoveToElement, _xmlTextReaderMoveToFirstAttribute,
+ _xmlTextReaderMoveToNextAttribute, _xmlTextReaderName, _xmlTextReaderNamespaceUri,
+ _xmlTextReaderNext, _xmlTextReaderNextSibling, _xmlTextReaderNodeType,
+ _xmlTextReaderNormalization, _xmlTextReaderPrefix, _xmlTextReaderPreserve,
+ _xmlTextReaderPreservePattern, _xmlTextReaderQuoteChar, _xmlTextReaderRead,
+ _xmlTextReaderReadAttributeValue, _xmlTextReaderReadInnerXml,
+ _xmlTextReaderReadOuterXml, _xmlTextReaderReadState, _xmlTextReaderReadString,
+ _xmlTextReaderRelaxNGSetSchema, _xmlTextReaderRelaxNGValidate,
+ _xmlTextReaderRelaxNGValidateCtxt, _xmlTextReaderSchemaValidate,
+ _xmlTextReaderSchemaValidateCtxt, _xmlTextReaderSetErrorHandler,
+ _xmlTextReaderSetParserProp, _xmlTextReaderSetSchema, _xmlTextReaderSetStructuredErrorHandler,
+ _xmlTextReaderSetup, _xmlTextReaderStandalone, _xmlTextReaderValue,
+ _xmlTextReaderXmlLang, _xmlTextWriterEndAttribute, _xmlTextWriterEndCDATA,
+ _xmlTextWriterEndComment, _xmlTextWriterEndDTD, _xmlTextWriterEndDTDAttlist,
+ _xmlTextWriterEndDTDElement, _xmlTextWriterEndDTDEntity, _xmlTextWriterEndDocument,
+ _xmlTextWriterEndElement, _xmlTextWriterEndPI, _xmlTextWriterFlush,
+ _xmlTextWriterFullEndElement, _xmlTextWriterSetIndent, _xmlTextWriterSetIndentString,
+ _xmlTextWriterSetQuoteChar, _xmlTextWriterStartAttribute,
+ _xmlTextWriterStartAttributeNS, _xmlTextWriterStartCDATA,
+ _xmlTextWriterStartComment, _xmlTextWriterStartDTD, _xmlTextWriterStartDTDAttlist,
+ _xmlTextWriterStartDTDElement, _xmlTextWriterStartDTDEntity,
+ _xmlTextWriterStartDocument, _xmlTextWriterStartElement, _xmlTextWriterStartElementNS,
+ _xmlTextWriterStartPI, _xmlTextWriterWriteAttribute, _xmlTextWriterWriteAttributeNS,
+ _xmlTextWriterWriteBase64, _xmlTextWriterWriteBinHex, _xmlTextWriterWriteCDATA,
+ _xmlTextWriterWriteComment, _xmlTextWriterWriteDTD, _xmlTextWriterWriteDTDAttlist,
+ _xmlTextWriterWriteDTDElement, _xmlTextWriterWriteDTDEntity,
+ _xmlTextWriterWriteDTDExternalEntity, _xmlTextWriterWriteDTDExternalEntityContents,
+ _xmlTextWriterWriteDTDInternalEntity, _xmlTextWriterWriteDTDNotation,
+ _xmlTextWriterWriteElement, _xmlTextWriterWriteElementNS,
+ _xmlTextWriterWriteFormatAttribute, _xmlTextWriterWriteFormatAttributeNS,
+ _xmlTextWriterWriteFormatCDATA, _xmlTextWriterWriteFormatComment,
+ _xmlTextWriterWriteFormatDTD, _xmlTextWriterWriteFormatDTDAttlist,
+ _xmlTextWriterWriteFormatDTDElement, _xmlTextWriterWriteFormatDTDInternalEntity,
+ _xmlTextWriterWriteFormatElement, _xmlTextWriterWriteFormatElementNS,
+ _xmlTextWriterWriteFormatPI, _xmlTextWriterWriteFormatRaw,
+ _xmlTextWriterWriteFormatString, _xmlTextWriterWritePI, _xmlTextWriterWriteRaw,
+ _xmlTextWriterWriteRawLen, _xmlTextWriterWriteString, _xmlTextWriterWriteVFormatAttribute,
+ _xmlTextWriterWriteVFormatAttributeNS, _xmlTextWriterWriteVFormatCDATA,
+ _xmlTextWriterWriteVFormatComment, _xmlTextWriterWriteVFormatDTD,
+ _xmlTextWriterWriteVFormatDTDAttlist, _xmlTextWriterWriteVFormatDTDElement,
+ _xmlTextWriterWriteVFormatDTDInternalEntity, _xmlTextWriterWriteVFormatElement,
+ _xmlTextWriterWriteVFormatElementNS, _xmlTextWriterWriteVFormatPI,
+ _xmlTextWriterWriteVFormatRaw, _xmlTextWriterWriteVFormatString,
+ _xmlThrDefBufferAllocScheme, _xmlThrDefDefaultBufferSize,
+ _xmlThrDefDeregisterNodeDefault, _xmlThrDefDoValidityCheckingDefaultValue,
+ _xmlThrDefGetWarningsDefaultValue, _xmlThrDefIndentTreeOutput,
+ _xmlThrDefKeepBlanksDefaultValue, _xmlThrDefLineNumbersDefaultValue,
+ _xmlThrDefLoadExtDtdDefaultValue, _xmlThrDefOutputBufferCreateFilenameDefault,
+ _xmlThrDefParserDebugEntities, _xmlThrDefParserInputBufferCreateFilenameDefault,
+ _xmlThrDefPedanticParserDefaultValue, _xmlThrDefRegisterNodeDefault,
+ _xmlThrDefSaveNoEmptyTags, _xmlThrDefSetGenericErrorFunc,
+ _xmlThrDefSetStructuredErrorFunc, _xmlThrDefSubstituteEntitiesDefaultValue,
+ _xmlThrDefTreeIndentString, _xmlTreeIndentString, _xmlUCSIsAegeanNumbers,
+ _xmlUCSIsAlphabeticPresentationForms, _xmlUCSIsArabic, _xmlUCSIsArabicPresentationFormsA,
+ _xmlUCSIsArabicPresentationFormsB, _xmlUCSIsArmenian, _xmlUCSIsArrows,
+ _xmlUCSIsBasicLatin, _xmlUCSIsBengali, _xmlUCSIsBlock, _xmlUCSIsBlockElements,
+ _xmlUCSIsBopomofo, _xmlUCSIsBopomofoExtended, _xmlUCSIsBoxDrawing,
+ _xmlUCSIsBraillePatterns, _xmlUCSIsBuhid, _xmlUCSIsByzantineMusicalSymbols,
+ _xmlUCSIsCJKCompatibility, _xmlUCSIsCJKCompatibilityForms,
+ _xmlUCSIsCJKCompatibilityIdeographs, _xmlUCSIsCJKCompatibilityIdeographsSupplement,
+ _xmlUCSIsCJKRadicalsSupplement, _xmlUCSIsCJKSymbolsandPunctuation,
+ _xmlUCSIsCJKUnifiedIdeographs, _xmlUCSIsCJKUnifiedIdeographsExtensionA,
+ _xmlUCSIsCJKUnifiedIdeographsExtensionB, _xmlUCSIsCat, _xmlUCSIsCatC,
+ _xmlUCSIsCatCc, _xmlUCSIsCatCf, _xmlUCSIsCatCo, _xmlUCSIsCatCs,
+ _xmlUCSIsCatL, _xmlUCSIsCatLl, _xmlUCSIsCatLm, _xmlUCSIsCatLo,
+ _xmlUCSIsCatLt, _xmlUCSIsCatLu, _xmlUCSIsCatM, _xmlUCSIsCatMc,
+ _xmlUCSIsCatMe, _xmlUCSIsCatMn, _xmlUCSIsCatN, _xmlUCSIsCatNd,
+ _xmlUCSIsCatNl, _xmlUCSIsCatNo, _xmlUCSIsCatP, _xmlUCSIsCatPc,
+ _xmlUCSIsCatPd, _xmlUCSIsCatPe, _xmlUCSIsCatPf, _xmlUCSIsCatPi,
+ _xmlUCSIsCatPo, _xmlUCSIsCatPs, _xmlUCSIsCatS, _xmlUCSIsCatSc,
+ _xmlUCSIsCatSk, _xmlUCSIsCatSm, _xmlUCSIsCatSo, _xmlUCSIsCatZ,
+ _xmlUCSIsCatZl, _xmlUCSIsCatZp, _xmlUCSIsCatZs, _xmlUCSIsCherokee,
+ _xmlUCSIsCombiningDiacriticalMarks, _xmlUCSIsCombiningDiacriticalMarksforSymbols,
+ _xmlUCSIsCombiningHalfMarks, _xmlUCSIsCombiningMarksforSymbols,
+ _xmlUCSIsControlPictures, _xmlUCSIsCurrencySymbols, _xmlUCSIsCypriotSyllabary,
+ _xmlUCSIsCyrillic, _xmlUCSIsCyrillicSupplement, _xmlUCSIsDeseret,
+ _xmlUCSIsDevanagari, _xmlUCSIsDingbats, _xmlUCSIsEnclosedAlphanumerics,
+ _xmlUCSIsEnclosedCJKLettersandMonths, _xmlUCSIsEthiopic, _xmlUCSIsGeneralPunctuation,
+ _xmlUCSIsGeometricShapes, _xmlUCSIsGeorgian, _xmlUCSIsGothic,
+ _xmlUCSIsGreek, _xmlUCSIsGreekExtended, _xmlUCSIsGreekandCoptic,
+ _xmlUCSIsGujarati, _xmlUCSIsGurmukhi, _xmlUCSIsHalfwidthandFullwidthForms,
+ _xmlUCSIsHangulCompatibilityJamo, _xmlUCSIsHangulJamo, _xmlUCSIsHangulSyllables,
+ _xmlUCSIsHanunoo, _xmlUCSIsHebrew, _xmlUCSIsHighPrivateUseSurrogates,
+ _xmlUCSIsHighSurrogates, _xmlUCSIsHiragana, _xmlUCSIsIPAExtensions,
+ _xmlUCSIsIdeographicDescriptionCharacters, _xmlUCSIsKanbun,
+ _xmlUCSIsKangxiRadicals, _xmlUCSIsKannada, _xmlUCSIsKatakana,
+ _xmlUCSIsKatakanaPhoneticExtensions, _xmlUCSIsKhmer, _xmlUCSIsKhmerSymbols,
+ _xmlUCSIsLao, _xmlUCSIsLatin1Supplement, _xmlUCSIsLatinExtendedA,
+ _xmlUCSIsLatinExtendedAdditional, _xmlUCSIsLatinExtendedB,
+ _xmlUCSIsLetterlikeSymbols, _xmlUCSIsLimbu, _xmlUCSIsLinearBIdeograms,
+ _xmlUCSIsLinearBSyllabary, _xmlUCSIsLowSurrogates, _xmlUCSIsMalayalam,
+ _xmlUCSIsMathematicalAlphanumericSymbols, _xmlUCSIsMathematicalOperators,
+ _xmlUCSIsMiscellaneousMathematicalSymbolsA, _xmlUCSIsMiscellaneousMathematicalSymbolsB,
+ _xmlUCSIsMiscellaneousSymbols, _xmlUCSIsMiscellaneousSymbolsandArrows,
+ _xmlUCSIsMiscellaneousTechnical, _xmlUCSIsMongolian, _xmlUCSIsMusicalSymbols,
+ _xmlUCSIsMyanmar, _xmlUCSIsNumberForms, _xmlUCSIsOgham, _xmlUCSIsOldItalic,
+ _xmlUCSIsOpticalCharacterRecognition, _xmlUCSIsOriya, _xmlUCSIsOsmanya,
+ _xmlUCSIsPhoneticExtensions, _xmlUCSIsPrivateUse, _xmlUCSIsPrivateUseArea,
+ _xmlUCSIsRunic, _xmlUCSIsShavian, _xmlUCSIsSinhala, _xmlUCSIsSmallFormVariants,
+ _xmlUCSIsSpacingModifierLetters, _xmlUCSIsSpecials, _xmlUCSIsSuperscriptsandSubscripts,
+ _xmlUCSIsSupplementalArrowsA, _xmlUCSIsSupplementalArrowsB,
+ _xmlUCSIsSupplementalMathematicalOperators, _xmlUCSIsSupplementaryPrivateUseAreaA,
+ _xmlUCSIsSupplementaryPrivateUseAreaB, _xmlUCSIsSyriac, _xmlUCSIsTagalog,
+ _xmlUCSIsTagbanwa, _xmlUCSIsTags, _xmlUCSIsTaiLe, _xmlUCSIsTaiXuanJingSymbols,
+ _xmlUCSIsTamil, _xmlUCSIsTelugu, _xmlUCSIsThaana, _xmlUCSIsThai,
+ _xmlUCSIsTibetan, _xmlUCSIsUgaritic, _xmlUCSIsUnifiedCanadianAboriginalSyllabics,
+ _xmlUCSIsVariationSelectors, _xmlUCSIsVariationSelectorsSupplement,
+ _xmlUCSIsYiRadicals, _xmlUCSIsYiSyllables, _xmlUCSIsYijingHexagramSymbols,
+ _xmlURIEscape, _xmlURIEscapeStr, _xmlURIUnescapeString, _xmlUTF8Charcmp,
+ _xmlUTF8Size, _xmlUTF8Strlen, _xmlUTF8Strloc, _xmlUTF8Strndup,
+ _xmlUTF8Strpos, _xmlUTF8Strsize, _xmlUTF8Strsub, _xmlUnlinkNode,
+ _xmlUnlockLibrary, _xmlUnsetNsProp, _xmlUnsetProp, _xmlValidBuildContentModel,
+ _xmlValidCtxtNormalizeAttributeValue, _xmlValidGetPotentialChildren,
+ _xmlValidGetValidElements, _xmlValidNormalizeAttributeValue,
+ _xmlValidateAttributeDecl, _xmlValidateAttributeValue, _xmlValidateDocument,
+ _xmlValidateDocumentFinal, _xmlValidateDtd, _xmlValidateDtdFinal,
+ _xmlValidateElement, _xmlValidateElementDecl, _xmlValidateNCName,
+ _xmlValidateNMToken, _xmlValidateName, _xmlValidateNameValue,
+ _xmlValidateNamesValue, _xmlValidateNmtokenValue, _xmlValidateNmtokensValue,
+ _xmlValidateNotationDecl, _xmlValidateNotationUse, _xmlValidateOneAttribute,
+ _xmlValidateOneElement, _xmlValidateOneNamespace, _xmlValidatePopElement,
+ _xmlValidatePushCData, _xmlValidatePushElement, _xmlValidateQName,
+ _xmlValidateRoot, _xmlXIncludeFreeContext, _xmlXIncludeNewContext,
+ _xmlXIncludeProcess, _xmlXIncludeProcessFlags, _xmlXIncludeProcessFlagsData,
+ _xmlXIncludeProcessNode, _xmlXIncludeProcessTree, _xmlXIncludeProcessTreeFlags,
+ _xmlXIncludeProcessTreeFlagsData, _xmlXIncludeSetFlags, _xmlXPathAddValues,
+ _xmlXPathBooleanFunction, _xmlXPathCastBooleanToNumber, _xmlXPathCastBooleanToString,
+ _xmlXPathCastNodeSetToBoolean, _xmlXPathCastNodeSetToNumber,
+ _xmlXPathCastNodeSetToString, _xmlXPathCastNodeToNumber, _xmlXPathCastNodeToString,
+ _xmlXPathCastNumberToBoolean, _xmlXPathCastNumberToString,
+ _xmlXPathCastStringToBoolean, _xmlXPathCastStringToNumber,
+ _xmlXPathCastToBoolean, _xmlXPathCastToNumber, _xmlXPathCastToString,
+ _xmlXPathCeilingFunction, _xmlXPathCmpNodes, _xmlXPathCompareValues,
+ _xmlXPathCompile, _xmlXPathCompiledEval, _xmlXPathCompiledEvalToBoolean,
+ _xmlXPathConcatFunction, _xmlXPathContainsFunction, _xmlXPathContextSetCache,
+ _xmlXPathConvertBoolean, _xmlXPathConvertNumber, _xmlXPathConvertString,
+ _xmlXPathCountFunction, _xmlXPathCtxtCompile, _xmlXPathDebugDumpCompExpr,
+ _xmlXPathDebugDumpObject, _xmlXPathDifference, _xmlXPathDistinct,
+ _xmlXPathDistinctSorted, _xmlXPathDivValues, _xmlXPathEqualValues,
+ _xmlXPathErr, _xmlXPathEval, _xmlXPathEvalExpr, _xmlXPathEvalExpression,
+ _xmlXPathEvalPredicate, _xmlXPathEvaluatePredicateResult,
+ _xmlXPathFalseFunction, _xmlXPathFloorFunction, _xmlXPathFreeCompExpr,
+ _xmlXPathFreeContext, _xmlXPathFreeNodeSet, _xmlXPathFreeNodeSetList,
+ _xmlXPathFreeObject, _xmlXPathFreeParserContext, _xmlXPathFunctionLookup,
+ _xmlXPathFunctionLookupNS, _xmlXPathHasSameNodes, _xmlXPathIdFunction,
+ _xmlXPathInit, _xmlXPathIntersection, _xmlXPathIsInf, _xmlXPathIsNaN,
+ _xmlXPathIsNodeType, _xmlXPathLangFunction, _xmlXPathLastFunction,
+ _xmlXPathLeading, _xmlXPathLeadingSorted, _xmlXPathLocalNameFunction,
+ _xmlXPathModValues, _xmlXPathMultValues, _xmlXPathNAN, _xmlXPathNINF,
+ _xmlXPathNamespaceURIFunction, _xmlXPathNewBoolean, _xmlXPathNewCString,
+ _xmlXPathNewContext, _xmlXPathNewFloat, _xmlXPathNewNodeSet,
+ _xmlXPathNewNodeSetList, _xmlXPathNewParserContext, _xmlXPathNewString,
+ _xmlXPathNewValueTree, _xmlXPathNextAncestor, _xmlXPathNextAncestorOrSelf,
+ _xmlXPathNextAttribute, _xmlXPathNextChild, _xmlXPathNextDescendant,
+ _xmlXPathNextDescendantOrSelf, _xmlXPathNextFollowing, _xmlXPathNextFollowingSibling,
+ _xmlXPathNextNamespace, _xmlXPathNextParent, _xmlXPathNextPreceding,
+ _xmlXPathNextPrecedingSibling, _xmlXPathNextSelf, _xmlXPathNodeEval,
+ _xmlXPathNodeLeading, _xmlXPathNodeLeadingSorted, _xmlXPathNodeSetAdd,
+ _xmlXPathNodeSetAddNs, _xmlXPathNodeSetAddUnique, _xmlXPathNodeSetContains,
+ _xmlXPathNodeSetCreate, _xmlXPathNodeSetDel, _xmlXPathNodeSetFreeNs,
+ _xmlXPathNodeSetMerge, _xmlXPathNodeSetRemove, _xmlXPathNodeSetSort,
+ _xmlXPathNodeTrailing, _xmlXPathNodeTrailingSorted, _xmlXPathNormalizeFunction,
+ _xmlXPathNotEqualValues, _xmlXPathNotFunction, _xmlXPathNsLookup,
+ _xmlXPathNumberFunction, _xmlXPathObjectCopy, _xmlXPathOrderDocElems,
+ _xmlXPathPINF, _xmlXPathParseNCName, _xmlXPathParseName, _xmlXPathPopBoolean,
+ _xmlXPathPopExternal, _xmlXPathPopNodeSet, _xmlXPathPopNumber,
+ _xmlXPathPopString, _xmlXPathPositionFunction, _xmlXPathRegisterAllFunctions,
+ _xmlXPathRegisterFunc, _xmlXPathRegisterFuncLookup, _xmlXPathRegisterFuncNS,
+ _xmlXPathRegisterNs, _xmlXPathRegisterVariable, _xmlXPathRegisterVariableLookup,
+ _xmlXPathRegisterVariableNS, _xmlXPathRegisteredFuncsCleanup,
+ _xmlXPathRegisteredNsCleanup, _xmlXPathRegisteredVariablesCleanup,
+ _xmlXPathRoot, _xmlXPathRoundFunction, _xmlXPathSetContextNode,
+ _xmlXPathStartsWithFunction, _xmlXPathStringEvalNumber, _xmlXPathStringFunction,
+ _xmlXPathStringLengthFunction, _xmlXPathSubValues, _xmlXPathSubstringAfterFunction,
+ _xmlXPathSubstringBeforeFunction, _xmlXPathSubstringFunction,
+ _xmlXPathSumFunction, _xmlXPathTrailing, _xmlXPathTrailingSorted,
+ _xmlXPathTranslateFunction, _xmlXPathTrueFunction, _xmlXPathValueFlipSign,
+ _xmlXPathVariableLookup, _xmlXPathVariableLookupNS, _xmlXPathWrapCString,
+ _xmlXPathWrapExternal, _xmlXPathWrapNodeSet, _xmlXPathWrapString,
+ _xmlXPatherror, _xmlXPtrBuildNodeList, _xmlXPtrEval, _xmlXPtrEvalRangePredicate,
+ _xmlXPtrFreeLocationSet, _xmlXPtrLocationSetAdd, _xmlXPtrLocationSetCreate,
+ _xmlXPtrLocationSetDel, _xmlXPtrLocationSetMerge, _xmlXPtrLocationSetRemove,
+ _xmlXPtrNewCollapsedRange, _xmlXPtrNewContext, _xmlXPtrNewLocationSetNodeSet,
+ _xmlXPtrNewLocationSetNodes, _xmlXPtrNewRange, _xmlXPtrNewRangeNodeObject,
+ _xmlXPtrNewRangeNodePoint, _xmlXPtrNewRangeNodes, _xmlXPtrNewRangePointNode,
+ _xmlXPtrNewRangePoints, _xmlXPtrRangeToFunction, _xmlXPtrWrapLocationSet ]
+...
diff --git a/Shared.IOS/Net/NetWiFi.cs b/Shared.IOS/Net/NetWiFi.cs
new file mode 100755
index 0000000..4899f4c
--- /dev/null
+++ b/Shared.IOS/Net/NetWiFi.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.NetworkInformation;
+using System.Text;
+
+
+namespace Shared.Net
+{
+ public class NetWiFi
+ {
+ public static string GetIPAddress()
+ {
+ return Shared.MyIpAddress.GetIPAddress();
+ }
+
+ /// <summary>
+ /// 获取当前设备的IP
+ /// </summary>
+ public System.Net.IPAddress IpAddress
+ {
+ get
+ {
+ return System.Net.IPAddress.Parse(GetIPAddress());
+ }
+ }
+
+ /// <summary>
+ /// 获取广播IPAddress
+ /// </summary>
+ public System.Net.IPAddress BroadcastIpAddress
+ {
+ get
+ {
+ return System.Net.IPAddress.Parse(Shared.MyIpAddress.GetCurrentBroadcastIP());
+ }
+ }
+
+ }
+
+
+
+}
diff --git a/Shared.IOS/Net/WifiUtil.cs b/Shared.IOS/Net/WifiUtil.cs
new file mode 100644
index 0000000..cc697ef
--- /dev/null
+++ b/Shared.IOS/Net/WifiUtil.cs
@@ -0,0 +1,63 @@
+锘縰sing System;
+using System.Collections.Generic;
+
+namespace Shared.Net
+{
+ public class WifiUtil
+ {
+ public void ConnectToWifi(Action<bool> action, string wifiName, string wifiPwd = null)
+ {
+ var hotspotConfig = new NetworkExtension.NEHotspotConfiguration(wifiName, wifiPwd, false);
+ NetworkExtension.NEHotspotConfigurationManager.SharedManager.ApplyConfiguration(hotspotConfig, (obj) =>
+ {
+ if (action != null)
+ {
+ if (obj == null||obj.ToString().Contains("already associated"))
+ {
+ action(true);
+ }
+ else
+ {
+ action(false);
+ }
+ }
+ });
+ }
+
+ // 鍗曚緥
+ static WifiUtil ourInstance = new WifiUtil();
+
+ public static WifiUtil Instance
+ {
+ get
+ {
+ return ourInstance;
+ }
+ }
+
+
+ ///// <summary>
+ ///// 鑾峰彇WiFi鍒楄〃
+ ///// </summary>
+ ///// <param name="mWifiManager"></param>
+ ///// <returns></returns>
+ //public List<string> GetWiFiList()
+ //{
+ // if (!mWifiManager.IsWifiEnabled)
+ // {
+ // mWifiManager.SetWifiEnabled(true);
+ // }
+ // List<string> ssidList = new List<string>();
+
+ // IList<ScanResult> tempList = new List<ScanResult>();
+ // mWifiManager.StartScan();
+ // tempList = mWifiManager.ScanResults;
+ // foreach (var DD in tempList)
+ // {
+ // ssidList.Add(DD.Ssid);
+ // }
+
+ // return ssidList;
+ //}
+ }
+}
diff --git a/Shared.IOS/Properties/AssemblyInfo.cs b/Shared.IOS/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..d7d7423
--- /dev/null
+++ b/Shared.IOS/Properties/AssemblyInfo.cs
@@ -0,0 +1,34 @@
+锘縰sing System.Reflection;
+using System.Runtime.CompilerServices;
+
+using Foundation;
+
+// This attribute allows you to mark your assemblies as 鈥渟afe to link鈥�.
+// When the attribute is present, the linker鈥攊f enabled鈥攚ill process the assembly
+// even if you鈥檙e using the 鈥淟ink SDK assemblies only鈥� option, which is the default for device builds.
+
+[assembly: LinkerSafe]
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle ("Shared.IOS")]
+[assembly: AssemblyDescription ("")]
+[assembly: AssemblyConfiguration ("")]
+[assembly: AssemblyCompany ("")]
+[assembly: AssemblyProduct ("")]
+[assembly: AssemblyCopyright ("hdl")]
+[assembly: AssemblyTrademark ("")]
+[assembly: AssemblyCulture ("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion ("23.06.06.1")]
+
+// The following attributes are used to specify the signing key for the assembly,
+// if desired. See the Mono documentation for more information about signing.
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]
diff --git a/Shared.IOS/Reachability.cs b/Shared.IOS/Reachability.cs
new file mode 100755
index 0000000..d54079b
--- /dev/null
+++ b/Shared.IOS/Reachability.cs
@@ -0,0 +1,151 @@
+锘縰sing System;
+using System.Net;
+using CoreFoundation;
+using SystemConfiguration;
+
+namespace Shared
+{
+ internal enum MyNetworkStatus
+ {
+ NotReachable = 0,
+ ReachableViaCarrierDataNetwork = 1,
+ ReachableViaWiFiNetwork = 2
+ }
+
+ internal static class MyReachability
+ {
+ static readonly string hostName = "www.apple.com";
+
+ public static bool IsReachableWithoutRequiringConnection (NetworkReachabilityFlags flags)
+ {
+ // Is it reachable with the current network configuration?
+ bool isReachable = (flags & NetworkReachabilityFlags.Reachable) != 0;
+
+ // Do we need a connection to reach it?
+ bool noConnectionRequired = (flags & NetworkReachabilityFlags.ConnectionRequired) == 0
+ || (flags & NetworkReachabilityFlags.IsWWAN) != 0;
+
+ return isReachable && noConnectionRequired;
+ }
+
+ // Is the host reachable with the current network configuration
+ public static bool IsHostReachable (string host)
+ {
+ if (string.IsNullOrEmpty (host))
+ return false;
+
+ using (var r = new NetworkReachability (host)) {
+ NetworkReachabilityFlags flags;
+
+ if (r.TryGetFlags (out flags))
+ return IsReachableWithoutRequiringConnection (flags);
+ }
+ return false;
+ }
+
+ //
+ // Raised every time there is an interesting reachable event,
+ // we do not even pass the info as to what changed, and
+ // we lump all three status we probe into one
+ //
+ public static EventHandler ReachabilityChanged;
+
+ static void OnChange (NetworkReachabilityFlags flags)
+ {
+ var h = ReachabilityChanged;
+ if (h != null)
+ h (null, EventArgs.Empty);
+ }
+
+ //
+ // Returns true if it is possible to reach the AdHoc WiFi network
+ // and optionally provides extra network reachability flags as the
+ // out parameter
+ //
+ static NetworkReachability adHocWiFiNetworkReachability;
+
+ public static bool IsAdHocWiFiNetworkAvailable (out NetworkReachabilityFlags flags)
+ {
+ if (adHocWiFiNetworkReachability == null) {
+ adHocWiFiNetworkReachability = new NetworkReachability (new IPAddress (new byte [] { 115, 29, 191, 136 }));
+ adHocWiFiNetworkReachability.SetNotification (OnChange);
+ adHocWiFiNetworkReachability.Schedule (CFRunLoop.Current, CFRunLoop.ModeDefault);
+ }
+
+ return adHocWiFiNetworkReachability.TryGetFlags (out flags) && IsReachableWithoutRequiringConnection (flags);
+ }
+
+ static NetworkReachability defaultRouteReachability;
+
+ static bool IsNetworkAvailable (out NetworkReachabilityFlags flags)
+ {
+ if (defaultRouteReachability == null) {
+ defaultRouteReachability = new NetworkReachability (new IPAddress (new byte [] { 115, 29, 191, 136 }));
+ defaultRouteReachability.SetNotification (OnChange);
+ defaultRouteReachability.Schedule (CFRunLoop.Current, CFRunLoop.ModeDefault);
+ }
+ return defaultRouteReachability.TryGetFlags (out flags) && IsReachableWithoutRequiringConnection (flags);
+ }
+
+ static NetworkReachability remoteHostReachability;
+
+ public static MyNetworkStatus RemoteHostStatus ()
+ {
+ NetworkReachabilityFlags flags;
+ bool reachable;
+
+ if (remoteHostReachability == null) {
+ remoteHostReachability = new NetworkReachability (hostName);
+
+ // Need to probe before we queue, or we wont get any meaningful values
+ // this only happens when you create NetworkReachability from a hostname
+ reachable = remoteHostReachability.TryGetFlags (out flags);
+
+ remoteHostReachability.SetNotification (OnChange);
+ remoteHostReachability.Schedule (CFRunLoop.Current, CFRunLoop.ModeDefault);
+ } else {
+ reachable = remoteHostReachability.TryGetFlags (out flags);
+ }
+
+ if (!reachable)
+ return MyNetworkStatus.NotReachable;
+
+ if (!IsReachableWithoutRequiringConnection (flags))
+ return MyNetworkStatus.NotReachable;
+
+ return (flags & NetworkReachabilityFlags.IsWWAN) != 0 ?
+ MyNetworkStatus.ReachableViaCarrierDataNetwork : MyNetworkStatus.ReachableViaWiFiNetwork;
+ }
+
+ public static MyNetworkStatus InternetConnectionStatus ()
+ {
+ NetworkReachabilityFlags flags;
+ bool defaultNetworkAvailable = IsNetworkAvailable (out flags);
+ if (defaultNetworkAvailable && ((flags & NetworkReachabilityFlags.IsDirect) != 0))
+ return MyNetworkStatus.NotReachable;
+ else if ((flags & NetworkReachabilityFlags.IsWWAN) != 0)
+ return MyNetworkStatus.ReachableViaCarrierDataNetwork;
+ else if (flags == 0)
+ return MyNetworkStatus.NotReachable;
+ return MyNetworkStatus.ReachableViaWiFiNetwork;
+ }
+
+ public static bool Online ()
+ {
+ NetworkReachabilityFlags flags;
+ bool defaultNetworkAvailable = IsNetworkAvailable (out flags);
+ return defaultNetworkAvailable;
+ }
+
+
+ public static MyNetworkStatus LocalWifiConnectionStatus ()
+ {
+ NetworkReachabilityFlags flags;
+ if (IsAdHocWiFiNetworkAvailable (out flags))
+ if ((flags & NetworkReachabilityFlags.IsDirect) != 0)
+ return MyNetworkStatus.ReachableViaWiFiNetwork;
+
+ return MyNetworkStatus.NotReachable;
+ }
+ }
+}
diff --git a/Shared.IOS/Server.cs b/Shared.IOS/Server.cs
new file mode 100644
index 0000000..1928397
--- /dev/null
+++ b/Shared.IOS/Server.cs
@@ -0,0 +1,172 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Web;
+using Foundation;
+
+namespace com.hdl.on
+{
+ public class Server
+ {
+ public static int Port=22222;
+ static System.Net.HttpListener listener;
+
+ /// <summary>
+ /// 鍚姩鐩戝惉鍙婂鐞�
+ /// </summary>
+ internal static void Start(System.Net.IPAddress ipAddress)
+ {
+ System.Threading.Tasks.Task.Run(() =>
+ {
+ try
+ {
+ if (listener == null)
+ {
+ listener = new System.Net.HttpListener();
+
+ listener.AuthenticationSchemes = System.Net.AuthenticationSchemes.Anonymous;
+
+ listener.Prefixes.Add(string.Format("http://{0}:{1}/", ipAddress.ToString(), Port));
+
+ listener.Start();
+
+ beginGetContext(listener);
+
+ Shared.HDLUtils.WriteLine("闊充箰鏈嶅姟鍚姩鎴愬姛!");
+ }
+ }
+ catch (Exception e)
+ {
+ Shared.HDLUtils.WriteLine("闊充箰鏈嶅姟鍚姩澶辫触!" + e.Message);
+ }
+ finally { }
+ });
+ }
+
+ internal static void Stop()
+ {
+ if (listener != null)
+ {
+ try
+ {
+ listener.Close();
+ }catch{}
+ }
+ listener = null;
+ Shared.HDLUtils.WriteLine("闊充箰鏈嶅姟鍋滄!");
+ }
+ static string getTempPath()
+ {
+ var dirs = NSSearchPath.GetDirectories(NSSearchPathDirectory.CachesDirectory, NSSearchPathDomain.User, true);
+ if (dirs == null || dirs.Length == 0)
+ {
+ return "";
+ }
+ return dirs[0];
+ }
+ /// <summary>
+ /// 寮�濮嬪紓姝ユ帴鏀秇ttp璇锋眰
+ /// </summary>
+ /// <param name="listerner"></param>
+ static void beginGetContext(System.Net.HttpListener listerner)
+ {
+ try
+ {
+
+ if (listerner == null || !listerner.IsListening)
+ {
+ return;
+ }
+ listerner.BeginGetContext(new System.AsyncCallback(getContextCallBack), null);
+
+ }
+ catch
+ {
+ System.Threading.Thread.Sleep(1);
+ beginGetContext(listerner);
+ }
+ }
+
+ /// <summary>
+ /// 鑾峰彇http璇锋眰锛屽苟澶勭悊
+ /// </summary>
+ /// <param name="ar"></param>
+ static void getContextCallBack(System.IAsyncResult ar)
+ {
+ beginGetContext(listener);
+ try
+ {
+ System.Net.HttpListenerContext context = listener.EndGetContext(ar);
+ manager(context);
+ }
+ catch { }
+
+ }
+
+
+ static void manager(System.Net.HttpListenerContext httpListenerContext)
+ {
+ System.Net.HttpListenerResponse httpListenerResponse = null;
+
+ try
+ {
+ #region
+ httpListenerResponse = httpListenerContext.Response;
+
+ httpListenerResponse.StatusCode = 200;//璁剧疆杩斿洖缁欏鏈嶇http鐘舵�佷唬鐮�
+ httpListenerResponse.ContentEncoding = System.Text.Encoding.UTF8;
+
+
+ var nameValueCollection = HttpUtility.ParseQueryString(System.IO.Path.GetFileName(httpListenerContext.Request.RawUrl));
+ if (0 < nameValueCollection.Count && System.IO.File.Exists($"{getTempPath()}/{nameValueCollection[0]}"))
+ {
+ var file = new System.IO.FileStream($"{getTempPath()}/{nameValueCollection[0]}", System.IO.FileMode.Open, System.IO.FileAccess.Read);
+ try
+ {
+ while (file.CanRead)
+ {
+ var bytes = new byte[1024];
+ var len = file.Read(bytes, 0, bytes.Length);
+ httpListenerResponse.OutputStream.Write(bytes, 0, len);
+ }
+ }
+ finally
+ {
+ file.Close();
+ }
+ }
+ httpListenerResponse.OutputStream.Flush();
+ #endregion
+ }
+ catch
+ {
+
+ }
+ finally
+ {
+ #region
+ try
+ {
+ httpListenerContext.Request.InputStream.Close();
+ }
+ catch { }
+
+ try
+ {
+ httpListenerResponse.OutputStream.Close();
+ }
+ catch { }
+
+
+ try
+ {
+ httpListenerResponse.Close();
+ }
+ catch { }
+
+ #endregion
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Shared.IOS/Shared.IOS.csproj b/Shared.IOS/Shared.IOS.csproj
new file mode 100644
index 0000000..2d9e1d8
--- /dev/null
+++ b/Shared.IOS/Shared.IOS.csproj
@@ -0,0 +1,198 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectTypeGuids>{8FFB629D-F513-41CE-95D2-7ECE97B6EEEC};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ProjectGuid>{0048AB87-2130-4437-8F01-8CADAB787004}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <RootNamespace>Shared</RootNamespace>
+ <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
+ <AssemblyName>Shared.IOS</AssemblyName>
+ <SignAssembly>true</SignAssembly>
+ <ReleaseVersion>1.1</ReleaseVersion>
+ <SynchReleaseVersion>false</SynchReleaseVersion>
+ <PackageId>10</PackageId>
+ <PackageVersion>1.0</PackageVersion>
+ <Copyright>HDL</Copyright>
+ <Owners>HXB</Owners>
+ <Authors>HXB</Authors>
+ <Description>HDL璺ㄥ钩鍙板紑鍙戦渶瑕�</Description>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug</OutputPath>
+ <DefineConstants>DEBUG;</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>false</ConsolePause>
+ <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
+ <DocumentationFile>bin\Debug\Shared.IOS.xml</DocumentationFile>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <BTouchExtraArgs></BTouchExtraArgs>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType></DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <DocumentationFile>bin\Release\Shared.IOS.xml</DocumentationFile>
+ <ConsolePause>false</ConsolePause>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="Xamarin.iOS" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Data" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.IO.Compression" />
+ <Reference Include="System.Net.Http" />
+ <Reference Include="System.Web.Services" />
+ <Reference Include="OpenTK-1.0" />
+ <Reference Include="Newtonsoft.Json">
+ <HintPath>..\DLL\Newtonsoft.Json.dll</HintPath>
+ </Reference>
+ <Reference Include="Xamarin.Essentials">
+ <HintPath>..\DLL\IOS\Xamarin.Essentials.dll</HintPath>
+ </Reference>
+ <Reference Include="MJRefresh_Xamarin">
+ <HintPath>..\packages\Xamarin.iOS.MJRefresh.3.2.2\lib\xamarinios10\MJRefresh_Xamarin.dll</HintPath>
+ </Reference>
+ <Reference Include="Shared.IOS.TBL">
+ <HintPath>..\DLL\Shared.IOS.TBL.dll</HintPath>
+ </Reference>
+ <Reference Include="MJRefresh_Xamarin">
+ <HintPath>..\DLL\IOS\MJRefresh_Xamarin.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="Resources\" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="IO\FileUtils.cs" />
+ <Compile Include="Net\NetWiFi.cs" />
+ <Compile Include="UI\Alert.cs" />
+ <Compile Include="UI\Application.cs" />
+ <Compile Include="UI\Button.cs" />
+ <Compile Include="UI\Dialog.cs" />
+ <Compile Include="UI\EditText.cs" />
+ <Compile Include="UI\Enum.cs" />
+ <Compile Include="UI\FrameLayout.cs" />
+ <Compile Include="UI\HorizontalScrolViewLayout.cs" />
+ <Compile Include="UI\HorizontalSeekBar.cs" />
+ <Compile Include="UI\Lanuage.cs" />
+ <Compile Include="UI\Loading.cs" />
+ <Compile Include="UI\PageLayout.cs" />
+ <Compile Include="UI\Spinner.cs" />
+ <Compile Include="UI\VerticalScrolViewLayout.cs" />
+ <Compile Include="UI\VerticalSeekBar.cs" />
+ <Compile Include="UI\Video.cs" />
+ <Compile Include="UI\View.cs" />
+ <Compile Include="UI\WebView.cs" />
+ <Compile Include="UI\Tip.cs" />
+ <Compile Include="UI\RowLayout.cs" />
+ <Compile Include="UI\ViewGroup.cs" />
+ <Compile Include="UI\TextView.cs" />
+ <Compile Include="UI\Camera.cs" />
+ <Compile Include="UI\DateView.cs" />
+ <Compile Include="UI\TimeView.cs" />
+ <Compile Include="UI\ColorPicker.cs" />
+ <Compile Include="UI\UrlMonitor.cs" />
+ <Compile Include="UI\LongPressMoveVerticalScrolViewLayout.cs" />
+ <Compile Include="UI\MusicVerticalScrolViewLayout.cs" />
+ <Compile Include="UI\ImageView.cs" />
+ <Compile Include="UI\WiimuUPnP.cs" />
+ <Compile Include="BaseApplicationDelegate.cs" />
+ <Compile Include="BaseViewController.cs" />
+ <Compile Include="MusicInfo.cs" />
+ <Compile Include="Volume.cs" />
+ <Compile Include="Server.cs" />
+ <Compile Include="CommonClass.cs" />
+ <Compile Include="Ezviz.cs" />
+ <Compile Include="UI\PickerView.cs" />
+ <Compile Include="Net\WifiUtil.cs" />
+ <Compile Include="UI\MyEchartsView.cs" />
+ <Compile Include="UI\ArcSeekBar.cs" />
+ <Compile Include="Reachability.cs" />
+ <Compile Include="Utils\TouchIDUtils.cs" />
+ <Compile Include="UI\WaveSeekBar.cs" />
+ <Compile Include="UI\GDMapView.cs" />
+ <Compile Include="Utils\HDLUtils.cs" />
+ <Compile Include="UI\UIPickerView.cs" />
+ <Compile Include="UI\UICoverFlowView.cs" />
+
+ <Compile Include="UI\CropImage.cs" />
+ <Compile Include="UI\GestureLockView.cs" />
+
+ <Compile Include="UI\Scan.cs" />
+ <Compile Include="UI\Contacts.cs" />
+
+ <Compile Include="UI\CurtainRollSeekBar.cs" />
+ <Compile Include="UI\CurtainSeekBar.cs" />
+ <Compile Include="UI\VerticalRefreshLayout.cs" />
+ <Compile Include="UI\ArcScaleSeekBar.cs" />
+ <Compile Include="UI\UIDrawerLayout.cs" />
+ <Compile Include="UI\CoverFlowLayout.cs" />
+ <Compile Include="UI\EditTextView.cs" />
+ <Compile Include="UI\HorizontalPages.cs" />
+ <Compile Include="UI\DiyImageSeekBar.cs" />
+ <Compile Include="UI\BaseSeekBar.cs" />
+ <Compile Include="UI\GradientMaskView.cs" />
+ <Compile Include="UI\ProgressLoading.cs" />
+ <Compile Include="BaseApplicationDelegateForHdlOn.cs" />
+ <Compile Include="UI\DiyImageVerticalSeekBar.cs" />
+ <Compile Include="UI\CurtainRollSeekBarOn.cs" />
+ <Compile Include="UI\CurtainSeekBarOn.cs" />
+ <Compile Include="UI\DiyArcSeekBar.cs" />
+ <Compile Include="UI\MyEchartsViewOn.cs" />
+ <Compile Include="UI\WaveSeekBarOn.cs" />
+ <Compile Include="UI\CurtainSingleSeekBar.cs" />
+ <Compile Include="BaseApplicationDelegateForOnPro.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ObjcBindingApiDefinition Include="ApiDefinition.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ObjcBindingCoreSource Include="StructsAndEnums.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.ObjCBinding.CSharp.targets" />
+ <ItemGroup>
+ <NativeReference Include="..\..\..\..\..\..\..\..\Applications\Xcode.app\Contents\Developer\Platforms\iPhoneOS.platform\Developer\SDKs\iPhoneOS.sdk\usr\lib\libxml2.tbd">
+ <Kind>Static</Kind>
+ <SmartLink>False</SmartLink>
+ <Frameworks></Frameworks>
+ </NativeReference>
+ <NativeReference Include="Native References\libSmartLink.a">
+ <Kind>Static</Kind>
+ <ForceLoad>True</ForceLoad>
+ </NativeReference>
+ <NativeReference Include="Native References\libMyLibrary.a">
+ <Kind>Static</Kind>
+ <Frameworks>AVFoundation CoreGraphics UIKit CoreMedia AudioToolbox VideoToolbox GLKit OpenAL MobileCoreServices SystemConfiguration CoreTelephony AVFoundation WebKit</Frameworks>
+ <ForceLoad>True</ForceLoad>
+ <IsCxx>True</IsCxx>
+ <LinkerFlags>-lz</LinkerFlags>
+ </NativeReference>
+ </ItemGroup>
+ <ItemGroup>
+ <BundleResource Include="packages.config" />
+ </ItemGroup>
+ <ProjectExtensions>
+ <MonoDevelop>
+ <Properties>
+ <Policies>
+ <VersionControlPolicy>
+ <CommitMessageStyle Header="" Indent="" FirstFilePrefix="* " FileSeparator=":
* " LastFilePostfix=": " LineAlign="2" InterMessageLines="1" IncludeDirectoryPaths="False" Wrap="True" />
+ </VersionControlPolicy>
+ </Policies>
+ </Properties>
+ </MonoDevelop>
+ </ProjectExtensions>
+ <Import Project="..\..\packages\NETStandard.Library.2.0.0\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('..\..\packages\NETStandard.Library.2.0.0\build\netstandard2.0\NETStandard.Library.targets')" />
+ <Import Project="..\..\Demo\Shared\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('..\..\Demo\Shared\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets')" />
+</Project>
\ No newline at end of file
diff --git a/Shared.IOS/Shared.IOS.userprefs b/Shared.IOS/Shared.IOS.userprefs
new file mode 100755
index 0000000..cae0aae
--- /dev/null
+++ b/Shared.IOS/Shared.IOS.userprefs
@@ -0,0 +1,9 @@
+锘�<Properties StartupItem="Shared.IOS.csproj">
+ <MonoDevelop.Ide.Workbench />
+ <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
+ <MonoDevelop.Ide.DebuggingService.Breakpoints>
+ <BreakpointStore />
+ </MonoDevelop.Ide.DebuggingService.Breakpoints>
+ <MonoDevelop.Ide.ItemProperties.Shared.IOS PreferredExecutionTarget="MonoDevelop.Default" />
+ <MonoDevelop.Ide.DebuggingService.PinnedWatches />
+</Properties>
\ No newline at end of file
diff --git a/Shared.IOS/StructsAndEnums.cs b/Shared.IOS/StructsAndEnums.cs
new file mode 100755
index 0000000..1a5e80c
--- /dev/null
+++ b/Shared.IOS/StructsAndEnums.cs
@@ -0,0 +1,47 @@
+锘縰sing System;
+using ObjCRuntime;
+namespace Shared
+{
+
+
+
+ public enum AMPopTipDirection
+ {
+ Up,
+ Down,
+ Left,
+ Right,
+ None
+ }
+
+public enum AMPopTipEntranceAnimation
+{
+ Scale,
+ Transition,
+ None,
+ Custom
+}
+
+
+public enum AMPopTipActionAnimation
+{
+ Bounce,
+ Float,
+ Pulse,
+ None
+}
+
+ public enum BQMenuStatus : uint
+ {
+ Hide,
+ Moving,
+ Show
+ }
+
+ public enum BQMenuPriority : uint
+ {
+ BelowContent,
+ OverContent
+ }
+
+}
\ No newline at end of file
diff --git a/Shared.IOS/UI/Alert.cs b/Shared.IOS/UI/Alert.cs
new file mode 100644
index 0000000..6f266d5
--- /dev/null
+++ b/Shared.IOS/UI/Alert.cs
@@ -0,0 +1,107 @@
+锘縰sing System;
+using UIKit;
+using CoreGraphics;
+
+namespace Shared
+{
+ /// <summary>
+ /// 瀵硅瘽妗�
+ /// </summary>
+ public class Alert
+ {
+ /// <summary>
+ /// 褰撳墠瀵硅瘽妗�
+ /// </summary>
+ UIAlertView myUIAlertView;
+
+ /// <summary>
+ /// 瀵硅瘽绐�
+ /// </summary>
+ /// <param name="title">鏍囬</param>
+ /// <param name="message">淇℃伅</param>
+ /// <param name="cancelButtonText">鍙栨秷鎸夐敭澶囨敞锛屽�糿ull琛ㄧず涓嶆樉绀哄彇娑堟寜閿�</param>
+ /// <param name="okButtonText">纭鎸夐敭澶囨敞</param>
+ public Alert(string title, string message, string cancelButtonText, string okButtonText)
+ {
+ myUIAlertView = new UIAlertView { Title = title, Message = message };
+ myUIAlertView.Clicked += (s, e) =>
+ {
+ if (ResultEventHandler != null)
+ {
+ if (e.ButtonIndex == 0)
+ {
+ if (flag)
+ {
+ //鍙栨秷鎸夐敭
+ ResultEventHandler?.Invoke(this, false);
+ }
+ else
+ {
+ //鎸変簡纭畾
+ ResultEventHandler?.Invoke(this, true);
+ }
+ }
+ else if (e.ButtonIndex == 1)
+ {
+ //鎸変簡纭畾
+ ResultEventHandler?.Invoke(this, true);
+ }
+ }
+
+ };
+ if (cancelButtonText != null)
+ {
+ myUIAlertView.AddButton(cancelButtonText);
+ flag = true;
+ }
+ myUIAlertView.AddButton(okButtonText);
+ }
+
+
+ bool flag;
+ /// <summary>
+ /// 瀵硅瘽绐�
+ /// </summary>
+ /// <param name="title">鏍囬</param>
+ /// <param name="message">淇℃伅</param>
+ /// <param name="okButtonText">纭鎸夐敭澶囨敞</param>
+ public Alert(string title,string message,string okButtonText):this(title,message,null,okButtonText)
+ {
+
+ }
+
+ /// <summary>
+ /// 缁撴灉閫氱煡浜嬩欢锛宼rue琛ㄧず閫変腑鎸夐敭锛宖alse琛ㄧず鍙栨秷浜嬩欢
+ /// </summary>
+ public Action<Alert, bool> ResultEventHandler;
+
+ /// <summary>
+ /// 鏄剧ず褰撳墠鐨勭晫闈�
+ /// </summary>
+ public void Show()
+ {
+ myUIAlertView.Show();
+
+ //if (myUIAlertView != null && !myUIAlertView.Visible)
+ //{
+ // myUIAlertView.Show();
+ //}
+ }
+
+
+
+ /// <summary>
+ /// 鍏抽棴褰撳墠鐨勭晫闈�
+ /// </summary>
+ public void Dismiss()
+ {
+ if (myUIAlertView != null )
+ {
+ myUIAlertView.DismissWithClickedButtonIndex(0, false);
+ }
+
+ }
+
+ }
+}
+
diff --git a/Shared.IOS/UI/Application.cs b/Shared.IOS/UI/Application.cs
new file mode 100644
index 0000000..985dc62
--- /dev/null
+++ b/Shared.IOS/UI/Application.cs
@@ -0,0 +1,435 @@
+锘縰sing System;
+using UIKit;
+
+namespace Shared
+{
+ //AVFoundation CoreGraphics UIKit CoreMedia AudioToolbox VideoToolbox GLKit OpenAL MobileCoreServices SystemConfiguration CoreTelephony AVFoundation WebKit
+ /// <summary>
+ /// UI澶勭悊绫�
+ /// </summary>
+ public static class Application
+ {
+ //public static double PhoneType
+ //{
+ // get
+ // {
+ // var type = UIDevice.CurrentDevice.SystemVersion.Split(new string[] { "." }, StringSplitOptions.None)[0];
+ // var d = 1.0d;
+ // double.TryParse(type, out d);
+ // return d;
+ // }
+ //}
+
+ public enum GpsUseMode
+ {
+ Always,
+ WhenInUse
+ }
+ public static bool IsGpsEnable = true;
+ public static GpsUseMode CurrentGpsUseMode = GpsUseMode.WhenInUse;
+
+ public static bool IsMusicEnable = true;
+ /// <summary>
+ /// EditText鏄惁榛樿瀵嗙爜杈撳叆鏂瑰紡
+ /// </summary>
+ public static bool IsEditTextContentTypePassword = true;
+
+ /// <summary>
+ /// 2020-06-23
+ /// 鏄惁鍏ㄥ睆骞曟墜鏈�
+ /// </summary>
+ public static bool IsFullScreen
+ {
+ get
+ {
+ /// iPhoneX_XS_11Pro 812
+ /// iPhoneXSMax_XR_11_11ProMax 896
+ /// 鏄惁鍏ㄥ睆骞曟墜鏈� 闇�瑕佹寔缁洿鏂伴�傞厤
+ //HDLUtils.WriteLine("UIScreenWidth:" + UIScreen.MainScreen.Bounds.Size.Width + " UIScreenHeight:" + UIScreen.MainScreen.Bounds.Size.Height);
+ return (UIScreen.MainScreen.Bounds.Size.Width == 375 && UIScreen.MainScreen.Bounds.Size.Height == 812) || (UIScreen.MainScreen.Bounds.Size.Width == 414 && UIScreen.MainScreen.Bounds.Size.Height == 896);
+ }
+ }
+
+ //2019-08-14 淇敼
+ public static double PhoneType
+ {
+ get
+ {
+ var device = Xamarin.Essentials.DeviceInfo.Model;
+ if (device == null)
+ {
+ return 1.0;
+ }
+ var type = device.Replace("iPhone", "").Split(',')[0];
+
+ double d = 1.0;
+ double.TryParse(type, out d);
+ return d;
+ }
+ }
+
+ //public static String PhoneTypeModel
+ //{
+ // get
+ // {
+ // var device = UIDevice.CurrentDevice.Model;// .SystemVersion.Split(new string[] { "." }, StringSplitOptions.None)[0];
+
+ // return device;
+ // }
+ //}
+
+
+ /// <summary>
+ /// 鑾峰彇瀹為檯鐨勯珮搴�
+ /// </summary>
+ /// <returns>The real height.</returns>
+ /// <param name="height">Height.</param>
+ public static int GetRealHeight(int height)
+ {
+ return (int)(height / HeightScale);
+ }
+
+ /// <summary>
+ /// 榛樿鐨勫瓧浣撳ぇ灏�
+ /// </summary>
+ public static int FontSize = 18;
+ public static bool IsUsePingFang = false;
+
+ /// <summary>
+ /// 鑾峰彇瀹為檯鐨勫搴�
+ /// </summary>
+ /// <returns>The real width.</returns>
+ /// <param name="width">Width.</param>
+ public static int GetRealWidth(int width)
+ {
+ return (int)(width / WidthScale);
+ }
+ /// <summary>
+ /// 闅愯棌杞敭鐩�
+ /// </summary>
+ public static void HideSoftInput()
+ {
+ if (Shared.EditText.Instance != null)
+ {
+ Shared.EditText.Instance.Foucs = false;
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠璁惧绫诲瀷
+ /// </summary>
+ public static readonly Device DeviceType = Device.Ios;
+
+ /// <summary>
+ /// 鑾峰彇鏈�灏忔瘮渚嬬殑瀹為檯鍊�
+ /// </summary>
+ /// <returns>The minimum real.</returns>
+ /// <param name="widthOrHeight">Width or height.</param>
+ public static int GetMinReal(int widthOrHeight)
+ {
+ return (int)(widthOrHeight / MinScale);
+ }
+
+ /// <summary>
+ /// 鑾峰彇骞冲潎瀹為檯鍊�
+ /// </summary>
+ /// <returns>The minimum real average.</returns>
+ /// <param name="widthOrHeight">Width or height.</param>
+ public static int GetMinRealAverage(int widthOrHeight)
+ {
+ return (int)(widthOrHeight / AverageScale);
+ }
+
+ /// <summary>
+ /// 涓荤嚎绋嬫墽琛屾寚瀹氫簨浠�
+ /// </summary>
+ /// <param name="action">Action.</param>
+ public static void RunOnMainThread(Action action)
+ {
+ try
+ {
+ if (System.Threading.Thread.CurrentThread.ManagedThreadId == mainThreadId)
+ {
+ action?.Invoke();
+ }
+ else
+ {
+ RootFrameLayout.InvokeOnMainThread(action);
+ }
+ }catch(Exception ex)
+ {
+ RunOnMainThread(() =>
+ {
+ try
+ {
+ CommonClass.ExcptionEvent(ex);
+ }catch(Exception ex2)
+ {
+ Console.WriteLine($"涓荤嚎绋嬪紓甯革細{ex2.Message}");
+ }
+ });
+ }
+ }
+
+ public static bool IsWifi {
+ get {
+ return MyReachability.InternetConnectionStatus() == MyNetworkStatus.ReachableViaWiFiNetwork;
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠璁惧鐨勫搴�
+ /// </summary>
+ public static int CurrentWidth;
+ /// <summary>
+ /// 褰撳墠璁惧鐨勯珮搴�
+ /// </summary>
+ public static int CurrentHeight;
+
+
+ /// <summary>
+ /// 瀹藉害姣斾緥
+ /// </summary>
+ /// <value>The width scale.</value>
+ public static float WidthScale
+ {
+ get
+ {
+ return DesignWidth * 1.0f / CurrentWidth;
+ }
+ }
+
+ /// <summary>
+ /// 楂樺害姣斾緥
+ /// </summary>
+ /// <value>The height scale.</value>
+ public static float HeightScale
+ {
+ get
+ {
+ //return Application.CurrentHeight / bigsize;
+ return DesignHeight * 1.0f / CurrentHeight;
+ }
+ }
+
+ /// <summary>
+ /// 鏈�灏忔瘮渚�
+ /// </summary>
+ /// <value>The minimum scale.</value>
+ public static float MinScale
+ {
+ get
+ {
+ return WidthScale < HeightScale ? WidthScale : HeightScale;
+ }
+ }
+
+ /// <summary>
+ /// 骞冲潎姣斾緥
+ /// </summary>
+ /// <value>The average scale.</value>
+ public static float AverageScale
+ {
+ get
+ {
+ return (WidthScale + HeightScale)/2;
+ }
+ }
+
+
+ /// <summary>
+ /// 璁捐瀹藉害
+ /// </summary>
+ public static int DesignWidth=1920;
+ /// <summary>
+ /// 璁捐楂樺害
+ /// </summary>
+ public static int DesignHeight=1136;
+
+
+// CoreGraphics.CGRect screenRect = [[UIScreen mainScreen] bounds];
+//CoreGraphics.CGSize screenSize = screenRect.size;
+
+
+ /// <summary>
+ /// 褰撳墠涓婚〉
+ /// </summary>
+ /// <value>The main page.</value>
+ public static Shared.FrameLayout MainPage
+ {
+ get;
+ private set;
+ }
+
+ static int mainThreadId;
+ static UIView rootFrameLayout;
+ /// <summary>
+ /// 鏍瑰鍣ㄨ鍥�
+ /// </summary>
+ /// <value>The root frame layout.</value>
+ public static UIView RootFrameLayout
+ {
+ get
+ {
+ return rootFrameLayout;
+ }
+ set
+ {
+ mainThreadId = System.Threading.Thread.CurrentThread.ManagedThreadId;
+ rootFrameLayout = value;
+ CurrentWidth = (int)value.Frame.Width;
+ Shared.HDLUtils.WriteLine ("3========" + CurrentWidth);
+ CurrentHeight = (int)value.Frame.Height;
+
+ MainPage = new FrameLayout(value) { Width = (int)value.Frame.Width, Height = (int)value.Frame.Height, Parent = new RootView() { Width = (int)value.Frame.Width, Height = (int)value.Frame.Height } };
+ MainPage.Refresh();
+ }
+ }
+
+ /// <summary>
+ /// 鏁版嵁鏂囦欢鏍圭洰褰�
+ /// </summary>
+ /// <value>The root path.</value>
+ public static string RootPath=System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal)+"/";
+
+ /// <summary>
+ /// 鍥剧墖鐨勬牴鐩綍
+ /// </summary>
+ /// <value>The root path image.</value>
+ public static string RootPathImage
+ {
+ get
+ {
+ return RootPath + "Phone/";
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁鏄痯ad
+ /// </summary>
+ public static bool IsPad {
+ get {
+ return false;
+ //return UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad;
+ }
+ }
+
+
+ /// <summary>
+ /// 鐨偆锛宯ull鏃惰〃绀虹敤榛樿鐨�
+ /// </summary>
+ public static string Skin;
+ /// <summary>
+ /// GPS浣嶇疆鍙樺寲浜嬩欢
+ /// </summary>
+ public static Action<double, double> LocationAction;
+
+
+ //鑾峰彇褰撳墠灞忓箷鏄剧ず鐨剉iewcontroller
+ public static UIViewController currentVC
+ {
+ get
+ {
+ var rootViewController = UIApplication.SharedApplication.KeyWindow.RootViewController;
+ var currentVC = getCurrentVCFrom(rootViewController);
+ return currentVC;
+ }
+ }
+
+ static UIViewController getCurrentVCFrom(UIViewController rootVC)
+ {
+ UIViewController currentVC;
+ if (rootVC.PresentedViewController != null)
+ {
+ // 瑙嗗浘鏄presented鍑烘潵鐨�
+ rootVC = rootVC.PresentedViewController;
+ }
+ if (rootVC.GetType() == typeof(UITabBarController))
+ {
+ // 鏍硅鍥句负UITabBarController
+ currentVC = getCurrentVCFrom((rootVC as UITabBarController).SelectedViewController);
+ }
+ else if (rootVC.GetType() == typeof(UINavigationController))
+ {
+ // 鏍硅鍥句负UINavigationController
+ currentVC = getCurrentVCFrom((rootVC as UINavigationController).VisibleViewController);
+ }
+ else
+ {
+ // 鏍硅鍥句负闈炲鑸被
+ currentVC = rootVC;
+ }
+ return currentVC;
+ }
+
+
+ /// <summary>
+ /// 寮�鍚畾浣嶆湇鍔�
+ /// </summary>
+ public static void StartGPSLocationService()
+ {
+ if (MyCLLocationManager.Instance.IsLocationServicesEnabled)
+ {
+ switch (Shared.Application.CurrentGpsUseMode)
+ {
+ case Application.GpsUseMode.Always:
+ MyCLLocationManager.Instance.RequestAlwaysAuthorization();
+ break;
+ case Application.GpsUseMode.WhenInUse:
+ MyCLLocationManager.Instance.RequestWhenInUseAuthorization();
+ break;
+ }
+
+ MyCLLocationManager.Instance.StartUpdatingLocation();
+
+ //if (launchOptions != null && launchOptions.ObjectForKey(UIApplication.LaunchOptionsLocationKey) != null)
+ //{
+ // MyCLLocationManager.Instance.StartMonitoringSignificantLocationChanges();
+ //}
+ //else
+ //{
+ // MyCLLocationManager.Instance.StartUpdatingLocation();
+ //}
+ }
+ else
+ {
+ HDLUtils.WriteLine("娌℃潈闄�");
+ ///TODO 鍙互鎻愮ず鐢ㄦ埛鎵撳紑瀹氫綅鏉冮檺
+ }
+ }
+
+ public static void CheckLocationPermission() {
+ Application.CheckLocationPermission();
+ }
+ /// <summary>
+ /// 鍏抽棴瀹氫綅鏈嶅姟
+ /// </summary>
+ public static void StopGPSLocationService()
+ {
+ if (MyCLLocationManager.Instance.IsLocationServicesEnabled)
+ {
+ MyCLLocationManager.Instance.StopUpdatingLocation();
+ }
+ else
+ {
+ HDLUtils.WriteLine("娌℃潈闄�");
+ }
+ }
+
+ /// <summary>
+ /// 璁剧疆椤堕儴鐘舵�佹爮瀛椾綋棰滆壊
+ /// </summary>
+ /// <param name="isBlack">鏄惁璁剧疆榛戣壊</param>
+ public static void SetStatusBarTextBlack(bool isBlack)
+ {
+ if (isBlack)
+ {
+ UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;
+ }
+ else
+ {
+ UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.Default;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Shared.IOS/UI/ArcScaleSeekBar.cs b/Shared.IOS/UI/ArcScaleSeekBar.cs
new file mode 100644
index 0000000..7fe9b05
--- /dev/null
+++ b/Shared.IOS/UI/ArcScaleSeekBar.cs
@@ -0,0 +1,315 @@
+using System;
+using Shared.IOS.TBL;
+
+
+namespace Shared
+{
+
+ /// <summary>
+ /// ArcScaleSeekBar 绌鸿皟 鍒诲害鍦嗗姬鎺т欢
+ /// </summary>
+ public class ArcScaleSeekBar : BaseSeekBar
+ {
+ /// <summary>
+ /// 褰撳墠瑙嗗浘
+ /// </summary>
+ /// <value>The HDLArcScaleSeekBar.</value>
+ HDLArcScaleSeekBar mHDLArcScaleSeekBar
+ {
+ get
+ {
+ return uiView as HDLArcScaleSeekBar;
+ }
+ set
+ {
+ uiView = value;
+ }
+ }
+
+
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public ArcScaleSeekBar()
+ {
+ mHDLArcScaleSeekBar = new HDLArcScaleSeekBar
+ {
+ MProgressChangedDelegate = new OnProgressChangeListener(this)
+ };
+
+ }
+
+
+ /// <summary>
+ /// 鍒锋柊甯冨眬
+ /// </summary>
+ private void RefreshFrame()
+ {
+ mHDLArcScaleSeekBar.InitWithFrameSeekBar(new CoreGraphics.CGRect(base.X, base.Y, base.Width, base.Height));
+ }
+
+ /// <summary>
+ /// 鎺т欢瀹藉害
+ /// </summary>
+ public override int Width
+ {
+ get
+ {
+ return base.Width;
+ }
+ set
+ {
+ base.Width = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨勯珮搴�
+ /// </summary>
+ public override int Height
+ {
+ get
+ {
+ return base.Height;
+ }
+ set
+ {
+ base.Height = value;
+ RefreshFrame();
+ }
+ }
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int X
+ {
+ get
+ {
+ return base.X;
+ }
+ set
+ {
+ base.X = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int Y
+ {
+ get
+ {
+ return base.Y;
+ }
+ set
+ {
+ base.Y = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 杩涘害鍊兼樉绀哄崟浣�
+ /// </summary>
+ /// <value>鍗曚綅瀛楃</value>
+ public String ProgressBarUnitSring
+ {
+ set
+ {
+ mHDLArcScaleSeekBar.SetProgressBarUnitSring(value);
+ }
+ }
+
+ int minValue = 0;
+ int maxValue = 100;
+ /// <summary>
+ /// 杩涘害鍊兼渶澶у��
+ /// </summary>
+ /// <value>鏈�澶у��</value>
+ public int MaxValue
+ {
+ set
+ {
+ maxValue = value;
+ mHDLArcScaleSeekBar.SetMinAndMaxValue(minValue, maxValue);
+ }
+ }
+
+ /// <summary>
+ /// 杩涘害鍊兼渶灏忓��
+ /// </summary>
+ /// <value>鏈�灏忓��</value>
+ public int MinValue
+ {
+ set
+ {
+ minValue = value;
+ mHDLArcScaleSeekBar.SetMinAndMaxValue(minValue, maxValue);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊�
+ /// </summary>
+ /// <value>杩涘害鍊�</value>
+ public int Progress
+ {
+ set
+ {
+ mHDLArcScaleSeekBar.SetProgress(value);
+ }
+ get
+ {
+ return (int)mHDLArcScaleSeekBar.MProgress;
+ }
+ }
+
+
+
+
+ /// <summary>
+ /// 璁剧疆杩涘害鏉� 娓愬彉棰滆壊鐨勫紑濮嬮鑹插拰缁撴潫棰滆壊
+ /// </summary>
+ /// <value>寮�濮嬮鑹层�佺粨鏉熼鑹�</value>
+ public void SetProgressBarColors(uint startColor, uint endColor)
+ {
+ byte r, g, b, a;
+ r = (byte)(startColor / 256 / 256 % 256);
+ g = (byte)(startColor / 256 % 256);
+ b = (byte)(startColor % 256);
+ a = (byte)(startColor / 256 / 256 / 256 % 256);
+
+ var start = UIKit.UIColor.FromRGBA(r, g, b, a);
+
+ byte r2, g2, b2, a2;
+ r2 = (byte)(endColor / 256 / 256 % 256);
+ g2 = (byte)(endColor / 256 % 256);
+ b2 = (byte)(endColor % 256);
+ a2 = (byte)(endColor / 256 / 256 / 256 % 256);
+ var end = UIKit.UIColor.FromRGBA(r2, g2, b2, a2);
+
+ mHDLArcScaleSeekBar.SetProgressBarColors(start, end);
+ mHDLArcScaleSeekBar.SetNeedsDisplay();
+ }
+
+ /// <summary>
+ /// 鏄惁绂荤嚎 绂荤嚎鐨勮瘽绂佹婊戝姩骞剁粯鍒惰儗鏅伄鎸″眰
+ /// </summary>
+ /// <value>鏄惁绂荤嚎</value>
+ public bool IsOffline
+ {
+ set
+ {
+ mHDLArcScaleSeekBar.SetOffline(value);
+ }
+ }
+
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊兼樉绀虹殑鏂囧瓧棰滆壊
+ /// </summary>
+ /// <value>鏂囧瓧棰滆壊</value>
+ public uint ProgressTextColor
+ {
+ set
+ {
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+
+ mHDLArcScaleSeekBar.MProgressTextColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊兼樉绀虹殑鏂囧瓧澶у皬
+ /// </summary>
+ /// <value>鏂囧瓧澶у皬</value>
+ public int ProgressTextSize
+ {
+ set
+ {
+ mHDLArcScaleSeekBar.MProgressTextSize = value;
+ }
+
+ }
+
+ /// <summary>
+ /// 鏄惁鍙互婊戝姩
+ /// </summary>
+ /// <value>鏄惁鍙互婊戝姩</value>
+ public bool IsClickable
+ {
+ set
+ {
+ mHDLArcScaleSeekBar.IsClickable = value;
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁鏄剧ず杩涘害鏂囧瓧
+ /// </summary>
+ /// <value>鏄惁鏄剧ず杩涘害鏂囧瓧</value>
+ public bool IsProgressTextShow
+ {
+ set
+ {
+ mHDLArcScaleSeekBar.IsProgressTextShow = value;
+ }
+ }
+
+
+
+
+
+ /// <summary>
+ /// EventHandler
+ /// </summary>
+ public EventHandler<int> OnProgressChangedEvent;
+ public EventHandler<bool> OnStartTrackingTouchEvent;
+ public EventHandler<int> OnStopTrackingTouchEvent;
+
+ ///// <summary>
+ ///// OnProgressChangeListener 缁ф壙鍝嶅簲浜嬩欢
+ ///// </summary>
+ OnProgressChangeListener mOnProgressChangeListener;
+
+ public class OnProgressChangeListener : HDLSeekBarProgressChangedDelegate
+ {
+
+ [Weak] ArcScaleSeekBar _ArcScaleSeekBar;
+
+ public OnProgressChangeListener(ArcScaleSeekBar view)
+ {
+ _ArcScaleSeekBar = view;
+ }
+
+ public override void OnProgressChanged(int mProgress)
+ {
+ if (_ArcScaleSeekBar.IsProgressChangeDelay()) return;
+ _ArcScaleSeekBar.OnProgressChangedEvent?.Invoke(this, mProgress);
+ }
+
+ public override void OnStartTrackingTouch()
+ {
+ _ArcScaleSeekBar.OnStartTrackingTouchEvent?.Invoke(this, true);
+ }
+
+ public override void OnStopTrackingTouch(int mProgress)
+ {
+ _ArcScaleSeekBar.OnProgressChangedEvent?.Invoke(this, mProgress);
+ _ArcScaleSeekBar.OnStopTrackingTouchEvent?.Invoke(this, mProgress);
+ }
+ }
+
+ }
+}
diff --git a/Shared.IOS/UI/ArcSeekBar.cs b/Shared.IOS/UI/ArcSeekBar.cs
new file mode 100644
index 0000000..2b34f3e
--- /dev/null
+++ b/Shared.IOS/UI/ArcSeekBar.cs
@@ -0,0 +1,419 @@
+using System;
+using Shared.IOS.TBL;
+
+
+namespace Shared
+{
+
+ /// <summary>
+ /// HDLArcSeekBar 鎺т欢
+ /// </summary>
+ public class ArcSeekBar : View
+ {
+ /// <summary>
+ /// 褰撳墠瑙嗗浘
+ /// </summary>
+ /// <value>The HDLArcSeekBar.</value>
+ HDLArcSeekbar mHDLArcSeekBar
+ {
+ get
+ {
+ return uiView as HDLArcSeekbar;
+ }
+ set
+ {
+ uiView = value;
+ }
+ }
+
+
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public ArcSeekBar()
+ {
+ mHDLArcSeekBar = new HDLArcSeekbar
+ {
+ MProgressChangedDelegate = new OnProgressChangeListener(this)
+ };
+
+ }
+
+
+ /// <summary>
+ /// 鍒锋柊甯冨眬
+ /// </summary>
+ private void RefreshFrame()
+ {
+ mHDLArcSeekBar.InitWithFrameArc(new CoreGraphics.CGRect(base.X, base.Y, base.Width, base.Height));
+ }
+
+ /// <summary>
+ /// 鎺т欢瀹藉害
+ /// </summary>
+ public override int Width
+ {
+ get
+ {
+ return base.Width;
+ }
+ set
+ {
+ base.Width = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨勯珮搴�
+ /// </summary>
+ public override int Height
+ {
+ get
+ {
+ return base.Height;
+ }
+ set
+ {
+ base.Height = value;
+ RefreshFrame();
+ }
+ }
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int X
+ {
+ get
+ {
+ return base.X;
+ }
+ set
+ {
+ base.X = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int Y
+ {
+ get
+ {
+ return base.Y;
+ }
+ set
+ {
+ base.Y = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 杩涘害鍊兼樉绀哄崟浣�
+ /// </summary>
+ /// <value>鍗曚綅瀛楃</value>
+ public String ProgressBarUnitSring
+ {
+ set
+ {
+ mHDLArcSeekBar.SetProgressBarUnitSring(value);
+ }
+ }
+
+ int minValue = 0;
+ int maxValue = 100;
+ /// <summary>
+ /// 杩涘害鍊兼渶澶у��
+ /// </summary>
+ /// <value>鏈�澶у��</value>
+ public int MaxValue
+ {
+ set
+ {
+ maxValue = value;
+ mHDLArcSeekBar.SetMinAndMaxValue(minValue, maxValue);
+ }
+ }
+
+ /// <summary>
+ /// 杩涘害鍊兼渶灏忓��
+ /// </summary>
+ /// <value>鏈�灏忓��</value>
+ public int MinValue
+ {
+ set
+ {
+ minValue = value;
+ mHDLArcSeekBar.SetMinAndMaxValue(minValue, maxValue);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊�
+ /// </summary>
+ /// <value>杩涘害鍊�</value>
+ public int Progress
+ {
+ set
+ {
+ mHDLArcSeekBar.SetProgress(value);
+ }
+
+ get
+ {
+ return (int)mHDLArcSeekBar.MProgressCurrentValue;
+ }
+ }
+
+ /// <summary>
+ /// 鍚屾椂璁剧疆鍦嗗姬鍜屾嫋鍔ㄥ渾褰㈢殑瀹�
+ /// </summary>
+ /// <value>瀹�</value>
+ public int ArcWidthWithDefaultStyle
+ {
+ set
+ {
+ mHDLArcSeekBar.MArcWidth = value;
+ }
+ }
+
+ /// <summary>
+ /// 鍦嗗姬榛樿鑳屾櫙棰滆壊
+ /// </summary>
+ /// <value>鑳屾櫙棰滆壊</value>
+ public uint ArcColor
+ {
+ set
+ {
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+
+ mHDLArcSeekBar.MArcBackBarColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+
+
+ }
+ }
+
+ /// <summary>
+ /// 杩涘害鏉¢鑹� 鍗曚竴棰滆壊涓嶆笎鍙�
+ /// </summary>
+ /// <value>鍗曚竴杩涘害鏉¢鑹�</value>
+ public uint ProgressBarColor
+ {
+ set
+ {
+ //mHDLArcSeekBar.SetProgressBarColor(value);
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+ mHDLArcSeekBar.SetProgressBarColor(UIKit.UIColor.FromRGBA(r, g, b, a));
+ }
+
+ }
+
+
+ uint thumbColor = 0xFFFFFFFF;
+ /// <summary>
+ /// 鎷栧姩鎸夐挳鍦嗗舰棰滆壊
+ /// </summary>
+ /// <value>鎷栧姩鎸夐挳棰滆壊</value>
+ public uint ThumbColor
+ {
+ get
+ {
+ return thumbColor;
+ }
+ set
+ {
+ thumbColor = value;
+
+ byte r, g, b, a;
+ r = (byte)(thumbColor / 256 / 256 % 256);
+ g = (byte)(thumbColor / 256 % 256);
+ b = (byte)(thumbColor % 256);
+ a = (byte)(thumbColor / 256 / 256 / 256 % 256);
+
+ mHDLArcSeekBar.MThumbColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+ }
+
+ /// <summary>
+ /// 鎷栧姩鎸夐挳榛樿褰㈢姸 濉弧瀹炲績鎴栬�呯┖蹇�
+ /// </summary>
+ /// <value>鏄惁濉弧</value>
+ public bool ThumbModeFill
+ {
+ set
+ {
+ if (value)
+ {
+ mHDLArcSeekBar.MThumbMode = IOS.TBL.HDLThumbMode.Fill;
+ }
+ else
+ {
+ mHDLArcSeekBar.MThumbMode = IOS.TBL.HDLThumbMode.Stroke;
+ }
+
+ }
+ }
+
+ /// <summary>
+ /// 鎷栧姩鎸夐挳鍦嗗舰鍗婂緞
+ /// </summary>
+ /// <value>鍗婂緞</value>
+ public int ThumbRadius
+ {
+ set
+ {
+ mHDLArcSeekBar.MThumbWidth = value * 2;//璁剧疆鐩村緞
+ }
+ }
+
+ /// <summary>
+ /// 鍦嗗姬瀹�
+ /// </summary>
+ /// <value>瀹�</value>
+ public int ArcWidth
+ {
+ set
+ {
+ mHDLArcSeekBar.MArcWidth = value;
+ }
+ }
+
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊兼樉绀虹殑鏂囧瓧棰滆壊
+ /// </summary>
+ /// <value>鏂囧瓧棰滆壊</value>
+ public uint ProgressTextColor
+ {
+ set
+ {
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+
+ mHDLArcSeekBar.MProgressTextColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊兼樉绀虹殑鏂囧瓧澶у皬
+ /// </summary>
+ /// <value>鏂囧瓧澶у皬</value>
+ public int ProgressTextSize
+ {
+ set
+ {
+ mHDLArcSeekBar.MProgressTextSize = value;
+ }
+
+ }
+
+ /// <summary>
+ /// 鏄惁鍙互婊戝姩
+ /// </summary>
+ /// <value>鏄惁鍙互婊戝姩</value>
+ public bool IsClickable
+ {
+ set
+ {
+ mHDLArcSeekBar.IsClickable = value;
+ }
+ }
+
+
+ /// <summary>
+ /// 璁剧疆杩涘害鏉� 娓愬彉棰滆壊鐨勫紑濮嬮鑹插拰缁撴潫棰滆壊
+ /// </summary>
+ /// <value>寮�濮嬮鑹层�佺粨鏉熼鑹�</value>
+ public void SetProgressBarColors(uint startColor, uint endColor)
+ {
+ byte r, g, b, a;
+ r = (byte)(startColor / 256 / 256 % 256);
+ g = (byte)(startColor / 256 % 256);
+ b = (byte)(startColor % 256);
+ a = (byte)(startColor / 256 / 256 / 256 % 256);
+
+ var start = UIKit.UIColor.FromRGBA(r, g, b, a);
+
+
+ byte r2, g2, b2, a2;
+ r2 = (byte)(endColor / 256 / 256 % 256);
+ g2 = (byte)(endColor / 256 % 256);
+ b2 = (byte)(endColor % 256);
+ a2 = (byte)(endColor / 256 / 256 / 256 % 256);
+
+ var end = UIKit.UIColor.FromRGBA(r2, g2, b2, a2);
+
+ mHDLArcSeekBar.SetProgressBarColors(start, end);
+
+ }
+
+ /// <summary>
+ /// 寮�鍙h搴�
+ /// </summary>
+ public int OpenAngle
+ {
+ set
+ {
+ mHDLArcSeekBar.SetOpenAngle(value);
+ mHDLArcSeekBar.SetNeedsDisplay();
+ }
+ }
+
+ /// <summary>
+ /// EventHandler
+ /// </summary>
+ public EventHandler<int> OnProgressChangedEvent;
+ public EventHandler<bool> OnStartTrackingTouchEvent;
+ public EventHandler<int> OnStopTrackingTouchEvent;
+
+ ///// <summary>
+ ///// OnProgressChangeListener 缁ф壙鍝嶅簲浜嬩欢
+ ///// </summary>
+ OnProgressChangeListener mOnProgressChangeListener;
+
+ public class OnProgressChangeListener : HDLArcSeekbarProgressChangedDelegate
+ {
+
+ [Weak] ArcSeekBar _ArcSeekBar;
+
+ public OnProgressChangeListener(ArcSeekBar view)
+ {
+ _ArcSeekBar = view;
+ }
+
+ public override void OnProgressChanged(int mProgress)
+ {
+ _ArcSeekBar.OnProgressChangedEvent?.Invoke(this, mProgress);
+ }
+
+ public override void OnStartTrackingTouch()
+ {
+ _ArcSeekBar.OnStartTrackingTouchEvent?.Invoke(this, true);
+ }
+
+ public override void OnStopTrackingTouch(int mProgress)
+ {
+ _ArcSeekBar.OnStopTrackingTouchEvent?.Invoke(this, mProgress);
+ }
+ }
+
+ }
+}
diff --git a/Shared.IOS/UI/BaseSeekBar.cs b/Shared.IOS/UI/BaseSeekBar.cs
new file mode 100644
index 0000000..d51c14a
--- /dev/null
+++ b/Shared.IOS/UI/BaseSeekBar.cs
@@ -0,0 +1,44 @@
+锘縰sing System;
+namespace Shared
+{
+
+ /// <summary>
+ /// BaseSeekBar 瀹炵幇ProgressChange 鏄惁灞忚斀鍒ゆ柇
+ /// </summary>
+ public class BaseSeekBar : View
+ {
+ //榛樿 300姣
+ int DelayTime = 300;
+ //涓婁竴娆hange鏃堕棿
+ DateTime delayDateTime = DateTime.MinValue;
+
+ /// <summary>
+ /// 灞忚斀鏃堕棿闂撮殧 鍗曚綅ms
+ /// </summary>
+ public int ProgressChangeDelayTime
+ {
+ get
+ {
+ return DelayTime;
+ }
+ set
+ {
+ DelayTime = value;
+ }
+ }
+
+ /// <summary>
+ /// 鍒ゆ柇鏄惁灞忚斀
+ /// </summary>
+ public bool IsProgressChangeDelay()
+ {
+ if ((DateTime.Now - delayDateTime).TotalMilliseconds < DelayTime)
+ {
+ return true;
+ }
+ delayDateTime = DateTime.Now;
+ return false;
+ }
+
+ }
+}
diff --git a/Shared.IOS/UI/Button.cs b/Shared.IOS/UI/Button.cs
new file mode 100644
index 0000000..a4f1528
--- /dev/null
+++ b/Shared.IOS/UI/Button.cs
@@ -0,0 +1,515 @@
+using UIKit;
+using Foundation;
+using Shared.IO;
+using System;
+using CoreGraphics;
+
+namespace Shared
+{
+ /// <summary>
+ /// Button 鎸夐敭
+ /// </summary>
+ public class Button : View
+ {
+ MyButton iosButton
+ {
+ get
+ {
+ return uiView as MyButton;
+ }
+ set
+ {
+ uiView = value;
+ }
+ }
+
+
+ // string PingFangSCRegular = "Helvetica";
+ //string PingFangSCSemibold = "Helvetica-Bold";
+
+ /// <summary>
+ /// 鏅�氬瓧浣�
+ /// </summary>
+ public string FontNameNormal = "PingFangSC-Regular";
+ /// <summary>
+ /// 绮椾綋
+ /// </summary>
+ public string FontNameBold = "PingFangSC-Semibold";
+
+
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Shared.Button"/> class.
+ /// </summary>
+ public Button()
+ {
+ iosButton = new MyButton(this) { };
+ if (Application.IsUsePingFang)
+ {
+ FontName = FontNameNormal;
+ }
+
+ iosButton.TitleLabel.Font = UIFont.FromName(FontName, Application.FontSize);
+ }
+
+ byte[] imageBytes;
+ public byte[] ImageBytes {
+ get {
+ return imageBytes;
+ }
+ set {
+ imageBytes = value;
+ IsSelected = isSelected;
+ }
+ }
+
+ int textID;
+ /// <summary>
+ /// 鏍规嵁ID鑾峰彇瀵瑰簲鐨勫娉�
+ /// </summary>
+ /// <value>The text I.</value>
+ public int TextID
+ {
+ get
+ {
+ return textID;
+ }
+ set
+ {
+ textID = value;
+ Text = Language.StringByID(TextID);
+ }
+ }
+
+ /// <summary>
+ /// 鏂囨湰
+ /// </summary>
+ /// <value>The text.</value>
+ public string Text
+ {
+ get
+ {
+ return iosButton.Title(UIKit.UIControlState.Normal);
+ }
+ set
+ {
+
+ iosButton.SetTitle(value, UIKit.UIControlState.Normal);
+ }
+ }
+
+ /// <summary>
+ /// 瀛椾綋鍚嶇О
+ /// </summary>
+ /// <value>The name of the font.</value>
+ public string FontName{
+ get{
+ return iosButton.TitleLabel.Font.Name;
+ }
+ set{
+ try
+ {
+ iosButton.TitleLabel.Font = UIFont.FromName(value, iosButton.Font.PointSize);
+ }
+ catch { }
+ }
+ }
+
+ public bool IsMoreLines {
+ get {
+ return iosButton.TitleLabel.Lines != 1 ? true : false;
+ }
+ set {
+ //IsMoreLines = value;
+ iosButton.TitleLabel.Lines = value ? 0 : 1;
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁鏄剧ず绮椾綋
+ /// </summary>
+ bool isBold;
+ public bool IsBold
+ {
+ get
+ {
+ return isBold;
+ }
+ set
+ {
+ isBold = value;
+ if (isBold)
+ {
+ iosButton.TitleLabel.Font = UIFont.FromName(FontNameBold, mTextSize);
+ }
+ else
+ {
+ iosButton.TitleLabel.Font = UIFont.FromName(FontNameNormal, mTextSize);
+ }
+ }
+ }
+
+ /// <summary>
+ /// 鑾峰彇瀛椾綋闀垮害
+ /// </summary>
+ public int GetTextWidth()
+ {
+ int textWidth = 0;
+ CGSize fontSize = this.Text.StringSize(iosButton.TitleLabel.Font);
+ textWidth = (int)fontSize.Width;
+
+ return textWidth;
+ }
+
+ /// <summary>
+ /// 鍒涙柊闇�瑕佸垱鏂扮殑淇℃伅
+ /// </summary>
+ public override void Refresh()
+ {
+ base.Refresh();
+ IsSelected = isSelected;
+ }
+
+ float mTextSize = Application.FontSize;
+ /// <summary>
+ /// 鏂囧瓧澶у皬,榛樿12
+ /// </summary>
+ /// <value>The size of the text.</value>
+ public float TextSize
+ {
+ get
+ {
+ return (float)iosButton.TitleLabel.Font.PointSize;
+ }
+ set
+ {
+ mTextSize = value;
+ iosButton.TitleLabel.Font = UIFont.FromName(FontName, value);
+ }
+ }
+
+
+ uint textColor=0xFFFFFFFF;
+ /// <summary>
+ /// 鏂囧瓧棰滆壊
+ /// </summary>
+ /// <value>The color of the text.</value>
+ public uint TextColor
+ {
+ get
+ {
+ return textColor;
+ }
+ set
+ {
+ textColor = value;
+ if (IsSelected)
+ {
+ return;
+ }
+ byte r, g, b, a;
+ r = (byte)(textColor / 256 / 256 % 256);
+ g = (byte)(textColor / 256 % 256);
+ b = (byte)(textColor % 256);
+ a = (byte)(textColor / 256 / 256 / 256 % 256);
+ iosButton.SetTitleColor(UIKit.UIColor.FromRGBA(r, g, b, a), UIControlState.Normal);
+ }
+ }
+
+ uint selecteTextColor = 0xFFFFFFFF;
+ /// <summary>
+ /// 鏂囧瓧棰滆壊
+ /// </summary>
+ /// <value>The color of the text.</value>
+ public uint SelectedTextColor
+ {
+ get
+ {
+ return selecteTextColor;
+ }
+ set
+ {
+ selecteTextColor = value;
+ if (!IsSelected)
+ {
+ return;
+ }
+ byte r, g, b, a;
+ r = (byte)(selecteTextColor / 256 / 256 % 256);
+ g = (byte)(selecteTextColor / 256 % 256);
+ b = (byte)(selecteTextColor % 256);
+ a = (byte)(selecteTextColor / 256 / 256 / 256 % 256);
+
+ iosButton.SetTitleColor(UIKit.UIColor.FromRGBA(r, g, b, a), UIControlState.Normal);
+ }
+ }
+
+ bool isSelected;
+
+ /// <summary>
+ /// 閫変腑鐘舵��
+ /// </summary>
+ /// <value><c>true</c> if this instance is selected; otherwise, <c>false</c>.</value>
+ public bool IsSelected
+ {
+ get
+ {
+ return isSelected;
+ }
+ set
+ {
+ try
+ {
+ isSelected = value;
+ if (!IsCanRefresh)
+ {
+ return;
+ }
+ if (isSelected)
+ {
+ if (null == SelectedImagePath)
+ {
+ byte r, g, b, a;
+ r = (byte)(SelectedBackgroundColor / 256 / 256 % 256);
+ g = (byte)(SelectedBackgroundColor / 256 % 256);
+ b = (byte)(SelectedBackgroundColor % 256);
+ a = (byte)(SelectedBackgroundColor / 256 / 256 / 256 % 256);
+ iosButton.BackgroundColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+ else
+ {
+ iosButton.SetBackgroundImage(UIImage.FromFile(FileUtils.GetImageFilePath(SelectedImagePath)), UIControlState.Normal);
+ }
+ SelectedTextColor = selecteTextColor;
+ }
+ else
+ {
+ if (imageBytes != null)
+ {
+ iosButton.SetBackgroundImage(UIImage.LoadFromData(NSData.FromArray(imageBytes)), UIControlState.Normal);
+ return;
+ }
+ if (null == UnSelectedImagePath)
+ {
+ byte r, g, b, a;
+ r = (byte)(BackgroundColor / 256 / 256 % 256);
+ g = (byte)(BackgroundColor / 256 % 256);
+ b = (byte)(BackgroundColor % 256);
+ a = (byte)(BackgroundColor / 256 / 256 / 256 % 256);
+ iosButton.BackgroundColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+ else
+ {
+ iosButton.SetBackgroundImage(UIImage.LoadFromData(NSData.FromFile(FileUtils.GetImageFilePath(UnSelectedImagePath))), UIControlState.Normal);
+ }
+ TextColor = textColor;
+ }
+ }
+ catch
+ {
+ }
+ }
+ }
+
+
+ TextAlignment textAlignment = TextAlignment.Center;
+ /// <summary>
+ /// 鏂囧瓧瀵归綈鏂瑰紡
+ /// </summary>
+ /// <param name="horizontalAlignment">Horizontal alignment.</param>
+ /// <param name="verticalAlignment">Vertical alignment.</param>
+ public TextAlignment TextAlignment
+ {
+ get
+ {
+ return textAlignment;
+ }
+ set
+ {
+ textAlignment = value;
+ switch (value)
+ {
+ case TextAlignment.TopLeft:
+ iosButton.TitleLabel.TextAlignment = UITextAlignment.Left;
+ iosButton.VerticalAlignment = UIKit.UIControlContentVerticalAlignment.Top;
+ iosButton.HorizontalAlignment = UIKit.UIControlContentHorizontalAlignment.Left;
+ break;
+ case TextAlignment.TopCenter:
+ iosButton.TitleLabel.TextAlignment = UITextAlignment.Center;
+ iosButton.VerticalAlignment = UIKit.UIControlContentVerticalAlignment.Top;
+ iosButton.HorizontalAlignment = UIKit.UIControlContentHorizontalAlignment.Center;
+ break;
+ case TextAlignment.TopRight:
+ iosButton.TitleLabel.TextAlignment = UITextAlignment.Right;
+ iosButton.VerticalAlignment = UIKit.UIControlContentVerticalAlignment.Top;
+ iosButton.HorizontalAlignment = UIKit.UIControlContentHorizontalAlignment.Right;
+ break;
+ case TextAlignment.CenterLeft:
+ iosButton.TitleLabel.TextAlignment = UITextAlignment.Left;
+ iosButton.VerticalAlignment = UIKit.UIControlContentVerticalAlignment.Center;
+ iosButton.HorizontalAlignment = UIKit.UIControlContentHorizontalAlignment.Left;
+ break;
+ case TextAlignment.Center:
+ iosButton.TitleLabel.TextAlignment = UITextAlignment.Center;
+ iosButton.VerticalAlignment = UIKit.UIControlContentVerticalAlignment.Center;
+ iosButton.HorizontalAlignment = UIKit.UIControlContentHorizontalAlignment.Center;
+ break;
+ case TextAlignment.CenterRight:
+ iosButton.TitleLabel.TextAlignment = UITextAlignment.Right;
+ iosButton.VerticalAlignment = UIKit.UIControlContentVerticalAlignment.Center;
+ iosButton.HorizontalAlignment = UIKit.UIControlContentHorizontalAlignment.Right;
+ break;
+ case TextAlignment.BottomLeft:
+ iosButton.TitleLabel.TextAlignment = UITextAlignment.Left;
+ iosButton.VerticalAlignment = UIKit.UIControlContentVerticalAlignment.Bottom;
+ iosButton.HorizontalAlignment = UIKit.UIControlContentHorizontalAlignment.Left;
+ break;
+ case TextAlignment.BottomCenter:
+ iosButton.TitleLabel.TextAlignment = UITextAlignment.Center;
+ iosButton.VerticalAlignment = UIKit.UIControlContentVerticalAlignment.Bottom;
+ iosButton.HorizontalAlignment = UIKit.UIControlContentHorizontalAlignment.Center;
+ break;
+ case TextAlignment.BottomRight:
+ iosButton.TitleLabel.TextAlignment = UITextAlignment.Right;
+ iosButton.VerticalAlignment = UIKit.UIControlContentVerticalAlignment.Bottom;
+ iosButton.HorizontalAlignment = UIKit.UIControlContentHorizontalAlignment.Right;
+ break;
+ }
+ }
+ }
+
+
+
+ string selectedImagePath;
+ /// <summary>
+ /// 閫夋嫨鏃惰儗鏅浘璺緞
+ /// </summary>
+ /// <value>The selected image path.</value>
+ public string SelectedImagePath
+ {
+ get
+ {
+ return selectedImagePath;
+ }
+ set
+ {
+ selectedImagePath = value;
+ IsSelected = IsSelected;
+ }
+ }
+
+ string unSelectedImagePath;
+ /// <summary>
+ /// 闈為�変腑鐘舵�佺殑鑳屾櫙鍥捐矾寰�
+ /// </summary>
+ /// <value>The un selected image path.</value>
+ public string UnSelectedImagePath
+ {
+ get
+ {
+ return unSelectedImagePath;
+ }
+ set
+ {
+ unSelectedImagePath = value;
+ IsSelected = IsSelected;
+ }
+ }
+
+ /// <summary>
+ /// 鍐呰竟璺�
+ /// </summary>
+ /// <value>The padding.</value>
+ public override Padding Padding
+ {
+ get
+ {
+ return new Padding((int)iosButton.ContentEdgeInsets.Top, (int)iosButton.ContentEdgeInsets.Left, (int)iosButton.ContentEdgeInsets.Bottom, (int)iosButton.ContentEdgeInsets.Right);
+ }
+ set
+ {
+ iosButton.ContentEdgeInsets = new UIEdgeInsets(value.Top, value.Left, value.Bottom, value.Right);
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁浣跨敤鐐瑰嚮
+ /// </summary>
+ /// <value><c>true</c> if enable; otherwise, <c>false</c>.</value>
+ public override bool Enable
+ {
+ get
+ {
+ return iosButton.Enabled;
+ }
+ set
+ {
+ iosButton.Enabled = value;
+ }
+ }
+
+ /// <summary>
+ /// 閫夋嫨鏃惰儗鏅鑹�
+ /// </summary>
+ /// <value>The color of the text.</value>
+ public uint SelectedBackgroundColor
+ {
+ get;
+ set;
+ }
+
+ public class MyButton : UIKit.UIButton
+ {
+ [Weak] View view;
+ public MyButton(View view)
+ {
+ this.view = view;
+ ContentEdgeInsets = new UIEdgeInsets(3, 3, 3, 3);
+ TitleLabel.LineBreakMode = UILineBreakMode.TailTruncation;
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮寮�濮�
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesBegan(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Down,(touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 绉诲姩
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesMoved(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Move,(touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮寮硅捣
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesEnded(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Up, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ public override void TouchesCancelled(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Cancel, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ public override UILineBreakMode LineBreakMode { get => base.LineBreakMode; set => base.LineBreakMode = value; }
+
+ public override UILabel TitleLabel => base.TitleLabel;
+
+ //int isMoreLines
+
+ }
+ }
+}
+
+
diff --git a/Shared.IOS/UI/Camera.cs b/Shared.IOS/UI/Camera.cs
new file mode 100644
index 0000000..5c51f5f
--- /dev/null
+++ b/Shared.IOS/UI/Camera.cs
@@ -0,0 +1,281 @@
+锘縰sing System;
+using AVFoundation;
+using CoreGraphics;
+using Foundation;
+using UIKit;
+
+namespace Shared
+{
+ /// <summary>
+ /// 鎷嶇収鎴栬�呴�夋嫨鍥剧墖
+ /// </summary>
+ public static class Camera
+ {
+ static readonly UIImagePickerController _picker;
+ static bool IsZoom;
+
+ /// <summary>
+ /// 鎷嶇収鎴栬�呰鍙栧浘鐗囧畬鎴愭椂璋冪敤鐨勫姩浣�,string==null琛ㄧず鐢ㄦ埛鍙栨秷浜嗘媿鐓ф垨鑰呭彇娑堥�夋嫨鍥剧墖,string!=null,琛ㄧず鍥剧墖鐨勮矾寰�
+ /// </summary>
+ static Action<string> _callback;
+
+ static Camera()
+ {
+ _picker = new UIImagePickerController();
+ _picker.Delegate = new MyCameraDelegate();
+ }
+
+ static string _fileName;
+
+ /// <summary>
+ /// Camera delegate.
+ /// </summary>
+ class MyCameraDelegate : UIImagePickerControllerDelegate
+ {
+ //16*9
+ public override void FinishedPickingMedia(UIImagePickerController picker, NSDictionary info)
+ {
+ picker.DismissModalViewController(true);
+
+ var tempPhoto = info.ValueForKey(new NSString("UIImagePickerControllerOriginalImage")) as UIImage;
+
+ tempPhoto = rotateImage(tempPhoto);
+ var width = tempPhoto.CGImage.Width;
+ var height = tempPhoto.CGImage.Height;
+ //Shared.HDLUtils.WriteLine("鍘熷搴�=" + width + "楂樺害=" + height);
+
+ nfloat noScale = width / height;
+ nfloat scale = 16.0f / 9.0f;
+ if (!IsZoom)
+ {
+ scale = noScale;
+ }
+ nfloat x = 0, y = 0, w = width, h = height;
+ if (scale < noScale)
+ {
+ w = height * scale;
+ x = (width - w) / 2;
+ }
+ else
+ {
+ h = width / scale;
+ y = (height - h) / 2;
+ }
+
+
+
+ var imageRef = tempPhoto.CGImage.WithImageInRect(new CGRect(x, y, w, h));
+ UIImage newImage = UIImage.FromImage(imageRef);
+
+
+ // 鍏抽棴涓婁笅鏂�
+ //Shared.HDLUtils.WriteLine("鏀瑰彉鍚庣殑瀹藉害=" + newImage.Size.Width + "楂樺害=" + newImage.Size.Height);
+ string tempFilePath = System.IO.Path.Combine(Application.RootPath, _fileName);
+ NSError err = null;
+ float f = 0.1f;
+ NSData nsData = newImage.AsJPEG(f);
+ while (f < 1.0f)
+ {
+ if (200 * 1024 < nsData.Length)
+ {
+ break;
+ }
+ f += 0.1f;
+ nsData = newImage.AsJPEG(f);
+ }
+ if (nsData.Save(tempFilePath, false, out err))
+ {
+ //淇濆瓨鎴愬姛
+ }
+ else
+ {
+ Shared.HDLUtils.WriteLine("淇濆瓨鍥剧墖澶�");
+ }
+ newImage.Dispose();
+ _callback?.Invoke(tempFilePath);
+ _callback = null;
+ }
+
+ public override void Canceled(UIImagePickerController picker)
+ {
+ picker.DismissModalViewController(true);
+ _callback?.Invoke(null);
+ _callback = null;
+ }
+
+ UIImage rotateImage(UIImage aImage)
+ {
+ var imgRef = aImage.CGImage;
+ var width = imgRef.Width;
+ var height = imgRef.Height;
+ CGAffineTransform transform = CGAffineTransform.MakeIdentity();
+ CGRect bounds = new CGRect(0, 0, width, height);
+ nfloat scaleRatio = 1;
+ nfloat boundHeight;
+ UIImageOrientation orient = aImage.Orientation;
+ nfloat M_PI = 3.14159265358979323846f;
+
+ switch (orient)
+ {
+ case UIImageOrientation.Up: //EXIF = 1
+ transform = CGAffineTransform.MakeIdentity();
+ break;
+ case UIImageOrientation.UpMirrored: //EXIF = 2
+ transform = CGAffineTransform.MakeTranslation(width, 0.0f);
+ transform = CGAffineTransform.Scale(transform, -1.0f, 1.0f);
+ break;
+ case UIImageOrientation.Down: //EXIF = 3
+ transform = CGAffineTransform.MakeTranslation(width, height);
+ transform = CGAffineTransform.Rotate(transform, M_PI);
+ break;
+ case UIImageOrientation.DownMirrored: //EXIF = 4
+ transform = CGAffineTransform.MakeTranslation(0.0f, height);
+ transform = CGAffineTransform.Scale(transform, 1.0f, -1.0f);
+ break;
+ case UIImageOrientation.LeftMirrored: //EXIF = 5
+ boundHeight = bounds.Height;
+ bounds.Height = bounds.Size.Width;
+ bounds.Width = boundHeight;
+ transform = CGAffineTransform.MakeTranslation(height, width);
+ transform = CGAffineTransform.Scale(transform, -1.0f, 1.0f);
+ transform = CGAffineTransform.Rotate(transform, 3.0f * M_PI / 2.0f);
+ break;
+ case UIImageOrientation.Left: //EXIF = 6
+ boundHeight = bounds.Height;
+ bounds.Height = bounds.Width;
+ bounds.Width = boundHeight;
+ transform = CGAffineTransform.MakeTranslation(0.0f, width);
+ transform = CGAffineTransform.Rotate(transform, 3.0f * M_PI / 2.0f);
+ break;
+ case UIImageOrientation.RightMirrored: //EXIF = 7
+ boundHeight = bounds.Height;
+ bounds.Height = bounds.Width;
+ bounds.Width = boundHeight;
+ transform = CGAffineTransform.MakeScale(-1.0f, 1.0f);
+ transform = CGAffineTransform.Rotate(transform, M_PI / 2.0f);
+ break;
+ case UIImageOrientation.Right: //EXIF = 8
+ boundHeight = bounds.Height;
+ bounds.Height = bounds.Width;
+ bounds.Width = boundHeight;
+ transform = CGAffineTransform.MakeTranslation(height, 0.0f);
+ transform = CGAffineTransform.Rotate(transform, M_PI / 2.0f);
+ break;
+ //default:
+ // [NSException raise:NSInternalInconsistencyException format:@"Invalid image orientation"];
+ }
+
+ UIGraphics.BeginImageContext(bounds.Size);
+ var context = UIGraphics.GetCurrentContext();
+ if (orient == UIImageOrientation.Right || orient == UIImageOrientation.Left)
+ {
+ context.ScaleCTM(-scaleRatio, scaleRatio);
+ context.TranslateCTM(-height, 0);
+ }
+ else
+ {
+ context.ScaleCTM(scaleRatio, -scaleRatio);
+ context.TranslateCTM(0, -height);
+ }
+
+ context.ConcatCTM(transform);
+ UIGraphics.GetCurrentContext().DrawImage(new CGRect(0, 0, width, height), imgRef);
+ UIImage imageCopy = UIGraphics.GetImageFromCurrentImageContext();
+ imgRef.Dispose();
+ UIGraphics.EndImageContext();
+ return imageCopy;
+ }
+ }
+
+ /// <summary>
+ /// 鎷嶇収
+ /// </summary>
+ /// <param name="callback">鍥炶皟鍑芥暟</param>
+ /// <param name="fileName">鏂囦欢鍚�</param>
+ public static void TakePicture(Action<string> callback, string fileName, bool isZoom = true)
+ {
+ _fileName = fileName;
+ _callback = callback;
+ _picker.SourceType = UIImagePickerControllerSourceType.Camera;
+ IsZoom = isZoom;
+ if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
+ {
+ if (!UIImagePickerController.IsCameraDeviceAvailable(UIImagePickerControllerCameraDevice.Front))
+ {
+ return;
+ }
+ _picker.ModalTransitionStyle = UIModalTransitionStyle.CrossDissolve;
+ currentVC.PresentModalViewController(_picker, true);
+ }
+ else
+ {
+ currentVC.PresentModalViewController(_picker, true);
+ }
+ }
+
+ /// <summary>
+ /// 閫夋嫨鍥剧墖
+ /// </summary>
+ /// <param name="callback">鍥炶皟鍑芥暟</param>
+ /// <param name="fileName">鏂囦欢鍚�</param>
+ public static void SelectPicture(Action<string> callback, string fileName, bool isZoom = true)
+ {
+ _fileName = fileName;
+ _callback = callback;
+ _picker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary;
+ IsZoom = isZoom;
+ if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
+ {
+ NSOperationQueue.MainQueue.AddOperation(() =>
+ {
+ _picker.ModalTransitionStyle = UIModalTransitionStyle.CoverVertical;
+ var popover = new UIPopoverController(_picker) { PopoverContentSize = Application.RootFrameLayout.Frame.Size };
+ popover.PresentFromRect(new CGRect(95, 235, 300, 300), Application.RootFrameLayout, UIPopoverArrowDirection.Down | UIPopoverArrowDirection.Left, true);
+ });
+ }
+ else
+ {
+ currentVC.PresentModalViewController(_picker, true);
+ }
+ }
+
+ //鑾峰彇褰撳墠灞忓箷鏄剧ず鐨剉iewcontroller
+ static UIViewController currentVC
+ {
+ get
+ {
+ var rootViewController = UIApplication.SharedApplication.KeyWindow.RootViewController;
+ var currentVC = getCurrentVCFrom(rootViewController);
+ return currentVC;
+ }
+ }
+
+ static UIViewController getCurrentVCFrom(UIViewController rootVC)
+ {
+ UIViewController currentVC;
+ if (rootVC.PresentedViewController != null)
+ {
+ // 瑙嗗浘鏄presented鍑烘潵鐨�
+ rootVC = rootVC.PresentedViewController;
+ }
+ if (rootVC.GetType() == typeof(UITabBarController))
+ {
+ // 鏍硅鍥句负UITabBarController
+ currentVC = getCurrentVCFrom((rootVC as UITabBarController).SelectedViewController);
+ }
+ else if (rootVC.GetType() == typeof(UINavigationController))
+ {
+ // 鏍硅鍥句负UINavigationController
+ currentVC = getCurrentVCFrom((rootVC as UINavigationController).VisibleViewController);
+ }
+ else
+ {
+ // 鏍硅鍥句负闈炲鑸被
+ currentVC = rootVC;
+ }
+ return currentVC;
+ }
+ }
+}
+
+
diff --git a/Shared.IOS/UI/ColorPicker.cs b/Shared.IOS/UI/ColorPicker.cs
new file mode 100644
index 0000000..fa63d62
--- /dev/null
+++ b/Shared.IOS/UI/ColorPicker.cs
@@ -0,0 +1,164 @@
+锘縰sing System;
+using CoreGraphics;
+using Foundation;
+using Shared.IO;
+using UIKit;
+
+
+namespace Shared
+{
+ /// <summary>
+ /// 鑹叉澘
+ /// </summary>
+ public class ColorPicker :View
+ {
+ MyUIImageView myUIImageView
+ {
+ get
+ {
+ return uiView as MyUIImageView;
+ }
+ set
+ {
+ uiView = value;
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Shared.Button"/> class.
+ /// </summary>
+ public ColorPicker()
+ {
+ myUIImageView = new MyUIImageView(this) { };
+
+ }
+
+ public override void Refresh()
+ {
+ base.Refresh();
+ //Width = (int)myUIImageView.Image.Size.Width;
+ //Height = (int)myUIImageView.Image.Size.Height;
+ }
+
+ string colorImagePath;
+ /// <summary>
+ /// 鑹叉澘鍥�
+ /// </summary>
+ /// <value>The color image path.</value>
+ public string ColorImagePath
+ {
+ get {
+ return colorImagePath;
+ }
+ set
+ {
+ colorImagePath = value;
+
+ myUIImageView.Image = UIImage.FromFile(FileUtils.GetImageFilePath(colorImagePath));
+ }
+ }
+
+ /// <summary>
+ /// 棰滆壊鍙樺寲
+ /// </summary>
+ public Action<View, byte[]> ColorChaged;
+
+ class MyUIImageView : UIImageView
+ {
+ [Weak] ColorPicker colorPicker;
+ public MyUIImageView(ColorPicker colorPicker)
+ {
+ this.colorPicker = colorPicker;
+ UserInteractionEnabled = true;
+ }
+
+
+ /// <summary>
+ /// 鐐瑰嚮寮�濮�
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesBegan(NSSet touches, UIEvent evt)
+ {
+ colorPicker?.TouchEvent(EventActions.Down,(touches.AnyObject as UITouch).LocationInView(this) );
+ colorChaged(colorAtPixel((touches.AnyObject as UITouch).LocationInView(this)));
+ }
+ /// <summary>
+ /// 绉诲姩
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesMoved(NSSet touches, UIEvent evt)
+ {
+ colorPicker?.TouchEvent(EventActions.Move,(touches.AnyObject as UITouch).LocationInView(this));
+ colorChaged(colorAtPixel((touches.AnyObject as UITouch).LocationInView(this)));
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮寮硅捣
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesEnded(NSSet touches, UIEvent evt)
+ {
+ colorPicker?.TouchEvent(EventActions.Up,(touches.AnyObject as UITouch).LocationInView(this));
+ colorChaged(colorAtPixel((touches.AnyObject as UITouch).LocationInView(this)));
+ }
+
+ public override void TouchesCancelled(NSSet touches, UIEvent evt)
+ {
+ colorPicker?.TouchEvent(EventActions.Cancel, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+
+ void colorChaged(UIColor uiColor)
+ {
+ nfloat r, g, b, a;
+ uiColor.GetRGBA(out r, out g, out b, out a);
+ if (r == 0 && g == 0 && b == 0)
+ {
+ return;
+ }
+ colorPicker?.ColorChaged?.Invoke(colorPicker,new byte[] { (byte)(r * 255), (byte)(g * 255), (byte)(b * 255) });
+ }
+
+ UIColor colorAtPixel(CGPoint point)
+ {
+ var pointX = (int)(point.X *Image.Size.Width/ Frame.Width);
+ var pointY = (int)(point.Y * Image.Size.Height / Frame.Height);
+
+ if (Image.Size.Width < pointX) {
+ pointX = (int)Image.Size.Width;
+ }
+
+ if (Image.Size.Height < pointY) {
+ pointY = (int)Image.Size.Height;
+ }
+ var cgImage = Image.CGImage;
+ var colorSpace = CGColorSpace.CreateDeviceRGB();
+ int bytesPerPixel = 4;
+ int bytesPerRow = bytesPerPixel * 1;
+ var bitsPerComponent = 8;
+ byte[] pixelData = { 0, 0, 0, 0 };
+ var context = new CGBitmapContext(pixelData,
+ 1,
+ 1,
+ bitsPerComponent,
+ bytesPerRow,
+ colorSpace, CGBitmapFlags.PremultipliedLast | CGBitmapFlags.ByteOrder32Big);
+
+ context.SetBlendMode(CGBlendMode.Copy);
+
+ context.TranslateCTM(-pointX, pointY - Image.Size.Height);
+ context.DrawImage(new CGRect(0.0f, 0.0f, Image.Size.Width, Image.Size.Height), cgImage);
+ var red = pixelData[0] / 255.0f;
+ var green = pixelData[1] / 255.0f;
+ var blue = pixelData[2] / 255.0f;
+ var alpha = pixelData[3] / 255.0f;
+ return UIColor.FromRGBA(red, green, blue, alpha);
+ }
+ }
+
+ }
+
+}
diff --git a/Shared.IOS/UI/Contacts.cs b/Shared.IOS/UI/Contacts.cs
new file mode 100644
index 0000000..22f6afb
--- /dev/null
+++ b/Shared.IOS/UI/Contacts.cs
@@ -0,0 +1,66 @@
+锘縰sing System;
+using AddressBook;
+using AddressBookUI;
+
+namespace Shared
+{
+ public static class Contacts
+ {
+ public static Action<string, string> ContactAction;
+ public static void Open()
+ {
+ switch (ABAddressBook.GetAuthorizationStatus())
+ {
+ case ABAuthorizationStatus.NotDetermined:
+ Foundation.NSError s=null;
+ ABAddressBook.Create(out s).RequestAccess((b, ss) => {
+ Shared.Application.RunOnMainThread(() =>
+ {
+ if (b)
+ {
+ var picker = new ABPeoplePickerNavigationController();
+ picker.Cancelled += Picker_Cancelled;
+ picker.SelectPerson2 += Picker_SelectPerson2;
+ BaseViewController.Instance.PresentViewController(picker, true, null);
+ }
+ else {
+ ContactAction?.Invoke(null, null);
+ }
+ });
+ });
+ break;
+ case ABAuthorizationStatus.Authorized:
+ {
+ var picker = new ABPeoplePickerNavigationController();
+ picker.Cancelled += Picker_Cancelled;
+ picker.SelectPerson2 += Picker_SelectPerson2;
+ BaseViewController.Instance.PresentViewController(picker, true, null);
+ }
+ break;
+ default:
+ ContactAction?.Invoke(null, null);
+ break;
+ }
+ }
+
+ private static void Picker_SelectPerson2(object sender, ABPeoplePickerSelectPerson2EventArgs e)
+ {
+ var person= e.Person;
+ string phone = "";
+ foreach(var v in person.GetPhones()) {
+ if (!string.IsNullOrEmpty(v.Value))
+ {
+ phone = v.Value.Replace("-", " ").Replace(" ", "");
+ break;
+ }
+ }
+ ContactAction?.Invoke((person.LastName + " " + person.FirstName).Trim(' '), phone);
+ }
+
+ private static void Picker_Cancelled(object sender, EventArgs e)
+ {
+ ContactAction?.Invoke(null, null);
+ }
+
+ }
+}
diff --git a/Shared.IOS/UI/CoverFlowLayout.cs b/Shared.IOS/UI/CoverFlowLayout.cs
new file mode 100644
index 0000000..31b4930
--- /dev/null
+++ b/Shared.IOS/UI/CoverFlowLayout.cs
@@ -0,0 +1,356 @@
+using System;
+using UIKit;
+using Shared.IO;
+using CoreGraphics;
+using Foundation;
+
+namespace Shared
+{
+ /// <summary>
+ /// 浣嶇疆甯冨眬
+ /// </summary>
+ public class CoverFlowLayout : ViewGroup
+ {
+ readonly MyCoverFlowLayout iosUIScrolView;
+
+ readonly UIPageControl iosUIPageControl;
+
+ /// <summary>
+ /// 椤甸潰鍙樺寲浜嬩欢
+ /// </summary>
+ public Action<CoverFlowLayout,int> PageChange;
+
+ /// <summary>
+ /// 鍨傜洿鏂瑰悜婊氬姩瑙嗗浘
+ /// </summary>
+ class MyCoverFlowLayout : UIScrollView
+ {
+ [Weak] CoverFlowLayout CoverFlowLayout;
+ public MyCoverFlowLayout(CoverFlowLayout CoverFlowLayout)
+ {
+
+ this.CoverFlowLayout = CoverFlowLayout;
+ DecelerationEnded += (s, e) =>
+ {
+ var tempUIScrolView = s as MyCoverFlowLayout;
+ //鑾峰彇褰撳墠鐣岄潰鐨勭储寮�
+ var tempPageIndex = Convert.ToInt32(tempUIScrolView.ContentOffset.X / (tempUIScrolView.Frame.Width - this.CoverFlowLayout._RowPadding));
+ //閫氱煡鐣岄潰绱㈠紩鍙樺寲
+ if (this.CoverFlowLayout.PageIndex != tempPageIndex)
+ {
+ this.CoverFlowLayout.PageIndex = tempPageIndex;
+ Shared.HDLUtils.WriteLine($"pageIndex-------{tempPageIndex}");
+ this.CoverFlowLayout.iosUIPageControl.CurrentPage = tempPageIndex;
+ this.CoverFlowLayout.PageChange?.Invoke(this.CoverFlowLayout, this.CoverFlowLayout.pageIndex);
+ }
+ };
+ }
+ /// <summary>
+ /// 鐐瑰嚮寮�濮�
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesBegan(NSSet touches, UIEvent evt)
+ {
+ CoverFlowLayout?.TouchEvent(EventActions.Down, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 绉诲姩
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesMoved(NSSet touches, UIEvent evt)
+ {
+ CoverFlowLayout?.TouchEvent(EventActions.Move, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮寮硅捣
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesEnded(NSSet touches, UIEvent evt)
+ {
+ CoverFlowLayout?.TouchEvent(EventActions.Up, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ public override void TouchesCancelled(NSSet touches, UIEvent evt)
+ {
+ CoverFlowLayout?.TouchEvent(EventActions.Cancel, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 妗嗘灦榛樿鍔犱簡涓や釜UIImageView 锛岃繖鏍峰彲浠ュ幓鎺夐粯璁ゆ坊鍔�
+ /// </summary>
+ /// <param name="view">View.</param>
+ public override void AddSubview(UIView view)
+ {
+ if (view.GetType() == typeof(UIImageView) && view.Tag != int.MinValue)
+ {
+ return;
+ }
+
+ if (view.ToString().Contains("UIScrollViewScrollIndicator"))
+ {
+ return;
+ }
+ base.AddSubview(view);
+ }
+ }
+
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public CoverFlowLayout()
+ {
+ viewGroup = new UIView();
+ iosUIPageControl = new UIPageControl { Enabled = false };
+ iosUIScrolView = new MyCoverFlowLayout(this) { };
+
+ realViewGroup = iosUIScrolView;
+
+ var frame = iosUIPageControl.Frame;
+ frame.Height = 16;
+ iosUIPageControl.Frame = frame;
+ //鍚姩缈婚〉鍔熻兘
+ //iosUIScrolView.PagingEnabled = true;
+
+ //iosUIScrolView.Bounces = false;
+ iosUIScrolView.ShowsHorizontalScrollIndicator = false;
+ viewGroup.AddSubview(iosUIScrolView);
+ viewGroup.AddSubview(iosUIPageControl);
+
+
+ _PagePadding = Application.GetRealWidth(41);
+ _RowPadding = Application.GetRealWidth(108);
+
+
+ }
+
+ //涓や釜Page涔嬮棿鐨勮窛绂�
+ int _PagePadding;
+ public int PagePadding
+ {
+ get
+ {
+ return _PagePadding;
+ }
+ set
+ {
+ _PagePadding = value;
+ ReLocation();
+ }
+ }
+ //page鐨勫杈硅窛
+ int _RowPadding;
+ public int RowPadding
+ {
+ get
+ {
+ return _RowPadding;
+ }
+ set
+ {
+ _RowPadding = value;
+ ReLocation();
+ }
+ }
+
+
+ /// <summary>
+ /// 鏄惁鏄剧ず涓嬮潰涓�鎺掔殑鐐�
+ /// </summary>
+ /// <value><c>true</c> if is show point; otherwise, <c>false</c>.</value>
+ public bool IsShowPoint
+ {
+ get
+ {
+ return !iosUIPageControl.Hidden;
+ }
+ set
+ {
+ iosUIPageControl.Hidden = !value;
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁鍏佽婊戝姩
+ /// </summary>
+ /// <value><c>true</c> if scroll enabled; otherwise, <c>false</c>.</value>
+ public bool ScrollEnabled
+ {
+ get
+ {
+ return (iosUIScrolView as MyCoverFlowLayout).ScrollEnabled;
+ }
+ set
+ {
+ (iosUIScrolView as MyCoverFlowLayout).ScrollEnabled = value;
+ }
+ }
+
+ int pageIndex;
+ /// <summary>
+ /// 璁剧疆鎴栬�呰幏鍙栧綋鍓嶇殑鐣岄潰绱㈠紩
+ /// </summary>
+ /// <value>The index of the page.</value>
+ public int PageIndex
+ {
+ get
+ {
+ return pageIndex;
+ }
+ set
+ {
+ if (value < 0 || ChildrenCount <= value)
+ {
+ return;
+ }
+ int beforePageIndex = pageIndex;
+ pageIndex = value;
+ if (!IsCanRefresh)
+ {
+ return;
+ }
+
+ var viewSize = iosUIScrolView.Frame.Size;
+
+
+ var rect = new CGRect(pageIndex * viewSize.Width, 0, viewSize.Width, viewSize.Height);
+ if (pageIndex != 0) {
+ var frame = iosUIScrolView.Subviews[pageIndex].Frame;
+ var w = frame.X - _RowPadding;
+
+ rect = new CGRect(w, 0, viewSize.Width, viewSize.Height);
+ Shared.HDLUtils.WriteLine($"CGRect xx-------{w}");
+ }
+
+ Shared.HDLUtils.WriteLine($"pageIndex xx-------{pageIndex}");
+ iosUIScrolView.ScrollRectToVisible(rect, false);
+
+ if (beforePageIndex != pageIndex)
+ {
+ iosUIPageControl.CurrentPage = pageIndex;
+ PageChange?.Invoke(this, pageIndex);
+ }
+ }
+ }
+ /// <summary>
+ /// 澧炲姞瀛愭帶浠�
+ /// </summary>
+ /// <param name="view">View.</param>
+ public override void AddChidren(View view)
+ {
+ //var v = Application.AverageScale;
+ //var vv = Application.CurrentHeight;
+ //var dddd = Application.DesignWidth;
+ base.AddChidren(view);
+ iosUIPageControl.Pages = ChildrenCount;
+ ReLocation();
+ }
+
+ /// <summary>
+ /// 閲嶆柊鎺掍綅缃強璁惧鍐呭澶у皬
+ /// </summary>
+ public virtual void ReLocation()
+ {
+ if (iosUIScrolView.Subviews.Length == 0)
+ {
+ return;
+ }
+
+ var frame0 = iosUIScrolView.Subviews[0].Frame;
+ frame0.X = _RowPadding;
+ iosUIScrolView.Subviews[0].Frame = frame0;
+
+
+
+ for (int i = 1; i < iosUIScrolView.Subviews.Length; i++)
+ {
+ var frame = iosUIScrolView.Subviews[i].Frame;
+ frame.X = iosUIScrolView.Subviews[i - 1].Frame.Right+_PagePadding;
+ iosUIScrolView.Subviews[i].Frame = frame;
+ }
+
+ iosUIScrolView.ContentSize = new CoreGraphics.CGSize(iosUIScrolView.Subviews[iosUIScrolView.Subviews.Length - 1].Frame.Right+_RowPadding, iosUIScrolView.Frame.Height);
+ }
+
+
+
+ /// <summary>
+ /// 鎺т欢瀹藉害
+ /// </summary>
+ /// <value>The width.</value>
+ public override int Width
+ {
+ get
+ {
+ return base.Width;
+ }
+ set
+ {
+ base.Width = value;
+ if (!IsCanRefresh)
+ return;
+ var frame = iosUIPageControl.Frame;
+ frame.Width = Width;
+ iosUIPageControl.Frame = frame;
+ }
+ }
+
+ /// <summary>
+ /// 鎺т欢鐨勯珮搴�
+ /// </summary>
+ /// <value>The height.</value>
+ public override int Height
+ {
+ get
+ {
+ return base.Height;
+ }
+ set
+ {
+ base.Height = value;
+ if (!IsCanRefresh)
+ return;
+ var frame = iosUIPageControl.Frame;
+ frame.Y = Height - frame.Height;
+ iosUIPageControl.Frame = frame;
+ }
+ }
+
+ /// <summary>
+ /// 绉婚櫎褰撳墠鎺т欢
+ /// </summary>
+ /// <param name="view">View.</param>
+ internal override void Remove(View view)
+ {
+ base.Remove(view);
+ ReLocation();
+ PageIndex = ChildrenCount - 1;
+ iosUIPageControl.Pages = ChildrenCount;
+ iosUIPageControl.CurrentPage = PageIndex;
+ }
+
+ /// <summary>
+ /// 绉婚櫎鎵�鏈夌殑鎺т欢
+ /// </summary>
+ public override void RemoveAll()
+ {
+ base.RemoveAll();
+ ReLocation();
+ iosUIPageControl.Pages = 0;
+ PageIndex = 0;
+ iosUIPageControl.CurrentPage = 0;
+ }
+
+ /// <summary>
+ /// 鏍规嵁绱㈠紩绉婚櫎鎺т欢
+ /// </summary>
+ /// <param name="index">Index.</param>
+ public override void RemoveAt(int index)
+ {
+ Remove(viewList[index]);
+ }
+ }
+}
+
diff --git a/Shared.IOS/UI/CropImage.cs b/Shared.IOS/UI/CropImage.cs
new file mode 100644
index 0000000..e944dfb
--- /dev/null
+++ b/Shared.IOS/UI/CropImage.cs
@@ -0,0 +1,115 @@
+锘縰sing System;
+using UIKit;
+using Shared.IOS.TBL;
+
+namespace Shared
+{
+
+ /// <summary>
+ /// 鎷嶇収鎴栬�呴�夋嫨鍥剧墖
+ /// </summary>
+ public static class CropImage
+ {
+ ///// <summary>
+ ///// 鎷嶇収鎴栬�呰鍙栧浘鐗囧畬鎴愭椂璋冪敤鐨勫姩浣�,string==null琛ㄧず鐢ㄦ埛鍙栨秷浜嗘媿鐓ф垨鑰呭彇娑堥�夋嫨鍥剧墖,string!=null,琛ㄧず鍥剧墖鐨勮矾寰�
+ ///// </summary>
+ //internal static Action<string> _callback;
+ ///// <summary>
+ ///// 鏂囦欢鍚�
+ ///// </summary>
+ //internal static string _fileName;
+ /// <summary>
+ /// 閫夋嫨绫诲瀷鏄媿鐓�
+ /// </summary>
+ internal static readonly int TypeCamera = 101;
+ /// <summary>
+ /// 閫夋嫨鍥剧墖
+ /// </summary>
+ internal static readonly int TypePicture = 102;
+
+
+ private static CropImageUtlis mCropImageUtlis;
+
+ static CropImage()
+ {
+ //mCropImageUtlis = new CropImageUtlis();
+ }
+
+
+ /// <summary>
+ /// 鎷嶇収瑁佸浘鐗�
+ /// </summary>
+ /// <param name="callback">鍥炶皟鍥剧墖璺緞</param>
+ /// <param name="fileName">鎸囧畾鍥剧墖鏂囦欢鍚�</param>
+ /// <param name="mRATIO_X">瀹介珮姣旓細瀹�</param>
+ /// <param name="mRATIO_Y">瀹介珮姣旓細瀹介珮</param>
+ /// <param name="OutputYSize">鎸囧畾鍒嗚鲸鐜囬珮鐨勫�硷紝0浠h〃涓嶆寚瀹氫笉鍘嬬缉</param>
+ public static void TakePicture(Action<string> callback, string fileName, int mRATIO_X = 1, int mRATIO_Y = 1, int OutputYSize = 200)
+ {
+
+ //_fileName = fileName;
+ mCropImageUtlis = new CropImageUtlis(Application.currentVC, TypeCamera, fileName, mRATIO_X, mRATIO_Y, OutputYSize, (obj) =>
+ {
+ if (obj != null && obj.Length > 0)
+ {
+ callback?.Invoke(obj);
+ }
+ else
+ {
+ callback?.Invoke(null);
+ }
+ mCropImageUtlis = null;
+ });
+
+
+
+
+ }
+
+ /// <summary>
+ /// 閫夋嫨鍥剧墖
+ /// </summary>
+ /// <param name="callback">鍥炶皟鍥剧墖璺緞</param>
+ /// <param name="fileName">鎸囧畾鍥剧墖鏂囦欢鍚�</param>
+ /// <param name="mRATIO_X">瀹介珮姣旓細瀹�</param>
+ /// <param name="mRATIO_Y">瀹介珮姣旓細瀹介珮</param>
+ /// <param name="OutputYSize">鎸囧畾鍒嗚鲸鐜囬珮鐨勫�硷紝0浠h〃涓嶆寚瀹氫笉鍘嬬缉</param>
+ public static void SelectPicture(Action<string> callback, string fileName, int mRATIO_X = 1, int mRATIO_Y = 1, int OutputYSize = 200)
+ {
+ //_fileName = fileName;
+ mCropImageUtlis = new CropImageUtlis(Application.currentVC, TypePicture, fileName, mRATIO_X, mRATIO_Y, OutputYSize, (obj) =>
+ {
+ if (obj != null && obj.Length > 0)
+ {
+ callback?.Invoke(obj);
+ }
+ else
+ {
+ callback?.Invoke(null);
+ }
+
+ mCropImageUtlis = null;
+ });
+ }
+
+
+ ///// <summary>
+ ///// OnCropImageeCallback
+ ///// </summary>
+ //public class OnCropImageeCallback : Java.Lang.Object, IOnCropImageeCallback
+ //{
+
+ // Action<string> mAction;
+ // public OnCropImageeCallback(Action<string> action)
+ // {
+ // mAction = action;
+ // }
+
+ // public void OnSaveCallback(string p0)
+ // {
+ // mAction?.Invoke(p0);
+ // }
+ //}
+ }
+}
+
diff --git a/Shared.IOS/UI/CurtainRollSeekBar.cs b/Shared.IOS/UI/CurtainRollSeekBar.cs
new file mode 100644
index 0000000..d27cffc
--- /dev/null
+++ b/Shared.IOS/UI/CurtainRollSeekBar.cs
@@ -0,0 +1,327 @@
+using System;
+using Shared.IOS.TBL;
+
+
+namespace Shared
+{
+
+ /// <summary>
+ /// CurtainRollSeekBar 鍗峰笜鎺т欢
+ /// </summary>
+ public class CurtainRollSeekBar : BaseSeekBar
+ {
+ /// <summary>
+ /// 褰撳墠瑙嗗浘
+ /// </summary>
+ /// <value>The HDLRollCurtainSeekBar.</value>
+ HDLRollCurtainSeekBar mHDLRollCurtainSeekBar
+ {
+ get
+ {
+ return uiView as HDLRollCurtainSeekBar;
+ }
+ set
+ {
+ uiView = value;
+ }
+ }
+
+
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public CurtainRollSeekBar()
+ {
+ mHDLRollCurtainSeekBar = new HDLRollCurtainSeekBar
+ {
+ MProgressChangedDelegate = new OnProgressChangeListener(this)
+ };
+
+ }
+
+
+ /// <summary>
+ /// 鍒锋柊甯冨眬
+ /// </summary>
+ private void RefreshFrame()
+ {
+ mHDLRollCurtainSeekBar.InitWithFrameSeekBar(new CoreGraphics.CGRect(base.X, base.Y, base.Width, base.Height));
+ }
+
+ /// <summary>
+ /// 鎺т欢瀹藉害
+ /// </summary>
+ public override int Width
+ {
+ get
+ {
+ return base.Width;
+ }
+ set
+ {
+ base.Width = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨勯珮搴�
+ /// </summary>
+ public override int Height
+ {
+ get
+ {
+ return base.Height;
+ }
+ set
+ {
+ base.Height = value;
+ RefreshFrame();
+
+ }
+ }
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int X
+ {
+ get
+ {
+ return base.X;
+ }
+ set
+ {
+ base.X = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int Y
+ {
+ get
+ {
+ return base.Y;
+ }
+ set
+ {
+ base.Y = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 杩涘害鍊兼樉绀哄崟浣�
+ /// </summary>
+ /// <value>鍗曚綅瀛楃</value>
+ public String ProgressBarUnitSring
+ {
+ set
+ {
+ mHDLRollCurtainSeekBar.SetProgressBarUnitSring(value);
+ }
+ }
+
+ int minValue = 0;
+ int maxValue = 100;
+ /// <summary>
+ /// 杩涘害鍊兼渶澶у��
+ /// </summary>
+ /// <value>鏈�澶у��</value>
+ public int MaxValue
+ {
+ set
+ {
+ maxValue = value;
+ mHDLRollCurtainSeekBar.SetMinAndMaxValue(minValue, maxValue);
+ }
+ }
+
+ /// <summary>
+ /// 杩涘害鍊兼渶灏忓��
+ /// </summary>
+ /// <value>鏈�灏忓��</value>
+ public int MinValue
+ {
+ set
+ {
+ minValue = value;
+ mHDLRollCurtainSeekBar.SetMinAndMaxValue(minValue, maxValue);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊�
+ /// </summary>
+ /// <value>杩涘害鍊�</value>
+ public int Progress
+ {
+ set
+ {
+ mHDLRollCurtainSeekBar.SetProgress(value);
+ }
+
+ get
+ {
+ return (int)mHDLRollCurtainSeekBar.MProgress;
+ }
+ }
+
+
+ ///// <summary>
+ ///// 杩涘害鏉′笌宸﹀彸杈规杈硅窛
+ ///// </summary>
+ //public int CurtainPaddingLeftRight
+ //{
+ // set
+ // {
+ // mHDLRollCurtainSeekBar.SetCurtainPadding(value);
+ // }
+ //}
+
+
+ ///// <summary>
+ ///// 椤堕儴padding
+ ///// </summary>
+ //public int CurtainPaddingTop
+ //{
+ // set
+ // {
+ // mHDLRollCurtainSeekBar.SetCurtainPaddingTop(value);
+ // }
+ //}
+
+
+ /// <summary>
+ /// 鏄惁绂荤嚎 绂荤嚎鐨勮瘽绂佹婊戝姩骞剁粯鍒惰儗鏅伄鎸″眰
+ /// </summary>
+ /// <value>鏄惁绂荤嚎</value>
+ public bool IsOffline
+ {
+ set
+ {
+ mHDLRollCurtainSeekBar.SetOffline(value);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊兼樉绀虹殑鏂囧瓧棰滆壊
+ /// </summary>
+ /// <value>鏂囧瓧棰滆壊</value>
+ public uint ProgressTextColor
+ {
+ set
+ {
+
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+
+ mHDLRollCurtainSeekBar.MProgressTextColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊兼樉绀虹殑鏂囧瓧澶у皬
+ /// </summary>
+ /// <value>鏂囧瓧澶у皬</value>
+ public int ProgressTextSize
+ {
+ set
+ {
+ mHDLRollCurtainSeekBar.MProgressTextSize = value;
+ }
+
+ }
+
+ /// <summary>
+ /// 鏄惁鍙互婊戝姩
+ /// </summary>
+ /// <value>鏄惁鍙互婊戝姩</value>
+ public bool IsClickable
+ {
+ set
+ {
+ mHDLRollCurtainSeekBar.IsClickable = value;
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁鏄剧ず杩涘害鏂囧瓧
+ /// </summary>
+ /// <value>鏄惁鏄剧ず杩涘害鏂囧瓧</value>
+ public bool IsProgressTextShow
+ {
+ set
+ {
+ mHDLRollCurtainSeekBar.IsProgressTextShow = value;
+ }
+ }
+
+
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊� Y鍧愭爣
+ /// </summary>
+ /// <value>Y鍧愭爣</value>
+ public int NowProgressY
+ {
+ get
+ {
+ return (int)mHDLRollCurtainSeekBar.ProgressY;
+ }
+ }
+
+
+
+
+ /// <summary>
+ /// EventHandler
+ /// </summary>
+ public EventHandler<int> OnProgressChangedEvent;
+ public EventHandler<bool> OnStartTrackingTouchEvent;
+ public EventHandler<int> OnStopTrackingTouchEvent;
+
+ ///// <summary>
+ ///// OnProgressChangeListener 缁ф壙鍝嶅簲浜嬩欢
+ ///// </summary>
+ OnProgressChangeListener mOnProgressChangeListener;
+
+ public class OnProgressChangeListener : HDLSeekBarProgressChangedDelegate
+ {
+
+ [Weak] CurtainRollSeekBar _CurtainRollSeekBar;
+
+ public OnProgressChangeListener(CurtainRollSeekBar view)
+ {
+ _CurtainRollSeekBar = view;
+ }
+
+ public override void OnProgressChanged(int mProgress)
+ {
+ //if (_CurtainRollSeekBar.IsProgressChangeDelay()) return;
+ _CurtainRollSeekBar.OnProgressChangedEvent?.Invoke(this, mProgress);
+ }
+
+ public override void OnStartTrackingTouch()
+ {
+ _CurtainRollSeekBar.OnStartTrackingTouchEvent?.Invoke(this, true);
+ }
+
+ public override void OnStopTrackingTouch(int mProgress)
+ {
+ _CurtainRollSeekBar.OnProgressChangedEvent?.Invoke(this, mProgress);
+ _CurtainRollSeekBar.OnStopTrackingTouchEvent?.Invoke(this, mProgress);
+ }
+ }
+
+ }
+}
diff --git a/Shared.IOS/UI/CurtainRollSeekBarOn.cs b/Shared.IOS/UI/CurtainRollSeekBarOn.cs
new file mode 100644
index 0000000..ab64689
--- /dev/null
+++ b/Shared.IOS/UI/CurtainRollSeekBarOn.cs
@@ -0,0 +1,321 @@
+using System;
+using Shared.IOS.TBL;
+
+
+namespace Shared
+{
+
+ /// <summary>
+ /// CurtainRollSeekBarOn
+ /// 2020-06-18 HDL ON+ 鍗峰笜鍜岀櫨鍙剁獥鎺т欢
+ /// </summary>
+ public class CurtainRollSeekBarOn : BaseSeekBar
+ {
+ /// <summary>
+ /// 褰撳墠瑙嗗浘
+ /// </summary>
+ /// <value>The HDLOnRollCurtainSeekBar.</value>
+ HDLOnRollCurtainSeekBar mHDLOnRollCurtainSeekBar
+ {
+ get
+ {
+ return uiView as HDLOnRollCurtainSeekBar;
+ }
+ set
+ {
+ uiView = value;
+ }
+ }
+
+
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public CurtainRollSeekBarOn()
+ {
+ mHDLOnRollCurtainSeekBar = new HDLOnRollCurtainSeekBar
+ {
+ MProgressChangedDelegate = new OnProgressChangeListener(this)
+ };
+
+ }
+
+
+ /// <summary>
+ /// 鍒锋柊甯冨眬
+ /// </summary>
+ private void RefreshFrame()
+ {
+ mHDLOnRollCurtainSeekBar.InitWithFrameSeekBar(new CoreGraphics.CGRect(base.X, base.Y, base.Width, base.Height));
+ }
+
+ /// <summary>
+ /// 鎺т欢瀹藉害
+ /// </summary>
+ public override int Width
+ {
+ get
+ {
+ return base.Width;
+ }
+ set
+ {
+ base.Width = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨勯珮搴�
+ /// </summary>
+ public override int Height
+ {
+ get
+ {
+ return base.Height;
+ }
+ set
+ {
+ base.Height = value;
+ RefreshFrame();
+
+ }
+ }
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int X
+ {
+ get
+ {
+ return base.X;
+ }
+ set
+ {
+ base.X = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int Y
+ {
+ get
+ {
+ return base.Y;
+ }
+ set
+ {
+ base.Y = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 杩涘害鍊兼樉绀哄崟浣�
+ /// </summary>
+ /// <value>鍗曚綅瀛楃</value>
+ public String ProgressBarUnitSring
+ {
+ set
+ {
+ mHDLOnRollCurtainSeekBar.SetProgressBarUnitSring(value);
+ }
+ }
+
+ int minValue = 0;
+ int maxValue = 100;
+ /// <summary>
+ /// 杩涘害鍊兼渶澶у��
+ /// </summary>
+ /// <value>鏈�澶у��</value>
+ public int MaxValue
+ {
+ set
+ {
+ maxValue = value;
+ mHDLOnRollCurtainSeekBar.SetMinAndMaxValue(minValue, maxValue);
+ }
+ }
+
+ /// <summary>
+ /// 杩涘害鍊兼渶灏忓��
+ /// </summary>
+ /// <value>鏈�灏忓��</value>
+ public int MinValue
+ {
+ set
+ {
+ minValue = value;
+ mHDLOnRollCurtainSeekBar.SetMinAndMaxValue(minValue, maxValue);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊�
+ /// </summary>
+ /// <value>杩涘害鍊�</value>
+ public int Progress
+ {
+ set
+ {
+ mHDLOnRollCurtainSeekBar.SetProgress(value);
+ }
+
+ get
+ {
+ return (int)mHDLOnRollCurtainSeekBar.MProgress;
+ }
+ }
+
+
+ /// <summary>
+ /// 鏄惁绂荤嚎 绂荤嚎鐨勮瘽绂佹婊戝姩骞剁粯鍒惰儗鏅伄鎸″眰
+ /// </summary>
+ /// <value>鏄惁绂荤嚎</value>
+ public bool IsOffline
+ {
+ set
+ {
+ mHDLOnRollCurtainSeekBar.SetOffline(value);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊兼樉绀虹殑鏂囧瓧棰滆壊
+ /// </summary>
+ /// <value>鏂囧瓧棰滆壊</value>
+ public uint ProgressTextColor
+ {
+ set
+ {
+
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+
+ mHDLOnRollCurtainSeekBar.MProgressTextColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊兼樉绀虹殑鏂囧瓧澶у皬
+ /// </summary>
+ /// <value>鏂囧瓧澶у皬</value>
+ public int ProgressTextSize
+ {
+ set
+ {
+ mHDLOnRollCurtainSeekBar.MProgressTextSize = value;
+ }
+
+ }
+
+ /// <summary>
+ /// 鏄惁鍙互婊戝姩
+ /// </summary>
+ /// <value>鏄惁鍙互婊戝姩</value>
+ public bool IsClickable
+ {
+ set
+ {
+ mHDLOnRollCurtainSeekBar.IsClickable = value;
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁鏄剧ず杩涘害鏂囧瓧
+ /// </summary>
+ /// <value>鏄惁鏄剧ず杩涘害鏂囧瓧</value>
+ public bool IsProgressTextShow
+ {
+ set
+ {
+ mHDLOnRollCurtainSeekBar.IsProgressTextShow = value;
+ }
+ }
+
+
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊� Y鍧愭爣
+ /// </summary>
+ /// <value>Y鍧愭爣</value>
+ public int NowProgressY
+ {
+ get
+ {
+ return (int)mHDLOnRollCurtainSeekBar.ProgressY;
+ }
+ }
+
+ /// <summary>
+ /// 璁剧疆鏄惁涓虹櫨鍙剁獥鏍峰紡
+ /// </summary>
+ public void SetBlindsType(bool isTrue)
+ {
+ mHDLOnRollCurtainSeekBar.SetBlindsType(isTrue);
+ }
+
+ /// <summary>
+ /// 杩涘害鍊兼槸鍚﹀彇鍙�
+ /// </summary>
+ public bool IsInvertedProgress
+ {
+ set
+ {
+ mHDLOnRollCurtainSeekBar.SetInvertedProgress(value);
+ }
+ }
+
+
+ /// <summary>
+ /// EventHandler
+ /// </summary>
+ public EventHandler<int> OnProgressChangedEvent;
+ public EventHandler<bool> OnStartTrackingTouchEvent;
+ public EventHandler<int> OnStopTrackingTouchEvent;
+
+ ///// <summary>
+ ///// OnProgressChangeListener 缁ф壙鍝嶅簲浜嬩欢
+ ///// </summary>
+ OnProgressChangeListener mOnProgressChangeListener;
+
+ public class OnProgressChangeListener : HDLSeekBarProgressChangedDelegate
+ {
+
+ [Weak] CurtainRollSeekBarOn _CurtainRollSeekBarOn;
+
+ public OnProgressChangeListener(CurtainRollSeekBarOn view)
+ {
+ _CurtainRollSeekBarOn = view;
+ }
+
+ public override void OnProgressChanged(int mProgress)
+ {
+ //if (_CurtainRollSeekBarOn.IsProgressChangeDelay()) return;
+ _CurtainRollSeekBarOn.OnProgressChangedEvent?.Invoke(this, mProgress);
+ }
+
+ public override void OnStartTrackingTouch()
+ {
+ _CurtainRollSeekBarOn.OnStartTrackingTouchEvent?.Invoke(this, true);
+ }
+
+ public override void OnStopTrackingTouch(int mProgress)
+ {
+ _CurtainRollSeekBarOn.OnProgressChangedEvent?.Invoke(this, mProgress);
+ _CurtainRollSeekBarOn.OnStopTrackingTouchEvent?.Invoke(this, mProgress);
+ }
+ }
+
+ }
+}
diff --git a/Shared.IOS/UI/CurtainSeekBar.cs b/Shared.IOS/UI/CurtainSeekBar.cs
new file mode 100644
index 0000000..17b5235
--- /dev/null
+++ b/Shared.IOS/UI/CurtainSeekBar.cs
@@ -0,0 +1,322 @@
+using System;
+using Shared.IOS.TBL;
+
+
+namespace Shared
+{
+
+ /// <summary>
+ /// CurtainSeekBar 寮�鍚堝笜鎺т欢
+ /// </summary>
+ public class CurtainSeekBar : BaseSeekBar
+ {
+ /// <summary>
+ /// 褰撳墠瑙嗗浘
+ /// </summary>
+ /// <value>The HDLOACCurtainSeekBar.</value>
+ HDLOACCurtainSeekBar mHDLOACCurtainSeekBar
+ {
+ get
+ {
+ return uiView as HDLOACCurtainSeekBar;
+ }
+ set
+ {
+ uiView = value;
+ }
+ }
+
+
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public CurtainSeekBar()
+ {
+ mHDLOACCurtainSeekBar = new HDLOACCurtainSeekBar
+ {
+ MProgressChangedDelegate = new OnProgressChangeListener(this)
+ };
+
+ }
+
+
+ /// <summary>
+ /// 鍒锋柊甯冨眬
+ /// </summary>
+ private void RefreshFrame()
+ {
+ mHDLOACCurtainSeekBar.InitWithFrameSeekBar(new CoreGraphics.CGRect(base.X, base.Y, base.Width, base.Height));
+ }
+
+ /// <summary>
+ /// 鎺т欢瀹藉害
+ /// </summary>
+ public override int Width
+ {
+ get
+ {
+ return base.Width;
+ }
+ set
+ {
+ base.Width = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨勯珮搴�
+ /// </summary>
+ public override int Height
+ {
+ get
+ {
+ return base.Height;
+ }
+ set
+ {
+ base.Height = value;
+ RefreshFrame();
+ }
+ }
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int X
+ {
+ get
+ {
+ return base.X;
+ }
+ set
+ {
+ base.X = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int Y
+ {
+ get
+ {
+ return base.Y;
+ }
+ set
+ {
+ base.Y = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 杩涘害鍊兼樉绀哄崟浣�
+ /// </summary>
+ /// <value>鍗曚綅瀛楃</value>
+ public String ProgressBarUnitSring
+ {
+ set
+ {
+ mHDLOACCurtainSeekBar.SetProgressBarUnitSring(value);
+ }
+ }
+
+ int minValue = 0;
+ int maxValue = 100;
+ /// <summary>
+ /// 杩涘害鍊兼渶澶у��
+ /// </summary>
+ /// <value>鏈�澶у��</value>
+ public int MaxValue
+ {
+ set
+ {
+ maxValue = value;
+ mHDLOACCurtainSeekBar.SetMinAndMaxValue(minValue, maxValue);
+ }
+ }
+
+ /// <summary>
+ /// 杩涘害鍊兼渶灏忓��
+ /// </summary>
+ /// <value>鏈�灏忓��</value>
+ public int MinValue
+ {
+ set
+ {
+ minValue = value;
+ mHDLOACCurtainSeekBar.SetMinAndMaxValue(minValue, maxValue);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊�
+ /// </summary>
+ /// <value>杩涘害鍊�</value>
+ public int Progress
+ {
+ set
+ {
+ mHDLOACCurtainSeekBar.SetProgress(value);
+ }
+
+ get
+ {
+ return (int)mHDLOACCurtainSeekBar.MProgress;
+ }
+ }
+
+
+ ///// <summary>
+ ///// 杩涘害鏉′笌宸﹀彸杈规杈硅窛
+ ///// </summary>
+ //public int CurtainPaddingLeftRight
+ //{
+ // set
+ // {
+ // mHDLOACCurtainSeekBar.SetCurtainPadding(value);
+ // }
+ //}
+
+
+ ///// <summary>
+ ///// 椤堕儴padding
+ ///// </summary>
+ //public int CurtainPaddingTop
+ //{
+ // set
+ // {
+ // mHDLOACCurtainSeekBar.SetCurtainPaddingTop(value);
+ // }
+ //}
+
+ /// <summary>
+ /// 鏄惁绂荤嚎 绂荤嚎鐨勮瘽绂佹婊戝姩骞剁粯鍒惰儗鏅伄鎸″眰
+ /// </summary>
+ /// <value>鏄惁绂荤嚎</value>
+ public bool IsOffline
+ {
+ set
+ {
+ mHDLOACCurtainSeekBar.SetOffline(value);
+ }
+ }
+
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊兼樉绀虹殑鏂囧瓧棰滆壊
+ /// </summary>
+ /// <value>鏂囧瓧棰滆壊</value>
+ public uint ProgressTextColor
+ {
+ set
+ {
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+
+ mHDLOACCurtainSeekBar.MProgressTextColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊兼樉绀虹殑鏂囧瓧澶у皬
+ /// </summary>
+ /// <value>鏂囧瓧澶у皬</value>
+ public int ProgressTextSize
+ {
+ set
+ {
+ mHDLOACCurtainSeekBar.MProgressTextSize = value;
+ }
+
+ }
+
+ /// <summary>
+ /// 鏄惁鍙互婊戝姩
+ /// </summary>
+ /// <value>鏄惁鍙互婊戝姩</value>
+ public bool IsClickable
+ {
+ set
+ {
+ mHDLOACCurtainSeekBar.IsClickable = value;
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁鏄剧ず杩涘害鏂囧瓧
+ /// </summary>
+ /// <value>鏄惁鏄剧ず杩涘害鏂囧瓧</value>
+ public bool IsProgressTextShow
+ {
+ set
+ {
+ mHDLOACCurtainSeekBar.IsProgressTextShow = value;
+ }
+ }
+
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊� X鍧愭爣
+ /// </summary>
+ /// <value>X鍧愭爣</value>
+ public int NowProgressX
+ {
+ get
+ {
+ return (int)mHDLOACCurtainSeekBar.ProgressX;
+ }
+ }
+
+
+ /// <summary>
+ /// EventHandler
+ /// </summary>
+ public EventHandler<int> OnProgressChangedEvent;
+ public EventHandler<bool> OnStartTrackingTouchEvent;
+ public EventHandler<int> OnStopTrackingTouchEvent;
+
+ ///// <summary>
+ ///// OnProgressChangeListener 缁ф壙鍝嶅簲浜嬩欢
+ ///// </summary>
+ OnProgressChangeListener mOnProgressChangeListener;
+
+ public class OnProgressChangeListener : HDLSeekBarProgressChangedDelegate
+ {
+
+ [Weak] CurtainSeekBar _CurtainSeekBar;
+
+ public OnProgressChangeListener(CurtainSeekBar view)
+ {
+ _CurtainSeekBar = view;
+ }
+
+ public override void OnProgressChanged(int mProgress)
+ {
+ //if (_CurtainSeekBar.IsProgressChangeDelay()) return;
+ _CurtainSeekBar.OnProgressChangedEvent?.Invoke(this, mProgress);
+ }
+
+ public override void OnStartTrackingTouch()
+ {
+ _CurtainSeekBar.OnStartTrackingTouchEvent?.Invoke(this, true);
+ }
+
+ public override void OnStopTrackingTouch(int mProgress)
+ {
+ _CurtainSeekBar.OnProgressChangedEvent?.Invoke(this, mProgress);
+ _CurtainSeekBar.OnStopTrackingTouchEvent?.Invoke(this, mProgress);
+ }
+ }
+
+ }
+}
diff --git a/Shared.IOS/UI/CurtainSeekBarOn.cs b/Shared.IOS/UI/CurtainSeekBarOn.cs
new file mode 100644
index 0000000..68d3c8f
--- /dev/null
+++ b/Shared.IOS/UI/CurtainSeekBarOn.cs
@@ -0,0 +1,310 @@
+using System;
+using Shared.IOS.TBL;
+
+
+namespace Shared
+{
+
+ /// <summary>
+ /// CurtainSeekBarOn 寮�鍚堝笜鎺т欢
+ /// HDL ON+ 寮�鍚堝笜鎺т欢
+ /// </summary>
+ public class CurtainSeekBarOn : BaseSeekBar
+ {
+ /// <summary>
+ /// 褰撳墠瑙嗗浘
+ /// </summary>
+ /// <value>The HDLOnOACCurtainSeekBar.</value>
+ HDLOnOACCurtainSeekBar mHDLOnOACCurtainSeekBar
+ {
+ get
+ {
+ return uiView as HDLOnOACCurtainSeekBar;
+ }
+ set
+ {
+ uiView = value;
+ }
+ }
+
+
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public CurtainSeekBarOn()
+ {
+ mHDLOnOACCurtainSeekBar = new HDLOnOACCurtainSeekBar
+ {
+ MProgressChangedDelegate = new OnProgressChangeListener(this)
+ };
+
+ }
+
+
+ /// <summary>
+ /// 鍒锋柊甯冨眬
+ /// </summary>
+ private void RefreshFrame()
+ {
+ mHDLOnOACCurtainSeekBar.InitWithFrameSeekBar(new CoreGraphics.CGRect(base.X, base.Y, base.Width, base.Height));
+ }
+
+ /// <summary>
+ /// 鎺т欢瀹藉害
+ /// </summary>
+ public override int Width
+ {
+ get
+ {
+ return base.Width;
+ }
+ set
+ {
+ base.Width = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨勯珮搴�
+ /// </summary>
+ public override int Height
+ {
+ get
+ {
+ return base.Height;
+ }
+ set
+ {
+ base.Height = value;
+ RefreshFrame();
+ }
+ }
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int X
+ {
+ get
+ {
+ return base.X;
+ }
+ set
+ {
+ base.X = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int Y
+ {
+ get
+ {
+ return base.Y;
+ }
+ set
+ {
+ base.Y = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 杩涘害鍊兼樉绀哄崟浣�
+ /// </summary>
+ /// <value>鍗曚綅瀛楃</value>
+ public String ProgressBarUnitSring
+ {
+ set
+ {
+ mHDLOnOACCurtainSeekBar.SetProgressBarUnitSring(value);
+ }
+ }
+
+ int minValue = 0;
+ int maxValue = 100;
+ /// <summary>
+ /// 杩涘害鍊兼渶澶у��
+ /// </summary>
+ /// <value>鏈�澶у��</value>
+ public int MaxValue
+ {
+ set
+ {
+ maxValue = value;
+ mHDLOnOACCurtainSeekBar.SetMinAndMaxValue(minValue, maxValue);
+ }
+ }
+
+ /// <summary>
+ /// 杩涘害鍊兼渶灏忓��
+ /// </summary>
+ /// <value>鏈�灏忓��</value>
+ public int MinValue
+ {
+ set
+ {
+ minValue = value;
+ mHDLOnOACCurtainSeekBar.SetMinAndMaxValue(minValue, maxValue);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊�
+ /// </summary>
+ /// <value>杩涘害鍊�</value>
+ public int Progress
+ {
+ set
+ {
+ mHDLOnOACCurtainSeekBar.SetProgress(value);
+ }
+
+ get
+ {
+ return (int)mHDLOnOACCurtainSeekBar.MProgress;
+ }
+ }
+
+
+ /// <summary>
+ /// 鏄惁绂荤嚎 绂荤嚎鐨勮瘽绂佹婊戝姩骞剁粯鍒惰儗鏅伄鎸″眰
+ /// </summary>
+ /// <value>鏄惁绂荤嚎</value>
+ public bool IsOffline
+ {
+ set
+ {
+ mHDLOnOACCurtainSeekBar.SetOffline(value);
+ }
+ }
+
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊兼樉绀虹殑鏂囧瓧棰滆壊
+ /// </summary>
+ /// <value>鏂囧瓧棰滆壊</value>
+ public uint ProgressTextColor
+ {
+ set
+ {
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+
+ mHDLOnOACCurtainSeekBar.MProgressTextColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊兼樉绀虹殑鏂囧瓧澶у皬
+ /// </summary>
+ /// <value>鏂囧瓧澶у皬</value>
+ public int ProgressTextSize
+ {
+ set
+ {
+ mHDLOnOACCurtainSeekBar.MProgressTextSize = value;
+ }
+
+ }
+
+ /// <summary>
+ /// 鏄惁鍙互婊戝姩
+ /// </summary>
+ /// <value>鏄惁鍙互婊戝姩</value>
+ public bool IsClickable
+ {
+ set
+ {
+ mHDLOnOACCurtainSeekBar.IsClickable = value;
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁鏄剧ず杩涘害鏂囧瓧
+ /// </summary>
+ /// <value>鏄惁鏄剧ず杩涘害鏂囧瓧</value>
+ public bool IsProgressTextShow
+ {
+ set
+ {
+ mHDLOnOACCurtainSeekBar.IsProgressTextShow = value;
+ }
+ }
+
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊� X鍧愭爣
+ /// </summary>
+ /// <value>X鍧愭爣</value>
+ public int NowProgressX
+ {
+ get
+ {
+ return (int)mHDLOnOACCurtainSeekBar.ProgressX;
+ }
+ }
+
+ /// <summary>
+ /// 杩涘害鍊兼槸鍚﹀彇鍙�
+ /// </summary>
+ public bool IsInvertedProgress
+ {
+ set
+ {
+ mHDLOnOACCurtainSeekBar.SetInvertedProgress(value);
+ }
+ }
+
+ /// <summary>
+ /// EventHandler
+ /// </summary>
+ public EventHandler<int> OnProgressChangedEvent;
+ public EventHandler<bool> OnStartTrackingTouchEvent;
+ public EventHandler<int> OnStopTrackingTouchEvent;
+
+ ///// <summary>
+ ///// OnProgressChangeListener 缁ф壙鍝嶅簲浜嬩欢
+ ///// </summary>
+ OnProgressChangeListener mOnProgressChangeListener;
+
+ public class OnProgressChangeListener : HDLSeekBarProgressChangedDelegate
+ {
+
+ [Weak] CurtainSeekBarOn _CurtainSeekBar;
+
+ public OnProgressChangeListener(CurtainSeekBarOn view)
+ {
+ _CurtainSeekBar = view;
+ }
+
+ public override void OnProgressChanged(int mProgress)
+ {
+ //if (_CurtainSeekBar.IsProgressChangeDelay()) return;
+ _CurtainSeekBar.OnProgressChangedEvent?.Invoke(this, mProgress);
+ }
+
+ public override void OnStartTrackingTouch()
+ {
+ _CurtainSeekBar.OnStartTrackingTouchEvent?.Invoke(this, true);
+ }
+
+ public override void OnStopTrackingTouch(int mProgress)
+ {
+ _CurtainSeekBar.OnProgressChangedEvent?.Invoke(this, mProgress);
+ _CurtainSeekBar.OnStopTrackingTouchEvent?.Invoke(this, mProgress);
+ }
+ }
+
+ }
+}
diff --git a/Shared.IOS/UI/CurtainSingleSeekBar.cs b/Shared.IOS/UI/CurtainSingleSeekBar.cs
new file mode 100644
index 0000000..20dead5
--- /dev/null
+++ b/Shared.IOS/UI/CurtainSingleSeekBar.cs
@@ -0,0 +1,313 @@
+using System;
+using Shared.IOS.TBL;
+
+namespace Shared
+{
+
+ /// <summary>
+ /// CurtainSingleSeekBar
+ /// 鍚戝乏鎴栬�呭悜鍙筹紝鍗曞悜鎵撳紑鐨勫紑鍚堝笜
+ /// IsRightOpenStyle
+ /// false锛氬彸婊戝叧闂紝杩涘害Progress 100-->0
+ /// true锛氬彸婊戞墦寮�锛岃繘搴rogress 0-->100
+ /// </summary>
+ public class CurtainSingleSeekBar : BaseSeekBar
+ {
+ /// <summary>
+ /// 褰撳墠瑙嗗浘
+ /// </summary>
+ /// <value>The HDLOACSingleCurtainSeekBar.</value>
+ HDLOACSingleCurtainSeekBar mHDLOACSingleCurtainSeekBar
+ {
+ get
+ {
+ return uiView as HDLOACSingleCurtainSeekBar;
+ }
+ set
+ {
+ uiView = value;
+ }
+ }
+
+
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public CurtainSingleSeekBar()
+ {
+ mHDLOACSingleCurtainSeekBar = new HDLOACSingleCurtainSeekBar
+ {
+ MProgressChangedDelegate = new OnProgressChangeListener(this)
+ };
+
+ }
+
+
+ /// <summary>
+ /// 鍒锋柊甯冨眬
+ /// </summary>
+ private void RefreshFrame()
+ {
+ mHDLOACSingleCurtainSeekBar.InitWithFrameSeekBar(new CoreGraphics.CGRect(base.X, base.Y, base.Width, base.Height));
+ }
+
+ /// <summary>
+ /// 鎺т欢瀹藉害
+ /// </summary>
+ public override int Width
+ {
+ get
+ {
+ return base.Width;
+ }
+ set
+ {
+ base.Width = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨勯珮搴�
+ /// </summary>
+ public override int Height
+ {
+ get
+ {
+ return base.Height;
+ }
+ set
+ {
+ base.Height = value;
+ RefreshFrame();
+ }
+ }
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int X
+ {
+ get
+ {
+ return base.X;
+ }
+ set
+ {
+ base.X = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int Y
+ {
+ get
+ {
+ return base.Y;
+ }
+ set
+ {
+ base.Y = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 杩涘害鍊兼樉绀哄崟浣�
+ /// </summary>
+ /// <value>鍗曚綅瀛楃</value>
+ public String ProgressBarUnitSring
+ {
+ set
+ {
+ mHDLOACSingleCurtainSeekBar.SetProgressBarUnitSring(value);
+ }
+ }
+
+ int minValue = 0;
+ int maxValue = 100;
+ /// <summary>
+ /// 杩涘害鍊兼渶澶у��
+ /// </summary>
+ /// <value>鏈�澶у��</value>
+ public int MaxValue
+ {
+ set
+ {
+ maxValue = value;
+ mHDLOACSingleCurtainSeekBar.SetMinAndMaxValue(minValue, maxValue);
+ }
+ }
+
+ /// <summary>
+ /// 杩涘害鍊兼渶灏忓��
+ /// </summary>
+ /// <value>鏈�灏忓��</value>
+ public int MinValue
+ {
+ set
+ {
+ minValue = value;
+ mHDLOACSingleCurtainSeekBar.SetMinAndMaxValue(minValue, maxValue);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊�
+ /// </summary>
+ /// <value>杩涘害鍊�</value>
+ public int Progress
+ {
+ set
+ {
+ mHDLOACSingleCurtainSeekBar.SetProgress(value);
+ }
+
+ get
+ {
+ return (int)mHDLOACSingleCurtainSeekBar.MProgress;
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁绂荤嚎 绂荤嚎鐨勮瘽绂佹婊戝姩骞剁粯鍒惰儗鏅伄鎸″眰
+ /// </summary>
+ /// <value>鏄惁绂荤嚎</value>
+ public bool IsOffline
+ {
+ set
+ {
+ mHDLOACSingleCurtainSeekBar.SetOffline(value);
+ }
+ }
+
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊兼樉绀虹殑鏂囧瓧棰滆壊
+ /// </summary>
+ /// <value>鏂囧瓧棰滆壊</value>
+ public uint ProgressTextColor
+ {
+ set
+ {
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+
+ mHDLOACSingleCurtainSeekBar.MProgressTextColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊兼樉绀虹殑鏂囧瓧澶у皬
+ /// </summary>
+ /// <value>鏂囧瓧澶у皬</value>
+ public int ProgressTextSize
+ {
+ set
+ {
+ mHDLOACSingleCurtainSeekBar.MProgressTextSize = value;
+ }
+
+ }
+
+ /// <summary>
+ /// 鏄惁鍙互婊戝姩
+ /// </summary>
+ /// <value>鏄惁鍙互婊戝姩</value>
+ public bool IsClickable
+ {
+ set
+ {
+ mHDLOACSingleCurtainSeekBar.IsClickable = value;
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁鏄剧ず杩涘害鏂囧瓧
+ /// </summary>
+ /// <value>鏄惁鏄剧ず杩涘害鏂囧瓧</value>
+ public bool IsProgressTextShow
+ {
+ set
+ {
+ mHDLOACSingleCurtainSeekBar.IsProgressTextShow = value;
+ }
+ }
+
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊� X鍧愭爣
+ /// </summary>
+ /// <value>X鍧愭爣</value>
+ public int NowProgressX
+ {
+ get
+ {
+ return (int)mHDLOACSingleCurtainSeekBar.ProgressX;
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁浠庡乏鍒板彸鎵撳紑鍒�100%锛岄粯璁alse
+ /// </summary>
+ /// <value>榛樿false</value>
+ public bool IsRightOpenStyle
+ {
+ set
+ {
+ mHDLOACSingleCurtainSeekBar.SetFromLeftToRightOpen(value);
+ }
+ }
+
+
+ /// <summary>
+ /// EventHandler
+ /// </summary>
+ public EventHandler<int> OnProgressChangedEvent;
+ public EventHandler<bool> OnStartTrackingTouchEvent;
+ public EventHandler<int> OnStopTrackingTouchEvent;
+
+ ///// <summary>
+ ///// OnProgressChangeListener 缁ф壙鍝嶅簲浜嬩欢
+ ///// </summary>
+ OnProgressChangeListener mOnProgressChangeListener;
+
+ public class OnProgressChangeListener : HDLSeekBarProgressChangedDelegate
+ {
+
+ [Weak] CurtainSingleSeekBar _CurtainSeekBar;
+
+ public OnProgressChangeListener(CurtainSingleSeekBar view)
+ {
+ _CurtainSeekBar = view;
+ }
+
+ public override void OnProgressChanged(int mProgress)
+ {
+ //if (_CurtainSeekBar.IsProgressChangeDelay()) return;
+ _CurtainSeekBar.OnProgressChangedEvent?.Invoke(this, mProgress);
+ }
+
+ public override void OnStartTrackingTouch()
+ {
+ _CurtainSeekBar.OnStartTrackingTouchEvent?.Invoke(this, true);
+ }
+
+ public override void OnStopTrackingTouch(int mProgress)
+ {
+ _CurtainSeekBar.OnProgressChangedEvent?.Invoke(this, mProgress);
+ _CurtainSeekBar.OnStopTrackingTouchEvent?.Invoke(this, mProgress);
+ }
+ }
+
+ }
+}
diff --git a/Shared.IOS/UI/DateView.cs b/Shared.IOS/UI/DateView.cs
new file mode 100644
index 0000000..853ad0f
--- /dev/null
+++ b/Shared.IOS/UI/DateView.cs
@@ -0,0 +1,124 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using UIKit;
+using Foundation;
+using Shared.IO;
+using CoreGraphics;
+
+namespace Shared
+{
+ /// <summary>
+ /// Button 鎸夐敭
+ /// </summary>
+ public class DateView : View
+ {
+ MyUIDatePicker myUIDatePicker
+ {
+ get
+ {
+ return uiView as MyUIDatePicker;
+ }
+ set
+ {
+ uiView = value;
+ }
+ }
+
+
+ /// <summary>
+ /// 骞�
+ /// </summary>
+ public int Year
+ {
+ get
+ {
+ return (int)myUIDatePicker.current.Year;
+ }
+ }
+ /// <summary>
+ /// 鏈�
+ /// </summary>
+ public int Month
+ {
+ get { return (int)myUIDatePicker.current.Month; }
+ }
+ /// <summary>
+ /// 澶�
+ /// </summary>
+ public int Day
+ {
+ get { return (int)myUIDatePicker.current.Day; }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Shared.DateView"/> class.
+ /// </summary>
+ public DateView()
+ {
+ myUIDatePicker = new MyUIDatePicker(this) { };
+
+ }
+
+ class MyUIDatePicker : UIDatePicker
+ {
+ [Weak] DateView dateView;
+ public MyUIDatePicker(DateView dateView)
+ {
+ this.dateView = dateView;
+ Mode = UIDatePickerMode.Date;
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮寮�濮�
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesBegan(NSSet touches, UIEvent evt)
+ {
+ dateView?.TouchEvent(EventActions.Down, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 绉诲姩
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesMoved(NSSet touches, UIEvent evt)
+ {
+ dateView?.TouchEvent(EventActions.Move, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮寮硅捣
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesEnded(NSSet touches, UIEvent evt)
+ {
+ dateView?.TouchEvent(EventActions.Up, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ public override void TouchesCancelled(NSSet touches, UIEvent evt)
+ {
+ dateView?.TouchEvent(EventActions.Cancel, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ /// <summary>
+ /// 褰撳墠鏃堕棿瀵硅薄
+ /// </summary>
+ /// <value>The current.</value>
+ public NSDateComponents current
+ {
+ get
+ {
+ NSCalendar cal = NSCalendar.CurrentCalendar;
+ return cal.Components(NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, Date);// [cal components: unitFlags fromDate: now]
+ }
+ }
+
+ }
+ }
+}
+
+
diff --git a/Shared.IOS/UI/Dialog.cs b/Shared.IOS/UI/Dialog.cs
new file mode 100644
index 0000000..a7a3924
--- /dev/null
+++ b/Shared.IOS/UI/Dialog.cs
@@ -0,0 +1,183 @@
+锘縰sing System;
+using UIKit;
+using CoreGraphics;
+
+namespace Shared
+{
+ /// <summary>
+ /// 寮圭獥
+ /// </summary>
+ public class Dialog
+ {
+ Button tempButton;
+ FrameLayout mainFrameLayout;
+ /// <summary>
+ /// 寮圭獥鏋勯�犲嚱鏁�
+ /// </summary>
+ public Dialog()
+ {
+ Application.MainPage.AddChidren(tempButton = new Button { Visible = false, Width = LayoutParams.MatchParent, Height = LayoutParams.MatchParent, BackgroundColor = 0x88323232 });
+ Application.MainPage.AddChidren(mainFrameLayout = new FrameLayout { Visible = false, });
+ //mainFrameLayout.MouseUpEventHandler += (sender, e) => {
+ //};
+ }
+ /// <summary>
+ /// 鑳屾櫙棰滆壊
+ /// </summary>
+ /// <value>The color of the background.</value>
+ public uint BackgroundColor
+ {
+ get
+ {
+ return mainFrameLayout.BackgroundColor;
+ }
+ set
+ {
+ mainFrameLayout.BackgroundColor = value;
+ }
+ }
+
+ /// <summary>
+ /// 鍦嗚澶у皬
+ /// </summary>
+ /// <value>The corner.</value>
+ public uint Radius
+ {
+ get
+ {
+ return mainFrameLayout.Radius;
+ }
+ set
+ {
+ mainFrameLayout.Radius = value;
+ }
+ }
+
+ /// <summary>
+ /// 杈规绾垮ぇ灏�
+ /// </summary>
+ /// <value>The width of the border.</value>
+ public uint BorderWidth
+ {
+ get
+ {
+ return mainFrameLayout.BorderWidth;
+ }
+ set
+ {
+ mainFrameLayout.BorderWidth = value;
+ }
+ }
+
+ /// <summary>
+ /// 澧炲姞瀛愭帶浠�
+ /// </summary>
+ /// <param name="view">View.</param>
+ public void AddChidren(View view)
+ {
+ mainFrameLayout.AddChidren(view);
+ }
+
+ /// <summary>
+ /// 鑳屾櫙鍥剧墖璺緞
+ /// </summary>
+ /// <value>The background image path.</value>
+ public string BackgroundImagePath
+ {
+ get
+ {
+ return mainFrameLayout.BackgroundImagePath;
+ }
+ set
+ {
+ mainFrameLayout.BackgroundImagePath = value;
+ }
+ }
+
+ /// <summary>
+ /// 瀹藉害
+ /// </summary>
+ /// <value>The width.</value>
+ public int Width
+ {
+ get
+ {
+ return mainFrameLayout.Width;
+ }
+ set
+ {
+ mainFrameLayout.Width = value;
+ }
+ }
+
+ /// <summary>
+ /// 楂樺
+ /// </summary>
+ /// <value>The height.</value>
+ public int Height
+ {
+ get
+ {
+ return mainFrameLayout.Height;
+ }
+ set
+ {
+ mainFrameLayout.Height = value;
+ }
+ }
+
+ /// <summary>
+ /// X
+ /// </summary>
+ /// <value>The height.</value>
+ public int X
+ {
+ get
+ {
+ return mainFrameLayout.X;
+ }
+ set
+ {
+ mainFrameLayout.X = value;
+ }
+ }
+
+ /// <summary>
+ /// Y
+ /// </summary>
+ /// <value>The height.</value>
+ public int Y
+ {
+ get
+ {
+ return mainFrameLayout.Y;
+ }
+ set
+ {
+ mainFrameLayout.Y = value;
+ }
+ }
+
+ /// <summary>
+ /// 鏄剧ず褰撳墠鐨勭晫闈�
+ /// </summary>
+ public void Show()
+ {
+ tempButton.Visible = true;
+ mainFrameLayout.Visible = true;
+ mainFrameLayout.Gravity = Gravity.Center;
+ tempButton.BringToFront();
+ mainFrameLayout.BringToFront();
+ }
+
+ /// <summary>
+ /// 鍏抽棴褰撳墠鐨勭晫闈紝閲婃斁璧勬簮
+ /// </summary>
+ public void Close()
+ {
+ tempButton.RemoveFromParent();
+ mainFrameLayout.RemoveFromParent();
+ }
+ }
+}
+
diff --git a/Shared.IOS/UI/DiyArcSeekBar.cs b/Shared.IOS/UI/DiyArcSeekBar.cs
new file mode 100644
index 0000000..c47c329
--- /dev/null
+++ b/Shared.IOS/UI/DiyArcSeekBar.cs
@@ -0,0 +1,410 @@
+using System;
+using Shared.IO;
+using Shared.IOS.TBL;
+using UIKit;
+
+namespace Shared
+{
+
+ /// <summary>
+ /// HDLDiyArcSeekBar 鎺т欢
+ /// </summary>
+ public class DiyArcSeekBar : View
+ {
+ /// <summary>
+ /// 褰撳墠瑙嗗浘
+ /// </summary>
+ /// <value>The HDLDiyArcSeekBar.</value>
+ HDLDiyArcSeekbar mHDLDiyArcSeekBar
+ {
+ get
+ {
+ return uiView as HDLDiyArcSeekbar;
+ }
+ set
+ {
+ uiView = value;
+ }
+ }
+
+
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public DiyArcSeekBar()
+ {
+ mHDLDiyArcSeekBar = new HDLDiyArcSeekbar
+ {
+ MProgressChangedDelegate = new OnProgressChangeListener(this)
+ };
+
+ }
+
+
+ /// <summary>
+ /// 鍒锋柊甯冨眬
+ /// </summary>
+ private void RefreshFrame()
+ {
+ mHDLDiyArcSeekBar.InitWithFrameSeekBar(new CoreGraphics.CGRect(base.X, base.Y, base.Width, base.Height));
+ }
+
+ /// <summary>
+ /// 鎺т欢瀹藉害
+ /// </summary>
+ public override int Width
+ {
+ get
+ {
+ return base.Width;
+ }
+ set
+ {
+ base.Width = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨勯珮搴�
+ /// </summary>
+ public override int Height
+ {
+ get
+ {
+ return base.Height;
+ }
+ set
+ {
+ base.Height = value;
+ RefreshFrame();
+ }
+ }
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int X
+ {
+ get
+ {
+ return base.X;
+ }
+ set
+ {
+ base.X = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int Y
+ {
+ get
+ {
+ return base.Y;
+ }
+ set
+ {
+ base.Y = value;
+ RefreshFrame();
+ }
+ }
+
+
+
+ int minValue = 0;
+ int maxValue = 100;
+ /// <summary>
+ /// 杩涘害鍊兼渶澶у��
+ /// </summary>
+ /// <value>鏈�澶у��</value>
+ public int MaxValue
+ {
+ set
+ {
+ maxValue = value;
+ mHDLDiyArcSeekBar.SetMinAndMaxValue(minValue, maxValue);
+ }
+ }
+
+ /// <summary>
+ /// 杩涘害鍊兼渶灏忓��
+ /// </summary>
+ /// <value>鏈�灏忓��</value>
+ public int MinValue
+ {
+ set
+ {
+ minValue = value;
+ mHDLDiyArcSeekBar.SetMinAndMaxValue(minValue, maxValue);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊�
+ /// </summary>
+ /// <value>杩涘害鍊�</value>
+ public int Progress
+ {
+ set
+ {
+ mHDLDiyArcSeekBar.SetProgress(value);
+ }
+
+ get
+ {
+ return (int)mHDLDiyArcSeekBar.MProgressCurrentValue;
+ }
+ }
+
+ /// <summary>
+ /// 鍚屾椂璁剧疆鍦嗗姬鍜屾嫋鍔ㄥ渾褰㈢殑瀹�
+ /// </summary>
+ /// <value>瀹�</value>
+ public int ArcWidthWithDefaultStyle
+ {
+ set
+ {
+ mHDLDiyArcSeekBar.MArcWidth = value;
+ }
+ }
+
+ /// <summary>
+ /// 鍦嗗姬榛樿鑳屾櫙棰滆壊
+ /// </summary>
+ /// <value>鑳屾櫙棰滆壊</value>
+ public uint ArcColor
+ {
+ set
+ {
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+
+ mHDLDiyArcSeekBar.MArcBackBarColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+
+
+ }
+ }
+
+ /// <summary>
+ /// 杩涘害鏉¢鑹� 鍗曚竴棰滆壊涓嶆笎鍙�
+ /// </summary>
+ /// <value>鍗曚竴杩涘害鏉¢鑹�</value>
+ public uint ProgressBarColor
+ {
+ set
+ {
+ //mHDLDiyArcSeekBar.SetProgressBarColor(value);
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+ mHDLDiyArcSeekBar.SetProgressBarColor(UIKit.UIColor.FromRGBA(r, g, b, a));
+ }
+
+ }
+
+ /// <summary>
+ /// 鍦嗗姬瀹�
+ /// </summary>
+ /// <value>瀹�</value>
+ public int ArcWidth
+ {
+ set
+ {
+ mHDLDiyArcSeekBar.SetArcWidth(value);
+ }
+ }
+
+
+ /// <summary>
+ /// 鏄惁鍙互婊戝姩
+ /// </summary>
+ /// <value>鏄惁鍙互婊戝姩</value>
+ public bool IsClickable
+ {
+ set
+ {
+ mHDLDiyArcSeekBar.IsClickable = value;
+ }
+ }
+
+
+ /// <summary>
+ /// 璁剧疆杩涘害鏉� 娓愬彉棰滆壊鐨勫紑濮嬮鑹插拰缁撴潫棰滆壊
+ /// </summary>
+ /// <value>寮�濮嬮鑹层�佺粨鏉熼鑹�</value>
+ public void SetProgressBarColors(uint startColor, uint endColor)
+ {
+ byte r, g, b, a;
+ r = (byte)(startColor / 256 / 256 % 256);
+ g = (byte)(startColor / 256 % 256);
+ b = (byte)(startColor % 256);
+ a = (byte)(startColor / 256 / 256 / 256 % 256);
+
+ var start = UIKit.UIColor.FromRGBA(r, g, b, a);
+
+
+ byte r2, g2, b2, a2;
+ r2 = (byte)(endColor / 256 / 256 % 256);
+ g2 = (byte)(endColor / 256 % 256);
+ b2 = (byte)(endColor % 256);
+ a2 = (byte)(endColor / 256 / 256 / 256 % 256);
+
+ var end = UIKit.UIColor.FromRGBA(r2, g2, b2, a2);
+
+ mHDLDiyArcSeekBar.SetProgressBarColors(start, end);
+
+ }
+
+ /// <summary>
+ /// 寮�鍙h搴�
+ /// </summary>
+ public int OpenAngle
+ {
+ set
+ {
+ mHDLDiyArcSeekBar.SetOpenAngle(value);
+ mHDLDiyArcSeekBar.SetNeedsDisplay();
+ }
+ }
+
+ /// <summary>
+ /// 杩涘害鏉′笌宸﹀彸杈规杈硅窛
+ /// </summary>
+ public int SeekBarPadding
+ {
+ set
+ {
+ mHDLDiyArcSeekBar.SetSeekBarPadding(value);
+ }
+ }
+
+
+
+ /// <summary>
+ /// 鎷栧姩鎸夐挳鍥剧墖楂樺害
+ /// </summary>
+ public int ThumbImageHeight
+ {
+ set
+ {
+ mHDLDiyArcSeekBar.SetThumbImgBtnWidth(value);
+ }
+ }
+
+ string thumbImagePath;
+ /// <summary>
+ /// 鎷栧姩鎸夐挳鍥剧墖
+ /// </summary>
+ public string ThumbImagePath
+ {
+ get
+ {
+ return thumbImagePath;
+ }
+
+ set
+ {
+ thumbImagePath = value;
+ var bitmap = UIImage.FromFile(FileUtils.GetImageFilePath(thumbImagePath));
+ if (bitmap == null) return;
+ mHDLDiyArcSeekBar.SetThumbImgBtnImg(bitmap);
+ }
+ }
+
+
+ /// <summary>
+ /// 鏄惁绂荤嚎 绂荤嚎鐨勮瘽绂佹婊戝姩骞剁粯鍒惰儗鏅伄鎸″眰
+ /// </summary>
+ /// <value>鏄惁绂荤嚎</value>
+ public bool IsOffline
+ {
+ set
+ {
+ mHDLDiyArcSeekBar.SetOffline(value);
+ }
+ }
+
+ /// <summary>
+ /// 绂荤嚎鏁堟灉鏃� 杩涘害鏉¢鑹� 鍗曚竴棰滆壊涓嶆笎鍙�
+ /// </summary>
+ /// <value>鍗曚竴杩涘害鏉¢鑹�</value>
+ public uint OfflineProgressBarColor
+ {
+ set
+ {
+ //mHDLDiyArcSeekBar.SetProgressBarColor(value);
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+ mHDLDiyArcSeekBar.SetOfflineProgressBarColor(UIKit.UIColor.FromRGBA(r, g, b, a));
+ }
+
+ }
+
+ /// <summary>
+ /// 鏄惁鏄剧ず鎷栧姩鎸夐挳鍥剧墖
+ /// </summary>
+ /// <value>鏄惁绂荤嚎</value>
+ public bool IsThumbImgBtnShow
+ {
+ set
+ {
+ mHDLDiyArcSeekBar.SetThumbImgBtnShow(value);
+ }
+ }
+
+
+
+ /// <summary>
+ /// EventHandler
+ /// </summary>
+ public EventHandler<int> OnProgressChangedEvent;
+ public EventHandler<bool> OnStartTrackingTouchEvent;
+ public EventHandler<int> OnStopTrackingTouchEvent;
+
+ ///// <summary>
+ ///// OnProgressChangeListener 缁ф壙鍝嶅簲浜嬩欢
+ ///// </summary>
+ OnProgressChangeListener mOnProgressChangeListener;
+
+ public class OnProgressChangeListener : HDLSeekBarProgressChangedDelegate
+ {
+
+ [Weak] DiyArcSeekBar _DiyArcSeekBar;
+
+ public OnProgressChangeListener(DiyArcSeekBar view)
+ {
+ _DiyArcSeekBar = view;
+ }
+
+ public override void OnProgressChanged(int mProgress)
+ {
+ _DiyArcSeekBar.OnProgressChangedEvent?.Invoke(this, mProgress);
+ }
+
+ public override void OnStartTrackingTouch()
+ {
+ _DiyArcSeekBar.OnStartTrackingTouchEvent?.Invoke(this, true);
+ }
+
+ public override void OnStopTrackingTouch(int mProgress)
+ {
+ _DiyArcSeekBar.OnStopTrackingTouchEvent?.Invoke(this, mProgress);
+ }
+ }
+
+ }
+}
diff --git a/Shared.IOS/UI/DiyImageSeekBar.cs b/Shared.IOS/UI/DiyImageSeekBar.cs
new file mode 100644
index 0000000..53f7e01
--- /dev/null
+++ b/Shared.IOS/UI/DiyImageSeekBar.cs
@@ -0,0 +1,407 @@
+using System;
+using Shared.IO;
+using Shared.IOS.TBL;
+using UIKit;
+
+namespace Shared
+{
+
+ /// <summary>
+ /// DiyImageSeekBar 鑷畾涔夊浘鐗囨嫋鍒版寜閽殑SeekBar
+ /// </summary>
+ public class DiyImageSeekBar : BaseSeekBar
+ {
+ /// <summary>
+ /// 褰撳墠瑙嗗浘
+ /// </summary>
+ /// <value>The HDLDiyImageSeekBar.</value>
+ HDLDiyImageSeekBar mHDLDiyImageSeekBar
+ {
+ get
+ {
+ return uiView as HDLDiyImageSeekBar;
+ }
+ set
+ {
+ uiView = value;
+ }
+ }
+
+
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public DiyImageSeekBar()
+ {
+ mHDLDiyImageSeekBar = new HDLDiyImageSeekBar
+ {
+ MProgressChangedDelegate = new OnProgressChangeListener(this)
+ };
+
+ }
+
+
+ /// <summary>
+ /// 鍒锋柊甯冨眬
+ /// </summary>
+ private void RefreshFrame()
+ {
+ mHDLDiyImageSeekBar.InitWithFrameSeekBar(new CoreGraphics.CGRect(base.X, base.Y, base.Width, base.Height));
+ }
+
+ /// <summary>
+ /// 鎺т欢瀹藉害
+ /// </summary>
+ public override int Width
+ {
+ get
+ {
+ return base.Width;
+ }
+ set
+ {
+ base.Width = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨勯珮搴�
+ /// </summary>
+ public override int Height
+ {
+ get
+ {
+ return base.Height;
+ }
+ set
+ {
+ base.Height = value;
+ RefreshFrame();
+
+ }
+ }
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int X
+ {
+ get
+ {
+ return base.X;
+ }
+ set
+ {
+ base.X = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int Y
+ {
+ get
+ {
+ return base.Y;
+ }
+ set
+ {
+ base.Y = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 杩涘害鍊兼樉绀哄崟浣�
+ /// </summary>
+ /// <value>鍗曚綅瀛楃</value>
+ public String ProgressBarUnitSring
+ {
+ set
+ {
+ mHDLDiyImageSeekBar.SetProgressBarUnitSring(value);
+ }
+ }
+
+ int minValue = 0;
+ int maxValue = 100;
+ /// <summary>
+ /// 杩涘害鍊兼渶澶у��
+ /// </summary>
+ /// <value>鏈�澶у��</value>
+ public int MaxValue
+ {
+ set
+ {
+ maxValue = value;
+ mHDLDiyImageSeekBar.SetMinAndMaxValue(minValue, maxValue);
+ }
+ }
+
+ /// <summary>
+ /// 杩涘害鍊兼渶灏忓��
+ /// </summary>
+ /// <value>鏈�灏忓��</value>
+ public int MinValue
+ {
+ set
+ {
+ minValue = value;
+ mHDLDiyImageSeekBar.SetMinAndMaxValue(minValue, maxValue);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊�
+ /// </summary>
+ /// <value>杩涘害鍊�</value>
+ public int Progress
+ {
+ set
+ {
+ mHDLDiyImageSeekBar.SetProgress(value);
+ }
+ get
+ {
+ return (int)mHDLDiyImageSeekBar.MProgress;
+ }
+ }
+
+
+
+
+
+
+ /// <summary>
+ /// 褰撳墠杩涘害鏉¢鑹�
+ /// </summary>
+ public uint ProgressBarColor
+ {
+ set
+ {
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+
+ mHDLDiyImageSeekBar.MProgressBarColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ mHDLDiyImageSeekBar.SetNeedsDisplay();
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鏉¤儗鏅殑棰滆壊
+ /// </summary>
+ public uint SeekBarBackgroundColor
+ {
+ set
+ {
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+
+ mHDLDiyImageSeekBar.MArcBackBarColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ mHDLDiyImageSeekBar.SetNeedsDisplay();
+ }
+ }
+
+
+ /// <summary>
+ /// 杩涘害鏉′笌宸﹀彸杈规杈硅窛
+ /// </summary>
+ public int SeekBarPadding
+ {
+ set
+ {
+ mHDLDiyImageSeekBar.SetSeekBarPadding(value);
+ }
+ }
+
+
+ /// <summary>
+ /// 杩涘害鏉¢珮搴�
+ /// </summary>
+ public int SeekBarViewHeight
+ {
+ set
+ {
+ mHDLDiyImageSeekBar.SetProgressBarHeight(value);
+ }
+ }
+
+ /// <summary>
+ /// 鎷栧姩鎸夐挳鍥剧墖楂樺害
+ /// </summary>
+ public int ThumbImageHeight
+ {
+ set
+ {
+ mHDLDiyImageSeekBar.SetBitmapButtonHeight(value);
+ }
+ }
+
+ string thumbImagePath;
+ /// <summary>
+ /// 鎷栧姩鎸夐挳鍥剧墖
+ /// </summary>
+ public string ThumbImagePath
+ {
+ get
+ {
+ return thumbImagePath;
+ }
+
+ set
+ {
+ thumbImagePath = value;
+ var bitmap = UIImage.FromFile(FileUtils.GetImageFilePath(thumbImagePath));
+ if (bitmap == null) return;
+ mHDLDiyImageSeekBar.SetBgBitmapButton(bitmap);
+ }
+ }
+
+
+ /// <summary>
+ /// 鏄惁绂荤嚎 绂荤嚎鐨勮瘽绂佹婊戝姩骞剁粯鍒惰儗鏅伄鎸″眰
+ /// </summary>
+ /// <value>鏄惁绂荤嚎</value>
+ public bool IsOffline
+ {
+ set
+ {
+ mHDLDiyImageSeekBar.SetOffline(value);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊兼樉绀虹殑鏂囧瓧棰滆壊
+ /// </summary>
+ /// <value>鏂囧瓧棰滆壊</value>
+ public uint ProgressTextColor
+ {
+ set
+ {
+
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+
+ mHDLDiyImageSeekBar.MProgressTextColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊兼樉绀虹殑鏂囧瓧澶у皬
+ /// </summary>
+ /// <value>鏂囧瓧澶у皬</value>
+ public int ProgressTextSize
+ {
+ set
+ {
+ mHDLDiyImageSeekBar.MProgressTextSize = value;
+ }
+
+ }
+
+ /// <summary>
+ /// 鏄惁鍙互婊戝姩
+ /// </summary>
+ /// <value>鏄惁鍙互婊戝姩</value>
+ public bool IsClickable
+ {
+ set
+ {
+ mHDLDiyImageSeekBar.IsClickable = value;
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁鏄剧ず杩涘害鏂囧瓧
+ /// </summary>
+ /// <value>鏄惁鏄剧ず杩涘害鏂囧瓧</value>
+ public bool IsProgressTextShow
+ {
+ set
+ {
+ mHDLDiyImageSeekBar.IsProgressTextShow = value;
+ }
+ }
+
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊� X鍧愭爣
+ /// </summary>
+ /// <value>X鍧愭爣</value>
+ public int NowProgressX
+ {
+ get
+ {
+ return (int)mHDLDiyImageSeekBar.ProgressX;
+ }
+ }
+
+ /// <summary>
+ /// 杩涘害鍊兼槸鍚﹀彇鍙�
+ /// </summary>
+ public bool IsInvertedProgress
+ {
+ set
+ {
+ mHDLDiyImageSeekBar.SetInvertedProgress(value);
+ }
+ }
+
+
+ /// <summary>
+ /// EventHandler
+ /// </summary>
+ public EventHandler<int> OnProgressChangedEvent;
+ public EventHandler<bool> OnStartTrackingTouchEvent;
+ public EventHandler<int> OnStopTrackingTouchEvent;
+
+ ///// <summary>
+ ///// OnProgressChangeListener 缁ф壙鍝嶅簲浜嬩欢
+ ///// </summary>
+ OnProgressChangeListener mOnProgressChangeListener;
+
+ public class OnProgressChangeListener : HDLSeekBarProgressChangedDelegate
+ {
+
+ [Weak] DiyImageSeekBar _DiyImageSeekBar;
+
+ public OnProgressChangeListener(DiyImageSeekBar view)
+ {
+ _DiyImageSeekBar = view;
+ }
+
+ public override void OnProgressChanged(int mProgress)
+ {
+ if (_DiyImageSeekBar.IsProgressChangeDelay()) return;
+ _DiyImageSeekBar.OnProgressChangedEvent?.Invoke(this, mProgress);
+ }
+
+ public override void OnStartTrackingTouch()
+ {
+ _DiyImageSeekBar.OnStartTrackingTouchEvent?.Invoke(this, true);
+ }
+
+ public override void OnStopTrackingTouch(int mProgress)
+ {
+ _DiyImageSeekBar.OnProgressChangedEvent?.Invoke(this, mProgress);
+ _DiyImageSeekBar.OnStopTrackingTouchEvent?.Invoke(this, mProgress);
+ }
+ }
+
+ }
+}
diff --git a/Shared.IOS/UI/DiyImageVerticalSeekBar.cs b/Shared.IOS/UI/DiyImageVerticalSeekBar.cs
new file mode 100644
index 0000000..0bdc02d
--- /dev/null
+++ b/Shared.IOS/UI/DiyImageVerticalSeekBar.cs
@@ -0,0 +1,398 @@
+锘縰sing System;
+using Shared.IO;
+using Shared.IOS.TBL;
+using UIKit;
+
+namespace Shared
+{
+
+ /// <summary>
+ /// DiyImageVerticalSeekBar 鑷畾涔夊浘鐗囨嫋鍒版寜閽殑 鍨傜洿SeekBar
+ /// </summary>
+ public class DiyImageVerticalSeekBar : BaseSeekBar
+ {
+ /// <summary>
+ /// 褰撳墠瑙嗗浘
+ /// </summary>
+ /// <value>The HDLDiyImageVerticalSeekBar.</value>
+ HDLDiyImageVerticalSeekBar mHDLDiyImageVerticalSeekBar
+ {
+ get
+ {
+ return uiView as HDLDiyImageVerticalSeekBar;
+ }
+ set
+ {
+ uiView = value;
+ }
+ }
+
+
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public DiyImageVerticalSeekBar()
+ {
+ mHDLDiyImageVerticalSeekBar = new HDLDiyImageVerticalSeekBar
+ {
+ MProgressChangedDelegate = new OnProgressChangeListener(this)
+ };
+
+ }
+
+
+ /// <summary>
+ /// 鍒锋柊甯冨眬
+ /// </summary>
+ private void RefreshFrame()
+ {
+ mHDLDiyImageVerticalSeekBar.InitWithFrameSeekBar(new CoreGraphics.CGRect(base.X, base.Y, base.Width, base.Height));
+ }
+
+ /// <summary>
+ /// 鎺т欢瀹藉害
+ /// </summary>
+ public override int Width
+ {
+ get
+ {
+ return base.Width;
+ }
+ set
+ {
+ base.Width = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨勯珮搴�
+ /// </summary>
+ public override int Height
+ {
+ get
+ {
+ return base.Height;
+ }
+ set
+ {
+ base.Height = value;
+ RefreshFrame();
+
+ }
+ }
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int X
+ {
+ get
+ {
+ return base.X;
+ }
+ set
+ {
+ base.X = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int Y
+ {
+ get
+ {
+ return base.Y;
+ }
+ set
+ {
+ base.Y = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 杩涘害鍊兼樉绀哄崟浣�
+ /// </summary>
+ /// <value>鍗曚綅瀛楃</value>
+ public String ProgressBarUnitSring
+ {
+ set
+ {
+ mHDLDiyImageVerticalSeekBar.SetProgressBarUnitSring(value);
+ }
+ }
+
+ int minValue = 0;
+ int maxValue = 100;
+ /// <summary>
+ /// 杩涘害鍊兼渶澶у��
+ /// </summary>
+ /// <value>鏈�澶у��</value>
+ public int MaxValue
+ {
+ set
+ {
+ maxValue = value;
+ mHDLDiyImageVerticalSeekBar.SetMinAndMaxValue(minValue, maxValue);
+ }
+ }
+
+ /// <summary>
+ /// 杩涘害鍊兼渶灏忓��
+ /// </summary>
+ /// <value>鏈�灏忓��</value>
+ public int MinValue
+ {
+ set
+ {
+ minValue = value;
+ mHDLDiyImageVerticalSeekBar.SetMinAndMaxValue(minValue, maxValue);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊�
+ /// </summary>
+ /// <value>杩涘害鍊�</value>
+ public int Progress
+ {
+ set
+ {
+ mHDLDiyImageVerticalSeekBar.SetProgress(value);
+ }
+ get
+ {
+ return (int)mHDLDiyImageVerticalSeekBar.MProgress;
+ }
+ }
+
+
+
+
+
+
+ /// <summary>
+ /// 褰撳墠杩涘害鏉¢鑹�
+ /// </summary>
+ public uint ProgressBarColor
+ {
+ set
+ {
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+
+ mHDLDiyImageVerticalSeekBar.MProgressBarColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ mHDLDiyImageVerticalSeekBar.SetNeedsDisplay();
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鏉¤儗鏅殑棰滆壊
+ /// </summary>
+ public uint SeekBarBackgroundColor
+ {
+ set
+ {
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+
+ mHDLDiyImageVerticalSeekBar.MArcBackBarColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ mHDLDiyImageVerticalSeekBar.SetNeedsDisplay();
+ }
+ }
+
+
+ /// <summary>
+ /// 杩涘害鏉′笌宸﹀彸杈规杈硅窛
+ /// </summary>
+ public int SeekBarPadding
+ {
+ set
+ {
+ mHDLDiyImageVerticalSeekBar.SetSeekBarPadding(value);
+ }
+ }
+
+
+ /// <summary>
+ /// 杩涘害鏉¢珮搴�
+ /// </summary>
+ public int SeekBarViewHeight
+ {
+ set
+ {
+ mHDLDiyImageVerticalSeekBar.SetProgressBarHeight(value);
+ }
+ }
+
+ /// <summary>
+ /// 鎷栧姩鎸夐挳鍥剧墖楂樺害
+ /// </summary>
+ public int ThumbImageHeight
+ {
+ set
+ {
+ mHDLDiyImageVerticalSeekBar.SetBitmapButtonHeight(value);
+ }
+ }
+
+ string thumbImagePath;
+ /// <summary>
+ /// 鎷栧姩鎸夐挳鍥剧墖
+ /// </summary>
+ public string ThumbImagePath
+ {
+ get
+ {
+ return thumbImagePath;
+ }
+
+ set
+ {
+ thumbImagePath = value;
+ var bitmap = UIImage.FromFile(FileUtils.GetImageFilePath(thumbImagePath));
+ if (bitmap == null) return;
+ mHDLDiyImageVerticalSeekBar.SetBgBitmapButton(bitmap);
+ }
+ }
+
+
+ /// <summary>
+ /// 鏄惁绂荤嚎 绂荤嚎鐨勮瘽绂佹婊戝姩骞剁粯鍒惰儗鏅伄鎸″眰
+ /// </summary>
+ /// <value>鏄惁绂荤嚎</value>
+ public bool IsOffline
+ {
+ set
+ {
+ mHDLDiyImageVerticalSeekBar.SetOffline(value);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊兼樉绀虹殑鏂囧瓧棰滆壊
+ /// </summary>
+ /// <value>鏂囧瓧棰滆壊</value>
+ public uint ProgressTextColor
+ {
+ set
+ {
+
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+
+ mHDLDiyImageVerticalSeekBar.MProgressTextColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊兼樉绀虹殑鏂囧瓧澶у皬
+ /// </summary>
+ /// <value>鏂囧瓧澶у皬</value>
+ public int ProgressTextSize
+ {
+ set
+ {
+ mHDLDiyImageVerticalSeekBar.MProgressTextSize = value;
+ }
+
+ }
+
+ /// <summary>
+ /// 鏄惁鍙互婊戝姩
+ /// </summary>
+ /// <value>鏄惁鍙互婊戝姩</value>
+ public bool IsClickable
+ {
+ set
+ {
+ mHDLDiyImageVerticalSeekBar.IsClickable = value;
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁鏄剧ず杩涘害鏂囧瓧
+ /// </summary>
+ /// <value>鏄惁鏄剧ず杩涘害鏂囧瓧</value>
+ public bool IsProgressTextShow
+ {
+ set
+ {
+ mHDLDiyImageVerticalSeekBar.IsProgressTextShow = value;
+ }
+ }
+
+
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊� Y鍧愭爣
+ /// </summary>
+ /// <value>Y鍧愭爣</value>
+ public int NowProgressY
+ {
+ get
+ {
+ return (int)mHDLDiyImageVerticalSeekBar.ProgressY;
+ }
+ }
+
+
+
+ /// <summary>
+ /// EventHandler
+ /// </summary>
+ public EventHandler<int> OnProgressChangedEvent;
+ public EventHandler<bool> OnStartTrackingTouchEvent;
+ public EventHandler<int> OnStopTrackingTouchEvent;
+
+ ///// <summary>
+ ///// OnProgressChangeListener 缁ф壙鍝嶅簲浜嬩欢
+ ///// </summary>
+ OnProgressChangeListener mOnProgressChangeListener;
+
+ public class OnProgressChangeListener : HDLSeekBarProgressChangedDelegate
+ {
+
+ [Weak] DiyImageVerticalSeekBar _DiyImageVerticalSeekBar;
+
+ public OnProgressChangeListener(DiyImageVerticalSeekBar view)
+ {
+ _DiyImageVerticalSeekBar = view;
+ }
+
+ public override void OnProgressChanged(int mProgress)
+ {
+ if (_DiyImageVerticalSeekBar.IsProgressChangeDelay()) return;
+ _DiyImageVerticalSeekBar.OnProgressChangedEvent?.Invoke(this, mProgress);
+ }
+
+ public override void OnStartTrackingTouch()
+ {
+ _DiyImageVerticalSeekBar.OnStartTrackingTouchEvent?.Invoke(this, true);
+ }
+
+ public override void OnStopTrackingTouch(int mProgress)
+ {
+ _DiyImageVerticalSeekBar.OnProgressChangedEvent?.Invoke(this, mProgress);
+ _DiyImageVerticalSeekBar.OnStopTrackingTouchEvent?.Invoke(this, mProgress);
+ }
+ }
+
+ }
+}
diff --git a/Shared.IOS/UI/EditText.cs b/Shared.IOS/UI/EditText.cs
new file mode 100644
index 0000000..28c1978
--- /dev/null
+++ b/Shared.IOS/UI/EditText.cs
@@ -0,0 +1,616 @@
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using UIKit;
+using Foundation;
+using Shared.IO;
+using CoreGraphics;
+
+namespace Shared
+{
+ /// <summary>
+ /// 鏂囨湰杈撳叆妗�
+ /// </summary>
+ public class EditText : View
+ {
+ public Action<View, FocusEventArgs> FoucsChanged;
+ /// <summary>
+ /// 褰撳墠瑙嗗浘
+ /// </summary>
+ /// <value>The ios user interface text view.</value>
+ MyEditText iosUITextView
+ {
+ get
+ {
+ return uiView as MyEditText;
+ }
+ set
+ {
+ uiView = value;
+ }
+ }
+
+ //涓�绔彛杩涘叆閰嶇疆妯″紡 1鎻愮ず涓嶈鎺ュ叆璁惧 2鑾峰彇璁惧鍒楄〃 3鎺ュ叆璁惧 4杩藉姞璁惧
+ /// <summary>
+ /// 鏂囧瓧澶у皬
+ /// </summary>
+ /// <value>The size of the text.</value>
+ public float TextSize
+ {
+ get
+ {
+ return (float)iosUITextView.Font.PointSize;
+ }
+ set
+ {
+ iosUITextView.Font = UIFont.SystemFontOfSize(value);// .SetTextSize (ComplexUnitType.Sp, value);
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁璁剧疆涓哄姞杞芥椂鏄剧ず杈撳叆閿洏
+ /// </summary>
+ /// <value><c>true</c> if is first responder; otherwise, <c>false</c>.</value>
+ public bool IsFirstResponder
+ {
+ get
+ {
+ return iosUITextView.IsFirstResponder;
+ }
+ set
+ {
+ if (value)
+ {
+ iosUITextView.BecomeFirstResponder();
+ }
+ else
+ {
+ iosUITextView.ResignFirstResponder();
+ }
+ }
+ }
+
+ int textID;
+ /// <summary>
+ /// 鏍规嵁ID鑾峰彇瀵瑰簲鐨勫娉�
+ /// </summary>
+ /// <value>The text I.</value>
+ public int TextID
+ {
+ get
+ {
+ return textID;
+ }
+ set
+ {
+ textID = value;
+ Text = Language.StringByID(TextID);
+ }
+ }
+
+
+ /// <summary>
+ /// 璁剧疆鏂囨湰妗嗚幏鍙栫煭淇¢獙璇佺爜
+ /// </summary>
+ public void SetTextContentTypeToOneTimeCode()
+ {
+ iosUITextView.TextContentType = UITextContentType.OneTimeCode;
+ }
+ /// <summary>
+ /// 鏂囨湰妗嗗唴瀹圭被鍨�
+ /// </summary>
+ public string MyTextContentType
+ {
+ get
+ {
+ return iosUITextView.TextContentType;
+ }
+ set
+ {
+ iosUITextView.TextContentType = new NSString(value);
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁浣胯兘
+ /// </summary>
+ /// <value>鏄惁浣胯兘</value>
+ public override bool Enable
+ {
+ get
+ {
+ return iosUITextView.Enabled;
+ }
+ set
+ {
+ iosUITextView.Enabled = value;
+ }
+ }
+
+
+ string _placeholderText = " ";
+ /// <summary>
+ /// 鏄剧ず鎻愮ず淇℃伅
+ /// </summary>
+ /// <value>The placeholder.</value>
+ public string PlaceholderText
+ {
+ get
+ {
+ return iosUITextView.Placeholder;
+ }
+ set
+ {
+ //iosUITextView.Placeholder = value;
+
+ _placeholderText = value;
+
+ setPlaceholderTextAndColor();
+
+ }
+ }
+
+
+ UIColor _placeholderTextUIColor;
+ uint placeholderTextColor;
+ /// <summary>
+ /// Gets or sets the color of the placeholder text.
+ /// </summary>
+ /// <value>The color of the placeholder text.</value>
+ public uint PlaceholderTextColor
+ {
+ get
+ {
+ return placeholderTextColor;
+ }
+ set
+ {
+ placeholderTextColor = value;
+ byte r, g, b, a;
+ r = (byte)(placeholderTextColor / 256 / 256 % 256);
+ g = (byte)(placeholderTextColor / 256 % 256);
+ b = (byte)(placeholderTextColor % 256);
+ a = (byte)(placeholderTextColor / 256 / 256 / 256 % 256);
+
+ //iosUITextView.SetValueForKeyPath(UIColor.FromRGBA(r, g, b, a), new NSString("_placeholderLabel.textColor"));
+
+ _placeholderTextUIColor = UIColor.FromRGBA(r, g, b, a);
+
+ setPlaceholderTextAndColor();
+ }
+ }
+
+ /// <summary>
+ /// 閫氳繃attributedPlaceholder灞炴�т慨鏀筆laceholder棰滆壊
+ /// </summary>
+ private void setPlaceholderTextAndColor() {
+ //2019-09-23 閫傞厤iOS13
+ var normalAttributedTitle = new NSAttributedString(_placeholderText, foregroundColor: _placeholderTextUIColor);
+ iosUITextView.AttributedPlaceholder = normalAttributedTitle;
+ }
+
+ /// <summary>
+ /// 鏄惁鐢�*鍙烽殣钘忓瓧绗�
+ /// </summary>
+ /// <value>The secure text entry.</value>
+ public bool SecureTextEntry
+ {
+ get
+ {
+ return iosUITextView.SecureTextEntry;
+ }
+ set
+ {
+ iosUITextView.SecureTextEntry = value;
+
+ // if (value)
+ // {
+ // ResetTextContentType();
+ // }
+ }
+ }
+
+
+ /// <summary>
+ /// 鏆傛椂瑙e喅iOS13 浠ヤ笂榛樿鎻愮ず鑷姩鐢熸垚寮哄瘑鐮侊紝涓嶆槸鏈�浼樻柟妗�
+ /// </summary>
+ public void ResetTextContentType()
+ {
+ if (UIDevice.CurrentDevice.CheckSystemVersion(12, 0))
+ {
+ if (Application.IsEditTextContentTypePassword)
+ {
+ iosUITextView.SetTextContentType(UITextContentType.Password);
+ }
+ //HDLUtils.WriteLine(" GetTextContentType: " + iosUITextView.GetTextContentType().ToString());
+ //if (iosUITextView.GetTextContentType() == UITextContentType.NewPassword)
+ //{
+ // iosUITextView.SetTextContentType(UITextContentType.Password);
+ //}
+ }
+ }
+
+
+ bool isNumberKeyboardType = false;
+ //璁剧疆閿洏绫诲瀷
+ public bool IsNumberKeyboardType
+ {
+ get
+ {
+ return isNumberKeyboardType;
+ }
+ set
+ {
+ isNumberKeyboardType = value;
+ if (value)
+ {
+ iosUITextView.KeyboardType = UIKeyboardType.NumberPad;
+ }
+ else
+ {
+ iosUITextView.KeyboardType = UIKeyboardType.Default;
+ }
+
+ }
+
+ }
+
+
+
+ public static EditText Instance;
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public EditText()
+ {
+ iosUITextView = new MyEditText(this) { };
+ ResetTextContentType();
+ }
+
+ /// <summary>
+ /// 鍒涙柊闇�瑕佸垱鏂扮殑淇℃伅
+ /// </summary>
+ public override void Refresh()
+ {
+ base.Refresh();
+ IsSelected = isSelected;
+ }
+
+
+ /// <summary>
+ /// 鏂囨湰
+ /// </summary>
+ /// <value>The text.</value>
+ public string Text
+ {
+ get
+ {
+ return iosUITextView.Text;
+ }
+ set
+ {
+
+ iosUITextView.Text = value;
+ TextChangeEventHandler?.Invoke(this, value);//璧嬪�硷紝澧炲姞瑙﹀彂浜嬩欢
+ }
+ }
+
+ uint textColor;
+ /// <summary>
+ /// 鏂囧瓧棰滆壊
+ /// </summary>
+ /// <value>The color of the text.</value>
+ public uint TextColor
+ {
+ get
+ {
+ return textColor;
+ }
+ set
+ {
+ textColor = value;
+ byte r, g, b, a;
+ r = (byte)(textColor / 256 / 256 % 256);
+ g = (byte)(textColor / 256 % 256);
+ b = (byte)(textColor % 256);
+ a = (byte)(textColor / 256 / 256 / 256 % 256);
+ iosUITextView.TextColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+
+ }
+ }
+
+
+ bool isSelected;
+ /// <summary>
+ /// Gets or sets a value indicating whether this instance is selected.
+ /// </summary>
+ /// <value><c>true</c> if this instance is selected; otherwise, <c>false</c>.</value>
+ public bool IsSelected
+ {
+ get
+ {
+ return isSelected;
+ }
+ set
+ {
+ isSelected = value;
+
+ if (!IsCanRefresh)
+ {
+ return;
+ }
+ if (isSelected)
+ {
+ if (null == SelectedImagePath)
+ {
+ byte r, g, b, a;
+ r = (byte)(SelectedBackgroundColor / 256 / 256 % 256);
+ g = (byte)(SelectedBackgroundColor / 256 % 256);
+ b = (byte)(SelectedBackgroundColor % 256);
+ a = (byte)(SelectedBackgroundColor / 256 / 256 / 256 % 256);
+ iosUITextView.BackgroundColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+ else
+ {
+ iosUITextView.Background = UIImage.FromFile(FileUtils.GetImageFilePath(SelectedImagePath));
+ }
+ }
+ else
+ {
+ if (null == UnSelectedImagePath)
+ {
+ byte r, g, b, a;
+ r = (byte)(BackgroundColor / 256 / 256 % 256);
+ g = (byte)(BackgroundColor / 256 % 256);
+ b = (byte)(BackgroundColor % 256);
+ a = (byte)(BackgroundColor / 256 / 256 / 256 % 256);
+ iosUITextView.BackgroundColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+ else
+ {
+ iosUITextView.Background = UIImage.FromFile(FileUtils.GetImageFilePath(UnSelectedImagePath));
+ }
+ }
+ }
+ }
+
+ /// <summary>
+ /// 閫夋嫨鏃惰儗鏅鑹�
+ /// </summary>
+ /// <value>The color of the text.</value>
+ public uint SelectedBackgroundColor
+ {
+ get;
+ set;
+ }
+
+
+ TextAlignment textAlignment = TextAlignment.Center;
+
+ /// <summary>
+ /// Texts the alignment.
+ /// </summary>
+ public TextAlignment TextAlignment
+ {
+ get
+ {
+ return textAlignment;
+ }
+ set
+ {
+ textAlignment = value;
+ switch (value)
+ {
+ case TextAlignment.TopLeft:
+ //iosUITextView.TextAlignment = UITextAlignment.Left;
+ break;
+ case TextAlignment.TopCenter:
+ //iosUITextView.TextAlignment = UITextAlignment.Center| UITextAlignment.Left;
+ break;
+ case TextAlignment.TopRight:
+ // iosUITextView.TextAlignment = UITextAlignment.Right;
+ break;
+ case TextAlignment.CenterLeft:
+ iosUITextView.TextAlignment = UITextAlignment.Left;
+ break;
+ case TextAlignment.Center:
+ iosUITextView.TextAlignment = UITextAlignment.Center;
+ break;
+ case TextAlignment.CenterRight:
+ iosUITextView.TextAlignment = UITextAlignment.Right;
+ break;
+ case TextAlignment.BottomLeft:
+ // iosUITextView.TextAlignment = UIKit.UIControlContentVerticalAlignment.Bottom;
+ // iosUITextView.TextAlignment = UIKit.UIControlContentHorizontalAlignment.Left;
+ break;
+ case TextAlignment.BottomCenter:
+ // iosUITextView.TextAlignment = UIKit.UIControlContentVerticalAlignment.Bottom;
+ // iosUITextView.TextAlignment = UIKit.UIControlContentHorizontalAlignment.Center;
+ break;
+ case TextAlignment.BottomRight:
+ // iosUITextView.VerticalAlignment = UIKit.UIControlContentVerticalAlignment.Bottom;
+ // iosUITextView.HorizontalAlignment = UIKit.UIControlContentHorizontalAlignment.Right;
+ break;
+ }
+ }
+ }
+
+ /// <summary>
+ /// 閫夋嫨鏃惰儗鏅浘璺緞
+ /// </summary>
+ /// <value>The selected image path.</value>
+ public string SelectedImagePath { get; set; }
+
+ /// <summary>
+ /// 闈為�変腑鐘舵�佺殑鑳屾櫙鍥捐矾寰�
+ /// </summary>
+ /// <value>The un selected image path.</value>
+ public string UnSelectedImagePath { get; set; }
+
+
+ /// <summary>
+ /// 杈撳叆鏂囧瓧鍙樺寲浜嬩欢
+ /// </summary>
+ public Action<View, string> TextChangeEventHandler;
+
+ /// <summary>
+ /// 鎸変簡杩斿洖鎸夐敭浜嬩欢
+ /// </summary>
+ public Action<View> EditorEnterAction;
+ /// <summary>
+ /// 璁剧疆鐒︾偣
+ /// </summary>
+ public bool Foucs
+ {
+ get
+ {
+ return iosUITextView.IsFirstResponder;
+ }
+ set
+ {
+ if (value)
+ {
+ //鏄剧ず閿洏
+ iosUITextView.BecomeFirstResponder();
+ }
+ else {
+ //闅愯棌閿洏
+ iosUITextView.ResignFirstResponder();
+ }
+ }
+ }
+
+ ///// <summary>
+ ///// 璁剧疆鐒︾偣浣嶇疆
+ ///// </summary>
+ //public void SetSelection(int index)
+ //{
+ // var mNSRange = new NSRange(index, 0);
+
+
+
+ // //UITextPosition start = [textFieldpositionFromPosition:[textFieldbeginningOfDocument]offset: range.location];
+
+ // //UITextPosition end = [textFieldpositionFromPosition: startoffset:range.length];
+
+ // //[textFieldsetSelectedTextRange:[iosUITextView textRangeFromPosition:start toPosition:end]];
+
+ // UITextPosition start = new UITextPosition();
+
+
+ // UITextRange AA = new UITextRange();
+
+
+ // iosUITextView.SelectedTextRange = AA;
+
+ //}
+
+
+ public Action<View, string> KeyEventAction;
+ class MyEditText : UIKit.UITextField, IUITextFieldDelegate
+ {
+ [Weak] EditText editText;
+ public MyEditText(EditText editText)
+ {
+ this.editText = editText;
+ TextColor = UIColor.White;
+ this.Delegate = this;
+ EditorEnterAction += () => {
+ this.editText?.EditorEnterAction?.Invoke(this.editText);
+ };
+
+ EditingChanged += (sender, e) =>
+ {
+ this.editText?.TextChangeEventHandler?.Invoke(this.editText, Text);
+ };
+ EditingDidBegin += (sender, e) =>
+ {
+ Instance = this.editText;
+ this.editText?.FoucsChanged?.Invoke(this.editText, new FocusEventArgs { Focus = true });
+ };
+ EditingDidEnd += (sender, e) =>
+ {
+ this.editText?.FoucsChanged?.Invoke(this.editText, new FocusEventArgs { Focus = false });
+ };
+ }
+
+
+ public override void MovedToSuperview()
+ {
+ base.MovedToSuperview();
+ if (Superview == null)
+ {
+ Shared.HDLUtils.WriteLine("浠庣埗鎺т欢涓Щ闄�");
+ }
+ else {
+ Shared.HDLUtils.WriteLine("娣诲姞鍒扮埗鎺т欢");
+ }
+ }
+
+ public override void DeleteBackward()
+ {
+ base.DeleteBackward();
+ editText?.KeyEventAction?.Invoke(editText, "Del");
+ }
+
+ internal System.Action EditorEnterAction;
+ [Export("textFieldShouldReturn:")]
+ public new bool ShouldReturn(UITextField textField)
+ {
+ ResignFirstResponder();
+ EditorEnterAction?.Invoke();
+ return true;
+ }
+
+
+
+ nfloat x;
+
+ /// <summary>
+ /// 鐐瑰嚮寮�濮�
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesBegan(NSSet touches, UIEvent evt)
+ {
+ editText?.TouchEvent(EventActions.Down, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 绉诲姩
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesMoved(NSSet touches, UIEvent evt)
+ {
+ editText?.TouchEvent(EventActions.Move, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮寮硅捣
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesEnded(NSSet touches, UIEvent evt)
+ {
+ editText?.TouchEvent(EventActions.Up, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ public override void TouchesCancelled(NSSet touches, UIEvent evt)
+ {
+ editText?.TouchEvent(EventActions.Cancel, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ }
+ }
+ public class FocusEventArgs : EventArgs
+ {
+ /// <summary>
+ /// true 涓鸿幏鍙栧埌鐒︾偣
+ /// false 鐒︾偣娑堝け
+ /// </summary>
+ public bool Focus;
+ }
+}
+
+
diff --git a/Shared.IOS/UI/EditTextView.cs b/Shared.IOS/UI/EditTextView.cs
new file mode 100644
index 0000000..0fa161b
--- /dev/null
+++ b/Shared.IOS/UI/EditTextView.cs
@@ -0,0 +1,625 @@
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using UIKit;
+using Foundation;
+using Shared.IO;
+using CoreGraphics;
+
+namespace Shared
+{
+ /// <summary>
+ /// EditTextView 鏂囨湰杈撳叆妗�
+ /// 鏀寔鎹㈣
+ /// </summary>
+ public class EditTextView : View
+ {
+ public Action<View, FocusEventArgs> FoucsChanged;
+ /// <summary>
+ /// 褰撳墠瑙嗗浘
+ /// </summary>
+ /// <value>The ios user interface text view.</value>
+ MyEditTextView iosUITextView
+ {
+ get
+ {
+ return uiView as MyEditTextView;
+ }
+ set
+ {
+ uiView = value;
+ }
+ }
+
+ //涓�绔彛杩涘叆閰嶇疆妯″紡 1鎻愮ず涓嶈鎺ュ叆璁惧 2鑾峰彇璁惧鍒楄〃 3鎺ュ叆璁惧 4杩藉姞璁惧
+ /// <summary>
+ /// 鏂囧瓧澶у皬
+ /// </summary>
+ /// <value>The size of the text.</value>
+ public float TextSize
+ {
+ get
+ {
+ return (float)iosUITextView.Font.PointSize;
+ }
+ set
+ {
+ iosUITextView.Font = UIFont.SystemFontOfSize(value);// .SetTextSize (ComplexUnitType.Sp, value);
+ iosUITextView.placeholderUILabel.Font = UIFont.SystemFontOfSize(value);// .SetTextSize (ComplexUnitType.Sp, value);
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁璁剧疆涓哄姞杞芥椂鏄剧ず杈撳叆閿洏
+ /// </summary>
+ /// <value><c>true</c> if is first responder; otherwise, <c>false</c>.</value>
+ public bool IsFirstResponder
+ {
+ get
+ {
+ return iosUITextView.IsFirstResponder;
+ }
+ set
+ {
+ if (value)
+ {
+ iosUITextView.BecomeFirstResponder();
+ }
+ else
+ {
+ iosUITextView.ResignFirstResponder();
+ }
+ }
+ }
+ /// <summary>
+ /// 璁剧疆鏂囨湰妗嗚幏鍙栫煭淇¢獙璇佺爜
+ /// </summary>
+ public void SetTextContentTypeToOneTimeCode()
+ {
+ iosUITextView.TextContentType = UITextContentType.OneTimeCode;
+ }
+ /// <summary>
+ /// 鏂囨湰妗嗗唴瀹圭被鍨�
+ /// </summary>
+ public string MyTextContentType
+ {
+ get
+ {
+ return iosUITextView.TextContentType;
+ }
+ set
+ {
+ iosUITextView.TextContentType = new NSString(value);
+ }
+ }
+
+
+ int textID;
+ /// <summary>
+ /// 鏍规嵁ID鑾峰彇瀵瑰簲鐨勫娉�
+ /// </summary>
+ /// <value>The text I.</value>
+ public int TextID
+ {
+ get
+ {
+ return textID;
+ }
+ set
+ {
+ textID = value;
+ Text = Language.StringByID(TextID);
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁浣胯兘
+ /// </summary>
+ /// <value>鏄惁浣胯兘</value>
+ public override bool Enable
+ {
+ get
+ {
+ return true;
+ }
+ set
+ {
+ //iosUITextView.Enabled = value;
+ }
+ }
+
+
+ string _placeholderText = " ";
+ /// <summary>
+ /// 鏄剧ず鎻愮ず淇℃伅
+ /// </summary>
+ /// <value>The placeholder.</value>
+ public string PlaceholderText
+ {
+ get
+ {
+ return _placeholderText;
+ }
+ set
+ {
+ //iosUITextView.Placeholder = value;
+
+ _placeholderText = value;
+
+ iosUITextView.placeholderUILabel.Text = _placeholderText;
+ }
+ }
+
+
+ UIColor _placeholderTextUIColor;
+ uint placeholderTextColor;
+ /// <summary>
+ /// Gets or sets the color of the placeholder text.
+ /// </summary>
+ /// <value>The color of the placeholder text.</value>
+ public uint PlaceholderTextColor
+ {
+ get
+ {
+ return placeholderTextColor;
+ }
+ set
+ {
+ placeholderTextColor = value;
+ byte r, g, b, a;
+ r = (byte)(placeholderTextColor / 256 / 256 % 256);
+ g = (byte)(placeholderTextColor / 256 % 256);
+ b = (byte)(placeholderTextColor % 256);
+ a = (byte)(placeholderTextColor / 256 / 256 / 256 % 256);
+
+ //iosUITextView.SetValueForKeyPath(UIColor.FromRGBA(r, g, b, a), new NSString("_placeholderLabel.textColor"));
+
+ _placeholderTextUIColor = UIColor.FromRGBA(r, g, b, a);
+
+ iosUITextView.placeholderUILabel.TextColor = _placeholderTextUIColor;
+ }
+ }
+
+
+ /// <summary>
+ /// 鏄惁鐢�*鍙烽殣钘忓瓧绗�
+ /// </summary>
+ /// <value>The secure text entry.</value>
+ public bool SecureTextEntry
+ {
+ get
+ {
+ return iosUITextView.SecureTextEntry;
+ }
+ set
+ {
+ iosUITextView.SecureTextEntry = value;
+ if (value)
+ {
+ SetTextContentType();
+ }
+ }
+ }
+
+
+ /// <summary>
+ /// 瑙e喅iOS12 浠ヤ笂榛樿鎻愮ず鑷姩鐢熸垚寮哄瘑鐮�
+ /// </summary>
+ public void SetTextContentType()
+ {
+ if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0))
+ {
+ iosUITextView.SetTextContentType(UITextContentType.Password);
+ }
+ }
+ public static EditTextView Instance;
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public EditTextView()
+ {
+ iosUITextView = new MyEditTextView(this) { };
+
+ this.TextSize = Application.FontSize;
+ }
+
+ /// <summary>
+ /// 鍒涙柊闇�瑕佸垱鏂扮殑淇℃伅
+ /// </summary>
+ public override void Refresh()
+ {
+ base.Refresh();
+ IsSelected = isSelected;
+ }
+
+
+ /// <summary>
+ /// 鏂囨湰
+ /// </summary>
+ /// <value>The text.</value>
+ public string Text
+ {
+ get
+ {
+ return iosUITextView.Text;
+ }
+ set
+ {
+
+ iosUITextView.Text = value;
+ TextChangeEventHandler?.Invoke(this, value);//璧嬪�硷紝澧炲姞瑙﹀彂浜嬩欢
+ }
+ }
+
+ uint textColor;
+ /// <summary>
+ /// 鏂囧瓧棰滆壊
+ /// </summary>
+ /// <value>The color of the text.</value>
+ public uint TextColor
+ {
+ get
+ {
+ return textColor;
+ }
+ set
+ {
+ textColor = value;
+ byte r, g, b, a;
+ r = (byte)(textColor / 256 / 256 % 256);
+ g = (byte)(textColor / 256 % 256);
+ b = (byte)(textColor % 256);
+ a = (byte)(textColor / 256 / 256 / 256 % 256);
+ iosUITextView.TextColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+
+ }
+ }
+
+
+ bool isSelected;
+ /// <summary>
+ /// Gets or sets a value indicating whether this instance is selected.
+ /// </summary>
+ /// <value><c>true</c> if this instance is selected; otherwise, <c>false</c>.</value>
+ public bool IsSelected
+ {
+ get
+ {
+ return isSelected;
+ }
+ set
+ {
+ isSelected = value;
+
+ if (!IsCanRefresh)
+ {
+ return;
+ }
+ if (isSelected)
+ {
+ byte r, g, b, a;
+ r = (byte)(SelectedBackgroundColor / 256 / 256 % 256);
+ g = (byte)(SelectedBackgroundColor / 256 % 256);
+ b = (byte)(SelectedBackgroundColor % 256);
+ a = (byte)(SelectedBackgroundColor / 256 / 256 / 256 % 256);
+ iosUITextView.BackgroundColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+ else
+ {
+ byte r, g, b, a;
+ r = (byte)(BackgroundColor / 256 / 256 % 256);
+ g = (byte)(BackgroundColor / 256 % 256);
+ b = (byte)(BackgroundColor % 256);
+ a = (byte)(BackgroundColor / 256 / 256 / 256 % 256);
+ iosUITextView.BackgroundColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+ }
+ }
+
+ /// <summary>
+ /// 閫夋嫨鏃惰儗鏅鑹�
+ /// </summary>
+ /// <value>The color of the text.</value>
+ public uint SelectedBackgroundColor
+ {
+ get;
+ set;
+ }
+
+
+ TextAlignment textAlignment = TextAlignment.Center;
+
+ /// <summary>
+ /// Texts the alignment.
+ /// </summary>
+ public TextAlignment TextAlignment
+ {
+ get
+ {
+ return textAlignment;
+ }
+ set
+ {
+ textAlignment = value;
+ switch (value)
+ {
+ case TextAlignment.TopLeft:
+ //iosUITextView.TextAlignment = UITextAlignment.Left;
+ break;
+ case TextAlignment.TopCenter:
+ //iosUITextView.TextAlignment = UITextAlignment.Center| UITextAlignment.Left;
+ break;
+ case TextAlignment.TopRight:
+ // iosUITextView.TextAlignment = UITextAlignment.Right;
+ break;
+ case TextAlignment.CenterLeft:
+ iosUITextView.TextAlignment = UITextAlignment.Left;
+ break;
+ case TextAlignment.Center:
+ iosUITextView.TextAlignment = UITextAlignment.Center;
+ break;
+ case TextAlignment.CenterRight:
+ iosUITextView.TextAlignment = UITextAlignment.Right;
+ break;
+ case TextAlignment.BottomLeft:
+ // iosUITextView.TextAlignment = UIKit.UIControlContentVerticalAlignment.Bottom;
+ // iosUITextView.TextAlignment = UIKit.UIControlContentHorizontalAlignment.Left;
+ break;
+ case TextAlignment.BottomCenter:
+ // iosUITextView.TextAlignment = UIKit.UIControlContentVerticalAlignment.Bottom;
+ // iosUITextView.TextAlignment = UIKit.UIControlContentHorizontalAlignment.Center;
+ break;
+ case TextAlignment.BottomRight:
+ // iosUITextView.VerticalAlignment = UIKit.UIControlContentVerticalAlignment.Bottom;
+ // iosUITextView.HorizontalAlignment = UIKit.UIControlContentHorizontalAlignment.Right;
+ break;
+ }
+ }
+ }
+
+ /// <summary>
+ /// 閫夋嫨鏃惰儗鏅浘璺緞
+ /// </summary>
+ /// <value>The selected image path.</value>
+ public string SelectedImagePath { get; set; }
+
+ /// <summary>
+ /// 闈為�変腑鐘舵�佺殑鑳屾櫙鍥捐矾寰�
+ /// </summary>
+ /// <value>The un selected image path.</value>
+ public string UnSelectedImagePath { get; set; }
+
+
+ /// <summary>
+ /// 杈撳叆鏂囧瓧鍙樺寲浜嬩欢
+ /// </summary>
+ public Action<View, string> TextChangeEventHandler;
+
+ /// <summary>
+ /// 鎸変簡杩斿洖鎸夐敭浜嬩欢
+ /// </summary>
+ public Action<View> EditorEnterAction;
+ /// <summary>
+ /// 璁剧疆鐒︾偣
+ /// </summary>
+ public bool Foucs
+ {
+ get
+ {
+ return iosUITextView.IsFirstResponder;
+ }
+ set
+ {
+ if (value)
+ {
+ //鏄剧ず閿洏
+ iosUITextView.BecomeFirstResponder();
+ }
+ else {
+ //闅愯棌閿洏
+ iosUITextView.ResignFirstResponder();
+ }
+ }
+ }
+
+ /// <summary>
+ /// 鍒锋柊placeholderUILabel甯冨眬
+ /// </summary>
+ public void InitIosPlaceholderUILabelWithHeight(int mHeight)
+ {
+ var MFrame = iosUITextView.placeholderUILabel.Frame;
+ MFrame.X = 5;
+ MFrame.Y = 0;
+ MFrame.Height = mHeight;
+ MFrame.Width = iosUITextView.Frame.Size.Width - 20;
+ iosUITextView.placeholderUILabel.Frame = MFrame;
+ }
+
+ /// <summary>
+ /// 闅愯棌杞敭鐩�
+ /// </summary>
+ public void HideSoftInput()
+ {
+ Foucs = false;
+ }
+
+ public Action<View, string> KeyEventAction;
+ class MyEditTextView : UIKit.UITextView, IUITextViewDelegate
+ {
+ public UILabel placeholderUILabel;
+ [Weak] EditTextView EditTextView;
+ public MyEditTextView(EditTextView EditTextView)
+ {
+ this.EditTextView = EditTextView;
+ TextColor = UIColor.White;
+ placeholderUILabel = new UILabel(new CGRect(5, 0, this.Frame.Size.Width - 20, 40));
+ placeholderUILabel.Lines = 0;
+ placeholderUILabel.TextColor = UIColor.Gray;
+
+
+ this.AddSubview(placeholderUILabel);
+
+ this.Delegate = this;
+ EditorEnterAction += () => {
+ this.EditTextView?.EditorEnterAction?.Invoke(this.EditTextView);
+ };
+
+ //EditingChanged += (sender, e) =>
+ //{
+ // this.EditTextView?.TextChangeEventHandler?.Invoke(this.EditTextView, Text);
+ //};
+ //EditingDidBegin += (sender, e) =>
+ //{
+ // Instance = this.EditTextView;
+ // this.EditTextView?.FoucsChanged?.Invoke(this.EditTextView, new FocusEventArgs { Focus = true });
+ //};
+ //EditingDidEnd += (sender, e) =>
+ //{
+ // this.EditTextView?.FoucsChanged?.Invoke(this.EditTextView, new FocusEventArgs { Focus = false });
+ //};
+ }
+
+ //public void InitPlaceholderUILabelWithHeight(int mHeight) {
+ // var MFrame = placeholderUILabel.Frame;
+ // MFrame.Height = mHeight;
+ // MFrame.Width = this.Frame.Size.Width - 20;
+ // placeholderUILabel.Frame = MFrame;
+ //}
+
+ public override void MovedToSuperview()
+ {
+ base.MovedToSuperview();
+ if (Superview == null)
+ {
+ Shared.HDLUtils.WriteLine("浠庣埗鎺т欢涓Щ闄�");
+ }
+ else {
+ Shared.HDLUtils.WriteLine("娣诲姞鍒扮埗鎺т欢");
+ }
+ }
+
+ public override void DeleteBackward()
+ {
+ base.DeleteBackward();
+ EditTextView?.KeyEventAction?.Invoke(EditTextView, "Del");
+ }
+
+ internal System.Action EditorEnterAction;
+
+
+ [Export("textViewDidChange:")]
+ public new void Changed(UITextView textView)
+ {
+ this.EditTextView?.TextChangeEventHandler?.Invoke(this.EditTextView, Text);
+
+ //鍙栨秷鎸夐挳鐐瑰嚮鏉冮檺锛屽苟鏄剧ず鏂囧瓧
+ if (textView.Text.Length == 0)
+ {
+ placeholderUILabel.Hidden = false;
+ }
+ else
+ {
+ placeholderUILabel.Hidden = true;
+ }
+ }
+
+ [Export("textViewDidBeginEditing:")]
+ public void EditingStarted(UITextView textView)
+ {
+ Instance = this.EditTextView;
+ this.EditTextView?.FoucsChanged?.Invoke(this.EditTextView, new FocusEventArgs { Focus = true });
+ }
+ [Export("textViewDidEndEditing:")]
+ public void EditingEnded(UITextView textView)
+ {
+ this.EditTextView?.FoucsChanged?.Invoke(this.EditTextView, new FocusEventArgs { Focus = false });
+ }
+
+
+
+
+ nfloat x;
+
+ /// <summary>
+ /// 鐐瑰嚮寮�濮�
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesBegan(NSSet touches, UIEvent evt)
+ {
+ EditTextView?.TouchEvent(EventActions.Down, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 绉诲姩
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesMoved(NSSet touches, UIEvent evt)
+ {
+ EditTextView?.TouchEvent(EventActions.Move, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮寮硅捣
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesEnded(NSSet touches, UIEvent evt)
+ {
+ EditTextView?.TouchEvent(EventActions.Up, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ public override void TouchesCancelled(NSSet touches, UIEvent evt)
+ {
+ EditTextView?.TouchEvent(EventActions.Cancel, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ }
+ }
+ //public class FocusEventArgs : EventArgs
+ //{
+ // /// <summary>
+ // /// true 涓鸿幏鍙栧埌鐒︾偣
+ // /// false 鐒︾偣娑堝け
+ // /// </summary>
+ // public bool Focus;
+ //}
+
+
+// -(void) textViewDidChange:(UITextView*) textView
+// {
+// self.descLab.hidden = YES;
+// self.sendBtn.userInteractionEnabled = YES;
+// self.sendBtn.backgroundColor = MainColor;
+// //瀹炴椂鏄剧ず瀛楁暟
+// self.stringlenghtLab.text = [NSString stringWithFormat:@"%ld/100",(long)textView.text.length];
+
+// //瀛楁暟闄愬埗
+// if (textView.text.length >= 100) {
+// textView.text = [textView.text substringToIndex: 100];
+// }
+
+// //鍙栨秷鎸夐挳鐐瑰嚮鏉冮檺锛屽苟鏄剧ず鏂囧瓧
+// if (textView.text.length == 0) {
+// self.descLab.hidden = NO;
+// self.sendBtn.userInteractionEnabled = NO;
+// self.sendBtn.backgroundColor = [UIColor lightGrayColor];
+// }
+// }
+
+//-(BOOL) textView:(UITextView*) textView shouldChangeTextInRange:(NSRange) range replacementText:(NSString*) text
+// {
+// if ([text isEqualToString:@"\n"]) {
+
+
+// [self.FKTextView resignFirstResponder];
+
+// return NO;
+// }
+
+// return YES;
+//}
+}
+
+
diff --git a/Shared.IOS/UI/Enum.cs b/Shared.IOS/UI/Enum.cs
new file mode 100755
index 0000000..338ebbf
--- /dev/null
+++ b/Shared.IOS/UI/Enum.cs
@@ -0,0 +1,85 @@
+锘�
+namespace Shared
+{
+
+ public static class LayoutParams
+ {
+ public static readonly int MatchParent=int.MinValue;
+ }
+
+ public enum EventType
+ {
+ Down,
+ Up,
+ Long
+ }
+
+ public enum Animate
+ {
+ None,
+ UpToDown,
+ DownToUp,
+ LeftToRight,
+ RightToLeft,
+ Rotation
+ }
+
+ /// <summary>
+ /// 閮ㄥ眬鏂瑰悜
+ /// </summary>
+ public enum Orientation
+ {
+ Horizontal,
+ Vertical
+ }
+ public enum Device
+ {
+ Android,
+ Ios,
+ Phone
+ }
+
+ public enum Color
+ {
+ Red=0xFF0000,
+ Green=0x00FF00,
+ Blue=0x0000FF
+ }
+
+
+
+ public enum Gravity
+ {
+ TopLeft,
+ TopCenter,
+ TopRight,
+ CenterLeft,
+ Center,
+ CenterRight,
+ BottomLeft,
+ BottomCenter,
+ BottomRight,
+ CenterVertical,
+ CenterHorizontal,
+ Frame
+ }
+
+ /// <summary>
+ /// Vertical alignment.
+ /// </summary>
+ public enum TextAlignment
+ {
+ TopLeft,
+ TopCenter,
+ TopRight,
+ CenterLeft,
+ Center,
+ CenterRight,
+ BottomLeft,
+ BottomCenter,
+ BottomRight,
+
+ }
+}
+
+
diff --git a/Shared.IOS/UI/FrameLayout.cs b/Shared.IOS/UI/FrameLayout.cs
new file mode 100644
index 0000000..33da965
--- /dev/null
+++ b/Shared.IOS/UI/FrameLayout.cs
@@ -0,0 +1,104 @@
+锘縰sing System;
+using UIKit;
+using Shared.IO;
+using CoreGraphics;
+using Foundation;
+
+namespace Shared
+{
+ /// <summary>
+ /// 缁濆浣嶇疆甯冨眬锛屽凡缁忓叏闈㈡鏌�
+ /// </summary>
+ public class FrameLayout:ViewGroup
+ {
+ /// <summary>
+ /// 缁濆甯冨眬
+ /// </summary>
+ public FrameLayout()
+ {
+ try
+ {
+ viewGroup = new MyFrameLayout(this) { };
+
+ realViewGroup = viewGroup;
+ }catch(Exception ex)
+ {
+ Console.WriteLine($"鍒濆鍖栧竷灞�寮傚父锛歕r\n{ex.Message}");
+ CommonClass.ExcptionEvent(ex);
+ }
+ }
+
+ internal FrameLayout(UIView frameLayout)
+ {
+ try
+ {
+ viewGroup = frameLayout;
+ realViewGroup = viewGroup;
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"鍒濆鍖栧竷灞�寮傚父锛歕r\n{ex.Message}");
+ CommonClass.ExcptionEvent(ex);
+ }
+ }
+ }
+
+ public class MyFrameLayout : UIView
+ {
+ [Weak] View view;
+ public MyFrameLayout(View view)
+ {
+ this.view = view;
+ //瓒呭嚭鍖哄煙涓嶆樉绀�
+ Layer.MasksToBounds = true;
+ }
+
+
+ /// <summary>
+ /// 鐐瑰嚮寮�濮�
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesBegan(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Down, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 绉诲姩
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesMoved(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Move, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮寮硅捣
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesEnded(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Up, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ public override void TouchesCancelled(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Cancel, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 鍥犱负杩欎釜瑙嗗浘寰堝鎬紝浼氳嚜鍔ㄥ姞浜嗕袱涓猆IImageView锛屾墍浠ヨ繖涓壒娈婂鐞嗕竴涓�
+ /// </summary>
+ /// <param name="view">View.</param>
+ public override void AddSubview(UIView view)
+ {
+ if (view.GetType() == typeof(UIImageView) && view.Tag != int.MinValue)
+ {
+ return;
+ }
+ base.AddSubview(view);
+ }
+ }
+}
+
diff --git a/Shared.IOS/UI/GDMapView.cs b/Shared.IOS/UI/GDMapView.cs
new file mode 100644
index 0000000..47b5d06
--- /dev/null
+++ b/Shared.IOS/UI/GDMapView.cs
@@ -0,0 +1,43 @@
+锘縰sing System;
+using Shared.IOS.TBL;
+
+namespace Shared
+{
+ public static class GDMapKit
+ {
+ public static void Show(Action<double , double, int, string> action, string titleName = "", string saveName = "淇濆瓨", bool bSetHome = false, double mLatitude = 0.0, double mLongitude = 0.0, int mRadius = 500)
+ {
+
+
+ GDMapViewController mGDMapViewController = new GDMapViewController();
+
+ mGDMapViewController.TitleName = titleName;
+ mGDMapViewController.Gd_save = saveName;
+
+ mGDMapViewController.MSaveButtonCallBack += (mmLatitude, mmLongitude, mmRadius, addressName) =>
+ {
+ action?.Invoke(mmLatitude, mmLongitude, mmRadius, addressName);
+ };
+
+
+ Application.currentVC.NavigationController.PushViewController(mGDMapViewController, true);
+
+
+ if (bSetHome && (mLatitude != 0.0) && (mLongitude != 0.0))
+ {
+ //mGDMapViewController.MRadius = mRadius;
+ mGDMapViewController.SetmHomeCoordinate(mLatitude, mLongitude, mRadius);
+ Shared.HDLUtils.WriteLine("GDMapKitShow: " + mLongitude + "-" + mLatitude);
+ }
+
+ }
+
+
+ public static void setGDApiKey(string KEY)
+ {
+
+ AMapServices.SharedServices.ApiKey = KEY;
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/Shared.IOS/UI/GestureLockView.cs b/Shared.IOS/UI/GestureLockView.cs
new file mode 100644
index 0000000..66889d9
--- /dev/null
+++ b/Shared.IOS/UI/GestureLockView.cs
@@ -0,0 +1,243 @@
+锘縰sing System;
+
+using Shared.IOS.TBL;
+
+
+namespace Shared
+{
+
+
+
+ /// <summary>
+ /// GestureLockView
+ /// </summary>
+ public class GestureLockView : View
+ {
+ /// <summary>
+ /// 褰撳墠瑙嗗浘
+ /// </summary>
+ /// <value>The GestureLockView.</value>
+ HDLGestureLockView mHDLGestureLockView
+ {
+ get
+ {
+ return uiView as HDLGestureLockView;
+ }
+ set
+ {
+ uiView = value;
+ }
+ }
+
+
+
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public GestureLockView()
+ {
+ mHDLGestureLockView = new HDLGestureLockView
+ {
+
+ Delegate = new OnLockVerifyListener(this)
+ };
+
+ }
+
+
+ /// <summary>
+ /// 鍒锋柊甯冨眬
+ /// </summary>
+ private void RefreshFrame()
+ {
+ mHDLGestureLockView.InitWithFrameLockView(new CoreGraphics.CGRect(base.X, base.Y, base.Width, base.Height));
+ }
+
+ /// <summary>
+ /// 鎺т欢瀹藉害
+ /// </summary>
+ public override int Width
+ {
+ get
+ {
+ return base.Width;
+ }
+ set
+ {
+ base.Width = value;
+ RefreshFrame();
+
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨勯珮搴�
+ /// </summary>
+ public override int Height
+ {
+ get
+ {
+ return base.Height;
+ }
+ set
+ {
+ base.Height = value;
+ RefreshFrame();
+
+ }
+ }
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int X
+ {
+ get
+ {
+ return base.X;
+ }
+ set
+ {
+ base.X = value;
+ RefreshFrame();
+
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int Y
+ {
+ get
+ {
+ return base.Y;
+ }
+ set
+ {
+ base.Y = value;
+ RefreshFrame();
+
+ }
+ }
+
+
+
+
+ /// <summary>
+ /// 璁剧疆姝g‘鍜屾櫘閫氭椂鐨勯鑹�
+ /// </summary>
+ /// <value>绾块鑹�</value>
+ public uint LockViewCorrectColor
+ {
+ set
+ {
+
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+
+ mHDLGestureLockView.SelectedLineColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+
+ }
+ }
+
+
+
+ /// <summary>
+ /// 璁剧疆閿欒鏃剁殑棰滆壊
+ /// </summary>
+ /// <value>绾块鑹�</value>
+ public uint LockViewErrorColor
+ {
+ set
+ {
+
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+
+ mHDLGestureLockView.ErrorLineColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ //mHDLArcSeekBar.SetProgressTextColor(UIKit.UIColor.FromRGBA(r, g, b, a));
+
+ }
+ }
+
+ /// <summary>
+ /// 榛樿鍦嗙偣鑳屾櫙棰滆壊
+ /// </summary>
+ /// <value>绾块鑹�</value>
+ public uint LockViewNormalColor
+ {
+ set
+ {
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+ mHDLGestureLockView.NormalColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+ }
+
+
+ /// <summary>
+ /// 鏄剧ず鎵嬪娍瑙i攣view 鏄惁鏄剧ず姝g‘
+ /// </summary>
+ public void showCorrectStatus(bool isTrue)
+ {
+ mHDLGestureLockView.ShowErrorStatus = !isTrue;
+ }
+
+ /// <summary>
+ /// 璁剧疆鏄惁涓哄疄蹇冨渾褰㈣В閿佹牱寮�
+ /// </summary>
+ public void SetSolidType(bool isTrue)
+ {
+ mHDLGestureLockView.SetSolidType(isTrue);
+ }
+
+
+ /// <summary>
+ /// Action
+ /// </summary>
+ public Action<string, int> OnLockVerifyEvent;
+
+ /// <summary>
+ /// OnLockVerifyListener 鎵嬪娍婊戝姩缁撴潫
+ /// </summary>
+ OnLockVerifyListener mOnLockVerifyListener;
+
+ public class OnLockVerifyListener : SSGestureLockViewDelegate
+ {
+
+ [Weak] GestureLockView _GestureLockView;
+
+ public OnLockVerifyListener(GestureLockView view)
+ {
+ _GestureLockView = view;
+ }
+
+ public override void onDidSelectedGestureLockView(string selectNumStr, int selectCount) {
+ _GestureLockView.OnLockVerifyEvent?.Invoke(selectNumStr, selectCount);
+ }
+ //public override void SelectIndex2(nint selectIndex1, nint selectIndex2, nint selectIndex3)
+ //{
+ // _GestureLockView.OnLockVerifyEvent?.Invoke();
+ //}
+
+ //public override void OnProgressChanged(int mProgress)
+ //{
+ // _WaveSeekBar.OnProgressChangedEvent?.Invoke(this, mProgress);
+ //}
+
+
+ }
+ }
+}
diff --git a/Shared.IOS/UI/GradientMaskView.cs b/Shared.IOS/UI/GradientMaskView.cs
new file mode 100644
index 0000000..ad2cf63
--- /dev/null
+++ b/Shared.IOS/UI/GradientMaskView.cs
@@ -0,0 +1,292 @@
+锘縰sing System;
+using CoreGraphics;
+using Foundation;
+using UIKit;
+
+namespace Shared
+{
+ public class GradientMaskView : View
+ {
+
+ GradientButton mGradientButton
+ {
+ get
+ {
+ return uiView as GradientButton;
+ }
+ set
+ {
+ uiView = value;
+ }
+ }
+
+
+
+ public GradientMaskView()
+ {
+ mGradientButton = new GradientButton(this) { };
+ SetGradientColors(mGradientColors);
+ }
+
+ //CAGradientLayer gradient = new CAGradientLayer();
+ //void SetCAGradientLayer()
+ //{
+
+ // gradient.Colors = new CoreGraphics.CGColor[] { startUIColor.CGColor, endUIColor.CGColor };
+ // gradient.StartPoint = new CoreGraphics.CGPoint(0, 0);
+ // gradient.EndPoint = new CoreGraphics.CGPoint(0.0, 1.0);
+ // //gradient.Locations = new Foundation.NSNumber[] { 0.0, 1.0};
+ // gradient.Frame = iosButton.Bounds;
+ // iosButton.Layer.AddSublayer(gradient);
+ //}
+
+ /// <summary>
+ /// 鍒锋柊甯冨眬
+ /// </summary>
+ private void RefreshFrame()
+ {
+ (uiView as GradientButton).InitWithFrameArc(new CoreGraphics.CGRect(base.X, base.Y, base.Width, base.Height));
+ }
+
+ /// <summary>
+ /// 鎺т欢瀹藉害
+ /// </summary>
+ public override int Width
+ {
+ get
+ {
+ return base.Width;
+ }
+ set
+ {
+ base.Width = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨勯珮搴�
+ /// </summary>
+ public override int Height
+ {
+ get
+ {
+ return base.Height;
+ }
+ set
+ {
+ base.Height = value;
+ RefreshFrame();
+ }
+ }
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int X
+ {
+ get
+ {
+ return base.X;
+ }
+ set
+ {
+ base.X = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int Y
+ {
+ get
+ {
+ return base.Y;
+ }
+ set
+ {
+ base.Y = value;
+ RefreshFrame();
+ }
+ }
+
+
+
+
+ public bool IsShow
+ {
+ get
+ {
+ return mGradientButton.IsShow;
+
+ }
+ set
+ {
+ mGradientButton.IsShow = value;
+
+ }
+
+ }
+
+
+ /// <summary>
+ /// 0%锛�25%锛�50%锛�80%
+ /// </summary>
+ uint[] mGradientColors = { 0x00000000, 0x40000000, 0x80000000, 0xCC000000 };
+ public uint[] GradientColors {
+ get
+ {
+ return mGradientColors;
+
+ }
+ set
+ {
+ mGradientColors = value;
+ SetGradientColors(mGradientColors);
+
+ }
+ }
+
+ void SetGradientColors(uint[] colors) {
+ if (colors == null || colors.Length == 0) return;
+
+ CGColor[] mCGColors = new CGColor[colors.Length];
+
+ for (int i = 0; i < colors.Length; i++) {
+ mCGColors[i] = HDLUtils.GetUIColorWithUint(colors[i]).CGColor;
+ }
+ mGradientButton.GradientColors = mCGColors;
+ }
+
+ public class GradientButton : UIKit.UIView
+ {
+ /// <summary>
+ /// 鍒锋柊甯冨眬
+ /// </summary>
+ public void InitWithFrameArc(CGRect mCGRect)
+ {
+ this.Frame = mCGRect;
+ }
+
+ [Weak] View view;
+ public GradientButton(View view)
+ {
+ this.view = view;
+ }
+
+
+
+ bool isShow = true;
+ public bool IsShow
+ {
+ get
+ {
+ return isShow;
+ }
+ set
+ {
+ isShow = value;
+ SetNeedsDisplay();
+ }
+ }
+
+ public override void Draw(CGRect rect)
+ {
+ base.Draw(rect);
+
+ if (isShow)
+ {
+ CGContext ctx = UIGraphics.GetCurrentContext();
+ if (ctx == null) return;
+ ctx.SaveState();
+ DrawWithGradient(ctx, rect);
+ ctx.RestoreState();
+ }
+
+ }
+
+
+ /// <summary>
+ /// 缁樺埗娓愬彉鏁堟灉
+ /// </summary>
+ /// <param name="ctx"></param>
+ /// <param name="rect"></param>
+ void DrawWithGradient(CGContext ctx, CGRect rect)
+ {
+ // 鍒涘缓涓�涓笎鍙樿壊
+ // 鍒涘缓RGB鑹插僵绌洪棿锛屽垱寤鸿繖涓互鍚庯紝context閲岄潰鐢ㄧ殑棰滆壊閮芥槸鐢≧GB琛ㄧず
+ CGColorSpace colorSpace = CGColorSpace.CreateDeviceRGB();
+ CGGradient gradient = new CGGradient(colorSpace, mGradientColors);
+ // 閲婃斁鑹插僵绌洪棿
+ colorSpace.Dispose();
+ colorSpace = null;
+ // 鍓璺緞
+ ctx.Clip();
+ // 鐢ㄦ笎鍙樿壊濉厖
+ ctx.DrawLinearGradient(gradient, new CGPoint(rect.X, rect.Top), new CGPoint(rect.X, rect.Bottom), CGGradientDrawingOptions.None);
+ // 閲婃斁娓愬彉鑹�
+ gradient.Dispose();
+ gradient = null;
+
+ ctx.RestoreState();
+ ctx.SaveState();
+ }
+
+ public CGColor[] mGradientColors = { UIColor.Clear.CGColor};
+
+ public CGColor[] GradientColors {
+ get
+ {
+ return mGradientColors;
+ }
+ set
+ {
+ mGradientColors = value;
+ SetNeedsDisplay();
+ }
+ }
+
+
+
+ /// <summary>
+ /// 鐐瑰嚮寮�濮�
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesBegan(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Down, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 绉诲姩
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesMoved(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Move, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮寮硅捣
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesEnded(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Up, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ public override void TouchesCancelled(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Cancel, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+
+ }
+ }
+}
diff --git a/Shared.IOS/UI/HorizontalPages.cs b/Shared.IOS/UI/HorizontalPages.cs
new file mode 100644
index 0000000..938bc33
--- /dev/null
+++ b/Shared.IOS/UI/HorizontalPages.cs
@@ -0,0 +1,890 @@
+using System;
+using UIKit;
+using Shared.IO;
+using CoreGraphics;
+using Foundation;
+using CoreAnimation;
+
+namespace Shared
+{
+ /// <summary>
+ /// 浣嶇疆甯冨眬
+ /// </summary>
+ public class HorizontalPages : ViewGroup
+ {
+ readonly MyHorizontalPages iosUIScrolView;
+
+ /// <summary>
+ /// 椤甸潰鍙樺寲浜嬩欢
+ /// </summary>
+ public Action<HorizontalPages, int> PageChange;
+
+ /// <summary>
+ /// 寮�濮嬫粦鍔ㄤ簨浠�
+ /// </summary>
+ public Action StartScrollAction;
+ /// <summary>
+ /// 缁撴潫婊戝姩浜嬩欢
+ /// </summary>
+ public Action EndScrollAction ;
+
+ /// <summary>
+ /// 娌℃湁鏇村鎻愮ずAction锛屽凡缁忔槸鏈�鍚庝竴涓�
+ /// </summary>
+ public Action NoMoreAction;
+
+ //ImageView LeftImageView = new ImageView() { ImagePath = "RoomIcon/1.jpg" };
+ //ImageView RightImageView = new ImageView() { ImagePath = "RoomIcon/2.jpg" };
+
+
+
+
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public HorizontalPages()
+ {
+ viewGroup = new UIView();
+ iosUIScrolView = new MyHorizontalPages(this) { };
+ iosUIScrolView.Bounces = false;
+ InitMyHorizontalPagesEvent();
+ realViewGroup = iosUIScrolView;
+ //鍚姩缈婚〉鍔熻兘
+ //iosUIScrolView.PagingEnabled = true;
+ iosUIScrolView.ShowsHorizontalScrollIndicator = false;
+ viewGroup.AddSubview(iosUIScrolView);
+ pagePadding = Application.GetRealWidth(50);
+ rowPadding = Application.GetRealWidth(100);
+ mTCBJ = Application.GetRealWidth(50);
+
+ }
+
+ ImageView LeftImageView;
+ ImageView RightImageView;
+ /// <summary>
+ /// 鏄惁璁剧疆浜嗚櫄鍋囪儗鏅疺iew 璁剧疆浜嗘墠鏄剧ず
+ /// </summary>
+ bool IsSetLeftAndRightImageView = false;
+ /// <summary>
+ /// 璁剧疆鎺у埗鏈�宸﹀拰鏈�鍙�2杈癸紝濉厖鐨勫亣鑳屾櫙View锛屼笉璁剧疆涓嶆樉绀猴紝闇�瑕佸湪AddChidren 鍓嶈皟鐢ㄨ鏂规硶
+ /// </summary>
+ /// <param name="mLeftImageView"></param>
+ /// <param name="mRightImageView"></param>
+ public void SetLeftAndRightImageView(ImageView mLeftImageView, ImageView mRightImageView)
+ {
+ if (mLeftImageView == null) return;
+
+ if (mRightImageView == null) return;
+
+ //璁剧疆涔嬪墠鍏堟竻绌轰竴娆�
+ foreach (var view in iosUIScrolView.Subviews)
+ {
+ view.RemoveFromSuperview();
+ }
+
+ LeftImageView = mLeftImageView;
+ iosUIScrolView.AddSubview(LeftImageView.RealView);
+ LeftImageView.Parent = this;
+ LeftImageView.Refresh();
+
+ RightImageView = mRightImageView;
+ iosUIScrolView.AddSubview(RightImageView.RealView);
+ RightImageView.Parent = this;
+ RightImageView.Refresh();
+
+ IsSetLeftAndRightImageView = true;
+
+ }
+
+ bool isNoMore;
+ bool isStart;
+ int mTouchSlop = 20;
+ nfloat beforeXScrollX;
+ nfloat moveX;
+ void InitMyHorizontalPagesEvent()
+ {
+
+
+ iosUIScrolView.Scrolled += (s, e) =>
+ {
+ //Shared.HDLUtils.WriteLine($"HorizontalPages Scrolled ContentOffsetX:{iosUIScrolView.ContentOffset.X}");
+ moveX = iosUIScrolView.ContentOffset.X - beforeXScrollX;
+ RefreshPageView();
+
+ if (mTouchSlop < Math.Abs(moveX))
+ {
+ if (!isStart)
+ {
+
+ //褰撳墠绱㈠紩涓猴紝涓嶆槸绗竴涓垨鑰呮渶鍚庝竴涓紝婊戝姩璺濈澶т簬瑙﹀彂璺濈骞朵笖娌℃墽琛岃繃鍒� 鎵ц涓�娆tartScrollAction
+ if ((moveX > 0 && PageIndex < ChildrenCount - 1) || (moveX < 0 && PageIndex > 0))
+ {
+ isStart = true;
+ StartScrollAction?.Invoke();
+ }
+
+ }
+
+
+ if (!isNoMore && !bSendPageChange)
+ {
+ //褰撳墠绱㈠紩涓虹涓�涓垨鑰呮渶鍚庝竴涓紝婊戝姩璺濈澶т簬瑙﹀彂璺濈銆佹病鎵ц杩囥�丳ageIndex娌″彉鍖栥�佸垯鎵ц涓�娆oMoreAction
+ if ((moveX > 0 && PageIndex == ChildrenCount - 1 && iosUIScrolView.ContentOffset.X > iosUIScrolView.ContentSize.Width - iosUIScrolView.Frame.Width) || (moveX < 0 && PageIndex == 0 && iosUIScrolView.ContentOffset.X < 0))
+ {
+ isNoMore = true;
+ NoMoreAction?.Invoke();
+ }
+
+ }
+ }
+
+
+ };
+
+ iosUIScrolView.DraggingStarted += (sender, e) =>
+ {
+ //Shared.HDLUtils.WriteLine("HorizontalPages DraggingStarted");
+ SetIsScrolling(true);
+ beforeXScrollX = iosUIScrolView.ContentOffset.X;
+ isStart = false;
+ isNoMore = false;
+ //StartScrollAction?.Invoke();
+ };
+
+ iosUIScrolView.DecelerationStarted += (s, e) =>
+ {
+ GetMovePageIndex();
+
+ };
+
+ iosUIScrolView.DecelerationEnded += (s, e) =>
+ {
+
+ if (!bSendPageChange && (PageIndex == ChildrenCount - 1 || PageIndex == 0 )) {
+ //褰撳墠绱㈠紩涓猴紝绗竴涓垨鑰呮渶鍚庝竴涓紝骞朵笖涔嬪墠鎵ц杩囧紑濮婣ction
+ SendEndScrollAction();
+
+
+ }
+
+ };
+
+ iosUIScrolView.DraggingEnded += (s, e) =>
+ {
+ if (!e.Decelerate)
+ {
+ GetMovePageIndex();
+ }
+ };
+
+ iosUIScrolView.ScrollAnimationEnded += (s, e) =>
+ {
+ //Shared.HDLUtils.WriteLine("HorizontalPages ScrollAnimationEnded");
+ SendIfPageChange();
+ SetIsScrolling(false);
+ };
+ }
+
+
+ private void GetMovePageIndex()
+ {
+
+ if (mTouchSlop < Math.Abs(moveX))
+ {
+ if (moveX < 0)
+ {
+ PageIndex -= 1;
+ }
+ else if (moveX > 0)
+ {
+ PageIndex += 1;
+ }
+ }
+ else
+ {
+ PageIndex = PageIndex;
+
+ }
+
+ }
+
+ //涓や釜Page鐣岄潰涔嬮棿鐨勮窛绂�
+ int pagePadding;
+ /// <summary>
+ /// 鐣岄潰涔嬮棿鐨勮竟璺�
+ /// </summary>
+ public int JMBJ
+ {
+ get
+ {
+ return pagePadding;
+ }
+ set
+ {
+ pagePadding = value;
+ rowPadding = mTCBJ + pagePadding;
+ RefreshScrollWidth();
+ ReLocation();
+ }
+ }
+
+ //page鐨勪笌鎵嬫満灞忓箷鐨勮竟璺� = 绐佸嚭瀹藉害 + 涓や釜Page涔嬮棿鐨勮窛绂�
+ int rowPadding;
+ /// <summary>
+ /// 绐佸嚭瀹藉害
+ /// </summary>
+ int mTCBJ;
+ public int TCBJ
+ {
+ get
+ {
+ return mTCBJ;
+ }
+ set
+ {
+ mTCBJ = value;
+ rowPadding = mTCBJ + pagePadding;
+ RefreshScrollWidth();
+ ReLocation();
+ }
+ }
+
+ int mScrollWidth;
+ int mPageWidth;
+ private void RefreshScrollWidth()
+ {
+ mScrollWidth = (int)this.RealView.Frame.Width - 2 * rowPadding + pagePadding;
+ mPageWidth = (int)this.RealView.Frame.Width - 2 * rowPadding;
+ }
+
+ /// <summary>
+ /// 鑷姩璁$畻鍒锋柊鎵�鏈塚iew鐨勯珮搴︼紝瀹炵幇缂╂斁鏁堟灉
+ /// </summary>
+ private void RefreshPageView()
+ {
+ //RefreshView();
+ //RefreshViewWithTransform3D();
+ //RefreshViewWithChangeHeight();
+ RefreshViewWithChangeHeightNew();
+ //RefreshViewWithChangeHeightSF();
+ }
+
+ //********************Transform3D 鏃嬭浆鏁堟灉鏂规硶**********************
+ //榛樿25搴�
+ nfloat transformAngle = (nfloat)(25 * Math.PI / 180.0);
+ //鏃嬭浆瑙掑害
+ public int TransformAngle
+ {
+ set
+ {
+ transformAngle = (nfloat)(value * Math.PI / 180.0);
+ }
+ }
+
+ ///// <summary>
+ ///// 鏃嬭浆鏁堟灉
+ ///// </summary>
+ //public void RefreshViewWithTransform3D()
+ //{
+ // if (ChildrenCount <= 0) return;
+
+ // if (PageIndex > ChildrenCount - 1)
+ // {
+ // PageIndex = ChildrenCount - 1;
+ // }
+
+ // // - 鍗曚綅鐭╅樀
+ // CATransform3D transform = CATransform3D.Identity;
+ // // - 澧炲姞閫忚鏁堟灉
+ // transform.m34 = (nfloat)(-1.0 / 500);
+ // var mRotate = transform.Rotate(0, 0f, 1f, 0f);
+ // iosUIScrolView.Subviews[PageIndex].Layer.Transform = mRotate;
+
+
+ // //鍒ゆ柇PageIndex 鍓嶅悗鏄惁鏈塿iew锛屽苟鏃嬭浆
+ // if (PageIndex - 1 >= 0)
+ // {
+ // var mRotate1 = transform.Rotate(transformAngle, 0f, 1f, 0f);
+ // iosUIScrolView.Subviews[PageIndex - 1].Layer.Transform = mRotate1;
+ // }
+
+ // if (PageIndex <= ChildrenCount - 2)
+ // {
+ // var mRotate2 = transform.Rotate(-1 * transformAngle, 0f, 1f, 0f);
+ // iosUIScrolView.Subviews[PageIndex + 1].Layer.Transform = mRotate2;
+ // }
+
+
+
+
+ //}
+
+ /// <summary>
+ /// 鍒锋柊鏈�澶ц窛绂诲��
+ /// </summary>
+ double MaxDistance;
+
+
+ private void RefreshViewWithChangeHeight()
+ {
+ if (ChildrenCount <= 0) return;
+
+ if (PageIndex > ChildrenCount - 1)
+ {
+ PageIndex = ChildrenCount - 1;
+ }
+
+ MaxDistance = Width - 2 * TCBJ - JMBJ;
+ double centerX = iosUIScrolView.ContentOffset.X + iosUIScrolView.Frame.Width * 0.5;
+
+ foreach (UIView mSubview in iosUIScrolView.Subviews)
+ {
+
+ double distance = Math.Abs(mSubview.Center.X - centerX);
+ var HH = 0;
+ if (distance <= 0)
+ {
+ HH = 0;
+ }
+ else if (distance >= MaxDistance)
+ {
+ HH = JMBJ;
+ }
+ else
+ {
+ HH = (int)((distance / MaxDistance) * JMBJ);
+
+ }
+ var mFrame = mSubview.Frame;
+ mFrame.Height = Height - HH * 2;
+ mFrame.Y = HH;
+ mSubview.Frame = mFrame;
+
+ //mSubview.MaskView
+
+
+ //double distance = Math.Abs(mSubview.Center.X - centerX);
+ //double factor = 0.01;
+ //float scale = (float)(1.0 / (1 + distance * factor));
+
+ ////var mFrame = mSubview.Frame;
+ ////mFrame.Height = Height * scale;
+ ////mFrame.Y = (Height - mFrame.Height) / 2;
+ ////mSubview.Frame = mFrame;
+
+ //var mFrame = mSubview.Frame;
+ //var HH = (int)(MaxChangeHeight - MaxChangeHeight * scale);
+ //mFrame.Height = Height - HH;
+ //mFrame.Y = HH / 2;
+ //mSubview.Frame = mFrame;
+
+ }
+ }
+
+ /// <summary>
+ /// 鍚屾椂鍒锋柊瀛恦iew 鍜孖mageView鐨勯珮搴︼紝鏆傛椂瑙e喅搴曢儴鍦嗚澶辨晥闂
+ /// </summary>
+ /// <param name="mView"></param>
+ /// <param name="height"></param>
+ void RefreshSubviewHeight(View mView, nfloat height)
+ {
+ try
+ {
+ if (mView is ViewGroup)
+ {
+ var tempViewGroup = (ViewGroup)mView;
+ for (int i = 0; i < tempViewGroup.ChildrenCount; i++)
+ {
+ if (tempViewGroup.GetChildren(i) is ViewGroup)
+ {
+ var tempViewGroup2 = (ViewGroup)tempViewGroup.GetChildren(i);
+ for (int j = 0; j < tempViewGroup2.ChildrenCount; j++)
+ {
+ if (tempViewGroup2.GetChildren(j) is ImageView && tempViewGroup2.GetChildren(j).Tag.ToString() == "R")
+ {
+
+ tempViewGroup2.GetChildren(j).Height = (int)height;
+ break;
+ }
+ }
+ if (tempViewGroup2.Tag.ToString() == "R")
+ {
+ tempViewGroup2.Height = (int)height;
+ break;
+ }
+ }
+
+ }
+ }
+ }
+ catch { }
+ }
+
+ /// <summary>
+ /// 璁$畻婊戝姩缂╂斁楂樺害鐨勬柟娉�
+ /// </summary>
+ private void RefreshViewWithChangeHeightNew()
+ {
+ if (ChildrenCount <= 0) return;
+
+ if (PageIndex > ChildrenCount - 1)
+ {
+ PageIndex = ChildrenCount - 1;
+ }
+
+ MaxDistance = Width - 2 * TCBJ - JMBJ;
+ double centerX = iosUIScrolView.ContentOffset.X + iosUIScrolView.Frame.Width * 0.5;
+
+ for (int i = 0; i < ChildrenCount; i++)
+ {
+ var mSubview = GetChildren(i).RealView;
+ var view = GetChildren(i);
+ double distance = Math.Abs(mSubview.Center.X - centerX);
+ var HH = 0;
+ if (distance <= 0)
+ {
+ HH = 0;
+ }
+ else if (distance >= MaxDistance)
+ {
+ HH = JMBJ;
+ }
+ else
+ {
+ HH = (int)((distance / MaxDistance) * JMBJ);
+
+ }
+ var mFrame = mSubview.Frame;
+ mFrame.Height = Height - HH * 2;
+ mFrame.Y = HH;
+ mSubview.Frame = mFrame;
+
+ RefreshSubviewHeight(view, mFrame.Height);
+ }
+ }
+
+ //private void RefreshViewWithChangeHeightSF()
+ //{
+ // if (ChildrenCount <= 0) return;
+
+ // if (PageIndex > ChildrenCount - 1)
+ // {
+ // PageIndex = ChildrenCount - 1;
+ // }
+
+ // MaxDistance = Width - 2 * TCBJ - JMBJ;
+ // double centerX = iosUIScrolView.ContentOffset.X + iosUIScrolView.Frame.Width * 0.5;
+
+ // foreach (UIView mSubview in iosUIScrolView.Subviews)
+ // {
+
+ // double distance = Math.Abs(mSubview.Center.X - centerX);
+ // nfloat HH = 1;
+ // if (distance <= 0)
+ // {
+ // mSubview.Transform = CGAffineTransform.MakeScale(1.0f, 1.0f);
+ // }
+ // else if (distance >= MaxDistance)
+ // {
+ // mSubview.Transform = CGAffineTransform.MakeScale(1.0f, 0.8f);
+ // }
+ // else
+ // {
+ // HH = (nfloat)((1-distance / MaxDistance) * 0.2f) + 0.8f;
+ // mSubview.Transform = CGAffineTransform.MakeScale(1.0f, 0.8f);
+ // }
+
+ // }
+ //}
+
+ /// <summary>
+ /// 鏄惁鍏佽婊戝姩
+ /// </summary>
+ /// <value><c>true</c> if scroll enabled; otherwise, <c>false</c>.</value>
+ public bool ScrollEnabled
+ {
+ get
+ {
+ return (iosUIScrolView as MyHorizontalPages).ScrollEnabled;
+ }
+ set
+ {
+ (iosUIScrolView as MyHorizontalPages).ScrollEnabled = value;
+ }
+ }
+
+ int pageIndex;
+ /// <summary>
+ /// 璁剧疆鎴栬�呰幏鍙栧綋鍓嶇殑鐣岄潰绱㈠紩
+ /// </summary>
+ /// <value>The index of the page.</value>
+ public int PageIndex
+ {
+ get
+ {
+ return pageIndex;
+ }
+ set
+ {
+ if (value < 0 || ChildrenCount <= value)
+ {
+
+ return;
+ }
+ int beforePageIndex = pageIndex;
+ pageIndex = value;
+ if (!IsCanRefresh)
+ {
+ return;
+ }
+
+ var viewSize = iosUIScrolView.Frame.Size;
+
+ RefreshPageView();
+ var rect = new CGRect(pageIndex * viewSize.Width, 0, viewSize.Width, viewSize.Height);
+ if (pageIndex != 0)
+ {
+ var frame = GetChildren(pageIndex).RealView.Frame;
+ var w = frame.X - rowPadding;
+
+ rect = new CGRect(w, 0, viewSize.Width, viewSize.Height);
+ //Shared.HDLUtils.WriteLine($"CGRect xx-------{w}");
+ }
+
+ //Shared.HDLUtils.WriteLine($"pageIndex xx-------{pageIndex}");
+ iosUIScrolView.ScrollRectToVisible(rect, true);
+
+ if (beforePageIndex != pageIndex)
+ {
+ bSendPageChange = true;//鍙戦�佹敼鍙樻爣蹇�
+ if (!isStart)
+ {
+ isStart = true;
+ StartScrollAction?.Invoke();
+ }
+ }
+ else
+ {
+ SendEndScrollAction();
+ }
+
+
+ }
+ }
+
+ /// <summary>
+ /// 鍒ゆ柇鏄惁闇�瑕佸彂閫佺粨鏉熸粦鍔ㄤ簨浠�
+ /// </summary>
+ void SendEndScrollAction() {
+ if (isStart)
+ {
+ isStart = false;
+ EndScrollAction?.Invoke();
+ }
+ }
+
+ bool bSendPageChange = false;
+ /// <summary>
+ /// 鍒ゆ柇鏄惁瑕佸彂閫佹敼鍙樹簨浠�
+ /// </summary>
+ private void SendIfPageChange()
+ {
+ if (bSendPageChange)
+ {
+ bSendPageChange = false;
+ PageChange?.Invoke(this, pageIndex);
+ }
+
+ //鍒ゆ柇鏄惁闇�瑕佸彂閫佺粨鏉熸粦鍔ㄤ簨浠�
+ SendEndScrollAction();
+ }
+
+ bool isScrolling;
+ /// <summary>
+ /// 鏄惁姝e湪婊戝姩
+ /// </summary>
+ public bool ISScrolling
+ {
+ get
+ {
+ return isScrolling;
+ }
+ }
+
+ private void SetIsScrolling(bool bSctolling)
+ {
+ if (isScrolling == bSctolling) return;
+
+ Shared.HDLUtils.WriteLine($"HorizontalPages StartScroll: {bSctolling}");
+ isScrolling = bSctolling;
+ }
+
+ /// <summary>
+ /// 鏄惁姝e湪婊戝姩
+ /// </summary>
+ /// <value><c>true</c> if decelerating; otherwise, <c>false</c>.</value>
+ public bool Decelerating
+ {
+ get
+ {
+ return iosUIScrolView.Decelerating;
+ }
+ }
+
+ //public void DelayPageChange()
+ //{
+ // PageChange?.Invoke(this, pageIndex);
+
+ // //new System.Threading.Thread(async () =>
+ // //{
+ // // System.Threading.Thread.Sleep(500);
+ // // Application.RunOnMainThread(() =>
+ // // {
+ // // PageChange?.Invoke(this, pageIndex);
+ // // });
+ // //})
+ // //{ IsBackground = true }.Start();
+ //}
+
+ /// <summary>
+ /// 澧炲姞瀛愭帶浠�
+ /// </summary>
+ /// <param name="view">View.</param>
+ public override void AddChidren(View view)
+ {
+ base.AddChidren(view);
+ ReLocation();
+ }
+
+ /// <summary>
+ /// 閲嶆柊鎺掍綅缃強璁惧鍐呭澶у皬
+ /// </summary>
+ public virtual void ReLocation()
+ {
+ try
+ {
+ if (ChildrenCount == 0)
+ {
+ return;
+ }
+
+
+ var frame0 = GetChildren(0).RealView.Frame;
+ frame0.X = rowPadding;
+ frame0.Y = 0;
+ frame0.Width = mPageWidth;
+ frame0.Height = iosUIScrolView.Frame.Height;
+ GetChildren(0).RealView.Frame = frame0;
+
+
+
+ for (int i = 1; i < ChildrenCount; i++)
+ {
+ var frame = GetChildren(i).RealView.Frame;
+
+ frame.Width = mPageWidth;
+ frame.Height = iosUIScrolView.Frame.Height;
+ frame.Y = 0;
+ //frame.X = iosUIScrolView.Subviews[i - 1].Frame.Right + pagePadding;
+ frame.X = rowPadding + (mPageWidth + pagePadding) * i;
+ GetChildren(i).RealView.Frame = frame;
+ }
+ iosUIScrolView.ContentSize = new CoreGraphics.CGSize(GetChildren(ChildrenCount - 1).RealView.Frame.Right + rowPadding, iosUIScrolView.Frame.Height);
+
+ //iosUIScrolView.ContentSize = new CoreGraphics.CGSize(iosUIScrolView.Subviews[ChildrenCount - 1].Frame.Right + rowPadding, iosUIScrolView.Frame.Height);
+
+ if (IsSetLeftAndRightImageView)
+ {
+ var leftFrame = iosUIScrolView.Subviews[0].Frame;
+ leftFrame.X = TCBJ - mPageWidth;
+ leftFrame.Y = JMBJ;
+ leftFrame.Width = mPageWidth;
+ leftFrame.Height = Height - JMBJ * 2;
+ iosUIScrolView.Subviews[0].Frame = leftFrame;
+
+
+ var rightFrame = iosUIScrolView.Subviews[1].Frame;
+ rightFrame.X = rowPadding + (mPageWidth + pagePadding) * (ChildrenCount);
+ rightFrame.Y = JMBJ;
+ rightFrame.Width = mPageWidth;
+ rightFrame.Height = Height - JMBJ * 2;
+ iosUIScrolView.Subviews[1].Frame = rightFrame;
+ }
+
+ RefreshPageView();
+ }
+ catch { }
+ }
+
+
+
+ /// <summary>
+ /// 鎺т欢瀹藉害
+ /// </summary>
+ /// <value>The width.</value>
+ public override int Width
+ {
+ get
+ {
+ return base.Width;
+ }
+ set
+ {
+ base.Width = value;
+
+ if (!IsCanRefresh)
+ return;
+
+
+ }
+ }
+
+ /// <summary>
+ /// 鎺т欢鐨勯珮搴�
+ /// </summary>
+ /// <value>The height.</value>
+ public override int Height
+ {
+ get
+ {
+ return base.Height;
+ }
+ set
+ {
+ base.Height = value;
+ if (!IsCanRefresh)
+ return;
+
+ }
+ }
+
+ /// <summary>
+ /// Bounces
+ /// </summary>
+ public bool Bounces
+ {
+ get
+ {
+ return iosUIScrolView.Bounces;
+ }
+ set
+ {
+ iosUIScrolView.Bounces = value;
+ }
+ }
+
+
+
+
+ /// <summary>
+ /// 绉婚櫎褰撳墠鎺т欢
+ /// </summary>
+ /// <param name="view">View.</param>
+ internal override void Remove(View view)
+ {
+ base.Remove(view);
+ ReLocation();
+
+ if (PageIndex > ChildrenCount - 1)
+ {
+ PageIndex = ChildrenCount - 1;
+ }
+
+ }
+
+ /// <summary>
+ /// 绉婚櫎鎵�鏈夌殑鎺т欢
+ /// </summary>
+ public override void RemoveAll()
+ {
+ base.RemoveAll();
+ ReLocation();
+ PageIndex = 0;
+ }
+
+ /// <summary>
+ /// 鏍规嵁绱㈠紩绉婚櫎鎺т欢
+ /// </summary>
+ /// <param name="index">Index.</param>
+ public override void RemoveAt(int index)
+ {
+ if (viewList.Count - 1 < index || index < 0)
+ {
+ return;
+ }
+ Remove(viewList[index]);
+ }
+
+
+ /// <summary>
+ /// 鍨傜洿鏂瑰悜婊氬姩瑙嗗浘
+ /// </summary>
+ class MyHorizontalPages : UIScrollView
+ {
+
+ [Weak] HorizontalPages HorizontalPages;
+ public MyHorizontalPages(HorizontalPages HorizontalPages)
+ {
+
+ this.HorizontalPages = HorizontalPages;
+ }
+
+ ///// <summary>
+ ///// 鐐瑰嚮寮�濮�
+ ///// </summary>
+ ///// <param name="touches">Touches.</param>
+ ///// <param name="evt">Evt.</param>
+ //public override void TouchesBegan(NSSet touches, UIEvent evt)
+ //{
+
+ // HorizontalPages?.TouchEvent(EventActions.Down, (touches.AnyObject as UITouch).LocationInView(this));
+
+ //}
+
+ //int mTouchSlop = 20;
+ //bool bMove;
+ ///// <summary>
+ ///// 绉诲姩
+ ///// </summary>
+ ///// <param name="touches">Touches.</param>
+ ///// <param name="evt">Evt.</param>
+ //public override void TouchesMoved(NSSet touches, UIEvent evt)
+ //{
+ // HorizontalPages?.TouchEvent(EventActions.Move, (touches.AnyObject as UITouch).LocationInView(this));
+
+ //}
+ ///// <summary>
+ ///// 鐐瑰嚮寮硅捣
+ ///// </summary>
+ ///// <param name="touches">Touches.</param>
+ ///// <param name="evt">Evt.</param>
+ //public override void TouchesEnded(NSSet touches, UIEvent evt)
+ //{
+ // HorizontalPages?.TouchEvent(EventActions.Up, (touches.AnyObject as UITouch).LocationInView(this));
+ //}
+
+ //public override void TouchesCancelled(NSSet touches, UIEvent evt)
+ //{
+ // HorizontalPages?.TouchEvent(EventActions.Cancel, (touches.AnyObject as UITouch).LocationInView(this));
+ //}
+ /// <summary>
+ /// 妗嗘灦榛樿鍔犱簡涓や釜UIImageView 锛岃繖鏍峰彲浠ュ幓鎺夐粯璁ゆ坊鍔�
+ /// </summary>
+ /// <param name="view">View.</param>
+ public override void AddSubview(UIView view)
+ {
+ if (view.GetType() == typeof(UIImageView) && view.Tag != int.MinValue)
+ {
+ return;
+ }
+
+ if (view.ToString().Contains("UIScrollViewScrollIndicator"))
+ {
+ return;
+ }
+ base.AddSubview(view);
+ }
+ }
+ }
+}
+
diff --git a/Shared.IOS/UI/HorizontalScrolViewLayout.cs b/Shared.IOS/UI/HorizontalScrolViewLayout.cs
new file mode 100644
index 0000000..6e6926c
--- /dev/null
+++ b/Shared.IOS/UI/HorizontalScrolViewLayout.cs
@@ -0,0 +1,232 @@
+锘縰sing System;
+using UIKit;
+using Shared.IO;
+using Foundation;
+using CoreGraphics;
+
+namespace Shared
+{
+ /// <summary>
+ /// 浣嶇疆甯冨眬
+ /// </summary>
+ public class HorizontalScrolViewLayout : ViewGroup
+ {
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public HorizontalScrolViewLayout()
+ {
+ viewGroup = new MyHorizontalScrolViewLayout(this) { };
+ realViewGroup = viewGroup;
+ HorizontalScrollBarEnabled = false;
+ }
+
+ /// <summary>
+ /// 鍨傜洿鏂瑰悜婊氬姩瑙嗗浘
+ /// </summary>
+ class MyHorizontalScrolViewLayout : UIScrollView
+ {
+ [Weak] internal HorizontalScrolViewLayout horizontalScrolViewLayout;
+ public MyHorizontalScrolViewLayout(HorizontalScrolViewLayout horizontalScrolViewLayout)
+ {
+ this.horizontalScrolViewLayout = horizontalScrolViewLayout;
+ }
+ /// <summary>
+ /// 鐐瑰嚮寮�濮�
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesBegan(NSSet touches, UIEvent evt)
+ {
+ horizontalScrolViewLayout?.TouchEvent(EventActions.Down, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 绉诲姩
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesMoved(NSSet touches, UIEvent evt)
+ {
+ horizontalScrolViewLayout?.TouchEvent(EventActions.Move, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮寮硅捣
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesEnded(NSSet touches, UIEvent evt)
+ {
+ horizontalScrolViewLayout?.TouchEvent(EventActions.Up, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ public override void TouchesCancelled(NSSet touches, UIEvent evt)
+ {
+ horizontalScrolViewLayout?.TouchEvent(EventActions.Cancel, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 妗嗘灦榛樿鍔犱簡涓や釜UIImageView 锛岃繖鏍峰彲浠ュ幓鎺夐粯璁ゆ坊鍔�
+ /// </summary>
+ /// <param name="view">View.</param>
+ public override void AddSubview(UIView view)
+ {
+ if (view.GetType() == typeof(UIImageView) && view.Tag != int.MinValue)
+ {
+ return;
+ }
+ base.AddSubview(view);
+ }
+ }
+
+ /// <summary>
+ /// 澧炲姞瀛愯鍥�
+ /// </summary>
+ /// <returns>The chidren.</returns>
+ /// <param name="view">View.</param>
+ public override void AddChidren(View view)
+ {
+ base.AddChidren(view);
+ ReLocation();
+ }
+
+ /// <summary>
+ /// 閲嶆柊鎺掍綅缃強璁惧鍐呭澶у皬
+ /// </summary>
+ public virtual void ReLocation()
+ {
+ if (0 == viewList.Count)
+ {
+ return;
+ }
+ for (int i = 1; i < viewList.Count; i++)
+ {
+ var frame = viewList[i].RealView.Frame;
+ frame.X = viewList[i - 1].RealView.Frame.Right;
+ viewList[i].RealView.Frame = frame;
+ }
+
+ (realViewGroup as MyHorizontalScrolViewLayout).ContentSize = new CoreGraphics.CGSize(viewList[viewList.Count - 1].Right <= Width ? Width + 1 : viewList[viewList.Count - 1].Right, 0);
+ }
+
+
+ /// <summary>
+ /// 绉婚櫎鎵�鏈夌殑瑙嗗浘
+ /// </summary>
+ public override void RemoveAll()
+ {
+ base.RemoveAll();
+ ReLocation();
+ }
+
+ /// <summary>
+ /// 绉婚櫎鎺т欢
+ /// </summary>
+ /// <param name="view">View.</param>
+ internal override void Remove(View view)
+ {
+ base.Remove(view);
+ ReLocation();
+ }
+
+
+ /// <summary>
+ /// 绉婚櫎鎸囧畾绱㈠紩瀵硅薄
+ /// </summary>
+ /// <param name="index">Index.</param>
+ public override void RemoveAt(int index)
+ {
+ base.RemoveAt(index);
+ ReLocation();
+ }
+
+ /// <summary>
+ /// 鏄惁鍏佽婊戝姩
+ /// </summary>
+ /// <value><c>true</c> if scroll enabled; otherwise, <c>false</c>.</value>
+ public bool ScrollEnabled
+ {
+ get
+ {
+ return (viewGroup as MyHorizontalScrolViewLayout).ScrollEnabled;
+ }
+ set
+ {
+ (viewGroup as MyHorizontalScrolViewLayout).ScrollEnabled = value;
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁姝e湪婊戝姩
+ /// </summary>
+ /// <value><c>true</c> if decelerating; otherwise, <c>false</c>.</value>
+ public bool Decelerating
+ {
+ get
+ {
+ return (viewGroup as MyHorizontalScrolViewLayout).Decelerating;
+ }
+ }
+
+ /// <summary>鈥� /// 鏄惁鏄剧ず姘村钩婊氬姩鏉♀�� /// </summary>
+
+ public bool HorizontalScrollBarEnabled
+ {
+ get鈥� {鈥� return (viewGroup as MyHorizontalScrolViewLayout).ShowsHorizontalScrollIndicator;鈥� }
+ set
+ {
+ (viewGroup as MyHorizontalScrolViewLayout).ShowsHorizontalScrollIndicator = value;
+
+ }
+ }
+
+ /// <summary>
+ /// 婊戝姩鍒版寚瀹氫綅缃�
+ /// </summary>
+ /// <param name="viewX"></param>
+ public void ScrollToX(int viewX)
+ {
+ //璁$畻鏈�澶у彲浠ユ粴鍔ㄧ殑鍖哄煙
+ var maxX = (realViewGroup as MyHorizontalScrolViewLayout).ContentSize.Width - Width;
+
+ if (viewX > maxX)
+ {
+ viewX = (int)maxX;
+ }
+
+ if (viewX < 0)
+ {
+ viewX = 0;
+ }
+
+ (viewGroup as MyHorizontalScrolViewLayout).SetContentOffset(new CGPoint(viewX, 0), false);
+ }
+
+ /// <summary>
+ /// 婊戝姩鍒版寚瀹歏IEW
+ /// </summary>
+ /// <param name="viewIndex"></param>
+ public void ScrollToViewIndex(int viewIndex)
+ {
+ if (viewList.Count == 0)
+ return;
+ var viewX = this.viewList[viewIndex].X;
+ //璁$畻鏈�澶у彲浠ユ粴鍔ㄧ殑鍖哄煙
+ var maxX = (realViewGroup as MyHorizontalScrolViewLayout).ContentSize.Width - Width;
+
+ if (viewX > maxX)
+ {
+ viewX = (int)maxX;
+ }
+
+ if (viewX < 0)
+ {
+ viewX = 0;
+ }
+
+ (viewGroup as MyHorizontalScrolViewLayout).SetContentOffset(new CGPoint(viewX, 0), false);
+ }
+
+ }
+
+
+}
diff --git a/Shared.IOS/UI/HorizontalSeekBar.cs b/Shared.IOS/UI/HorizontalSeekBar.cs
new file mode 100644
index 0000000..9908a3d
--- /dev/null
+++ b/Shared.IOS/UI/HorizontalSeekBar.cs
@@ -0,0 +1,340 @@
+using System;
+using UIKit;
+using System.IO;
+using Foundation;
+using CoreGraphics;
+using Shared.IO;
+
+namespace Shared
+{
+ /// <summary>
+ /// 浣嶇疆甯冨眬
+ /// </summary>
+ public class HorizontalSeekBar : View
+ {
+ MySlide currentRealView;
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public HorizontalSeekBar()
+ {
+ currentRealView = new MySlide(this) { };
+
+ uiView = currentRealView;
+ }
+
+ /// <summary>
+ /// 杩涘害鍙樺寲浜嬩欢
+ /// </summary>
+ public Action<View, int> ProgressChanged;
+
+
+ int max = 100;
+ /// <summary>
+ /// 鏈�澶у��
+ /// </summary>
+ /// <value>The max.</value>
+ public int Max
+ {
+ get
+ {
+ return max;
+ }
+ set
+ {
+ max = value;
+ if (!IsCanRefresh)
+ {
+ return;
+ }
+ currentRealView.MaxValue = value;
+ }
+ }
+ bool isCanScrolled = true;
+ /// <summary>
+ /// 鏄惁鍏佽婊戝姩婊戝潡
+ /// </summary>
+ /// <value><c>true</c> if is can scrolled; otherwise, <c>false</c>.</value>
+ public bool IsCanScrolled
+ {
+ get
+ {
+ return isCanScrolled;
+ }
+ set
+ {
+ isCanScrolled = value;
+ if (!IsCanRefresh)
+ {
+ return;
+ }
+ currentRealView.UserInteractionEnabled = value;
+ if (value)
+ {
+ //currentRealView.ThumbTintColor = UIColor.White;
+ }
+ else
+ {
+ //currentRealView.ThumbTintColor = UIColor.Clear;
+ }
+ }
+ }
+
+ //2019-08-29 鏀�100姣
+ public int DelayTime = 100;
+ //闃叉璺冲姩锛屽欢鏃舵樉绀虹姸鎬�
+ DateTime delayDateTime = DateTime.MinValue;
+ int progress;
+ /// <summary>
+ /// 褰撳墠杩涘害
+ /// </summary>
+ /// <value>The progress.</value>
+ public int Progress
+ {
+ get
+ {
+ return (int)currentRealView.Value;
+ }
+ set
+ {
+ progress = value;
+ if (!IsCanRefresh)
+ {
+ return;
+ }
+ //鍙戦�佸懡浠ゅ悗3000姣鍐呬笉鏇存柊鐘舵�侊紝闃叉璺冲姩
+ if ((DateTime.Now - delayDateTime).TotalMilliseconds < DelayTime)
+ {
+ return;
+ }
+ currentRealView.Value = value;
+ }
+ }
+
+ public int SleepTime = 0;
+ uint progressColor = 0xFFEB642C;
+ /// <summary>
+ /// 杩涘害棰滆壊
+ /// </summary>
+ /// <value>The color of the progress.</value>
+ public uint ProgressColor
+ {
+ get
+ {
+ return progressColor;
+ }
+ set
+ {
+ progressColor = value;
+ int r = (byte)(progressColor / 256 / 256 % 256);
+ int g = (byte)(progressColor / 256 % 256);
+ int b = (byte)(progressColor % 256);
+ int a = (byte)(progressColor / 256 / 256 / 256 % 256);
+ currentRealView.MinimumTrackTintColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+ }
+
+ uint backgroundColor = 0xFFFFFFFF;
+ /// <summary>
+ /// 搴曢儴棰滆壊
+ /// </summary>
+ /// <value>The color of the background.</value>
+ public new uint BackgroundColor
+ {
+ get
+ {
+ return backgroundColor;
+ }
+ set
+ {
+ backgroundColor = value;
+ int r = (byte)(backgroundColor / 256 / 256 % 256);
+ int g = (byte)(backgroundColor / 256 % 256);
+ int b = (byte)(backgroundColor % 256);
+ int a = (byte)(backgroundColor / 256 / 256 / 256 % 256);
+ currentRealView.MaximumTrackTintColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+ }
+
+ uint thumbColor = 0xFFFFFFFF;
+ /// <summary>
+ /// 婊戝潡棰滆壊
+ /// </summary>
+ /// <value>The color of the background.</value>
+ public uint ThumbColor
+ {
+ get
+ {
+ return thumbColor;
+ }
+ set
+ {
+ thumbColor = value;
+ int r = (byte)(thumbColor / 256 / 256 % 256);
+ int g = (byte)(thumbColor / 256 % 256);
+ int b = (byte)(thumbColor % 256);
+ int a = (byte)(thumbColor / 256 / 256 / 256 % 256);
+ currentRealView.SetThumbImage(createImageWithColor(UIColor.FromRGBA(r, g, b, a)), UIControlState.Normal);
+ }
+ }
+
+
+ /// <summary>
+ /// 鏄惁鍙互婊戝姩
+ /// </summary>
+ public bool IsCanMove = true;
+ public DateTime dateTime = DateTime.MinValue;
+ internal override bool TouchEvent(EventActions eventAction, CGPoint point)
+ {
+ if (!IsCanMove)
+ {
+ return true;
+ }
+ delayDateTime = DateTime.Now;
+ switch (eventAction)
+ {
+ case EventActions.Down:
+ dateTime = DateTime.MinValue;
+ setValue((float)point.X);
+ break;
+ case EventActions.Move:
+ if (dateTime == DateTime.MinValue)
+ {
+ dateTime = DateTime.Now;
+ }
+ setValue((float)point.X);
+ break;
+ case EventActions.Up:
+ dateTime = DateTime.MinValue;
+ setValue((float)point.X);
+ break;
+ case EventActions.Cancel:
+ dateTime = DateTime.MinValue;
+ setValue((float)point.X);
+ break;
+ }
+ return base.TouchEvent(eventAction, point);
+ }
+ float beforeValue = -1;
+ void setValue(float x)
+ {
+ if (x < 0)
+ {
+ x = 0;
+ }
+ if (Width - ThumbRadius < x)
+ {
+ x = Width - ThumbRadius;
+ }
+
+ currentRealView.Value = (x / (Width - ThumbRadius) * max);
+
+ if (beforeValue != currentRealView.Value)
+ {
+ //鐐瑰嚮涓嬫垨鑰呭脊璧锋垨鑰呮粦鍔ㄦ椂闂�500姣鐨勬椂鍊欙紝灏辫Е鍙戜簨浠�
+ if (ProgressChanged != null
+ && SleepTime < (DateTime.Now - dateTime).TotalMilliseconds)
+ {
+ beforeValue = currentRealView.Value;
+ dateTime = DateTime.MinValue;
+ delayDateTime = DateTime.Now;
+ ProgressChanged(this, (int)currentRealView.Value);
+ }
+ }
+ }
+
+ int thumbRadius = 9;// 12;
+ public int ThumbRadius
+ {
+ get
+ {
+ return thumbRadius;
+ }
+ set
+ {
+ thumbRadius = value;
+ int r = (byte)(thumbColor / 256 / 256 % 256);
+ int g = (byte)(thumbColor / 256 % 256);
+ int b = (byte)(thumbColor % 256);
+ int a = (byte)(thumbColor / 256 / 256 / 256 % 256);
+ currentRealView.SetThumbImage(createImageWithColor(UIColor.FromRGBA(r, g, b, a)), UIControlState.Normal);
+ }
+ }
+
+ /// <summary>
+ /// 鍒锋柊褰撳墠瑙嗗浘
+ /// </summary>
+ public override void Refresh()
+ {
+ base.Refresh();
+ Max = max;
+ ProgressColor = progressColor;
+ Progress = progress;
+ IsCanScrolled = isCanScrolled;
+ ThumbRadius = thumbRadius;
+ }
+
+ UIImage createImageWithColor(UIColor color)
+ {
+ //璁剧疆闀垮
+ CGRect rect = new CGRect(0.0f, 0.0f, ThumbRadius * 2, ThumbRadius * 2);
+ UIGraphics.BeginImageContext(rect.Size);
+ var context = UIGraphics.GetCurrentContext();
+ context.SetFillColor(color.CGColor);
+ context.FillRect(rect);
+ UIImage resultImage = UIGraphics.GetImageFromCurrentImageContext();
+ UIGraphics.EndImageContext();
+ // 寮�濮嬩竴涓狪mage鐨勪笂涓嬫枃
+ UIGraphics.BeginImageContextWithOptions(resultImage.Size, false, 0.0f);
+ // 娣诲姞鍦嗚
+ UIBezierPath.FromRoundedRect(rect, ThumbRadius).AddClip();
+ // 缁樺埗鍥剧墖
+ resultImage.Draw(rect);
+ // 鎺ュ彈缁樺埗鎴愬姛鐨勫浘鐗�
+ resultImage = UIGraphics.GetImageFromCurrentImageContext();
+ UIGraphics.EndImageContext();
+ return resultImage;
+ }
+
+ class MySlide : UISlider
+ {
+ [Weak] View view;
+ public MySlide(View view) {
+ this.view = view;
+ }
+ /// <summary>
+ /// 鐐瑰嚮寮�濮�
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesBegan(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Down, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 绉诲姩
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesMoved(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Move, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮寮硅捣
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesEnded(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Up, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ public override void TouchesCancelled(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Cancel, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ }
+ }
+}
diff --git a/Shared.IOS/UI/ImageView.cs b/Shared.IOS/UI/ImageView.cs
new file mode 100644
index 0000000..003a09a
--- /dev/null
+++ b/Shared.IOS/UI/ImageView.cs
@@ -0,0 +1,130 @@
+锘縰sing System;
+using Foundation;
+using Shared.IO;
+using UIKit;
+
+namespace Shared
+{
+ /// <summary>
+ /// ImageView
+ /// </summary>
+ public class ImageView : View
+ {
+ MyImageView myImageView
+ {
+ get
+ {
+ return uiView as MyImageView;
+ }
+ set
+ {
+ uiView = value;
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Shared.Button"/> class.
+ /// </summary>
+ public ImageView()
+ {
+ myImageView = new MyImageView(this) { };
+
+ }
+
+ internal string imagePath, tempImagePath;
+ /// <summary>
+ /// 闈為�変腑鐘舵�佺殑鑳屾櫙鍥捐矾寰�
+ /// </summary>
+ /// <value>The un selected image path.</value>
+ public string ImagePath
+ {
+ get
+ {
+ return imagePath;
+ }
+ set
+ {
+ tempImagePath = value;
+ if (!IsCanRefresh)
+ {
+ return;
+ }
+ if (imageBytes != null)
+ {
+ myImageView.SetBackgroundImage(UIImage.LoadFromData(NSData.FromArray(imageBytes)), UIControlState.Normal);
+ return;
+ }
+ if (ImagePath == value)
+ {
+ return;
+ }
+ imagePath = value;
+ myImageView.SetBackgroundImage(UIImage.FromFile(FileUtils.GetImageFilePath(imagePath)), UIControlState.Normal);
+ }
+ }
+
+ byte[] imageBytes;
+ public byte[] ImageBytes
+ {
+ get
+ {
+ return imageBytes;
+ }
+ set
+ {
+ imageBytes = value;
+ ImagePath = tempImagePath;
+ }
+ }
+
+
+ public override void Refresh()
+ {
+ base.Refresh();
+
+ ImagePath = tempImagePath;
+ }
+ }
+
+ class MyImageView : UIKit.UIButton
+ {
+ [Weak] View view;
+ public MyImageView(View view)
+ {
+ this.view = view;
+ }
+ /// <summary>
+ /// 鐐瑰嚮寮�濮�
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesBegan(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Down, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 绉诲姩
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesMoved(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Move, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮寮硅捣
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesEnded(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Up, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ public override void TouchesCancelled(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Cancel, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ }
+}
diff --git a/Shared.IOS/UI/Lanuage.cs b/Shared.IOS/UI/Lanuage.cs
new file mode 100755
index 0000000..431fde6
--- /dev/null
+++ b/Shared.IOS/UI/Lanuage.cs
@@ -0,0 +1,99 @@
+锘縰sing System;
+using System.IO;
+
+namespace Shared
+{
+ public static class Language
+ {
+ static System.Collections.Generic.List<string> currentStringList;
+ static Language()
+ {
+ UpdateLanguage ();
+ if (0 < currentStringList.Count&¤tStringList[0].StartsWith("CurrentLanguage=")) {
+ CurrentLanguage = currentStringList [0].Substring ("CurrentLanguage=".Length);
+ }
+ }
+ static System.Collections.Generic.List<string> readStringList(string fileName,System.Text.Encoding encoding)
+ {
+ var stringList = new System.Collections.Generic.List<string> ();
+ System.IO.StreamReader fs = null;
+ try {
+ var filePath = Foundation.NSBundle.MainBundle.PathForResource(fileName, null);
+ if (filePath == null)
+ {
+ return stringList;
+ }
+ //if (System.IO.File.Exists (System.IO.Path.Combine (Application.RootPath, fileName))) {
+ //fs = new StreamReader (System.IO.Path.Combine (Application.RootPath, fileName),encoding);
+ //} else if (System.IO.File.Exists (fileName)) {
+ fs = new StreamReader (filePath,encoding);
+ //} else {
+ //return stringList;
+ //}
+ string s;
+ while(null!=(s=fs.ReadLine()))
+ {
+ stringList.Add(s.Trim());
+ }
+ return stringList;
+ } catch {
+ return stringList;
+ } finally {
+ try {
+ if (fs != null) {
+ fs.Close ();
+ }
+ } catch {
+
+ }
+ }
+ }
+ /// <summary>
+ /// 閲嶆柊鏇存柊璇█搴撴暟鎹�
+ /// </summary>
+ public static void UpdateLanguage()
+ {
+ currentStringList = readStringList("Language.ini", System.Text.Encoding.UTF8);
+ }
+ /// <summary>
+ /// 褰撳墠璁剧疆鐨勮瑷�
+ /// </summary>
+ public static string CurrentLanguage="English";
+ /// <summary>
+ /// 鏍规嵁ID鑾峰彇瀵瑰簲鐨勫娉�
+ /// </summary>
+ /// <returns>The by I.</returns>
+ /// <param name="id">Identifier.</param>
+ public static string StringByID(int id)
+ {
+ bool flag = false;
+ for (int i = 0; i < currentStringList.Count; i++) {
+ string currentLine = currentStringList [i];
+ if (flag) {
+ if (currentLine.Contains("=")&¤tLine.StartsWith(id.ToString()+"=")) {
+ return currentLine.Substring (id.ToString ().Length + 1);
+ }
+ } else if (currentLine == "[" + CurrentLanguage + "]") {
+ flag = true;
+ } else {
+ continue;
+ }
+ }
+ return string.Empty;
+ }
+
+ public static string []GetAllLanguage()
+ {
+ var list = new System.Collections.Generic.List<string> ();
+
+ for (int i = 0; i < currentStringList.Count; i++) {
+ string currentLine = currentStringList [i].Trim();
+ if (currentLine.StartsWith ("[") && currentLine.EndsWith ("]")) {
+ list.Add(currentLine.Substring(1,currentLine.Length-2));
+ }
+ }
+ return list.ToArray();
+ }
+ }
+}
+
diff --git a/Shared.IOS/UI/Loading.cs b/Shared.IOS/UI/Loading.cs
new file mode 100644
index 0000000..379f32b
--- /dev/null
+++ b/Shared.IOS/UI/Loading.cs
@@ -0,0 +1,310 @@
+锘縰sing System;
+using UIKit;
+using CoreGraphics;
+
+namespace Shared
+{
+ /// <summary>
+ /// Loading UI
+ /// </summary>
+ public class Loading : View
+ {
+
+ public bool CurStatus = false;
+ internal IosLoading iosLoading
+ {
+ get
+ {
+ return uiView as IosLoading;
+ }
+ set
+ {
+ uiView = value;
+ }
+ }
+
+ /// <summary>
+ /// Loading UI
+ /// </summary>
+ public Loading()
+ {
+ var bounds = UIScreen.MainScreen.Bounds;
+ iosLoading = new IosLoading(bounds);
+ }
+
+
+ /// <summary>
+ /// 寮�濮嬪綋鍓嶈鍥�
+ /// </summary>
+ public void Start()
+ {
+ Text = "Loading......";
+ iosLoading.Start();
+ CurStatus = true;
+ }
+
+ /// <summary>
+ /// 寮�濮嬪綋鍓嶈鍥�
+ /// </summary>
+ public void Start(string s)
+ {
+ Text = s;
+ iosLoading.Start();
+ }
+
+
+ /// <summary>
+ /// 闅愯棌褰撳墠瑙嗗浘
+ /// </summary>
+ public void Hide()
+ {
+ Text = "Loading......";
+ iosLoading.Hide();
+ CurStatus = false;
+ }
+
+ public string Text
+ {
+ get
+ {
+ return iosLoading.uiLabel.Text;
+ }
+ set
+ {
+ iosLoading.uiLabel.Text = value;
+ iosLoading.RefreshWidth();
+
+ }
+ }
+
+ uint mTextColor;
+ public uint TextColor
+ {
+ get
+ {
+ return mTextColor;
+ }
+ set
+ {
+ mTextColor = value;
+ iosLoading.uiLabel.TextColor = HDLUtils.GetUIColorWithUint(mTextColor);
+ }
+ }
+
+
+
+ public virtual uint LodingBackgroundColor
+ {
+ get
+ {
+ return (iosLoading as IosLoading).LodingBackgroundColor;
+ }
+ set
+ {
+ (iosLoading as IosLoading).LodingBackgroundColor = value;
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="mViewStyle">1 涓虹伆鑹�</param>
+ public void SetUIActivityIndicatorViewStyle(int mViewStyle)
+ {
+ (iosLoading as IosLoading).SetUIActivityIndicatorViewStyle(mViewStyle);
+
+ }
+
+ /// <summary>
+ /// 鏂囧瓧澶у皬
+ /// </summary>
+ /// <value>The size of the text.</value>
+ public float TextSize
+ {
+ get
+ {
+ return (float)iosLoading.uiLabel.Font.PointSize;
+ }
+ set
+ {
+ iosLoading.uiLabel.Font = UIFont.FromName(iosLoading.uiLabel.Font.Name, value);
+ }
+ }
+
+
+ }
+
+ internal class IosLoading : UIView
+ {
+
+ UIActivityIndicatorView activitySpinner = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);
+ public UILabel uiLabel = new UILabel();
+ UIView backUIView = new UIView(new CGRect(0, 0, 160, 120));
+
+ public IosLoading(CGRect frame)
+ {
+ BackgroundColor = UIKit.UIColor.FromRGBA(0x32, 0x32, 0x32, 50);
+
+ Frame = frame;
+ Hidden = true;
+
+ AutoresizingMask = UIViewAutoresizing.All;
+
+ var f = backUIView.Frame;
+ f.Width = frame.Width;
+ //f.Height = frame.Height;
+ backUIView.Frame = f;
+ var center = backUIView.Center;
+ center.X = Frame.Width / 2;
+ center.Y = Frame.Height / 2;
+ backUIView.Center = center;
+ AddSubview(backUIView);
+ // create the activity spinner, center it horizontall and put it 5 points above center x
+ var center1 = activitySpinner.Center;
+ center1.X = backUIView.Frame.Width / 2;
+ center1.Y = (backUIView.Frame.Height - 62) / 2 + 20;
+ activitySpinner.Center = center1;
+ backUIView.AddSubview(activitySpinner);
+ activitySpinner.BackgroundColor = UIColor.Clear;
+ activitySpinner.Color = UIColor.Gray;
+
+ var frame2 = uiLabel.Frame;
+ frame2.Y = backUIView.Frame.Height - 42;
+ frame2.Width = backUIView.Frame.Width;
+ frame2.Height = 22;
+ uiLabel.Frame = frame2;
+
+ uiLabel.BackgroundColor = UIColor.Clear;
+ uiLabel.TextColor = UIColor.Gray;
+ uiLabel.TextAlignment = UITextAlignment.Center;
+ //uiLabel.F
+ backUIView.AddSubview(uiLabel);
+
+ }
+
+ public void Start()
+ {
+ if (Superview == null)
+ {
+ return;
+ }
+
+ Hidden = false;
+ activitySpinner.StartAnimating();
+ Superview.BringSubviewToFront(this);
+ }
+
+ /// <summary>
+ /// Fades out the control and then removes it from the super view
+ /// </summary>
+ public void Hide()
+ {
+ if (Superview == null)
+ {
+ return;
+ }
+ Hidden = true;
+ activitySpinner.StopAnimating();
+ Superview.SendSubviewToBack(this);
+ }
+
+ uint loadingBackgroundColor;
+ /// <summary>
+ /// 鑳屾櫙棰滆壊
+ /// </summary>
+ /// <value>The color of the background.</value>
+ public virtual uint LodingBackgroundColor
+ {
+ get
+ {
+ return loadingBackgroundColor;
+ }
+ set
+ {
+ loadingBackgroundColor = value;
+
+ if (this.GetType() != typeof(ImageView))
+ {
+ byte r, g, b, a;
+ r = (byte)(loadingBackgroundColor / 256 / 256 % 256);
+ g = (byte)(loadingBackgroundColor / 256 % 256);
+ b = (byte)(loadingBackgroundColor % 256);
+ a = (byte)(loadingBackgroundColor / 256 / 256 / 256 % 256);
+ backUIView.BackgroundColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+
+
+ backUIView.Layer.MasksToBounds = true;
+ backUIView.Layer.CornerRadius = 6;
+ backUIView.Layer.BorderWidth = 0;
+ }
+ }
+ }
+
+ public void SetUIActivityIndicatorViewStyle(int mViewStyle)
+ {
+ if (mViewStyle == 1)
+ {
+ activitySpinner.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray;
+ }
+ else
+ {
+ activitySpinner.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.WhiteLarge;
+ }
+
+ }
+
+ public void RefreshWidth()
+ {
+ int maxTextWidth = GetTextWidth() + 40;
+ if (maxTextWidth > this.Frame.Width - 20)
+ {
+ maxTextWidth = (int)this.Frame.Width - 20;
+ }
+ else if (maxTextWidth < 120)
+ {
+ maxTextWidth = 120;
+ }
+
+ var mFrame = backUIView.Frame;
+ if ((int)mFrame.Width == maxTextWidth)
+ {
+ return;
+ }
+
+ mFrame.Width = maxTextWidth;
+ //f.Height = frame.Height;
+ backUIView.Frame = mFrame;
+ var center = backUIView.Center;
+ center.X = Frame.Width / 2;
+ center.Y = Frame.Height / 2;
+
+ backUIView.Center = center;
+
+ var center1 = activitySpinner.Center;
+ center1.X = backUIView.Frame.Width / 2;
+ activitySpinner.Center = center1;
+
+ var frame2 = uiLabel.Frame;
+ frame2.Width = backUIView.Frame.Width;
+ uiLabel.Frame = frame2;
+ }
+
+ /// <summary>
+ /// 鑾峰彇瀛椾綋闀垮害
+ /// </summary>
+ int GetTextWidth()
+ {
+ try
+ {
+ CGSize fontSize = uiLabel.Text.StringSize(uiLabel.Font);
+ return (int)fontSize.Width;
+ }
+ catch
+ {
+ return 0;
+ }
+ }
+
+ }
+}
+
diff --git a/Shared.IOS/UI/LongPressMoveVerticalScrolViewLayout.cs b/Shared.IOS/UI/LongPressMoveVerticalScrolViewLayout.cs
new file mode 100644
index 0000000..75b2c09
--- /dev/null
+++ b/Shared.IOS/UI/LongPressMoveVerticalScrolViewLayout.cs
@@ -0,0 +1,277 @@
+锘縰sing System;
+using CoreGraphics;
+using Foundation;
+using UIKit;
+
+namespace Shared
+{
+ public class LongPressMoveVerticalScrolViewLayout:ViewGroup
+ {
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public LongPressMoveVerticalScrolViewLayout()
+ {
+ viewGroup = new MyLongPressMoveVerticalScrolViewLayout(this);
+ realViewGroup = viewGroup;
+ viewGroup.AddGestureRecognizer(new MyUILongPressGestureRecognizer(sender =>
+ {
+ (sender as MyUILongPressGestureRecognizer).longPressMoveVerticalScrolViewLayout?.uiViewLongPressed(sender);
+ })
+ { longPressMoveVerticalScrolViewLayout = this });
+ }
+
+ class MyUILongPressGestureRecognizer : UILongPressGestureRecognizer {
+ [Weak] internal LongPressMoveVerticalScrolViewLayout longPressMoveVerticalScrolViewLayout;
+ public MyUILongPressGestureRecognizer(Action<UILongPressGestureRecognizer> action):base(action) {
+
+ }
+ }
+
+ public override void AddChidren(View view)
+ {
+ base.AddChidren(view);
+ int maxHeight = 0;
+ foreach (View tempView in viewList)
+ {
+ if (maxHeight < tempView.Bottom)
+ {
+ maxHeight = tempView.Bottom;
+ }
+ }
+ (realViewGroup as MyLongPressMoveVerticalScrolViewLayout).ContentSize = new CGSize(Width, maxHeight);
+ }
+
+ /// <summary>
+ /// 鏍规嵁鐐瑰嚮浣嶇疆鎵惧嚭鐐瑰嚮鍒扮殑瑙嗗浘
+ /// </summary>
+ /// <returns>The view of point.</returns>
+ /// <param name="point">Point.</param>
+ /// <param name="uiview">Uiview.</param>
+ UIView replaceUIViewOfPoint(CGPoint point, UIView uiview)
+ {
+ //绗竴涓槸鑳屾櫙鍥�
+ for (int i = 1; i < realViewGroup.Subviews.Length; i++)
+ {
+ var tempUIView = realViewGroup.Subviews[i];
+ if (tempUIView != uiview)
+ {
+ if (tempUIView.Frame.Contains(point))
+ {
+ return tempUIView;
+ }
+ }
+ }
+ return null;
+ }
+
+ /// <summary>
+ /// 瀵规崲浣嶇疆鐨勪袱涓鍥�
+ /// </summary>
+ public Action<View,View> ReplaceChanged;
+
+ /// <summary>
+ /// 鏍规嵁鐐瑰嚮浣嶇疆鎵惧嚭鐐瑰嚮鍒扮殑瑙嗗浘
+ /// </summary>
+ /// <returns>杩斿洖鐐瑰嚮鍒扮殑瑙嗗浘</returns>
+ /// <param name="point">褰撳墠鐐瑰嚮浣嶇疆</param>
+ UIView selectedUIViewOfPoint(CGPoint point)
+ {
+ foreach (UIView uiView in realViewGroup.Subviews)
+ {
+ if (uiView.GetType() != typeof(UIImageView) && uiView.Frame.Contains(point))
+ {
+ return uiView;
+ }
+ }
+ return null;
+ }
+
+
+ CGPoint originPoint;
+ bool contain;
+ UIView selectedUIView;
+ void uiViewLongPressed(UILongPressGestureRecognizer sender)
+ {
+ //闀挎寜寮�濮�
+ if (sender.State == UIGestureRecognizerState.Began)
+ {
+ //鎵惧嚭褰撳墠鐐瑰嚮浣嶇疆鐨勮鍥�
+ selectedUIView = selectedUIViewOfPoint(sender.LocationInView(sender.View));
+ if (selectedUIView == null)
+ {
+ return;
+ }
+ originPoint = selectedUIView.Center;
+ UIView.Animate(1.0f, () =>
+ {
+ selectedUIView.Transform = CGAffineTransform.MakeScale(1.1f, 1.1f);
+ selectedUIView.Alpha = 0.7f;
+ });
+ }
+ else if (sender.State == UIGestureRecognizerState.Changed)
+ {
+ if (selectedUIView == null)
+ {
+ return;
+ }
+ //绉诲姩褰撳墠瑙嗗浘
+ selectedUIView.Center = sender.LocationInView(sender.View);
+ //鑾峰彇褰撳墠瑙嗗浘杩涘叆浜嗗摢涓鍥剧殑鍖哄煙
+ var replaceUIView = replaceUIViewOfPoint(selectedUIView.Center, selectedUIView);
+ if (replaceUIView ==null)
+ {
+ contain = false;
+ }
+ else
+ {
+ //杩涘叆鍖哄煙鍚庡垏鎹綅缃�
+ UIView.Animate(1.0f, () =>
+ {
+ var temp = replaceUIView.Center;
+ replaceUIView.Center = originPoint;
+ selectedUIView.Center = temp;
+ originPoint = selectedUIView.Center;
+ contain = true;
+ }, () =>
+ {
+ View selectedView = null;
+ foreach (View view in viewList)
+ {
+ if (view.RealView == selectedUIView)
+ {
+ selectedView = view;
+ break;
+ }
+ }
+ View replaceView = null;
+ foreach (View view in viewList)
+ {
+ if (view.RealView == replaceUIView)
+ {
+ replaceView = view;
+ break;
+ }
+ }
+ if(ReplaceChanged!=null){
+ ReplaceChanged(selectedView, replaceView);
+ }
+
+ });
+ }
+ }
+ else if (sender.State == UIGestureRecognizerState.Ended)
+ {
+ if (selectedUIView == null)
+ {
+ return;
+ }
+ UIView.Animate(1.0f, () =>
+ {
+ selectedUIView.Transform = CGAffineTransform.MakeIdentity();
+ selectedUIView.Alpha = 1.0f;
+ //濡傛灉涓嶉渶瑕佺Щ鍔ㄤ綅缃�
+ if (!contain)
+ {
+ selectedUIView.Center = originPoint;
+ }
+ });
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁鍏佽婊戝姩
+ /// </summary>
+ /// <value><c>true</c> if scroll enabled; otherwise, <c>false</c>.</value>
+ public bool ScrollEnabled
+ {
+ get
+ {
+ return (viewGroup as MyLongPressMoveVerticalScrolViewLayout).ScrollEnabled;
+ }
+ set
+ {
+ (viewGroup as MyLongPressMoveVerticalScrolViewLayout).ScrollEnabled = value;
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁姝e湪婊戝姩
+ /// </summary>
+ /// <value><c>true</c> if decelerating; otherwise, <c>false</c>.</value>
+ public bool Decelerating
+ {
+ get
+ {
+ return (viewGroup as MyLongPressMoveVerticalScrolViewLayout).Decelerating;
+ }
+ }
+
+ /// <summary>
+ /// 婊戝姩浜嬩欢
+ /// </summary>
+ public EventHandler<MouseEventArgs> ScrolledEventHandler;
+
+ /// <summary>
+ /// 鍨傜洿鏂瑰悜婊氬姩瑙嗗浘
+ /// </summary>
+ class MyLongPressMoveVerticalScrolViewLayout : UIScrollView
+ {
+ [Weak] LongPressMoveVerticalScrolViewLayout view;
+ public MyLongPressMoveVerticalScrolViewLayout(LongPressMoveVerticalScrolViewLayout view)
+ {
+ this.view = view;
+
+ Scrolled += (sender, e) =>
+ {
+ this.view?.ScrolledEventHandler?.Invoke(this, new MouseEventArgs { X = (float)(sender as MyLongPressMoveVerticalScrolViewLayout).ContentOffset.X, Y = (float)(sender as MyLongPressMoveVerticalScrolViewLayout).ContentOffset.Y });
+ };
+ }
+ /// <summary>
+ /// 鐐瑰嚮寮�濮�
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesBegan(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Down, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 绉诲姩
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesMoved(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Move, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮寮硅捣
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesEnded(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Up, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ public override void TouchesCancelled(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Cancel, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 妗嗘灦榛樿鍔犱簡涓や釜UIImageView 锛岃繖鏍峰彲浠ュ幓鎺夐粯璁ゆ坊鍔�
+ /// </summary>
+ /// <param name="view">View.</param>
+ public override void AddSubview(UIView view)
+ {
+ if (view.GetType() == typeof(UIImageView) && view.Tag != int.MinValue)
+ {
+ return;
+ }
+ base.AddSubview(view);
+ }
+ }
+ }
+}
diff --git a/Shared.IOS/UI/MusicVerticalScrolViewLayout.cs b/Shared.IOS/UI/MusicVerticalScrolViewLayout.cs
new file mode 100644
index 0000000..9f14fc2
--- /dev/null
+++ b/Shared.IOS/UI/MusicVerticalScrolViewLayout.cs
@@ -0,0 +1,262 @@
+锘縰sing System;
+using CoreGraphics;
+using Foundation;
+using UIKit;
+
+namespace Shared
+{
+ public class MusicVerticalScrolViewLayout:ViewGroup
+ {
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public MusicVerticalScrolViewLayout()
+ {
+ viewGroup = new MyMusicVerticalScrolViewLayout(this) { };
+
+ viewGroup.AddGestureRecognizer(new MyUILongPressGestureRecognizer(sender =>
+ {
+ (sender as MyUILongPressGestureRecognizer).musicVerticalScrolViewLayout?.uiViewLongPressed(sender);
+ })
+ { MinimumPressDuration = 1.0f,musicVerticalScrolViewLayout=this });
+ realViewGroup = viewGroup;
+ }
+
+ class MyUILongPressGestureRecognizer : UILongPressGestureRecognizer
+ {
+ [Weak] internal MusicVerticalScrolViewLayout musicVerticalScrolViewLayout;
+ public MyUILongPressGestureRecognizer(Action<UILongPressGestureRecognizer> action) : base(action)
+ {
+
+ }
+ }
+
+ public override void AddChidren(View view)
+ {
+ base.AddChidren(view);
+ int maxHeight = 0;
+ foreach (View tempView in viewList)
+ {
+ if (maxHeight < tempView.Bottom)
+ {
+ maxHeight = tempView.Bottom;
+ }
+ }
+ (realViewGroup as MyMusicVerticalScrolViewLayout).ContentSize = new CGSize(Width, maxHeight < realViewGroup.Frame.Height ? (realViewGroup.Frame.Height + 1) : maxHeight);
+ }
+
+ /// <summary>
+ /// 鏍规嵁鐐瑰嚮浣嶇疆鎵惧嚭鐐瑰嚮鍒扮殑瑙嗗浘
+ /// </summary>
+ /// <returns>The view of point.</returns>
+ /// <param name="point">Point.</param>
+ /// <param name="uiview">Uiview.</param>
+ UIView replaceUIViewOfPoint(CGPoint point, UIView uiview)
+ {
+ //绗竴涓槸鑳屾櫙鍥�
+ for (int i = 1; i < realViewGroup.Subviews.Length; i++)
+ {
+ var tempUIView = realViewGroup.Subviews[i];
+ if (tempUIView != uiview)
+ {
+ if (tempUIView.Frame.Contains(point))
+ {
+ return tempUIView;
+ }
+ }
+ }
+ return null;
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ public Action<View, View> ReplaceChanged;
+ /// <summary>
+ /// 闀挎寜浜嬩欢
+ /// </summary>
+ public Action<View> LongPressAction;
+
+ /// <summary>
+ /// 鏍规嵁鐐瑰嚮浣嶇疆鎵惧嚭鐐瑰嚮鍒扮殑瑙嗗浘
+ /// </summary>
+ /// <returns>杩斿洖鐐瑰嚮鍒扮殑瑙嗗浘</returns>
+ /// <param name="point">褰撳墠鐐瑰嚮浣嶇疆</param>
+ UIView selectedUIViewOfPoint(CGPoint point)
+ {
+ foreach (UIView uiView in realViewGroup.Subviews)
+ {
+ if (uiView.GetType() != typeof(UIImageView) && uiView.Frame.Contains(point))
+ {
+ return uiView;
+ }
+ }
+ return null;
+ }
+ CGPoint originPoint;
+ UIView selectedUIView,replaceUIView;
+ bool isFirst;
+ void uiViewLongPressed(UILongPressGestureRecognizer sender)
+ {
+ //闀挎寜寮�濮�
+ if (sender.State == UIGestureRecognizerState.Began)
+ {
+ //鎵惧嚭褰撳墠鐐瑰嚮浣嶇疆鐨勮鍥�
+ selectedUIView = selectedUIViewOfPoint(sender.LocationInView(sender.View));
+ if (selectedUIView == null)
+ {
+ return;
+ }
+ viewGroup.BringSubviewToFront(selectedUIView);
+ originPoint = selectedUIView.Center;
+ isFirst = false;
+ UIView.Animate(1.0f, () =>
+ {
+ selectedUIView.Transform = CGAffineTransform.MakeScale(0.8f, 0.8f);
+ selectedUIView.Alpha = 0.7f;
+ });
+ }
+ else if (sender.State == UIGestureRecognizerState.Changed)
+ {
+ if (selectedUIView == null)
+ {
+ return;
+ }
+ //绉诲姩褰撳墠瑙嗗浘
+ selectedUIView.Center = sender.LocationInView(sender.View);
+ //鑾峰彇褰撳墠瑙嗗浘杩涘叆浜嗗摢涓鍥剧殑鍖哄煙
+ var temReplaceUIView = replaceUIViewOfPoint(selectedUIView.Center, selectedUIView);
+ replaceUIView = temReplaceUIView;
+ if (temReplaceUIView != null)
+ {
+ if (isFirst)
+ {
+ return;
+ }
+ isFirst = true;
+ ////杩涘叆鍖哄煙鍚庡垏鎹綅缃�
+ UIView.Animate(1.0f, () =>
+ {
+ temReplaceUIView.Transform = CGAffineTransform.MakeScale(1.1f, 1.1f);
+ }, () =>
+ {
+ temReplaceUIView.Transform = CGAffineTransform.MakeScale(1.0f, 1.0f);
+ });
+
+ }
+ }
+ else if (sender.State == UIGestureRecognizerState.Ended)
+ {
+ if (selectedUIView == null)
+ {
+ return;
+ }
+ View selectedView = null;
+ foreach (View view in viewList)
+ {
+ if (view.RealView == selectedUIView)
+ {
+ selectedView = view;
+ break;
+ }
+ }
+
+ if(selectedUIView!=null&&selectedUIView.Frame.Contains(originPoint)){
+ UIView.Animate(1.0f, () =>
+ {
+ selectedUIView.Transform = CGAffineTransform.MakeIdentity();
+ selectedUIView.Alpha = 1.0f;
+ selectedUIView.Center = originPoint;
+ });
+ return;
+ }
+ UIView.Animate(1.0f, () =>
+ {
+ selectedUIView.Transform = CGAffineTransform.MakeIdentity();
+ selectedUIView.Alpha = 1.0f;
+ selectedUIView.Center = originPoint;
+ });
+
+ if (replaceUIView == null)
+ {
+ if (LongPressAction != null)
+ {
+ LongPressAction(selectedView);
+ }
+ return;
+ }
+
+ View replaceView = null;
+ foreach (View view in viewList)
+ {
+ if (view.RealView == replaceUIView)
+ {
+ replaceView = view;
+ break;
+ }
+ }
+ if (ReplaceChanged != null)
+ {
+ ReplaceChanged(replaceView, selectedView);
+ }
+ }
+ }
+
+ /// <summary>
+ /// 鍨傜洿鏂瑰悜婊氬姩瑙嗗浘
+ /// </summary>
+ class MyMusicVerticalScrolViewLayout : UIScrollView
+ {
+ [Weak] View view;
+ public MyMusicVerticalScrolViewLayout(View view)
+ {
+ this.view = view;
+ }
+ /// <summary>
+ /// 鐐瑰嚮寮�濮�
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesBegan(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Down, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 绉诲姩
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesMoved(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Move, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮寮硅捣
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesEnded(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Up, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ public override void TouchesCancelled(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Cancel, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 妗嗘灦榛樿鍔犱簡涓や釜UIImageView 锛岃繖鏍峰彲浠ュ幓鎺夐粯璁ゆ坊鍔�
+ /// </summary>
+ /// <param name="view">View.</param>
+ public override void AddSubview(UIView view)
+ {
+ if (view.GetType() == typeof(UIImageView) && view.Tag != int.MinValue)
+ {
+ return;
+ }
+ base.AddSubview(view);
+ }
+ }
+ }
+}
diff --git a/Shared.IOS/UI/MyEchartsView.cs b/Shared.IOS/UI/MyEchartsView.cs
new file mode 100644
index 0000000..c7f3d13
--- /dev/null
+++ b/Shared.IOS/UI/MyEchartsView.cs
@@ -0,0 +1,168 @@
+using UIKit;
+using Foundation;
+using Shared.IO;
+using CoreFoundation;
+using System.Collections.Generic;
+using System;
+using System.Runtime;
+using WebKit;
+
+namespace Shared
+{
+ /// <summary>
+ /// MyEchartsView
+ /// 2020-06-19 UIWebView鏇挎崲涓篧KWebView
+ /// UIWebView宸茬粡寮冪敤锛屽悗闈㈠啀浣跨敤鐨凙PP灏嗕笉鑳藉彂甯冧笂鏋�
+ /// </summary>
+ public class MyEchartsView : View
+ {
+ JsonData jsonData = new JsonData { };
+ WKWebView uIWebView;
+ public MyEchartsView()
+ {
+ //榛樿甯冨眬锛屽楂樹负0鐨勮瘽浼氬紓甯�
+ var mFrame = new CoreGraphics.CGRect(base.X, base.Y, 10, 10);
+ uIWebView = new WKWebView(mFrame, new WKWebViewConfiguration()) { };
+ uiView = uIWebView;
+ uIWebView.ScrollView.Bounces = false;
+ uIWebView.ScrollView.ScrollEnabled = false;
+ uIWebView.NavigationDelegate = new OnWKNavigationDelegate(this);
+ var filePath = NSBundle.MainBundle.PathForResource("echarts", "html");
+ var url = new NSUrl(filePath, false);
+ uIWebView.LoadFileUrl(url, url);
+ }
+
+ public void Show(string title, string[] xArray, object[] yArray)
+ {
+ jsonData.Title = title;
+ jsonData.XArray = xArray;
+ jsonData.YArray = yArray;
+ EvaluateJavascript();
+ }
+
+ public string Unit
+ {
+ get
+ {
+ return jsonData.Unit;
+ }
+ set
+ {
+ jsonData.Unit = value;
+ }
+ }
+
+ public void EvaluateJavascript()
+ {
+ WKJavascriptEvaluationResult handler = (NSObject result, NSError err) => {
+ if (err != null)
+ {
+ HDLUtils.WriteLine("EvaluateJavascript:" + err);
+ }
+ if (result != null)
+ {
+ HDLUtils.WriteLine("EvaluateJavascript:" + result);
+ }
+ };
+ var v = Newtonsoft.Json.JsonConvert.SerializeObject(jsonData);
+ uIWebView.EvaluateJavaScript($"loadEcharts({Newtonsoft.Json.JsonConvert.SerializeObject(jsonData)},'undefined')", handler);
+
+ }
+
+
+ public class OnWKNavigationDelegate : WKNavigationDelegate
+ {
+ [Weak] MyEchartsView _MyEchartsView;
+
+ public OnWKNavigationDelegate(MyEchartsView view)
+ {
+ _MyEchartsView = view;
+ }
+
+
+ public override void DidFinishNavigation(WKWebView webView, WKNavigation navigation)
+ {
+ Console.WriteLine("WKWebView DidFinishNavigation");
+ _MyEchartsView.EvaluateJavascript();
+ }
+ }
+
+
+ [Serializable]
+ class JsonData
+ {
+ /// <summary>
+ /// 鏍囬鍐呭
+ /// </summary>
+ /// <value>The title.</value>
+ [Newtonsoft.Json.JsonIgnore]
+ public string Title
+ {
+ get
+ {
+ return title["text"].ToString();
+ }
+ set
+ {
+ title["text"] = value;
+ }
+ }
+ [Newtonsoft.Json.JsonProperty]
+ readonly Dictionary<string, object> title = new Dictionary<string, object> { ["text"] = "" };
+ [Newtonsoft.Json.JsonProperty]
+ readonly Dictionary<string, object> tooltip = new Dictionary<string, object> { ["trigger"] = "axis" };
+ /// <summary>
+ /// X杞村潗鏍囩偣
+ /// </summary>
+ /// <value>The XA rray.</value>
+ [Newtonsoft.Json.JsonIgnore]
+ public string[] XArray
+ {
+ get
+ {
+ return (xAxis[0] as Dictionary<string, object>)["data"] as string[];
+ }
+ set
+ {
+ (xAxis[0] as Dictionary<string, object>)["data"] = value;
+ }
+ }
+ [Newtonsoft.Json.JsonProperty]
+ readonly List<object> xAxis = new List<object> { new Dictionary<string, object> { ["type"] = "category", ["boundaryGap"] = false, ["data"] = new object[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } } };
+ [Newtonsoft.Json.JsonIgnore]
+ public string Unit
+ {
+ get
+ {
+ return ((yAxis[0] as Dictionary<string, object>)["axisLabel"] as Dictionary<string, object>)["formatter"].ToString().Substring("{value}".Length);
+ }
+ set
+ {
+ ((yAxis[0] as Dictionary<string, object>)["axisLabel"] as Dictionary<string, object>)["formatter"] = "{value}" + value;
+ }
+ }
+ [Newtonsoft.Json.JsonProperty]
+ readonly List<object> yAxis = new List<object> { new Dictionary<string, object> { ["type"] = "value", ["axisLabel"] = new Dictionary<string, object> { ["formatter"] = "{value}" } } };
+ /// <summary>
+ /// Y杞村潗鏍囩偣
+ /// </summary>
+ /// <value>The YA rray.</value>
+ [Newtonsoft.Json.JsonIgnore]
+ public object[] YArray
+ {
+ get
+ {
+ return (series[0] as Dictionary<string, object>)["data"] as object[];
+ }
+ set
+ {
+ (series[0] as Dictionary<string, object>)["data"] = value;
+ }
+ }
+ [Newtonsoft.Json.JsonProperty]
+ readonly List<object> series = new List<object> { new Dictionary<string, object> { ["name"] = "Value", ["type"] = "line", ["data"] = new object[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, ["markPoint"] = new Dictionary<string, object> { ["data"] = new List<object> { new Dictionary<string, object> { ["type"] = "max", ["name"] = "Max" }, new Dictionary<string, object> { ["type"] = "min", ["name"] = "Min" } } }, ["markLine"] = new Dictionary<string, object> { ["data"] = new List<object> { new Dictionary<string, object> { ["type"] = "average", ["name"] = "Average" } } } } };
+ }
+ }
+}
+
+
diff --git a/Shared.IOS/UI/MyEchartsViewOn.cs b/Shared.IOS/UI/MyEchartsViewOn.cs
new file mode 100644
index 0000000..001c89a
--- /dev/null
+++ b/Shared.IOS/UI/MyEchartsViewOn.cs
@@ -0,0 +1,148 @@
+using Foundation;
+using System;
+using WebKit;
+
+namespace Shared
+{
+ /// <summary>
+ /// MyEchartsViewOn HDLON+
+ /// </summary>
+ public class MyEchartsViewOn : View
+ {
+ //EchartRootJson jsonData = new EchartRootJson() { };
+
+ /// <summary>
+ /// option鐨勯厤缃甹son
+ /// </summary>
+ string optionJsonString;
+
+ /// <summary>
+ /// WKWebView鎺т欢
+ /// </summary>
+ WKWebView uIWebView;
+
+ /// <summary>
+ ///
+ /// </summary>
+ public MyEchartsViewOn()
+ {
+ //jsonData = new EchartRootJson();
+ //榛樿甯冨眬锛屽楂樹负0鐨勮瘽浼氬紓甯�
+ var mFrame = new CoreGraphics.CGRect(base.X, base.Y, 10, 10);
+ uIWebView = new WKWebView(mFrame, new WKWebViewConfiguration()) { };
+ uiView = uIWebView;
+ uIWebView.ScrollView.Bounces = false;
+ uIWebView.ScrollView.ScrollEnabled = false;
+ uIWebView.NavigationDelegate = new OnWKNavigationDelegate(this);
+ //var filePath = NSBundle.MainBundle.PathForResource("echarts", "html");
+ var filePath = NSBundle.MainBundle.PathForResource("echartsNew", "html");
+
+ var url = new NSUrl(filePath, false);
+ uIWebView.LoadFileUrl(url, url);
+ }
+
+ /// <summary>
+ /// 鍔犺浇鏈湴HTML
+ /// </summary>
+ public void LoadFileUrl()
+ {
+ var filePath = NSBundle.MainBundle.PathForResource(htmlPathName, "html");
+ var url = new NSUrl(filePath, false);
+ uIWebView.LoadFileUrl(url, url);
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ string htmlPathName = "echarts";
+ public string HtmlPathName
+ {
+ get
+ {
+ return htmlPathName;
+ }
+ set
+ {
+ htmlPathName = value;
+ LoadFileUrl();
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁閲囩敤LoadEchartsNew鐨勬柟寮�
+ /// </summary>
+ bool IsLoadEchartsNew = false;
+ /// <summary>
+ /// 鍔犺浇Option閰嶇疆鍙傛暟
+ /// 鍒锋柊鍥捐〃
+ /// </summary>
+ /// <param name="option"></param>
+ public void ShowWithOption(string option)
+ {
+ IsLoadEchartsNew = true;
+ optionJsonString = option;
+ EvaluateJavascript();
+ }
+
+ /// <summary>
+ /// 鍔犺浇Option閰嶇疆jsonString
+ /// </summary>
+ /// <param name="jsonString"></param>
+ public void ShowWithOptionJsonString(string jsonString)
+ {
+ IsLoadEchartsNew = false;
+ optionJsonString = jsonString;
+ EvaluateJavascript();
+ }
+
+ /// <summary>
+ /// EvaluateJavascript
+ /// </summary>
+ public void EvaluateJavascript()
+ {
+ WKJavascriptEvaluationResult handler = (NSObject result, NSError err) =>
+ {
+ if (err != null)
+ {
+ HDLUtils.WriteLine("EvaluateJavascript:" + err);
+ }
+ if (result != null)
+ {
+ HDLUtils.WriteLine("EvaluateJavascript:" + result);
+ }
+ };
+ //鏄惁璋冪敤loadEchartsNew
+ if (IsLoadEchartsNew)
+ {
+ uIWebView.EvaluateJavaScript($"loadEchartsNew({optionJsonString})", handler);
+ }
+ else
+ {
+ uIWebView.EvaluateJavaScript($"loadEcharts({optionJsonString})", handler);
+ }
+ }
+
+ /// <summary>
+ /// OnWKNavigationDelegate
+ /// </summary>
+ public class OnWKNavigationDelegate : WKNavigationDelegate
+ {
+ [Weak] MyEchartsViewOn _MyEchartsViewOn;
+
+ public OnWKNavigationDelegate(MyEchartsViewOn view)
+ {
+ _MyEchartsViewOn = view;
+ }
+
+ public override void DidFinishNavigation(WKWebView webView, WKNavigation navigation)
+ {
+ Console.WriteLine("WKWebView DidFinishNavigation");
+ _MyEchartsViewOn.EvaluateJavascript();
+ }
+ }
+
+ }
+
+}
+
+
diff --git a/Shared.IOS/UI/PageLayout.cs b/Shared.IOS/UI/PageLayout.cs
new file mode 100644
index 0000000..bfc45d8
--- /dev/null
+++ b/Shared.IOS/UI/PageLayout.cs
@@ -0,0 +1,335 @@
+using System;
+using UIKit;
+using Shared.IO;
+using CoreGraphics;
+using Foundation;
+
+namespace Shared
+{
+ /// <summary>
+ /// 浣嶇疆甯冨眬
+ /// </summary>
+ public class PageLayout : ViewGroup
+ {
+ readonly MyPageLayout iosUIScrolView;
+
+ readonly UIPageControl iosUIPageControl;
+
+ /// <summary>
+ /// 椤甸潰鍙樺寲浜嬩欢
+ /// </summary>
+ public Action<PageLayout,int> PageChange;
+
+ /// <summary>
+ /// 鍨傜洿鏂瑰悜婊氬姩瑙嗗浘
+ /// </summary>
+ class MyPageLayout : UIScrollView
+ {
+ [Weak] PageLayout pageLayout;
+ public MyPageLayout(PageLayout pageLayout)
+ {
+ this.pageLayout = pageLayout;
+ DecelerationEnded += (s, e) =>
+ {
+ var tempUIScrolView = s as MyPageLayout;
+ //鑾峰彇褰撳墠鐣岄潰鐨勭储寮�
+ var tempPageIndex = Convert.ToInt32(tempUIScrolView.ContentOffset.X / tempUIScrolView.Frame.Width);
+
+ //閫氱煡鐣岄潰绱㈠紩鍙樺寲
+ if (this.pageLayout.pageIndex != tempPageIndex)
+ {
+ this.pageLayout.pageIndex = tempPageIndex;
+ this.pageLayout.iosUIPageControl.CurrentPage = tempPageIndex;
+ this.pageLayout.PageChange?.Invoke(this.pageLayout, this.pageLayout.pageIndex);
+ }
+ };
+ }
+
+ /// <summary>
+ /// 2021-04-21
+ /// UIScrollView鍜孶IControl婊戝姩鍐茬獊瑙e喅
+ /// </summary>
+ /// <param name="point"></param>
+ /// <param name="uievent"></param>
+ /// <returns></returns>
+ public override UIView HitTest(CGPoint point, UIEvent uievent)
+ {
+ //1.寰楀埌鎺ユ敹浜嬩欢view
+ var findUIView = base.HitTest(point, uievent);
+ //2.濡傛灉涔嬪墠鏄兘澶熸粦鍔ㄧ殑鎵嶅仛澶勭悊
+ if (this.pageLayout.scrollEnabled)
+ {
+ //3.鍒ゆ柇濡傛灉view鏄疷IControl鐪熷綋鍓嶆粦鍔╒iew绂佹婊戝姩
+ if (findUIView.IsKindOfClass(new UIControl().Class))
+ {
+ //濡傛灉鎺ユ敹浜嬩欢view鏄疷IControl,鍒檚crollview绂佹鍝嶅簲婊戝姩
+ this.ScrollEnabled = false;
+ }
+ else
+ { //濡傛灉涓嶆槸,鍒欐仮澶嶆粦鍔�
+ this.ScrollEnabled = true;
+ }
+ }
+ return findUIView;
+
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮寮�濮�
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesBegan(NSSet touches, UIEvent evt)
+ {
+ pageLayout?.TouchEvent(EventActions.Down, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 绉诲姩
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesMoved(NSSet touches, UIEvent evt)
+ {
+ pageLayout?.TouchEvent(EventActions.Move, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮寮硅捣
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesEnded(NSSet touches, UIEvent evt)
+ {
+ pageLayout?.TouchEvent(EventActions.Up, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ public override void TouchesCancelled(NSSet touches, UIEvent evt)
+ {
+ pageLayout?.TouchEvent(EventActions.Cancel, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 妗嗘灦榛樿鍔犱簡涓や釜UIImageView 锛岃繖鏍峰彲浠ュ幓鎺夐粯璁ゆ坊鍔�
+ /// </summary>
+ /// <param name="view">View.</param>
+ public override void AddSubview(UIView view)
+ {
+ if (view.GetType() == typeof(UIImageView) && view.Tag != int.MinValue)
+ {
+ return;
+ }
+
+ if (view.ToString().Contains("UIScrollViewScrollIndicator"))
+ {
+ return;
+ }
+ base.AddSubview(view);
+ }
+ }
+
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public PageLayout()
+ {
+ viewGroup = new UIView();
+ iosUIPageControl = new UIPageControl { Enabled = false };
+ iosUIScrolView = new MyPageLayout(this) { };
+
+ realViewGroup = iosUIScrolView;
+
+ var frame = iosUIPageControl.Frame;
+ frame.Height = 16;
+ iosUIPageControl.Frame = frame;
+ //鍚姩缈婚〉鍔熻兘
+ iosUIScrolView.PagingEnabled = true;
+ iosUIScrolView.Bounces = false;
+ iosUIScrolView.ShowsHorizontalScrollIndicator = false;
+ viewGroup.AddSubview(iosUIScrolView);
+ viewGroup.AddSubview(iosUIPageControl);
+ scrollEnabled = (iosUIScrolView as MyPageLayout).ScrollEnabled;
+ }
+
+
+ /// <summary>
+ /// 鏄惁鏄剧ず涓嬮潰涓�鎺掔殑鐐�
+ /// </summary>
+ /// <value><c>true</c> if is show point; otherwise, <c>false</c>.</value>
+ public bool IsShowPoint
+ {
+ get
+ {
+ return !iosUIPageControl.Hidden;
+ }
+ set
+ {
+ iosUIPageControl.Hidden = !value;
+ }
+ }
+
+ bool scrollEnabled;
+ /// <summary>
+ /// 鏄惁鍏佽婊戝姩
+ /// </summary>
+ /// <value><c>true</c> if scroll enabled; otherwise, <c>false</c>.</value>
+ public bool ScrollEnabled
+ {
+ get
+ {
+ return (iosUIScrolView as MyPageLayout).ScrollEnabled;
+ }
+ set
+ {
+ scrollEnabled = value;
+ (iosUIScrolView as MyPageLayout).ScrollEnabled = value;
+ }
+ }
+
+ int pageIndex;
+ /// <summary>
+ /// 璁剧疆鎴栬�呰幏鍙栧綋鍓嶇殑鐣岄潰绱㈠紩
+ /// </summary>
+ /// <value>The index of the page.</value>
+ public int PageIndex
+ {
+ get
+ {
+ return pageIndex;
+ }
+ set
+ {
+ if (value < 0 || ChildrenCount <= value)
+ {
+ return;
+ }
+ int beforePageIndex = pageIndex;
+ pageIndex = value;
+ if (!IsCanRefresh)
+ {
+ return;
+ }
+
+ var viewSize = iosUIScrolView.Frame.Size;
+ var rect = new CGRect(pageIndex * viewSize.Width, 0, viewSize.Width, viewSize.Height);
+ iosUIScrolView.ScrollRectToVisible(rect, false);
+
+ if (beforePageIndex != pageIndex)
+ {
+ iosUIPageControl.CurrentPage = pageIndex;
+ PageChange?.Invoke(this, pageIndex);
+ }
+ }
+ }
+ /// <summary>
+ /// 澧炲姞瀛愭帶浠�
+ /// </summary>
+ /// <param name="view">View.</param>
+ public override void AddChidren(View view)
+ {
+ //var v = Application.AverageScale;
+ //var vv = Application.CurrentHeight;
+ //var dddd = Application.DesignWidth;
+ base.AddChidren(view);
+ iosUIPageControl.Pages = ChildrenCount;
+ ReLocation();
+ }
+
+ /// <summary>
+ /// 閲嶆柊鎺掍綅缃強璁惧鍐呭澶у皬
+ /// </summary>
+ public virtual void ReLocation()
+ {
+ if (iosUIScrolView.Subviews.Length == 0)
+ {
+ return;
+ }
+
+ for (int i = 1; i < iosUIScrolView.Subviews.Length; i++)
+ {
+ var frame = iosUIScrolView.Subviews[i].Frame;
+ frame.X = iosUIScrolView.Subviews[i - 1].Frame.Right;
+ iosUIScrolView.Subviews[i].Frame = frame;
+ }
+
+ iosUIScrolView.ContentSize = new CoreGraphics.CGSize(iosUIScrolView.Subviews[iosUIScrolView.Subviews.Length - 1].Frame.Right, iosUIScrolView.Frame.Height);
+ }
+
+
+
+ /// <summary>
+ /// 鎺т欢瀹藉害
+ /// </summary>
+ /// <value>The width.</value>
+ public override int Width
+ {
+ get
+ {
+ return base.Width;
+ }
+ set
+ {
+ base.Width = value;
+ if (!IsCanRefresh)
+ return;
+ var frame = iosUIPageControl.Frame;
+ frame.Width = Width;
+ iosUIPageControl.Frame = frame;
+ }
+ }
+
+ /// <summary>
+ /// 鎺т欢鐨勯珮搴�
+ /// </summary>
+ /// <value>The height.</value>
+ public override int Height
+ {
+ get
+ {
+ return base.Height;
+ }
+ set
+ {
+ base.Height = value;
+ if (!IsCanRefresh)
+ return;
+ var frame = iosUIPageControl.Frame;
+ frame.Y = Height - frame.Height;
+ iosUIPageControl.Frame = frame;
+ }
+ }
+
+ /// <summary>
+ /// 绉婚櫎褰撳墠鎺т欢
+ /// </summary>
+ /// <param name="view">View.</param>
+ internal override void Remove(View view)
+ {
+ base.Remove(view);
+ ReLocation();
+ PageIndex = ChildrenCount - 1;
+ iosUIPageControl.Pages = ChildrenCount;
+ iosUIPageControl.CurrentPage = PageIndex;
+ }
+
+ /// <summary>
+ /// 绉婚櫎鎵�鏈夌殑鎺т欢
+ /// </summary>
+ public override void RemoveAll()
+ {
+ base.RemoveAll();
+ ReLocation();
+ iosUIPageControl.Pages = 0;
+ PageIndex = 0;
+ iosUIPageControl.CurrentPage = 0;
+ }
+
+ /// <summary>
+ /// 鏍规嵁绱㈠紩绉婚櫎鎺т欢
+ /// </summary>
+ /// <param name="index">Index.</param>
+ public override void RemoveAt(int index)
+ {
+ Remove(viewList[index]);
+ }
+ }
+}
+
diff --git a/Shared.IOS/UI/PickerView.cs b/Shared.IOS/UI/PickerView.cs
new file mode 100644
index 0000000..9ed5848
--- /dev/null
+++ b/Shared.IOS/UI/PickerView.cs
@@ -0,0 +1,176 @@
+锘縰sing System;
+using Foundation;
+using System.Collections.Generic;
+using Shared.IOS.TBL;
+
+namespace Shared
+{
+ public static class PickerView
+ {
+ //public static void Show(List<KeyValuePair<string, string[]>> list, Action<int> action, string sure = "Sure", string beforeValue = "")
+ //{
+ // var tempList = new List<NSDictionary>();
+ // foreach (KeyValuePair<string, string[]> kv in list)
+ // {
+ // tempList.Add(NSDictionary.FromObjectAndKey(NSArray.FromStrings(kv.Value), new NSString(kv.Key)));
+ // }
+ // var nSArray = NSArray.FromNSObjects(tempList.ToArray());
+ // ZJPickerView.Zj_showWithDataList(nSArray,
+ // NSDictionary.FromObjectsAndKeys(new NSString[]{
+ // new NSString(beforeValue),
+ // new NSString(sure),
+ // //new NSString(cancel),
+ // }, new NSString[] {
+ // Constants.ZJPickerViewPropertyTipLabelTextKey ,
+ // Constants.ZJPickerViewPropertySureBtnTitleKey,
+ // //Constants.ZJPickerViewPropertyCanceBtnTitleKey
+ // }), (selectIndex1, selectIndex2, selectIndex3s) =>
+ // {
+ // if (action != null)
+ // {
+ // action((int)selectIndex1);
+ // }
+ // });
+ //}
+
+
+ public static void Show(List<string> mList, Action<int> action, int mSelectIndex1 = 0, string title = "", string sure = "纭", string cancel = "鍙栨秷")
+ {
+
+ //璁剧疆榛樿閫変腑绱㈠紩 鏍煎紡锛�"selectIndex1-selectIndex2-selectIndex3"
+ string selectStr = mSelectIndex1 + "-0-0";
+
+ ZJPickerView.Zj_showWithDataList(NSArray.FromObjects(mList.ToArray()),
+ NSDictionary.FromObjectsAndKeys(new NSString[]{
+ new NSString(title),
+ new NSString(sure),
+ new NSString(cancel),
+ new NSString(selectStr)//璁剧疆榛樿閫変腑绱㈠紩
+ }, new NSString[] {
+ Constants.ZJPickerViewPropertyTipLabelTextKey,
+ Constants.ZJPickerViewPropertySureBtnTitleKey,
+ Constants.ZJPickerViewPropertyCanceBtnTitleKey,
+ Constants.ZJPickerViewPropertyDefaultSelectedIndexKey
+
+ }), (selectIndex1, selectIndex2, selectIndex3) => {
+ action?.Invoke((int)selectIndex1);
+ });
+ }
+
+ /// <summary>
+ /// 浜岀骇鑱斿姩寮圭獥 鏀寔鑷畾涔夋爣棰橈紝纭鎸夐挳锛屽彇娑堟寜閽枃瀛�
+ /// </summary>
+ public static void ShowSecondary(List<string> mFirstList, List<List<string>> mSecondList, Action<int, int> action, int mSelectIndex1 = 0, int mSelectIndex2 = 0, string title = "", string sure = "纭", string cancel = "鍙栨秷")
+ {
+ if (mFirstList == null)
+ {
+ return;
+ }
+
+ if (mFirstList.Count != mSecondList.Count)
+ {
+
+ return;
+ }
+
+ //璁剧疆榛樿閫変腑绱㈠紩 鏍煎紡锛�"selectIndex1-selectIndex2-selectIndex3"
+ string selectStr = mSelectIndex1 + "-" + mSelectIndex2 + "-0";
+
+ var dictDataList = new NSMutableArray();
+
+
+ for (int i = 0; i < mFirstList.Count; i++)
+ {
+
+ dictDataList.Add(NSDictionary.FromObjectAndKey(NSArray.FromObjects(mSecondList[i].ToArray()), new NSString(mFirstList[i])));
+
+ }
+
+ //Shared.HDLUtils.WriteLine("OnOptionsSelect: ZJPickerView锛�" + dictDataList.ToString());
+
+ NSDictionary settingNSDictionary = NSDictionary.FromObjectsAndKeys(new NSString[]{
+ new NSString(title),
+ new NSString(sure),
+ new NSString(cancel),
+ new NSString(selectStr)//璁剧疆榛樿閫変腑绱㈠紩
+ }, new NSString[] {
+ Constants.ZJPickerViewPropertyTipLabelTextKey,
+ Constants.ZJPickerViewPropertySureBtnTitleKey,
+ Constants.ZJPickerViewPropertyCanceBtnTitleKey,
+ Constants.ZJPickerViewPropertyDefaultSelectedIndexKey
+
+ });
+
+ ZJPickerView.Zj_showWithDataList(
+ dictDataList,
+ settingNSDictionary,
+ (selectIndex1, selectIndex2, selectIndex3) => {
+ action?.Invoke((int)selectIndex1, (int)selectIndex2);
+ });
+
+
+ }
+
+
+
+
+ /// <summary>
+ /// 涓嶈仈鍔ㄦ敮鎸佽嚜瀹氫箟鏍囬锛岀‘璁ゆ寜閽紝鍙栨秷鎸夐挳鏂囧瓧
+ /// </summary>
+ public static void ShowNormal(List<string> mFirstList, List<string> mSecondList, List<string> mThirdList, Action<int, int, int> action, int mSelectIndex1 = 0, int mSelectIndex2 = 0, int mSelectIndex3 = 0, string title = "", string sure = "纭", string cancel = "鍙栨秷")
+ {
+ if (mFirstList == null)
+ {
+ return;
+ }
+
+ if (mSecondList == null)
+ {
+ return;
+ }
+
+ NSArray mThirdListNSArray = null;
+ if (mThirdList != null)
+ {
+ mThirdListNSArray = NSArray.FromObjects(mThirdList.ToArray());
+ }
+
+
+
+ //璁剧疆榛樿閫変腑绱㈠紩 鏍煎紡锛�"selectIndex1-selectIndex2-selectIndex3"
+ string selectStr = mSelectIndex1 + "-" + mSelectIndex2 + "-" + mSelectIndex3;
+
+
+ NSDictionary settingNSDictionary = NSDictionary.FromObjectsAndKeys(new NSString[]{
+ new NSString(title),
+ new NSString(sure),
+ new NSString(cancel),
+ new NSString(selectStr)//璁剧疆榛樿閫変腑绱㈠紩
+ }, new NSString[] {
+ Constants.ZJPickerViewPropertyTipLabelTextKey,
+ Constants.ZJPickerViewPropertySureBtnTitleKey,
+ Constants.ZJPickerViewPropertyCanceBtnTitleKey,
+ Constants.ZJPickerViewPropertyDefaultSelectedIndexKey
+
+ });
+
+
+ Shared.HDLUtils.WriteLine("OnOptionsSelect: ZJPickerView锛�" + NSArray.FromObjects(mFirstList.ToArray()).ToString() + "\n mSecondList锛�" + NSArray.FromObjects(mSecondList.ToArray()).ToString());
+
+ ZJPickerView.Zj_showWithDataListWithNotLinked(
+ NSArray.FromObjects(mFirstList.ToArray()),
+ NSArray.FromObjects(mSecondList.ToArray()),
+ mThirdListNSArray,
+ settingNSDictionary,
+ (selectIndex1, selectIndex2, selectIndex3) => {
+ action?.Invoke((int)selectIndex1, (int)selectIndex2, (int)selectIndex3);
+ });
+
+
+ }
+
+ }
+
+
+
+}
diff --git a/Shared.IOS/UI/ProgressLoading.cs b/Shared.IOS/UI/ProgressLoading.cs
new file mode 100644
index 0000000..4136a2c
--- /dev/null
+++ b/Shared.IOS/UI/ProgressLoading.cs
@@ -0,0 +1,418 @@
+锘縰sing System;
+using System.Threading;
+using CoreGraphics;
+using Foundation;
+using UIKit;
+
+namespace Shared
+{
+ public class ProgressLoading : View
+ {
+
+ ProgressLoadingView mProgressLoadingView
+ {
+ get
+ {
+ return uiView as ProgressLoadingView;
+ }
+ set
+ {
+ uiView = value;
+ }
+ }
+
+
+
+ public ProgressLoading()
+ {
+ mProgressLoadingView = new ProgressLoadingView(this) { };
+ LoadingBackgroundColor = 0x30696969;
+ //iosButton.BackgroundColor = UIColor.Clear;
+ }
+
+ Thread mLoadingThead;
+ bool IsStartLoading;
+ /// <summary>
+ /// 寮�濮婰oading绾跨▼
+ /// </summary>
+ /// <param name="mTime">鏈�灏�1000ms</param>
+ public void StartLoading(int mTime = 3000)
+ {
+ try
+ {
+ if (mTime < 500) mTime = 500;
+
+ EndLoading();
+ mProgressLoadingView.BackgroundColor = mLoadingBackgroundColor;
+ //Progress = 0;
+ float PP = 0;
+ int count = (int)(mTime * 0.01f);
+
+ mLoadingThead = new Thread((obj) =>
+ {
+ try
+ {
+ IsStartLoading = true;
+ while (PP <= 1 && IsStartLoading)
+ {
+ PP = PP + 0.01f;
+ Application.RunOnMainThread(() =>
+ {
+ Progress = PP;
+ });
+ Thread.Sleep(count);
+ }
+ }
+ catch
+ {
+
+ }
+ finally
+ {
+ IsStartLoading = false;
+ Application.RunOnMainThread(() =>
+ {
+ Progress = 0;
+ mProgressLoadingView.BackgroundColor = UIColor.Clear;
+ SetIsNeedRemove();
+ });
+ }
+
+ });
+ mLoadingThead.Start();
+ }
+ catch
+ {
+
+ }
+ }
+
+ /// <summary>
+ /// 缁撴潫Loading
+ /// </summary>
+ void EndLoading()
+ {
+ IsStartLoading = false;
+ if (mLoadingThead != null)
+ mLoadingThead.Abort();
+
+ Progress = 0;
+ mProgressLoadingView.BackgroundColor = UIColor.Clear;
+
+ }
+
+ void SetIsNeedRemove()
+ {
+ if (IsNeedRemove)
+ {
+ this.RemoveFromParent();
+ }
+ }
+
+ /// <summary>
+ /// 缁撴潫Loading
+ /// </summary>
+ public void HideLoading()
+ {
+ EndLoading();
+ SetIsNeedRemove();
+ }
+
+
+
+
+ /// <summary>
+ /// 鍒锋柊甯冨眬
+ /// </summary>
+ private void RefreshFrame()
+ {
+ (uiView as ProgressLoadingView).InitWithFrameArc(new CoreGraphics.CGRect(base.X, base.Y, base.Width, base.Height));
+ }
+
+
+
+ /// <summary>
+ /// 鎺т欢瀹藉害
+ /// </summary>
+ public override int Width
+ {
+ get
+ {
+ return base.Width;
+ }
+ set
+ {
+ base.Width = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨勯珮搴�
+ /// </summary>
+ public override int Height
+ {
+ get
+ {
+ return base.Height;
+ }
+ set
+ {
+ base.Height = value;
+ RefreshFrame();
+ }
+ }
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int X
+ {
+ get
+ {
+ return base.X;
+ }
+ set
+ {
+ base.X = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int Y
+ {
+ get
+ {
+ return base.Y;
+ }
+ set
+ {
+ base.Y = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊�
+ /// </summary>
+ /// <value>杩涘害鍊�</value>
+ public float Progress
+ {
+ set
+ {
+ mProgressLoadingView.Progress = value;
+ }
+ get
+ {
+ return mProgressLoadingView.Progress;
+ }
+ }
+
+
+ /// <summary>
+ /// 褰撳墠杩涘害瀹�
+ /// </summary>
+ /// <value>杩涘害鍊�</value>
+ public int ProgressWidth
+ {
+ set
+ {
+ mProgressLoadingView.ProgressWidth = value;
+ }
+ get
+ {
+ return (int)mProgressLoadingView.ProgressWidth;
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍗婂緞
+ /// </summary>
+ /// <value>杩涘害鍊�</value>
+ public int ProgressRadius
+ {
+ set
+ {
+ mProgressLoadingView.Radius = value;
+ }
+ get
+ {
+ return (int)mProgressLoadingView.Radius;
+ }
+ }
+
+ /// <summary>
+ /// 杩涘害鏉¢鑹�
+ /// </summary>
+ /// <value>鍗曚竴杩涘害鏉¢鑹�</value>
+ public uint ProgressBarColor
+ {
+ set
+ {
+ mProgressLoadingView.mProgressBarColor = HDLUtils.GetUIColorWithUint(value);
+ mProgressLoadingView.SetNeedsDisplay();
+ }
+ }
+
+ UIColor mLoadingBackgroundColor = UIColor.Gray;
+ /// <summary>
+ /// LoadingBackgroundColor
+ /// </summary>
+ /// <value>鑳屾櫙棰滆壊</value>
+ public uint LoadingBackgroundColor
+ {
+ set
+ {
+ mLoadingBackgroundColor = HDLUtils.GetUIColorWithUint(value);
+ }
+
+ }
+
+ bool isNeedRemove = true;
+ public bool IsNeedRemove
+ {
+ get
+ {
+ return isNeedRemove;
+
+ }
+ set
+ {
+ isNeedRemove = value;
+ }
+
+ }
+
+
+
+ public class ProgressLoadingView : UIKit.UIView
+ {
+ /// <summary>
+ /// 鍒锋柊甯冨眬
+ /// </summary>
+ public void InitWithFrameArc(CGRect mCGRect)
+ {
+ this.Frame = mCGRect;
+ }
+
+ [Weak] View view;
+ public ProgressLoadingView(View view)
+ {
+ this.view = view;
+ }
+
+
+ float mProgress = 0.0f;
+ public UIColor mProgressBarColor = UIColor.White;
+ public nfloat ProgressWidth = 3;
+ public nfloat Radius = 15;
+ public nfloat StartAngle = (nfloat)(-Math.PI * 0.5);
+ public override void Draw(CGRect rect)
+ {
+
+ base.Draw(rect);
+
+ if (isShow && mProgress > 0)
+ {
+ CGContext ctx = UIGraphics.GetCurrentContext();
+
+ if (ctx == null) return;
+ ctx.SaveState();
+ nfloat xCenter = rect.Size.Width * 0.5f;
+ nfloat yCenter = rect.Size.Height * 0.5f;
+ //mProgressBarColor.SetStroke();
+ mProgressBarColor.SetColor();
+
+ ctx.SetLineWidth(ProgressWidth);
+ ctx.SetLineCap(CGLineCap.Round);
+ nfloat endAngle = (nfloat)(StartAngle + mProgress * Math.PI * 2.0f); // 鍒濆鍊�0.05
+ ctx.AddArc(xCenter, yCenter, Radius, StartAngle, endAngle, false);
+ ctx.StrokePath();
+
+ ctx.RestoreState();
+ }
+
+
+ }
+
+ bool isShow = true;
+ public bool IsShow
+ {
+ get
+ {
+ return isShow;
+
+ }
+ set
+ {
+ isShow = value;
+ SetNeedsDisplay();
+ }
+
+ }
+
+ public float Progress
+ {
+ get
+ {
+ return mProgress;
+ }
+ set
+ {
+ if (value < 0) value = 0.0f;
+
+ if (value > 1) value = 1.0f;
+
+ mProgress = value;
+
+ SetNeedsDisplay();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// 鐐瑰嚮寮�濮�
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesBegan(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Down, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 绉诲姩
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesMoved(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Move, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮寮硅捣
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesEnded(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Up, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ public override void TouchesCancelled(NSSet touches, UIEvent evt)
+ {
+ view?.TouchEvent(EventActions.Cancel, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+
+ }
+ }
+}
diff --git a/Shared.IOS/UI/RowLayout.cs b/Shared.IOS/UI/RowLayout.cs
new file mode 100644
index 0000000..558a638
--- /dev/null
+++ b/Shared.IOS/UI/RowLayout.cs
@@ -0,0 +1,490 @@
+using System;
+using UIKit;
+using CoreGraphics;
+using Shared.IO;
+using Foundation;
+
+namespace Shared
+{
+ /// <summary>
+ /// 鍦ㄦ粦鍔ㄤ簨浠朵笅锛屽彲鏄剧ず闅愯棌浜涜嚜瀹氫箟瑙嗗浘
+ /// </summary>
+ public class RowLayout : ViewGroup
+ {
+ /// <summary>
+ /// OpenMenuAction
+ /// </summary>
+ public Action OpenMenuAction;
+
+ /// <summary>
+ /// 鍙宠竟鐨勮鍥惧垪琛�
+ /// </summary>
+ internal System.Collections.Generic.List<Button> leftView = new System.Collections.Generic.List<Button>();
+ /// <summary>
+ /// 鍙宠竟鐨勮鍥惧垪琛�
+ /// </summary>
+ internal System.Collections.Generic.List<Button> rigthView = new System.Collections.Generic.List<Button>();
+ /// <summary>
+ /// 涓嬮潰閭h竟寮�
+ /// </summary>
+ UIView lineUIView = new UIView();
+
+ /// <summary>
+ /// 閲嶆柊鍒锋柊鎺т欢
+ /// </summary>
+ public override void Refresh()
+ {
+ base.Refresh();
+ LineColor = lineColor;
+ }
+ /// <summary>
+ /// 鎺т欢瀹藉害
+ /// </summary>
+ public override int Width
+ {
+ get
+ {
+ return base.Width;
+ }
+ set
+ {
+ base.Width = value;
+ if (!IsCanRefresh)
+ return;
+
+ var frame4 = lineUIView.Frame;
+ frame4.Width = base.Width;
+ lineUIView.Frame = frame4;
+ }
+ }
+
+ /// <summary>
+ /// 瀛愯鍥剧殑瀹藉害
+ /// </summary>
+ public int SubViewWidth = 70;
+
+ /// <summary>
+ /// 鎺т欢鐨勯珮搴�
+ /// </summary>
+ /// <value>The height.</value>
+ public override int Height
+ {
+ get
+ {
+ return base.Height;
+ }
+ set
+ {
+ base.Height = value;
+ if (!IsCanRefresh)
+ return;
+
+ {
+ var frame = realViewGroup.Frame;
+ frame.Height = Height;
+ realViewGroup.Frame = frame;
+ }
+
+ var frame4 = lineUIView.Frame;
+ frame4.Y = base.Height - frame4.Height;
+ lineUIView.Frame = frame4;
+ }
+ }
+
+ uint lineColor = 0x80818181;
+ /// <summary>
+ /// 鑳屾櫙棰滆壊
+ /// </summary>
+ /// <value>The color of the background.</value>
+ public virtual uint LineColor
+ {
+ get
+ {
+ return lineColor;
+ }
+ set
+ {
+ lineColor = value;
+ if (!IsCanRefresh)
+ {
+ return;
+ }
+ byte r, g, b, a;
+ r = (byte)(lineColor / 256 / 256 % 256);
+ g = (byte)(lineColor / 256 % 256);
+ b = (byte)(lineColor % 256);
+ a = (byte)(lineColor / 256 / 256 / 256 % 256);
+ lineUIView.BackgroundColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁姝f墦寮�
+ /// </summary>
+ //public bool IsOpening;
+ public bool IsShowLeft;
+ public bool IsShowRight;
+
+ /// <summary>
+ /// 鍏抽棴鍏朵粬RowLayout 鏄剧ず鐨刅iew
+ /// </summary>
+ private void HideOtherRowLayout()
+ {
+ try
+ {
+ if (this.Parent != null)
+ {
+ foreach (View mView in Parent.viewList)
+ {
+ if (mView is RowLayout && mView != this)
+ {
+
+ if ((mView as RowLayout).IsShowRight || (mView as RowLayout).IsShowLeft)
+ {
+ (mView as RowLayout).HideMenu();
+ }
+ }
+ }
+
+ }
+ }
+ catch
+ {
+ }
+ }
+
+ /// <summary>
+ /// 鍏抽棴鏄剧ず鐨刅iew
+ /// </summary>
+ public void HideMenu()
+ {
+ if (IsShowLeft)
+ {
+ HideLeftMenu();
+ }
+ if (IsShowRight)
+ {
+ HideRightMenu();
+ }
+
+ }
+
+ public void OpenLeftMenu()
+ {
+ HideOtherRowLayout();
+ if (IsShowRight)
+ {
+ HideRightMenu();
+ return;
+ }
+
+ if (leftView.Count == 0)
+ return;
+
+
+ IsShowLeft = true;
+ (viewGroup as UIScrollView).SetContentOffset(new CGPoint(leftView[0].RealView.Frame.X, 0), true);
+ OpenMenuAction?.Invoke();
+ }
+
+ public void HideLeftMenu()
+ {
+ IsShowLeft = false;
+ HideAllMenuView();
+ }
+
+ public void OpenRightMenu()
+ {
+ HideOtherRowLayout();
+ if (IsShowLeft)
+ {
+ HideLeftMenu();
+ return;
+ }
+ if (rigthView.Count == 0)
+ return;
+ IsShowRight = true;
+ var rigthViewX = realViewGroup.Frame.X + GetAllRightViewWidth();
+ (viewGroup as UIScrollView).SetContentOffset(new CGPoint(rigthViewX, 0), true);
+ OpenMenuAction?.Invoke();
+
+ }
+
+ public void HideRightMenu()
+ {
+ IsShowRight = false;
+
+ HideAllMenuView();
+ }
+
+ void RestMenuView() {
+ if (IsShowRight)
+ {
+ OpenRightMenu();
+ }
+ else if (IsShowLeft)
+ {
+ OpenLeftMenu();
+
+ }
+ else {
+ HideAllMenuView();
+ }
+
+ }
+
+ void HideAllMenuView()
+ {
+ (viewGroup as UIScrollView).SetContentOffset(new CGPoint(realViewGroup.Frame.X, 0), true);
+ }
+
+ /// <summary>
+ /// 鏄惁浣跨敤鍚屾牱鐨凷ubViewWidth瀹�
+ /// </summary>
+ bool isUseSameSubViewWidth = true;
+ public bool IsUseSameSubViewWidth
+ {
+ get
+ {
+ return isUseSameSubViewWidth;
+
+ }
+ set
+ {
+ isUseSameSubViewWidth = value;
+ }
+
+ }
+
+ /// <summary>
+ /// 鑾峰彇褰撳墠leftView鐨勬�诲
+ /// </summary>
+ /// <returns></returns>
+ int GetAllLeftViewWidth() {
+ int mWidth = 0;
+ foreach (var mView in leftView)
+ {
+ mWidth += mView.Width;
+ }
+ return mWidth;
+ }
+
+ /// <summary>
+ /// 鑾峰彇褰撳墠rigthView鐨勬�诲
+ /// </summary>
+ /// <returns></returns>
+ int GetAllRightViewWidth()
+ {
+ int mWidth = 0;
+ foreach (var mView in rigthView)
+ {
+ mWidth += mView.Width;
+ }
+ return mWidth;
+ }
+
+
+ /// <summary>
+ /// 澧炲姞宸﹁竟瑙嗗浘
+ /// </summary>
+ /// <param name="view">View.</param>
+ public void AddLeftView(Button view)
+ {
+ if (null == view)
+ {
+ return;
+ }
+
+ var mSubViewWidth = isUseSameSubViewWidth ? SubViewWidth : view.Width;
+
+ view.X = GetAllLeftViewWidth();
+ view.Y = 0;
+ view.Width = mSubViewWidth;
+ view.Height = Height;
+ viewGroup.AddSubview(view.RealView);
+ view.Parent = this;
+ view.Refresh();
+ leftView.Add(view);
+ var frame = realViewGroup.Frame;
+ frame.X += mSubViewWidth;
+ realViewGroup.Frame = frame;
+ foreach (var right in rigthView)
+ {
+ right.X += mSubViewWidth;
+ }
+
+ RefreshContentSize();
+ }
+
+ void RefreshContentSize() {
+ var menuWidth = GetAllLeftViewWidth() + GetAllRightViewWidth();
+ (viewGroup as UIScrollView).ContentSize = new CoreGraphics.CGSize(menuWidth + realViewGroup.Frame.Width, 0);
+ (viewGroup as UIScrollView).SetContentOffset(new CGPoint(realViewGroup.Frame.X, 0), false);
+ }
+
+ internal override void removeChildParent()
+ {
+ foreach (var tempView in leftView)
+ {
+ tempView.Parent = null;
+ }
+ foreach (var tempView in rigthView)
+ {
+ tempView.Parent = null;
+ }
+ base.removeChildParent();
+ }
+
+ /// <summary>
+ /// 澧炲姞鍙宠竟瑙嗗浘
+ /// </summary>
+ /// <param name="view">View.</param>
+ public void AddRightView(Button view)
+ {
+ if (null == view)
+ {
+ return;
+ }
+ var mSubViewWidth = isUseSameSubViewWidth ? SubViewWidth : view.Width;
+
+ view.X =(int)realViewGroup.Frame.Right + GetAllRightViewWidth();
+ view.Y = 0;
+ view.Width = mSubViewWidth;
+ view.Height = Height;
+ viewGroup.AddSubview(view.RealView);
+ view.Parent = this;
+ view.Refresh();
+ rigthView.Add(view);
+
+ RefreshContentSize();
+ }
+
+ nfloat beforeXScrollX;
+ nfloat moveX;
+ /// <summary>
+ /// 鍦ㄦ粦鍔ㄤ簨浠朵笅锛屽彲鏄剧ず闅愯棌浜涜嚜瀹氫箟瑙嗗浘
+ /// </summary>
+ public RowLayout()
+ {
+ viewGroup = new UIScrollView { Bounces = false };
+ realViewGroup = new MyRowLayout(this) { };
+
+ viewGroup.AddSubview(realViewGroup);
+ viewGroup.Layer.MasksToBounds = true;
+
+ lineUIView.BackgroundColor = new UIColor(0x81 / 255.0f, 0x81 / 255.0f, 0x81 / 255.0f, 0.8f);
+ var lineUIViewFrame = lineUIView.Frame;
+ lineUIViewFrame.Height = 1.0f;
+ lineUIView.Frame = lineUIViewFrame;
+ viewGroup.AddSubview(lineUIView);
+
+ (viewGroup as UIScrollView).ShowsHorizontalScrollIndicator = false;//闅愯棌姘村钩婊氬姩鏉�
+
+
+ (viewGroup as UIScrollView).Scrolled += (s, e) =>
+ {
+ moveX = (viewGroup as UIScrollView).ContentOffset.X - beforeXScrollX;
+ };
+
+ (viewGroup as UIScrollView).DraggingStarted += (sender, e) =>
+ {
+ beforeXScrollX = (viewGroup as UIScrollView).ContentOffset.X;
+ };
+
+ (viewGroup as UIScrollView). DecelerationStarted += (s, e) =>
+ {
+
+ GetMovePageIndex();
+
+ };
+
+
+
+ (viewGroup as UIScrollView).DraggingEnded += (s, e) =>
+ {
+ if (!e.Decelerate)
+ {
+ GetMovePageIndex();
+ }
+ };
+
+ }
+
+ void GetMovePageIndex(){
+
+ if (20 < Math.Abs(moveX))
+ {
+ if (moveX < 0)
+ {
+ OpenLeftMenu();
+ }
+ else if (moveX > 0)
+ {
+ OpenRightMenu();
+ }
+ }
+ else
+ {
+ RestMenuView();
+ }
+ }
+
+
+ /// <summary>
+ /// 鍨傜洿鏂瑰悜婊氬姩瑙嗗浘
+ /// </summary>
+ class MyRowLayout : UIView
+ {
+ [Weak] internal RowLayout rowLayout;
+ public MyRowLayout(RowLayout rowLayout)
+ {
+ this.rowLayout = rowLayout;
+ }
+ /// <summary>
+ /// 鐐瑰嚮寮�濮�
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesBegan(NSSet touches, UIEvent evt)
+ {
+ rowLayout?.TouchEvent(EventActions.Down, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 绉诲姩
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesMoved(NSSet touches, UIEvent evt)
+ {
+ rowLayout?.TouchEvent(EventActions.Move, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮寮硅捣
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesEnded(NSSet touches, UIEvent evt)
+ {
+ rowLayout?.TouchEvent(EventActions.Up, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ public override void TouchesCancelled(NSSet touches, UIEvent evt)
+ {
+ rowLayout?.TouchEvent(EventActions.Cancel, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 妗嗘灦榛樿鍔犱簡涓や釜UIImageView 锛岃繖鏍峰彲浠ュ幓鎺夐粯璁ゆ坊鍔�
+ /// </summary>
+ /// <param name="view">View.</param>
+ public override void AddSubview(UIView view)
+ {
+ if (view.GetType() == typeof(UIImageView) && view.Tag != int.MinValue)
+ {
+ return;
+ }
+ base.AddSubview(view);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Shared.IOS/UI/Scan.cs b/Shared.IOS/UI/Scan.cs
new file mode 100644
index 0000000..6aec6b9
--- /dev/null
+++ b/Shared.IOS/UI/Scan.cs
@@ -0,0 +1,26 @@
+锘�//using System;
+//using ZXing.Mobile;
+
+//namespace Shared.Droid
+//{
+// public static class Scan
+// {
+// static ZXing.Mobile.MobileBarcodeScanner scanner;
+// public static async System.Threading.Tasks.Task ScanQRcode(Action<string> action)
+// {
+// if (scanner == null)
+// {
+// scanner = new ZXing.Mobile.MobileBarcodeScanner(new UIKit.UIViewController { });
+// }
+
+// var result = await scanner.Scan();
+
+// if (result != null)
+// action?.Invoke(result.Text);
+// else
+// action?.Invoke(null);
+
+
+// }
+// }
+//}
diff --git a/Shared.IOS/UI/Spinner.cs b/Shared.IOS/UI/Spinner.cs
new file mode 100644
index 0000000..b622784
--- /dev/null
+++ b/Shared.IOS/UI/Spinner.cs
@@ -0,0 +1,186 @@
+锘縰sing System;
+using UIKit;
+using CoreAnimation;
+
+
+namespace Shared
+{
+ /// <summary>
+ /// 褰撳墠瑙嗗浘
+ /// </summary>
+ public class Spinner : Button
+ {
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public Spinner ()
+ {
+ TextColor = 0xff007aff;
+ BorderWidth = 1;
+ Radius = 10;
+ MouseUpEventHandler += (sender1, e1) => {
+ if (AdapterStr == null || AdapterStr.Length == 0)
+ {
+ return;
+ }
+ UIScrollView tempUIScrollView = new UIScrollView();
+ tempUIScrollView.BackgroundColor = UIColor.Clear;
+ var frame2 = tempUIScrollView.Frame;
+ frame2.Width = Application.CurrentWidth;
+ frame2.Height = Application.CurrentHeight;
+ tempUIScrollView.Frame = frame2;
+ tempUIScrollView.Alpha = 0.94f;
+ UITapGestureRecognizer gestureRecognizer = new UITapGestureRecognizer(() =>
+ {
+ remoteFromSuperview(tempUIScrollView);
+ });
+ tempUIScrollView.AddGestureRecognizer(gestureRecognizer);
+
+ int height = 40;
+
+ var size = tempUIScrollView.ContentSize;
+ size.Width = Application.CurrentWidth;
+ size.Height = height * AdapterStr.Length;
+ tempUIScrollView.ContentSize = size;
+ size.Width = 20;
+ size.Height = 20;
+ for (int i = 0; i < AdapterStr.Length; i++)
+ {
+ UIButton button = new UIButton();
+ var tempButtonFrame = button.Frame;
+ tempButtonFrame.Y = (int)Math.Max(tempUIScrollView.Frame.Height, tempUIScrollView.ContentSize.Height) - (height * (i + 1));
+ tempButtonFrame.Width = Application.CurrentWidth;
+ tempButtonFrame.Height = height;
+ button.Frame = tempButtonFrame;
+ button.SetTitle(AdapterStr[i], UIControlState.Normal);
+ button.SetTitleColor(new UIColor(0x6d / 255.0f, 0x6d / 255.0f, 0x72 / 255.0f, 1), UIControlState.Normal);
+ button.BackgroundColor = UIColor.White;
+ button.Tag = i;
+ button.TouchUpInside += (sender, ee) =>
+ {
+ remoteFromSuperview(tempUIScrollView);
+ Text = AdapterStr[button.Tag];
+ if (SelectedItemChanged != null)
+ {
+ SelectedItemChanged(this, (int)button.Tag);
+ }
+ };
+ tempUIScrollView.AddSubview(button);
+
+ if (i == this.AdapterStr.Length - 1)
+ {
+
+ UIBezierPath uIBezierPath = UIBezierPath.FromRoundedRect(button.Bounds, UIRectCorner.TopLeft | UIRectCorner.TopRight, size);
+
+ CAShapeLayer cAShapeLayer = new CAShapeLayer();
+ cAShapeLayer.Frame = button.Bounds;
+ cAShapeLayer.Path = uIBezierPath.CGPath;
+ button.Layer.Mask = cAShapeLayer;
+
+ }
+ else {
+
+ UIView line = new UIView();
+ var ddd = line.Frame;
+ ddd.Y = button.Frame.Y;
+ ddd.Width = Application.CurrentWidth;
+ ddd.Height = 1;
+ line.Frame = ddd;
+
+ line.BackgroundColor = new UIColor(0xdd / 255.0f, 0xdd / 255.0f, 0xdd / 255.0f, 1);
+ tempUIScrollView.AddSubview(line);
+
+ if (i == 0)
+ {
+ UIBezierPath uIBezierPath = UIBezierPath.FromRoundedRect(button.Bounds, UIRectCorner.BottomLeft | UIRectCorner.BottomRight, size);
+ CAShapeLayer cAShapeLayer = new CAShapeLayer();
+ cAShapeLayer.Frame = button.Bounds;
+ cAShapeLayer.Path = uIBezierPath.CGPath;
+ button.Layer.Mask = cAShapeLayer;
+ }
+ }
+ }
+ var frame = tempUIScrollView.Frame;
+ frame.Y = Application.CurrentHeight;
+ tempUIScrollView.Frame = frame;
+ Application.RootFrameLayout.AddSubview(tempUIScrollView);
+
+ UIView.AnimateNotify(0.6f, 0.01f, UIViewAnimationOptions.CurveLinear, () =>
+ {
+ frame.Y = 0;
+ tempUIScrollView.Frame = frame;
+ }, null);
+ };
+ }
+
+ void remoteFromSuperview(UIScrollView uIScrollView)
+ {
+ UIView.AnimateNotify(0.6f,0.01f,UIViewAnimationOptions.CurveLinear,() => {
+ var frame= uIScrollView.Frame ;
+ frame.Y=Application.CurrentHeight;
+ uIScrollView.Frame=frame;
+ },(b)=>{
+ if(b)
+ {
+ uIScrollView.RemoveFromSuperview();
+ }
+ });
+
+ }
+
+ /// <summary>
+ /// 鍒锋柊褰撳墠瑙嗗浘
+ /// </summary>
+ public override void Refresh()
+ {
+ base.Refresh();
+ CurrentRow = currentRow;
+ }
+
+
+
+ int currentRow;
+ /// <summary>
+ ///
+ /// </summary>
+ /// <value>The current row.</value>
+ public int CurrentRow
+ {
+ get
+ {
+ return currentRow;
+
+ }
+ set
+ {
+ if (AdapterStr == null || value < 0 || AdapterStr.Length <= value)
+ {
+ return;
+ }
+
+ currentRow = value;
+ Text = AdapterStr[value];
+ }
+ }
+
+
+ /// <summary>
+ /// 娣诲姞涓嬫媺鍒楄〃鐨勬暟鎹�
+ /// </summary>
+ /// <param name="Str">String.</param>
+ public string []AdapterStr {
+ get;
+ set ;
+ }
+
+ /// <summary>
+ /// 閫夋嫨鍒楄〃鍙樺寲鐨勪簨浠�
+ /// </summary>
+ public Action<View, int> SelectedItemChanged;
+
+ }
+
+
+}
+
+
diff --git a/Shared.IOS/UI/TextView.cs b/Shared.IOS/UI/TextView.cs
new file mode 100644
index 0000000..c5b2a75
--- /dev/null
+++ b/Shared.IOS/UI/TextView.cs
@@ -0,0 +1,467 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using UIKit;
+using Foundation;
+using Shared.IO;
+using CoreGraphics;
+
+namespace Shared
+{
+ /// <summary>
+ /// 鏂囨湰杈撳叆妗�
+ /// </summary>
+ public class TextView : View
+ {
+ /// <summary>
+ /// 鏂囧瓧澶у皬
+ /// </summary>
+ /// <value>The size of the text.</value>
+ public float TextSize
+ {
+ get
+ {
+ return (float)uILable.TextSize.PointSize;
+ }
+ set
+ {
+ uILable.TextSize = UIFont.SystemFontOfSize(value);
+ }
+ }
+
+ int textID;
+ /// <summary>
+ /// 鏍规嵁ID鑾峰彇瀵瑰簲鐨勫娉�
+ /// </summary>
+ public int TextID
+ {
+ get
+ {
+ return textID;
+ }
+ set
+ {
+ textID = value;
+ Text = Language.StringByID(TextID);
+ }
+ }
+
+ MyUILable uILable;
+ public TextView()
+ {
+ uiView = uILable = new MyUILable(this) { };
+
+ }
+
+ string text = "";
+ /// <summary>
+ /// 鏂囨湰
+ /// </summary>
+ /// <value>鏂囨湰</value>
+ public string Text
+ {
+ get
+ {
+ return text;
+ }
+ set
+ {
+ text = value;
+ if(!IsCanRefresh){
+ return;
+ }
+ uILable.Text = value;
+ }
+ }
+
+ /// <summary>
+ /// 鏂囨湰棰滆壊
+ /// </summary>
+ public uint TextColor
+ {
+ get
+ {
+ nfloat r, g, b, a;
+ uILable.TextColor.GetRGBA(out r, out g, out b, out a);
+ r *= 255;
+ g *= 255;
+ b *= 255;
+ a *= 255;
+ return (uint)(r * 256 * 256 * 256 + g * 256 * 256 + b * 256 + a);
+ }
+ set
+ {
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+ uILable.TextColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁鏀寔鎹㈣
+ /// </summary>
+ /// <value><c>true</c> if is more lines; otherwise, <c>false</c>.</value>
+ public bool IsMoreLines
+ {
+ get
+ {
+ return uILable.IsMoreLines;
+ }
+ set
+ {
+ uILable.IsMoreLines = value;
+ }
+ }
+
+
+ public override void Refresh()
+ {
+ base.Refresh();
+ Text = Text;
+ }
+
+ }
+
+ class MyUILable : UILabel
+ {
+ [Weak] TextView textView;
+ public MyUILable(TextView textView)
+ {
+ this.textView = textView;
+ LineBreakMode = UILineBreakMode.MiddleTruncation;
+ TextAlignment = UITextAlignment.Center;
+ }
+
+ bool isMoreLines;
+ public bool IsMoreLines
+ {
+ get
+ {
+ return isMoreLines;
+ }
+ set
+ {
+ isMoreLines = value;
+ if (isMoreLines)
+ {
+ Lines = 0;
+ }
+ else
+ {
+ Lines = 1;
+ }
+ }
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮寮�濮�
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesBegan(NSSet touches, UIEvent evt)
+ {
+ textView?.TouchEvent(EventActions.Down, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 绉诲姩
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesMoved(NSSet touches, UIEvent evt)
+ {
+ textView?.TouchEvent(EventActions.Move, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮寮硅捣
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesEnded(NSSet touches, UIEvent evt)
+ {
+ textView?.TouchEvent(EventActions.Up, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ public override void TouchesCancelled(NSSet touches, UIEvent evt)
+ {
+ textView?.TouchEvent(EventActions.Cancel, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+
+ /// <summary>
+ /// 鍥犱负杩欎釜瑙嗗浘寰堝鎬紝浼氳嚜鍔ㄥ姞浜嗕袱涓猆IImageView锛屾墍浠ヨ繖涓壒娈婂鐞嗕竴涓�
+ /// </summary>
+ /// <param name="view">View.</param>
+ public override void AddSubview(UIView view)
+ {
+ if (view.GetType() == typeof(UIImageView) && view.Tag != int.MinValue)
+ {
+ return;
+ }
+ base.AddSubview(view);
+ }
+
+
+ /// <summary>
+ /// 鏂囨湰
+ /// </summary>
+ /// <value>The text.</value>
+ public string Text
+ {
+ get
+ {
+ return base.Text;
+ }
+ set
+ {
+ base.Text = value;
+ }
+ }
+
+ /// <summary>
+ /// 鏂囨湰鐨勯鑹�
+ /// </summary>
+ /// <value>鏂囨湰鐨勯鑹�</value>
+ public UIColor TextColor
+ {
+ get
+ {
+ return base.TextColor;
+ }
+ set
+ {
+ base.TextColor = value;
+ }
+ }
+
+ /// <summary>
+ /// 鏂囨湰鐨勫ぇ灏�
+ /// </summary>
+ /// <value>鏂囨湰鐨勫ぇ灏�</value>
+ public UIFont TextSize
+ {
+ get
+ {
+ return base.Font;
+ }
+ set
+ {
+ base.Font = value;
+ }
+ }
+ }
+
+ //class MyUILable : UIScrollView
+ //{
+ // View view;
+ // public MyUILable(View view)
+ // {
+ // this.view = view;
+ // commonInit();
+ // }
+
+ // /// <summary>
+ // /// 鐐瑰嚮寮�濮�
+ // /// </summary>
+ // /// <param name="touches">Touches.</param>
+ // /// <param name="evt">Evt.</param>
+ // public override void TouchesBegan(NSSet touches, UIEvent evt)
+ // {
+ // //base.TouchesBegan(touches, evt);
+ // view.TouchEvent(EventActions.Down, (touches.AnyObject as UITouch).LocationInView(this));
+ // }
+ // /// <summary>
+ // /// 绉诲姩
+ // /// </summary>
+ // /// <param name="touches">Touches.</param>
+ // /// <param name="evt">Evt.</param>
+ // public override void TouchesMoved(NSSet touches, UIEvent evt)
+ // {
+ // //base.TouchesMoved(touches, evt);
+ // view.TouchEvent(EventActions.Move, (touches.AnyObject as UITouch).LocationInView(this));
+ // }
+
+
+
+ // /// <summary>
+ // /// 鐐瑰嚮寮硅捣
+ // /// </summary>
+ // /// <param name="touches">Touches.</param>
+ // /// <param name="evt">Evt.</param>
+ // public override void TouchesEnded(NSSet touches, UIEvent evt)
+ // {
+ // //base.TouchesEnded(touches, evt);
+ // view.TouchEvent(EventActions.Up, (touches.AnyObject as UITouch).LocationInView(this));
+ // }
+
+
+ // /// <summary>
+ // /// 鍥犱负杩欎釜瑙嗗浘寰堝鎬紝浼氳嚜鍔ㄥ姞浜嗕袱涓猆IImageView锛屾墍浠ヨ繖涓壒娈婂鐞嗕竴涓�
+ // /// </summary>
+ // /// <param name="view">View.</param>
+ // public override void AddSubview(UIView view)
+ // {
+ // if (view.GetType() == typeof(UIImageView) && view.Tag != int.MinValue)
+ // {
+ // return;
+ // }
+ // base.AddSubview(view);
+ // }
+
+ // UILabel[] labels = new UILabel[2];
+ // float scrollSpeed = 30;
+ // float bufferSpaceBetweenLabels = 20;
+ // void commonInit()
+ // {
+ // for (int i = 0; i < labels.Length; ++i)
+ // {
+ // labels[i] = new UILabel();
+ // labels[i].TextColor = UIColor.White;
+ // labels[i].BackgroundColor = UIColor.Clear;
+ // labels[i].Text = " ";
+ // AddSubview(labels[i]);
+ // }
+ // ShowsVerticalScrollIndicator = false;
+ // ShowsHorizontalScrollIndicator = false;
+ // UserInteractionEnabled = false;
+ // }
+
+
+ // void scroll()
+ // {
+ // ContentOffset = new CGPoint(0, 0);
+ // AnimateNotify(
+ // labels[0].Frame.Size.Width / scrollSpeed,
+ // 0f,
+ // UIViewAnimationOptions.CurveLinear, () =>
+ // {
+ // ContentOffset = new CGPoint(labels[0].Frame.Width + bufferSpaceBetweenLabels, 0);
+ // },
+ // finished =>
+ // {
+ // if (finished)
+ // scroll();
+ // }
+ // );
+ // }
+
+ // void readjustLabels()
+ // {
+ // Layer.RemoveAllAnimations();
+ // float offset = 0.0f;
+ // for (int i = 0; i < labels.Length; ++i)
+ // {
+ // labels[i].SizeToFit();
+ // CGPoint center;
+ // center = labels[i].Center;
+ // center.Y = Center.Y - Frame.Y;
+ // labels[i].Center = center;
+
+ // CGRect frame;
+ // frame = labels[i].Frame;
+ // frame.X = offset;
+ // labels[i].Frame = frame;
+
+ // offset += (float)labels[i].Frame.Width + bufferSpaceBetweenLabels;
+ // }
+
+ // var size = new CGSize
+ // {
+ // Width = labels[0].Frame.Width + Frame.Width + bufferSpaceBetweenLabels,
+ // Height = Frame.Height
+ // };
+ // ContentSize = size;
+
+ // SetContentOffset(new CGPoint(0, 0), false);
+
+ // if (labels[0].Frame.Width > Frame.Width)
+ // {
+ // for (int i = 1; i < labels.Length; ++i)
+ // {
+ // labels[i].Hidden = false;
+ // }
+ // scroll();
+ // }
+ // else
+ // {
+ // for (int i = 1; i < labels.Length; ++i)
+ // {
+ // labels[i].Hidden = true;
+ // }
+ // CGPoint center;
+ // center = labels[0].Center;
+ // center.X = Center.X - Frame.X;
+ // labels[0].Center = center;
+ // }
+ // }
+
+ // /// <summary>
+ // /// 鏂囨湰
+ // /// </summary>
+ // /// <value>The text.</value>
+ // public string Text
+ // {
+ // get
+ // {
+ // return labels[0].Text;
+ // }
+ // set
+ // {
+ // if (labels[0].Text == value)
+ // {
+ // return;
+ // }
+ // for (int i = 0; i < labels.Length; ++i)
+ // {
+ // labels[i].Text = value;
+ // }
+
+ // readjustLabels();
+ // }
+ // }
+
+ // /// <summary>
+ // /// 鏂囨湰鐨勯鑹�
+ // /// </summary>
+ // /// <value>鏂囨湰鐨勯鑹�</value>
+ // public UIColor TextColor
+ // {
+ // get
+ // {
+ // return labels[0].TextColor;
+ // }
+ // set
+ // {
+ // for (int i = 0; i < labels.Length; ++i)
+ // {
+ // labels[i].TextColor = value;
+ // }
+ // }
+ // }
+
+ // /// <summary>
+ // /// 鏂囨湰鐨勫ぇ灏�
+ // /// </summary>
+ // /// <value>鏂囨湰鐨勫ぇ灏�</value>
+ // public UIFont TextSize
+ // {
+ // get
+ // {
+ // return labels[0].Font;
+ // }
+ // set
+ // {
+ // for (int i = 0; i < labels.Length; ++i)
+ // {
+ // labels[i].Font = value;
+ // }
+ // }
+ // }
+ //}
+}
+
+
diff --git a/Shared.IOS/UI/TimeView.cs b/Shared.IOS/UI/TimeView.cs
new file mode 100644
index 0000000..8704442
--- /dev/null
+++ b/Shared.IOS/UI/TimeView.cs
@@ -0,0 +1,113 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using CoreGraphics;
+using Foundation;
+using UIKit;
+
+namespace Shared
+{
+ /// <summary>
+ /// 鏃堕棿瑙嗗浘
+ /// </summary>
+ public class TimeView : View
+ {
+ /// <summary>
+ /// 褰撳墠瑙嗗浘
+ /// </summary>
+ /// <value>The android text.</value>
+ MyUITimePicker currentUITimePicker
+ {
+ get
+ {
+ return uiView as MyUITimePicker;
+ }
+ set
+ {
+ uiView = value;
+ }
+ }
+
+
+ /// <summary>
+ /// 鏃�
+ /// </summary>
+ public int Hour
+ {
+ get { return (int)currentUITimePicker.current.Hour; }
+ }
+ /// <summary>
+ /// 鍒�
+ /// </summary>
+ public int Minute
+ {
+ get { return (int)currentUITimePicker.current.Minute; }
+ }
+
+ /// <summary>
+ /// 瑙嗗浘
+ /// </summary>
+ public TimeView()
+ {
+ currentUITimePicker = new MyUITimePicker(this) { };
+
+ }
+
+ class MyUITimePicker : UIDatePicker
+ {
+ [Weak] TimeView timeView;
+ public MyUITimePicker(TimeView timeView)
+ {
+ this.timeView = timeView;
+ Mode = UIDatePickerMode.Time;
+ }
+
+ nfloat x;
+ /// <summary>
+ /// 鐐瑰嚮寮�濮�
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesBegan(NSSet touches, UIEvent evt)
+ {
+ timeView?.TouchEvent(EventActions.Down, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 绉诲姩
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesMoved(NSSet touches, UIEvent evt)
+ {
+ timeView?.TouchEvent(EventActions.Move, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮寮硅捣
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesEnded(NSSet touches, UIEvent evt)
+ {
+ timeView?.TouchEvent(EventActions.Up, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ public override void TouchesCancelled(NSSet touches, UIEvent evt)
+ {
+ timeView?.TouchEvent(EventActions.Cancel, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ public NSDateComponents current
+ {
+ get
+ {
+ NSCalendar cal = NSCalendar.CurrentCalendar;
+ return cal.Components(NSCalendarUnit.Hour | NSCalendarUnit.Minute | NSCalendarUnit.Second, Date);// [cal components: unitFlags fromDate: now
+ }
+ }
+
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/Shared.IOS/UI/Tip.cs b/Shared.IOS/UI/Tip.cs
new file mode 100755
index 0000000..4caa4bd
--- /dev/null
+++ b/Shared.IOS/UI/Tip.cs
@@ -0,0 +1,77 @@
+锘縰sing System;
+using UIKit;
+using CoreGraphics;
+
+namespace Shared
+{
+ /// <summary>
+ /// 淇℃伅鎻愮ず
+ /// </summary>
+ public class Tip
+ {
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public Tip()
+ {
+ this.BackgroundColor = 0xff323232;
+ }
+ /// <summary>
+ /// 鍏抽棴鏃堕棿
+ /// </summary>
+ /// <value>The close time.</value>
+ public int CloseTime {
+ get;
+ set;
+ }
+ /// <summary>
+ /// 鎻愮ず鍐呭
+ /// </summary>
+ /// <value>The text.</value>
+ public string Text {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// 鏂囧瓧鎻愮ず鏂瑰悜
+ /// </summary>
+ /// <value>The direction.</value>
+ public AMPopTipDirection Direction {
+ get;
+ set;
+ }
+ /// <summary>
+ /// 鏈�澶у搴�
+ /// </summary>
+ /// <value>The width of the max.</value>
+ public int MaxWidth {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// 鑳屾櫙棰滆壊
+ /// </summary>
+ /// <value>The color of the background.</value>
+ public uint BackgroundColor {
+ get;
+ set;
+ }
+
+
+ /// <summary>
+ /// 鐐瑰嚮鍝釜View鏃舵樉璧彁绀�
+ /// </summary>
+ public void Show(View view)
+ {
+ var popTip= AMPopTip.PopTip ();
+ popTip.PopoverColor = new UIKit.UIColor(((this.BackgroundColor >> 16) & 0xff)/255.0f, ((this.BackgroundColor >> 8) & 0xFF)/255.0f, (this.BackgroundColor & 0xFF)/255.0f, ((this.BackgroundColor >> 24) & 0xFF)/255.0f);
+ popTip.ShowText (this.Text,Direction,MaxWidth, Application.RootFrameLayout, view.RealView.ConvertRectToView(view.RealView.Bounds,Application.RootFrameLayout),CloseTime);
+ }
+
+
+ }
+
+}
+
diff --git a/Shared.IOS/UI/UICoverFlowView.cs b/Shared.IOS/UI/UICoverFlowView.cs
new file mode 100644
index 0000000..b5c2e7e
--- /dev/null
+++ b/Shared.IOS/UI/UICoverFlowView.cs
@@ -0,0 +1,300 @@
+锘縰sing System;
+using System.Collections.Generic;
+using Shared.IOS.TBL;
+using UIKit;
+
+namespace Shared
+{
+
+ /// <summary>
+ /// UICoverFlowView 宸插簾寮冿紝鏆傜敤HorizontalPages浠f浛瀹炵幇
+ /// </summary>
+ public class UICoverFlowView : View
+ {
+ /// <summary>
+ /// 褰撳墠瑙嗗浘
+ /// </summary>
+ /// <value>The UICoverFlowView.</value>
+ HDLCoverFlow mHDLCoverFlow
+ {
+ get
+ {
+ return uiView as HDLCoverFlow;
+ }
+ set
+ {
+ uiView = value;
+ }
+ }
+
+
+
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public UICoverFlowView()
+ {
+ mHDLCoverFlow = new HDLCoverFlow
+ {
+
+ //MChangedDelegate = new OnSelectChangeListener(this)
+ };
+
+ Parents = new ViewGroup();
+ }
+
+
+ /// <summary>
+ /// 鍒锋柊甯冨眬
+ /// </summary>
+ private void RefreshFrame()
+ {
+ mHDLCoverFlow.InitWithFrameArc(new CoreGraphics.CGRect(base.X, base.Y, base.Width, base.Height));
+ }
+
+ /// <summary>
+ /// 鎺т欢瀹藉害
+ /// </summary>
+ public override int Width
+ {
+ get
+ {
+ return base.Width;
+ }
+ set
+ {
+ base.Width = value;
+ RefreshFrame();
+
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨勯珮搴�
+ /// </summary>
+ public override int Height
+ {
+ get
+ {
+ return base.Height;
+ }
+ set
+ {
+ base.Height = value;
+ RefreshFrame();
+
+ }
+ }
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int X
+ {
+ get
+ {
+ return base.X;
+ }
+ set
+ {
+ base.X = value;
+ RefreshFrame();
+
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int Y
+ {
+ get
+ {
+ return base.Y;
+ }
+ set
+ {
+ base.Y = value;
+ RefreshFrame();
+
+ }
+ }
+
+
+
+ //public void setCurrentItems(int option1, int option2, int option3)
+ //{
+
+ // mHDLCoverFlow.SetCurrentItems(option1, option2, option3);
+
+ //}
+
+ //public void setNPicker(List<string> mFirstList, List<string> mSecondList, List<string> mThirdList)
+ //{
+
+ // mHDLCoverFlow.SetNPicker(NSArray.FromObjects(mFirstList.ToArray()), NSArray.FromObjects(mSecondList.ToArray()), NSArray.FromObjects(mThirdList.ToArray()));
+
+ //}
+
+
+
+ UIView[] mAndroidViewsList;
+ List<View> viewList = new List<View>();
+
+ private void UpdateViewsList()
+ {
+
+ mAndroidViewsList = new UIView[viewList.Count];
+ for (int i=0;i<viewList.Count;i++)
+ {
+
+ mAndroidViewsList[i]= viewList[i].RealView;
+ }
+
+ mHDLCoverFlow.AddCoverFlowViewDatas(mAndroidViewsList);
+ }
+
+ int pageIndex;
+ /// <summary>
+ /// 璁剧疆鎴栬�呰幏鍙栧綋鍓嶇殑鐣岄潰绱㈠紩
+ /// </summary>
+ /// <value>The index of the page.</value>
+ public int PageIndex
+ {
+ get
+ {
+ return pageIndex;
+ }
+ set
+ {
+ if (value < 0 || viewList.Count < value)
+ {
+ return;
+ }
+
+ pageIndex = value;
+ mHDLCoverFlow.SetCoverFlowSelectIndex(pageIndex);
+
+
+ }
+ }
+
+
+
+ public void Remove(View view)
+ {
+ if (view == null)
+ {
+ return;
+ }
+
+ viewList.Remove(view);
+ //realViewGroup.RemoveView(view.AndroidView);
+ //view.Parent = null;
+
+ //base.Remove(view);
+ //UpdateViewsList();
+ }
+
+ /// <summary>
+ /// 鐖跺鍣�
+ /// </summary>
+ /// <value>The parent.</value>
+ ViewGroup Parents;
+ /// <summary>
+ /// 澧炲姞瀛愭帶浠�
+ /// </summary>
+ /// <param name="view">View.</param>
+ public void AddChidren(View view)
+ {
+ view.Parent = Parents;
+ view.Refresh();
+ viewList.Add(view);
+
+ //base.AddChidren(view);
+ UpdateViewsList();
+ }
+
+
+ /// <summary>
+ /// 娓呯┖鎵�鏈夌殑鎺т欢
+ /// </summary>
+ public void RemoveAll()
+ {
+ viewList.Clear();
+ //base.RemoveAll();
+ UpdateViewsList();
+ }
+
+ /// <summary>
+ /// 绉婚櫎鎸囧畾绱㈠紩瀵硅薄
+ /// </summary>
+ /// <param name="index">Index.</param>
+ public void RemoveAt(int index)
+ {
+ if (GetChildren(index) != null)
+ {
+ viewList.Remove(GetChildren(index));
+ UpdateViewsList();
+ }
+
+ //base.RemoveAt(index);
+ //UpdateViewsList();
+ }
+
+
+ /// <summary>
+ /// 鑾峰彇鎸囧畾绱㈠紩瀵硅薄
+ /// </summary>
+ /// <returns>The children.</returns>
+ /// <param name="index">Index.</param>
+ public View GetChildren(int index)
+ {
+ if (viewList.Count - 1 < index || index < 0)
+ {
+ return null;
+ }
+ return viewList[index];
+ }
+
+
+
+
+
+
+
+
+ //public Action<int> OnSelectChangeEvent;
+ public Action<int> OnCoverFlowViewClickEvent;
+
+ /// <summary>
+ /// Action
+ /// </summary>
+ public Action<int> OnSelectChangeEvent;
+
+ /// <summary>
+ /// OnSelectChangeListener 缁ф壙鍝嶅簲浜嬩欢
+ /// </summary>
+ OnSelectChangeListener mOnSelectChangeListener;
+
+ public class OnSelectChangeListener : SelectItemDelegate
+ {
+
+ [Weak] UICoverFlowView _UICoverFlowView;
+
+ public OnSelectChangeListener(UICoverFlowView view)
+ {
+ _UICoverFlowView = view;
+ }
+
+ public override void OnSelectItem(nint mSelectIndex)
+ {
+ _UICoverFlowView.OnSelectChangeEvent?.Invoke((int)mSelectIndex);
+ }
+
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/Shared.IOS/UI/UIDrawerLayout.cs b/Shared.IOS/UI/UIDrawerLayout.cs
new file mode 100644
index 0000000..b717668
--- /dev/null
+++ b/Shared.IOS/UI/UIDrawerLayout.cs
@@ -0,0 +1,508 @@
+锘縰sing System;
+using CoreGraphics;
+using Foundation;
+using UIKit;
+
+
+
+namespace Shared
+{
+ /// <summary>
+ /// 鍙虫粦鎶藉眽View
+ /// </summary>
+ public class UIDrawerLayout : ViewGroup
+ {
+ /// <summary>
+ /// 褰撳墠瑙嗗浘
+ /// </summary>
+ /// <value>The UICoverFlowView.</value>
+ MyUIDrawerLayout mUIDrawerLayout
+ {
+ get
+ {
+ return uiView as MyUIDrawerLayout;
+ }
+ set
+ {
+ uiView = value;
+ }
+ }
+
+ /// <summary>
+ /// 宸︿晶鑿滃崟View
+ /// </summary>
+ UIView leftView;
+ /// <summary>
+ /// 涓昏彍鍗昖iew
+ /// </summary>
+ UIView mainView;
+ /// <summary>
+ /// 钂欏眰閬尅View
+ /// </summary>
+ MyMaskUIView maskUIView;
+
+
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public UIDrawerLayout()
+ {
+
+ mUIDrawerLayout = new MyUIDrawerLayout(this) { };
+ viewGroup = mUIDrawerLayout;
+ mainView = new UIView();
+ realViewGroup = mainView;
+ viewGroup.AddSubview(realViewGroup);
+ viewGroup.Layer.MasksToBounds = true;
+ leftView = new UIView();
+ //new UIView(new CGRect(0, 0, Application.CurrentWidth, Application.CurrentHeight));
+ var leftViewFrame = leftView.Frame;
+ leftViewFrame.Y = 0;
+ leftViewFrame.X = 0;
+ leftViewFrame.Width = Application.CurrentWidth;
+ leftViewFrame.Height = Application.CurrentHeight;
+ leftViewFrame.X = -Application.CurrentWidth;
+ leftView.Frame = leftViewFrame;
+ leftView.BackgroundColor = UIColor.FromRGBA(0, 0, 0, 99);
+ viewGroup.AddSubview(leftView);
+
+ maskUIView = new MyMaskUIView();
+ var maskFrame = maskUIView.Frame;
+ maskFrame.Y = 0;
+ maskFrame.X = 0;
+ maskFrame.Width = Application.CurrentWidth;
+ maskFrame.Height = Application.CurrentHeight;
+ maskUIView.Frame = maskFrame;
+ maskUIView.BackgroundColor = UIColor.FromRGBA(0, 0, 0, 0);
+ viewGroup.AddSubview(maskUIView);
+ }
+
+ /// <summary>
+ /// 鍒锋柊宸iew鏄剧ず鐨勪綅缃�
+ /// </summary>
+ /// <param name="leftFrame">鏈�缁坴iew鐨勪綅缃�</param>
+ /// <param name="needAnimations">鏄惁闇�瑕佸钩绉诲姩鐢�</param>
+ void RefreshLeftViewFrame(CGRect leftFrame, bool needAnimations = true)
+ {
+ //leftView.Frame = leftFrame;
+ //RefreshMaskUIViewBackgroundColor(leftView.Frame.X);
+
+ //2020-06-11 澧炲姞骞崇Щ鍔ㄧ敾
+ if (!needAnimations)
+ {
+ leftView.Frame = leftFrame;
+ RefreshMaskUIViewBackgroundColor(leftView.Frame.X);
+ }
+ else
+ {
+ UIView.BeginAnimations("move");
+ UIView.SetAnimationDuration(0.3);
+ //UIView.SetAnimationDelegate(leftView);
+ leftView.Frame = leftFrame;
+ RefreshMaskUIViewBackgroundColor(leftView.Frame.X);
+ UIView.CommitAnimations();
+
+ }
+
+ }
+
+ /// <summary>
+ /// 鍒锋柊钂欏眰View鐨勪綅缃拰閫忔槑搴﹂鑹�
+ /// </summary>
+ /// <param name="leftViewX"></param>
+ void RefreshMaskUIViewBackgroundColor(nfloat leftViewX)
+ {
+ int alpha = 180 + (int)(leftViewX / mUIDrawerLayout.Frame.Size.Width * 180);
+ maskUIView.BackgroundColor = UIColor.FromRGBA(0, 0, 0, alpha);
+ var maskFrame = maskUIView.Frame;
+ maskFrame.X = leftView.Frame.X + leftView.Frame.Width;
+ maskUIView.Frame = maskFrame;
+ }
+
+
+ View leftChildView;
+ /// <summary>
+ /// 澧炲姞宸﹁竟瑙嗗浘
+ /// </summary>
+ /// <param name="view">View.</param>
+ public void AddLeftView(View view)
+ {
+ if (null == view)
+ {
+ return;
+ }
+ LeftViewRemoveAllViews();
+
+ view.Parent = this;
+ leftChildView = view;
+ var addFrame = leftView.Frame;
+ addFrame.X = 0;
+ addFrame.Y = 0;
+ leftChildView.RealView.Frame = addFrame;
+ leftView.AddSubview(leftChildView.RealView);
+
+ }
+
+
+ /// <summary>
+ /// RemoveLeftView
+ /// </summary>
+ public void LeftViewRemoveAllViews()
+ {
+ if (leftChildView == null) return;
+
+
+ if (leftChildView.RealView.Superview != null)
+ {
+ leftChildView.RealView.RemoveFromSuperview();
+ }
+
+ leftChildView.Parent = null;
+ }
+
+ /// <summary>
+ /// 鏄惁閿佸畾鍙虫粦鍔熻兘锛� 閿佸畾鍚庡彸婊戝脊鍑鸿彍鍗曞け鏁�
+ /// </summary>
+ bool isDrawerLockModei;
+ public bool IsDrawerLockMode
+ {
+ get鈥� {鈥� return isDrawerLockModei;鈥� }
+ set
+ {
+ isDrawerLockModei = value;
+ mUIDrawerLayout.IsDrawerLockMode = isDrawerLockModei;
+ }
+ }
+
+ bool isDrawerOpen = false;
+
+ private bool IsDrawerOpen
+ {
+ get鈥� {鈥� return isDrawerOpen;鈥� }
+ set
+ {
+ isDrawerOpen = value;
+ mUIDrawerLayout.IsDrawerOpen = isDrawerOpen;
+
+
+ }
+ }
+
+ /// <summary>
+ /// 鎵撳紑鎶藉眽view
+ /// </summary>
+ public void OpenLeftMenu()
+ {
+ if (!IsDrawerOpen)
+ {
+ IsDrawerOpen = true;
+ ShowLeftView(IsDrawerOpen);
+ //Shared.HDLUtils.WriteLine("OpenLeftMenu-------");
+ }
+
+ }
+
+ /// <summary>
+ /// 鍏抽棴鎶藉眽view
+ /// </summary>
+ public void CloseLeftMenu()
+ {
+ if (IsDrawerOpen)
+ {
+ IsDrawerOpen = false;
+ ShowLeftView(IsDrawerOpen);
+ //Shared.HDLUtils.WriteLine("CloseLeftMenu-------");
+ }
+ }
+
+
+ //private CABasicAnimation moveX(float X)
+ //{
+ // //CABasicAnimation animation = new CABasicAnimation("transform.translation.x");
+ // CABasicAnimation animation = CABasicAnimation.FromKeyPath("transform.translation.x");
+ // animation.To = NSNumber.FromFloat(X);
+ // animation.Duration = 0.2F;
+ // animation.RemovedOnCompletion = false;//yes鐨勮瘽锛屽張杩斿洖鍘熶綅缃簡銆�
+ // animation.RepeatCount = 1;
+ // animation.FillMode = CAFillMode.Forwards;
+ // return animation;
+ //}
+
+
+ /// <summary>
+ /// 鏄惁鎵撳紑鏄剧ず宸﹁竟鑿滃崟view
+ /// </summary>
+ private void ShowLeftView(bool bShow)
+ {
+ var mFrame = leftView.Frame;
+ mFrame.X = bShow ? 0 : -mUIDrawerLayout.Frame.Size.Width;
+ RefreshLeftViewFrame(mFrame);
+ }
+
+
+ /// <summary>
+ /// 绉诲姩宸﹁竟view
+ /// </summary>
+ public void MoveLeftView(nfloat moveX)
+ {
+ if (IsDrawerOpen)
+ {
+ if (moveX < 0)
+ {
+ var mFrame = leftView.Frame;
+ mFrame.X = 0 + moveX;
+ RefreshLeftViewFrame(mFrame,false);
+ }
+ }
+ else
+ {
+ if (moveX > 0)
+ {
+ var mFrame = leftView.Frame;
+ mFrame.X = -mUIDrawerLayout.Frame.Size.Width + moveX;
+ RefreshLeftViewFrame(mFrame,false);
+ }
+
+ }
+ }
+
+
+ /// <summary>
+ /// 閲嶇疆宸﹁竟view
+ /// </summary>
+ public void ResetView()
+ {
+
+ var mFrame = leftView.Frame;
+ if (IsDrawerOpen)
+ {
+ mFrame.X = 0;
+ //Shared.HDLUtils.WriteLine($"Reset Open");
+ }
+ else
+ {
+ mFrame.X = -mUIDrawerLayout.Frame.Size.Width;
+ //Shared.HDLUtils.WriteLine($"Reset CLOSE");
+ }
+
+ RefreshLeftViewFrame(mFrame);
+ }
+
+
+ nfloat mLastX, mLastY, deltaX;
+ int mTouchSlop = 3;
+
+ private void MYTouchEvent(EventActions eventAction, CGPoint point)
+ {
+ if (isDrawerLockModei) return;
+
+ switch (eventAction)
+ {
+ case EventActions.Down:
+
+ //璁板綍鐐瑰嚮鐨勬渶鏂癤鍧愭爣
+ mLastX = point.X;
+ mLastY = point.Y;
+ //Shared.HDLUtils.WriteLine($"DrawerLayout:EventActions.Down XXX{mLastX}");
+ break;
+ case EventActions.Move:
+ moveWithPoint(point);
+ //Shared.HDLUtils.WriteLine("DrawerLayout:EventActions.Move");
+ break;
+ case EventActions.Up:
+ //Shared.HDLUtils.WriteLine($"DrawerLayout:EventActions.Down deltaX{deltaX} WWW:{mUIDrawerLayout.Frame.Size.Width} ");
+ if (Math.Abs(deltaX) >= mUIDrawerLayout.Frame.Size.Width / 2)
+ {
+ if (deltaX > 0)
+ {
+ IsDrawerOpen = true;
+ ShowLeftView(IsDrawerOpen);
+ }
+ else
+ {
+ IsDrawerOpen = false;
+ ShowLeftView(IsDrawerOpen);
+ }
+ }
+ else
+ {
+ ResetView();
+
+ }
+ break;
+
+ }
+ }
+
+ private void moveWithPoint(CGPoint movePoint)
+ {
+ var x = movePoint.X;
+ deltaX = x - mLastX;
+
+ if (deltaX * deltaX > mTouchSlop * mTouchSlop)
+ {
+ //寮�濮嬬Щ鍔ㄨ鍥�
+ if (IsDrawerOpen)
+ {
+ //MoveAction?.Invoke(deltaX);
+ MoveLeftView(deltaX);
+ }
+ else
+ {
+ if (mLastX < 10)
+ {
+ MoveLeftView(deltaX);
+ }
+ }
+
+ }
+
+ }
+
+
+ /// <summary>
+ /// 鍨傜洿鏂瑰悜婊氬姩瑙嗗浘
+ /// </summary>
+ class MyUIDrawerLayout : UIView
+ {
+ public bool IsDrawerOpen = false;
+ public bool IsDrawerLockMode = false;
+
+ [Weak] internal UIDrawerLayout mUIDrawerLayout;
+
+ public MyUIDrawerLayout(UIDrawerLayout mUIDrawerLayout)
+ {
+ this.mUIDrawerLayout = mUIDrawerLayout;
+ }
+
+
+ /// <summary>
+ /// 瀵绘壘鏈�閫傚悎鐨刅iew
+ /// 瀹炵幇鎷︽埅
+ /// </summary>
+ public override UIView HitTest(CGPoint point, UIEvent uievent)
+ {
+
+ //Shared.HDLUtils.WriteLine($"MyUIDrawerLayout:HitTest{point.X} uievent{uievent.ToString()}");
+
+ if (!IsDrawerLockMode)//涓嶉攣瀹氾紝鍏佽鍙虫粦
+ {
+ if (PointInside(point, uievent))
+ {
+ if (IsDrawerOpen)//宸﹁彍鍗曟槸鍚︽墦寮�
+ {
+ if (point.X > this.Frame.Size.Width - 10)
+ {
+ //Shared.HDLUtils.WriteLine($"MyUIDrawerLayout:HitTest{point.X} uievent{uievent.ToString()}");
+ return this;//鎷︽埅
+ }
+
+ }
+ else
+ {
+ if (point.X < 10)
+ {
+ //Shared.HDLUtils.WriteLine($"MyUIDrawerLayout:HitTest{point.X} uievent{uievent.ToString()}");
+ return this;
+ }
+ }
+
+ }
+ }
+
+ return base.HitTest(point, uievent);//涓嶆嫤鎴�
+
+ //UIView viewReturn = base.HitTest(point, uievent);
+ //if (viewReturn is MyUIDrawerLayout)
+ //{
+ // return base.HitTest(point, uievent);//涓嶆嫤鎴�
+ //}
+ //else {
+
+
+ // return base.HitTest(point, uievent);//涓嶆嫤鎴�
+ //}
+ }
+
+
+ /// <summary>
+ /// 鐐瑰嚮寮�濮�
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesBegan(NSSet touches, UIEvent evt)
+ {
+ //Shared.HDLUtils.WriteLine("MyUIDrawerLayout:TouchesBegan");
+ mUIDrawerLayout?.TouchEvent(EventActions.Down, (touches.AnyObject as UITouch).LocationInView(this));
+ mUIDrawerLayout?.MYTouchEvent(EventActions.Down, (touches.AnyObject as UITouch).LocationInView(this));
+
+ }
+ /// <summary>
+ /// 绉诲姩
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesMoved(NSSet touches, UIEvent evt)
+ {
+ mUIDrawerLayout?.TouchEvent(EventActions.Move, (touches.AnyObject as UITouch).LocationInView(this));
+ mUIDrawerLayout?.MYTouchEvent(EventActions.Move, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮寮硅捣
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesEnded(NSSet touches, UIEvent evt)
+ {
+ mUIDrawerLayout?.TouchEvent(EventActions.Up, (touches.AnyObject as UITouch).LocationInView(this));
+ mUIDrawerLayout?.MYTouchEvent(EventActions.Up, (touches.AnyObject as UITouch).LocationInView(this));
+ //Shared.HDLUtils.WriteLine("MyUIDrawerLayout:TouchesEnded");
+ }
+
+ public override void TouchesCancelled(NSSet touches, UIEvent evt)
+ {
+ mUIDrawerLayout?.TouchEvent(EventActions.Cancel, (touches.AnyObject as UITouch).LocationInView(this));
+ mUIDrawerLayout?.MYTouchEvent(EventActions.Cancel, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 妗嗘灦榛樿鍔犱簡涓や釜UIImageView 锛岃繖鏍峰彲浠ュ幓鎺夐粯璁ゆ坊鍔�
+ /// </summary>
+ /// <param name="view">View.</param>
+ public override void AddSubview(UIView view)
+ {
+ if (view.GetType() == typeof(UIImageView) && view.Tag != int.MinValue)
+ {
+ return;
+ }
+ base.AddSubview(view);
+ }
+ }
+
+
+
+ /// <summary>
+ /// 钂欏眰View
+ /// </summary>
+ class MyMaskUIView : UIView
+ {
+ public MyMaskUIView()
+ {
+
+
+
+ }
+
+ /// <summary>
+ /// 瀵绘壘鏈�閫傚悎鐨刅iew
+ /// 瀹炵幇鎷︽埅
+ /// </summary>
+ public override UIView HitTest(CGPoint point, UIEvent uievent)
+ {
+ return null;
+ }
+
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/Shared.IOS/UI/UIPickerView.cs b/Shared.IOS/UI/UIPickerView.cs
new file mode 100644
index 0000000..2276631
--- /dev/null
+++ b/Shared.IOS/UI/UIPickerView.cs
@@ -0,0 +1,282 @@
+锘縰sing System;
+using System.Collections.Generic;
+using Foundation;
+using Shared.IOS.TBL;
+
+
+namespace Shared
+{
+
+
+
+ /// <summary>
+ /// UIPickerView
+ /// </summary>
+ public class UIPickerView : View
+ {
+ /// <summary>
+ /// 褰撳墠瑙嗗浘
+ /// </summary>
+ /// <value>The UIPickerView.</value>
+ HDLPickerView mHDLPickerView
+ {
+ get
+ {
+ return uiView as HDLPickerView;
+ }
+ set
+ {
+ uiView = value;
+ }
+ }
+
+
+
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public UIPickerView()
+ {
+ mHDLPickerView = new HDLPickerView
+ {
+
+ MChangedDelegate = new OnSelectChangeListener(this)
+ };
+
+ }
+
+
+ /// <summary>
+ /// 鍒锋柊甯冨眬
+ /// </summary>
+ private void RefreshFrame()
+ {
+ mHDLPickerView.InitWithFrameArc(new CoreGraphics.CGRect(base.X, base.Y, base.Width, base.Height));
+ }
+
+ /// <summary>
+ /// 鎺т欢瀹藉害
+ /// </summary>
+ public override int Width
+ {
+ get
+ {
+ return base.Width;
+ }
+ set
+ {
+ base.Width = value;
+ RefreshFrame();
+
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨勯珮搴�
+ /// </summary>
+ public override int Height
+ {
+ get
+ {
+ return base.Height;
+ }
+ set
+ {
+ base.Height = value;
+ RefreshFrame();
+
+ }
+ }
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int X
+ {
+ get
+ {
+ return base.X;
+ }
+ set
+ {
+ base.X = value;
+ RefreshFrame();
+
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int Y
+ {
+ get
+ {
+ return base.Y;
+ }
+ set
+ {
+ base.Y = value;
+ RefreshFrame();
+
+ }
+ }
+
+
+ /// <summary>
+ /// 璁剧疆PickerView 榛樿閫変腑椤�
+ /// </summary>
+ public void setCurrentItems(int option1, int option2, int option3)
+ {
+
+ mHDLPickerView.SetCurrentItems(option1, option2, option3);
+
+ }
+
+
+ /// <summary>
+ /// 璁剧疆PickerView 鏁版嵁
+ /// </summary>
+ public void setNPicker(List<string> mFirstList, List<string> mSecondList, List<string> mThirdList)
+ {
+ if (mFirstList == null)
+ {
+ return;
+ }
+
+ if (mSecondList == null)
+ {
+ mHDLPickerView.SetNPicker(NSArray.FromObjects(mFirstList.ToArray()), null, null);
+
+ }
+ else
+ {
+ if (mThirdList == null)
+ {
+ mHDLPickerView.SetNPicker(NSArray.FromObjects(mFirstList.ToArray()), NSArray.FromObjects(mSecondList.ToArray()), null);
+ }
+ else {
+ mHDLPickerView.SetNPicker(NSArray.FromObjects(mFirstList.ToArray()), NSArray.FromObjects(mSecondList.ToArray()), NSArray.FromObjects(mThirdList.ToArray()));
+ }
+
+ }
+
+
+ }
+
+ /// <summary>
+ /// 璁剧疆PickerView 鏁版嵁
+ /// </summary>
+ public void setPicker(List<string> mFirstList, List<List<string>> mSecondList)
+ {
+ if (mFirstList == null)
+ {
+ return;
+ }
+
+ if (mFirstList.Count != mSecondList.Count)
+ {
+ return;
+ }
+
+ var dictDataList = new NSMutableArray();
+
+ for (int i = 0; i < mFirstList.Count; i++)
+ {
+
+ dictDataList.Add(NSDictionary.FromObjectAndKey(NSArray.FromObjects(mSecondList[i].ToArray()), new NSString(mFirstList[i])));
+
+ }
+
+ mHDLPickerView.SetPicker(dictDataList);
+
+ }
+
+
+ /// <summary>
+ /// 璁剧疆PickerView 閫変腑鏂囧瓧鐨勯鑹�
+ /// </summary>
+ public void setTextColorCenter(uint mColor, int indexID)
+ {
+
+ byte r, g, b, a;
+ r = (byte)(mColor / 256 / 256 % 256);
+ g = (byte)(mColor / 256 % 256);
+ b = (byte)(mColor % 256);
+ a = (byte)(mColor / 256 / 256 / 256 % 256);
+
+
+ mHDLPickerView.SetTextColorCenter(UIKit.UIColor.FromRGBA(r, g, b, a), indexID);
+ }
+
+ /// <summary>
+ /// 鏂囧瓧澶у皬
+ /// </summary>
+ /// <value>The size of the text.</value>
+ public float TextSize
+ {
+ set
+ {
+ mHDLPickerView.SetPickerTextSize(value);
+ }
+ }
+
+
+ uint pickerBackgroundColor;
+ /// <summary>
+ /// 鑳屾櫙棰滆壊
+ /// </summary>
+ public uint PickerBackgroundColor
+ {
+ //get
+ //{
+ // return pickerBackgroundColor;
+ //}
+ set
+ {
+ pickerBackgroundColor = value;
+ byte r, g, b, a;
+ r = (byte)(pickerBackgroundColor / 256 / 256 % 256);
+ g = (byte)(pickerBackgroundColor / 256 % 256);
+ b = (byte)(pickerBackgroundColor % 256);
+ a = (byte)(pickerBackgroundColor / 256 / 256 / 256 % 256);
+ mHDLPickerView.BackgroundColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+ }
+
+ /// <summary>
+ /// Action
+ /// </summary>
+ public Action<int, int, int> OnSelectChangeEvent;
+
+ /// <summary>
+ /// OnSelectChangeListener 缁ф壙鍝嶅簲浜嬩欢
+ /// </summary>
+ OnSelectChangeListener mOnSelectChangeListener;
+
+ public class OnSelectChangeListener : HDLPickerviewChangedDelegate
+ {
+
+ [Weak] UIPickerView _UIPickerView;
+
+ public OnSelectChangeListener(UIPickerView view)
+ {
+ _UIPickerView = view;
+ }
+
+ public override void SelectIndex2(nint selectIndex1, nint selectIndex2, nint selectIndex3)
+ {
+ _UIPickerView.OnSelectChangeEvent?.Invoke((int)selectIndex1, (int)selectIndex2, (int)selectIndex3);
+ }
+
+ //public override void OnProgressChanged(int mProgress)
+ //{
+ // _WaveSeekBar.OnProgressChangedEvent?.Invoke(this, mProgress);
+ //}
+
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/Shared.IOS/UI/UrlMonitor.cs b/Shared.IOS/UI/UrlMonitor.cs
new file mode 100644
index 0000000..572b0b4
--- /dev/null
+++ b/Shared.IOS/UI/UrlMonitor.cs
@@ -0,0 +1,131 @@
+锘縰sing System;
+using System.Net;
+using CoreGraphics;
+using UIKit;
+
+namespace Shared
+{
+ public class UrlMonitor : View
+ {
+ public UrlMonitor()
+ {
+ uiView = new UIImageView { Tag=int.MinValue};
+ }
+
+ public
+
+ //鏄惁宸茬粡鍚姩
+ bool isStarted;
+ /// <summary>
+ /// 鐢ㄦ埛鍚�
+ /// </summary>
+ public string UserName = "";
+ /// <summary>
+ /// 瀵嗙爜
+ /// </summary>
+ public string Password = "";
+
+ /// <summary>
+ /// 鎽勫儚澶寸殑鍥剧墖鍦板潃
+ /// </summary>
+ public string URL;
+
+ /// <summary>
+ /// 鍚姩
+ /// </summary>
+ public void Start()
+ {
+ if (isStarted)
+ {
+ return;
+ }
+ isStarted = true;
+ System.Threading.Tasks.Task.Run(() =>
+ {
+ while (isStarted)
+ {
+ System.Threading.Thread.Sleep(100);
+ try
+ {
+ WebClient webClient = new WebClient();
+ webClient.Headers.Add("Accept-Encoding", "gzip, deflate");
+ webClient.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(UserName + ":" + Password)));
+ var bytes = webClient.DownloadData(URL);
+ var uiImage = UIImage.LoadFromData(Foundation.NSData.FromArray(bytes));
+ Application.RunOnMainThread(() =>
+ {
+ try
+ {
+ (uiView as UIImageView).Image = imimage(uiImage);
+ }
+ catch { }
+ });
+ }
+ catch { }
+ }
+ });
+ }
+ /// <summary>
+ /// 鍋滄鎾斁
+ /// </summary>
+ public void Stop()
+ {
+ isStarted = false;
+ }
+
+ /// <summary>
+ /// 鏃嬭浆褰撳墠鐢婚潰
+ /// </summary>
+ /// <returns>婧愬浘</returns>
+ /// <param name="image">鏃嬭浆鍚庣殑鐣岄潰</param>
+ UIImage imimage(UIImage image)
+ {
+ if (Application.IsPad)
+ {
+ return image;
+ }
+ else
+ {
+ var rotate = 3 * Math.PI / 2;
+ var rect = new CGRect(0, 0, image.Size.Height, image.Size.Width);
+ nfloat translateX = -rect.Size.Height;
+ nfloat translateY = 0;
+ nfloat scaleX = rect.Size.Height / rect.Size.Width;
+ nfloat scaleY = rect.Size.Width / rect.Size.Height;
+ //case UIImageOrientation.Right:
+ //rotate = 3 * Math.PI / 2;
+ // rect = new CGRect(0, 0, image.Size.Height, image.Size.Width);
+ // translateX = -rect.Size.Height;
+ // translateY = 0;
+ // scaleY = rect.Size.Width / rect.Size.Height;
+ // scaleX = rect.Size.Height / rect.Size.Width;
+ // break;
+ //case UIImageOrientation.Down:
+ // rotate = M_PI;
+ // rect = new CGRect(0, 0, image.Size.Width, image.Size.Height);
+ // translateX = -rect.Size.Width;
+ // translateY = -rect.Size.Height;
+ // break;
+ //default:
+ // rotate = 0.0f;
+ // rect = new CGRect(0, 0, image.Size.Width, image.Size.Height);
+ // translateX = 0;
+ // translateY = 0;
+ // break;
+
+ UIGraphics.BeginImageContext(rect.Size);
+ var context = UIGraphics.GetCurrentContext();
+ //鍋欳TM鍙樻崲
+ context.TranslateCTM(0.0f, rect.Size.Height);
+ context.ScaleCTM(1.0f, -1.0f);
+ context.RotateCTM((nfloat)rotate);
+ context.TranslateCTM(translateX, translateY);
+ context.ScaleCTM(scaleX, scaleY);
+
+ //缁樺埗鍥剧墖
+ context.DrawImage(new CGRect(0, 0, rect.Size.Width, rect.Size.Height), image.CGImage);
+ return UIGraphics.GetImageFromCurrentImageContext();
+ }
+ }
+ }
+}
diff --git a/Shared.IOS/UI/VerticalRefreshLayout.cs b/Shared.IOS/UI/VerticalRefreshLayout.cs
new file mode 100644
index 0000000..7bc8186
--- /dev/null
+++ b/Shared.IOS/UI/VerticalRefreshLayout.cs
@@ -0,0 +1,279 @@
+锘縰sing System;
+using UIKit;
+using CoreGraphics;
+using Shared.IO;
+using Foundation;
+using MJRefresh;
+
+namespace Shared
+{
+ /// <summary>
+ /// 浣嶇疆甯冨眬 甯︿笅鎷夊埛鏂�
+ /// </summary>
+ public class VerticalRefreshLayout : ViewGroup
+ {
+
+ public Action BeginHeaderRefreshingAction;
+ //public Action BeginFooterRefreshingAction;
+ MyRefreshScrolViewLayout mUIScrollView;
+
+ public VerticalRefreshLayout()
+ {
+ mUIScrollView = new MyRefreshScrolViewLayout(this) { };
+
+ viewGroup = mUIScrollView;
+
+ realViewGroup = mUIScrollView;
+
+ _isCanHeaderRefresh = true;
+
+ MJRefreshNormalHeader header = new MJRefreshNormalHeader();
+ //闅愯棌鎻愮ず鏂囧瓧
+ header.LastUpdatedTimeLabel.Hidden = true;
+ //header.StateLabel.Hidden = true;
+
+ mUIScrollView.SetMj_header(header);
+
+ header.RefreshingBlock = () =>
+ {
+ BeginHeaderRefreshingAction?.Invoke();
+ };
+
+
+
+ //header.SetTitle(NSBundle_MJRefresh.Mj_localizedStringForKey(NSBundle_MJRefresh.Mj_refreshBundle(NSBundle.MainBundle), "MJRefreshHeaderIdleText"), MJRefreshState.Idle);
+ //header.SetTitle(NSBundle_MJRefresh.Mj_localizedStringForKey(NSBundle_MJRefresh.Mj_refreshBundle(NSBundle.MainBundle), "MJRefreshHeaderPullingText"), MJRefreshState.Pulling);
+ //header.SetTitle(NSBundle_MJRefresh.Mj_localizedStringForKey(NSBundle_MJRefresh.Mj_refreshBundle(NSBundle.MainBundle), "MJRefreshHeaderRefreshingText"), MJRefreshState.Refreshing);
+
+ //header.AutomaticallyChangeAlpha = true;
+
+
+ }
+
+ //private void AddFotterView() {
+
+ // MJRefreshAutoNormalFooter footer = new MJRefreshAutoNormalFooter();
+ // mUIScrollView.SetMj_footer(footer);
+
+ // footer.RefreshingBlock = async () =>
+ // {
+ // BeginFooterRefreshingAction?.Invoke();
+ // };
+
+ //}
+
+
+
+ //***************************涓嬫媺鍒锋柊***************************
+ /// <summary>鈥� /// 鏄惁鏀寔涓嬫媺鍒锋柊鈥� /// </summary>
+ bool _isCanHeaderRefresh;
+ private bool IsCanHeaderRefresh
+ {
+ get鈥� {鈥� return _isCanHeaderRefresh;鈥� }
+ set
+ {
+ _isCanHeaderRefresh = value;
+
+ }
+ }
+
+
+ /// <summary>鈥� /// 澶村紑濮嬪埛鏂扳�� /// </summary>
+ public void BeginHeaderRefreshing()
+ {
+ if (!IsCanHeaderRefresh) return;
+
+
+ if (!mUIScrollView.Mj_header().Refreshing)
+ {
+ mUIScrollView.Mj_header().BeginRefreshing();
+ }
+ }
+
+ /// <summary>鈥� /// 澶寸粨鏉熷埛鏂扳�� /// </summary>
+ public void EndHeaderRefreshing()
+ {
+ if (!IsCanHeaderRefresh) return;
+
+ if (mUIScrollView.Mj_header().Refreshing)
+ {
+ mUIScrollView.Mj_header().EndRefreshing();
+ }
+ }
+
+
+ /// <summary>鈥� /// 鏄惁鏄剧ず婊氬姩鏉♀�� /// </summary>
+
+ public bool VerticalScrollBarEnabled
+ {
+ get鈥� {鈥� return mUIScrollView.ShowsVerticalScrollIndicator;鈥� }
+ set
+ {
+ mUIScrollView.ShowsVerticalScrollIndicator = value;
+
+ }
+ }
+
+
+
+ /// <summary>
+ /// 鍨傜洿鏂瑰悜婊氬姩瑙嗗浘
+ /// </summary>
+ class MyRefreshScrolViewLayout : UIScrollView
+ {
+ [Weak] VerticalRefreshLayout _view;
+ public MyRefreshScrolViewLayout(VerticalRefreshLayout view)
+ {
+ this._view = view;
+ Scrolled += (sender, e) =>
+ {
+ this._view?.ScrolledEventHandler?.Invoke(this, new MouseEventArgs { X = (float)(sender as MyRefreshScrolViewLayout).ContentOffset.X, Y = (float)(sender as MyRefreshScrolViewLayout).ContentOffset.Y });
+ };
+ }
+ /// <summary>
+ /// 鐐瑰嚮寮�濮�
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesBegan(NSSet touches, UIEvent evt)
+ {
+ _view?.TouchEvent(EventActions.Down, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 绉诲姩
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesMoved(NSSet touches, UIEvent evt)
+ {
+ _view?.TouchEvent(EventActions.Move, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮寮硅捣
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesEnded(NSSet touches, UIEvent evt)
+ {
+ _view?.TouchEvent(EventActions.Up, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ public override void TouchesCancelled(NSSet touches, UIEvent evt)
+ {
+ _view?.TouchEvent(EventActions.Cancel, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 妗嗘灦榛樿鍔犱簡涓や釜UIImageView 锛岃繖鏍峰彲浠ュ幓鎺夐粯璁ゆ坊鍔�
+ /// </summary>
+ /// <param name="view">View.</param>
+ public override void AddSubview(UIView view)
+ {
+ if (view.GetType() == typeof(UIImageView) && view.Tag != int.MinValue)
+ {
+ return;
+ }
+ base.AddSubview(view);
+ }
+ }
+
+ /// <summary>
+ /// 澧炲姞鎺т欢
+ /// </summary>
+ /// <param name="view">瀛愭帶浠�</param>
+ public override void AddChidren(View view)
+ {
+ base.AddChidren(view);
+ ReLocation();
+ }
+
+ /// <summary>
+ /// 閲嶆柊鎺掍綅缃強璁惧鍐呭澶у皬
+ /// </summary>
+ public virtual void ReLocation()
+ {
+ if (0 == viewList.Count)
+ {
+ return;
+ }
+ var frame1 = viewList[0].RealView.Frame;
+ frame1.Y = 0;
+ viewList[0].RealView.Frame = frame1;
+
+ for (int i = 1; i < viewList.Count; i++)
+ {
+ var frame = viewList[i].RealView.Frame;
+ frame.Y = viewList[i - 1].RealView.Frame.Bottom;
+ viewList[i].RealView.Frame = frame;
+ }
+
+ (realViewGroup as MyRefreshScrolViewLayout).ContentSize = new CoreGraphics.CGSize(0, viewList[viewList.Count - 1].Bottom <= Height ? Height + 1 : viewList[viewList.Count - 1].Bottom);
+ }
+
+ /// <summary>
+ /// 绉婚櫎鎵�鏈夌殑瑙嗗浘
+ /// </summary>
+ public override void RemoveAll()
+ {
+ base.RemoveAll();
+
+ ReLocation();
+ }
+
+ /// <summary>
+ /// 绉婚櫎褰撳墠瑙嗗浘
+ /// </summary>
+ /// <param name="view">褰撳墠瑙嗗浘</param>
+ internal override void Remove(View view)
+ {
+ base.Remove(view);
+
+ ReLocation();
+ }
+
+ /// <summary>
+ /// 绉婚櫎鎸囧畾绱㈠紩
+ /// </summary>
+ /// <param name="index">绱㈠紩</param>
+ public override void RemoveAt(int index)
+ {
+ base.RemoveAt(index);
+ ReLocation();
+ }
+
+ ///// <summary>
+ ///// 鏄惁鍏佽婊戝姩
+ ///// </summary>
+ ///// <value><c>true</c> if scroll enabled; otherwise, <c>false</c>.</value>
+ //public bool ScrollEnabled
+ //{
+ // get
+ // {
+ // return (realViewGroup as MyRefreshScrolViewLayout).ScrollEnabled;
+ // }
+ // set
+ // {
+ // (realViewGroup as MyRefreshScrolViewLayout).ScrollEnabled = value;
+ // }
+ //}
+
+ ///// <summary>
+ ///// 鏄惁姝e湪婊戝姩
+ ///// </summary>
+ ///// <value><c>true</c> if decelerating; otherwise, <c>false</c>.</value>
+ //public bool Decelerating
+ //{
+ // get
+ // {
+ // return (realViewGroup as MyRefreshScrolViewLayout).Decelerating;
+ // }
+ //}
+
+ /// <summary>
+ /// 婊戝姩浜嬩欢
+ /// </summary>
+ public EventHandler<MouseEventArgs> ScrolledEventHandler;
+
+
+ }
+}
\ No newline at end of file
diff --git a/Shared.IOS/UI/VerticalScrolViewLayout.cs b/Shared.IOS/UI/VerticalScrolViewLayout.cs
new file mode 100644
index 0000000..c631bdb
--- /dev/null
+++ b/Shared.IOS/UI/VerticalScrolViewLayout.cs
@@ -0,0 +1,246 @@
+锘縰sing System;
+using UIKit;
+using CoreGraphics;
+using Shared.IO;
+using Foundation;
+
+namespace Shared
+{
+ /// <summary>
+ /// 浣嶇疆甯冨眬锛屽凡缁忓叏闈㈡鏌�
+ /// </summary>
+ public class VerticalScrolViewLayout : ViewGroup
+ {
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public VerticalScrolViewLayout()
+ {
+ viewGroup = new MyVerticalScrolViewLayout(this) { };
+
+ realViewGroup = viewGroup;
+ }
+
+ /// <summary>
+ /// 鍨傜洿鏂瑰悜婊氬姩瑙嗗浘
+ /// </summary>
+ class MyVerticalScrolViewLayout : UIScrollView
+ {
+ [Weak] VerticalScrolViewLayout verticalScrolViewLayout;
+ public MyVerticalScrolViewLayout(VerticalScrolViewLayout verticalScrolViewLayout)
+ {
+ this.verticalScrolViewLayout = verticalScrolViewLayout;
+ Scrolled += (sender, e) =>
+ {
+ this.verticalScrolViewLayout?.ScrolledEventHandler?.Invoke(this, new MouseEventArgs { X = (float)(sender as MyVerticalScrolViewLayout).ContentOffset.X, Y = (float)(sender as MyVerticalScrolViewLayout).ContentOffset.Y });
+ };
+ }
+ /// <summary>
+ /// 鐐瑰嚮寮�濮�
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesBegan(NSSet touches, UIEvent evt)
+ {
+ verticalScrolViewLayout?.TouchEvent(EventActions.Down, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 绉诲姩
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesMoved(NSSet touches, UIEvent evt)
+ {
+ verticalScrolViewLayout?.TouchEvent(EventActions.Move, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮寮硅捣
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesEnded(NSSet touches, UIEvent evt)
+ {
+ verticalScrolViewLayout?.TouchEvent(EventActions.Up, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ public override void TouchesCancelled(NSSet touches, UIEvent evt)
+ {
+ verticalScrolViewLayout?.TouchEvent(EventActions.Cancel, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 妗嗘灦榛樿鍔犱簡涓や釜UIImageView 锛岃繖鏍峰彲浠ュ幓鎺夐粯璁ゆ坊鍔�
+ /// </summary>
+ /// <param name="view">View.</param>
+ public override void AddSubview(UIView view)
+ {
+ if (view.GetType() == typeof(UIImageView) && view.Tag != int.MinValue)
+ {
+ return;
+ }
+ base.AddSubview(view);
+ }
+ }
+
+ /// <summary>
+ /// 澧炲姞鎺т欢
+ /// </summary>
+ /// <param name="view">瀛愭帶浠�</param>
+ public override void AddChidren(View view)
+ {
+ base.AddChidren(view);
+ ReLocation();
+ }
+
+ /// <summary>
+ /// 閲嶆柊鎺掍綅缃強璁惧鍐呭澶у皬
+ /// </summary>
+ public virtual void ReLocation()
+ {
+ if (0 == viewList.Count)
+ {
+ return;
+ }
+ var frame1 = viewList[0].RealView.Frame;
+ frame1.Y = 0;
+ viewList[0].RealView.Frame = frame1;
+
+ for (int i = 1; i < viewList.Count; i++)
+ {
+ var frame = viewList[i].RealView.Frame;
+ frame.Y = viewList[i - 1].RealView.Frame.Bottom;
+ viewList[i].RealView.Frame = frame;
+ }
+
+ (realViewGroup as MyVerticalScrolViewLayout).ContentSize = new CoreGraphics.CGSize(0, viewList[viewList.Count - 1].Bottom <= Height ? Height + 1 : viewList[viewList.Count - 1].Bottom);
+ }
+
+ /// <summary>
+ /// 绉婚櫎鎵�鏈夌殑瑙嗗浘
+ /// </summary>
+ public override void RemoveAll()
+ {
+ base.RemoveAll();
+
+ ReLocation();
+ }
+
+ /// <summary>
+ /// 绉婚櫎褰撳墠瑙嗗浘
+ /// </summary>
+ /// <param name="view">褰撳墠瑙嗗浘</param>
+ internal override void Remove(View view)
+ {
+ base.Remove(view);
+
+ ReLocation();
+ }
+
+ /// <summary>
+ /// 绉婚櫎鎸囧畾绱㈠紩
+ /// </summary>
+ /// <param name="index">绱㈠紩</param>
+ public override void RemoveAt(int index)
+ {
+ base.RemoveAt(index);
+ ReLocation();
+ }
+
+ /// <summary>
+ /// 鏄惁鍏佽婊戝姩
+ /// </summary>
+ /// <value><c>true</c> if scroll enabled; otherwise, <c>false</c>.</value>
+ public bool ScrollEnabled
+ {
+ get
+ {
+ return (viewGroup as MyVerticalScrolViewLayout).ScrollEnabled;
+ }
+ set
+ {
+ (viewGroup as MyVerticalScrolViewLayout).ScrollEnabled = value;
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁姝e湪婊戝姩
+ /// </summary>
+ /// <value><c>true</c> if decelerating; otherwise, <c>false</c>.</value>
+ public bool Decelerating
+ {
+ get
+ {
+ return (viewGroup as MyVerticalScrolViewLayout).Decelerating;
+ }
+ }
+
+ /// <summary>
+ /// 婊戝姩浜嬩欢
+ /// </summary>
+ public EventHandler<MouseEventArgs> ScrolledEventHandler;
+
+ /// <summary>鈥� /// 鏄惁鏄剧ず鍨傜洿婊氬姩鏉♀�� /// </summary>
+
+ public bool VerticalScrollBarEnabled
+ {
+ get鈥� {鈥� return (viewGroup as MyVerticalScrolViewLayout).ShowsVerticalScrollIndicator;鈥� }
+ set
+ {
+ (viewGroup as MyVerticalScrolViewLayout).ShowsVerticalScrollIndicator = value;
+
+ }
+ }
+
+ /// <summary>
+ /// 婊戝姩鍒版寚瀹氫綅缃�
+ /// </summary>
+ /// <param name="viewY"></param>
+ public void ScrollToY(int viewY)
+ {
+ //璁$畻鏈�澶у彲浠ユ粴鍔ㄧ殑鍖哄煙
+ var maxY = (realViewGroup as MyVerticalScrolViewLayout).ContentSize.Height - Height;
+
+ if (viewY > maxY)
+ {
+ viewY = (int)maxY;
+ }
+
+ if (viewY < 0)
+ {
+ viewY = 0;
+ }
+
+ (viewGroup as MyVerticalScrolViewLayout).SetContentOffset(new CGPoint(0, viewY), false);
+ }
+
+ /// <summary>
+ /// 婊戝姩鍒版寚瀹歏IEW
+ /// </summary>
+ /// <param name="viewIndex"></param>
+ public void ScrollToViewIndex(int viewIndex)
+ {
+ if (viewList.Count == 0)
+ return;
+ var viewY = this.viewList[viewIndex].Y;
+ //璁$畻鏈�澶у彲浠ユ粴鍔ㄧ殑鍖哄煙
+ var maxY = (realViewGroup as MyVerticalScrolViewLayout).ContentSize.Height - Height;
+
+ if (viewY > maxY)
+ {
+ viewY = (int)maxY;
+ }
+
+ if (viewY < 0)
+ {
+ viewY = 0;
+ }
+
+ (viewGroup as MyVerticalScrolViewLayout).SetContentOffset(new CGPoint(0, viewY), false);
+ }
+
+ }
+
+
+
+
+}
diff --git a/Shared.IOS/UI/VerticalSeekBar.cs b/Shared.IOS/UI/VerticalSeekBar.cs
new file mode 100644
index 0000000..f20c24b
--- /dev/null
+++ b/Shared.IOS/UI/VerticalSeekBar.cs
@@ -0,0 +1,459 @@
+using System;
+using UIKit;
+using System.IO;
+using Foundation;
+using CoreGraphics;
+using Shared.IO;
+
+namespace Shared
+{
+ /// <summary>
+ /// 浣嶇疆甯冨眬
+ /// </summary>
+ public class VerticalSeekBar : View
+ {
+ /// <summary>
+ /// 婊戝潡
+ /// </summary>
+ UIButton btnThum = new UIButton(new CGRect(0, 0, 24, 24)) { Enabled = false };
+ /// <summary>
+ /// 杩涘害鏉¢鑹�
+ /// </summary>
+ UIButton btnProgressColor = new UIButton(new CGRect(0, 0, 1, 0)) { Enabled = false };
+ /// <summary>
+ /// 鑳屾櫙杩涘害鏉¢鑹�
+ /// </summary>
+ UIButton btnBackgroundColor = new UIButton(new CGRect(0, 0, 1, 0)) { Enabled = false };
+
+ MyVerticalSeekBar currentRealView;
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public VerticalSeekBar()
+ {
+ currentRealView = new MyVerticalSeekBar(this) { };
+
+ uiView = currentRealView;
+
+ uiView.AddSubview(btnBackgroundColor);
+ uiView.AddSubview(btnProgressColor);
+ uiView.AddSubview(btnThum);
+
+ }
+
+ /// <summary>
+ /// 鐢熸垚鍦嗗舰鐨勬粦鍔�
+ /// </summary>
+ /// <returns>The image with color.</returns>
+ /// <param name="color">Color.</param>
+ UIImage createImageWithColor(UIColor color)
+ {
+ //璁剧疆闀垮
+ CGRect rect = new CGRect(0.0f, 0.0f, btnThum.Frame.Width, btnThum.Frame.Width);
+ UIGraphics.BeginImageContext(rect.Size);
+ var context = UIGraphics.GetCurrentContext();
+ context.SetFillColor(color.CGColor);
+ context.FillRect(rect);
+ UIImage resultImage = UIGraphics.GetImageFromCurrentImageContext();
+ UIGraphics.EndImageContext();
+ // 寮�濮嬩竴涓狪mage鐨勪笂涓嬫枃
+ UIGraphics.BeginImageContextWithOptions(resultImage.Size, false, 0.0f);
+ // 娣诲姞鍦嗚
+ UIBezierPath.FromRoundedRect(rect, btnThum.Frame.Width / 2).AddClip();
+ // 缁樺埗鍥剧墖
+ resultImage.Draw(rect);
+ // 鎺ュ彈缁樺埗鎴愬姛鐨勫浘鐗�
+ resultImage = UIGraphics.GetImageFromCurrentImageContext();
+ UIGraphics.EndImageContext();
+ return resultImage;
+ }
+
+ public override void Refresh()
+ {
+ base.Refresh();
+ ProgressColor = progressColor;
+ BackgroundColor = backgroundColor;
+ ThumbColor = thumbColor;
+ Progress = progress;
+ }
+
+ /// <summary>
+ /// 褰撳墠瑙嗗浘鐨勯珮搴�
+ /// </summary>
+ /// <value>The height.</value>
+ public override int Height
+ {
+ get
+ {
+ return base.Height;
+ }
+ set
+ {
+ base.Height = value;
+ if (!IsCanRefresh)
+ {
+ return;
+ }
+ var frameBackgroundColor = btnBackgroundColor.Frame;
+ frameBackgroundColor.Height = base.Height;
+ btnBackgroundColor.Frame = frameBackgroundColor;
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠瑙嗗浘鐨勫搴�
+ /// </summary>
+ /// <value>The width.</value>
+ public override int Width
+ {
+ get
+ {
+ return base.Width;
+ }
+ set
+ {
+ base.Width = value;
+ if (!IsCanRefresh)
+ {
+ return;
+ }
+
+ var frameBtnFrame = btnThum.Frame;
+ frameBtnFrame.X = (base.Width - btnThum.Frame.Width) / 2;
+ btnThum.Frame = frameBtnFrame;
+
+ var frameBackgroundColor = btnBackgroundColor.Frame;
+ frameBackgroundColor.X = (base.Width - frameBackgroundColor.Width) / 2;
+ btnBackgroundColor.Frame = frameBackgroundColor;
+
+ var frameProgressColor = btnProgressColor.Frame;
+ frameProgressColor.X = (base.Width - frameProgressColor.Width) / 2;
+ btnProgressColor.Frame = frameProgressColor;
+ }
+ }
+
+
+ DateTime dateTime;
+ /// <summary>
+ /// 杩涘害鍙樺寲浜嬩欢
+ /// </summary>
+ public Action<View, int> ProgressChanged;
+
+ int max = 100;
+ /// <summary>
+ /// 鏈�澶у��
+ /// </summary>
+ /// <value>The max.</value>
+ public int Max
+ {
+ get
+ {
+ return max;
+ }
+ set
+ {
+ max = value;
+ }
+ }
+ bool isCanScrolled = true;
+ /// <summary>
+ /// 鏄惁鍏佽婊戝姩婊戝潡
+ /// </summary>
+ /// <value><c>true</c> if is can scrolled; otherwise, <c>false</c>.</value>
+ public bool IsCanScrolled
+ {
+ get
+ {
+ return isCanScrolled;
+ }
+ set
+ {
+ isCanScrolled = value;
+ }
+ }
+
+ nfloat validHeight
+ {
+ get {
+ return uiView.Frame.Height - btnThum.Frame.Height;
+ }
+ }
+
+ //2019-08-29 鏀�100姣
+ public int DelayTime = 100;
+ //闃叉璺冲姩锛屽欢鏃舵樉绀虹姸鎬�
+ DateTime delayDateTime = DateTime.MinValue;
+ int progress;
+ /// <summary>
+ /// 褰撳墠杩涘害
+ /// </summary>
+ /// <value>The progress.</value>
+ public int Progress
+ {
+ get
+ {
+ return (int)(Max * (validHeight - btnThum.Frame.Y) / validHeight);
+ }
+ set
+ {
+ progress = value;
+ if (!IsCanRefresh)
+ {
+ return;
+ }
+ //鍙戦�佸懡浠ゅ悗3000姣鍐呬笉鏇存柊鐘舵�侊紝闃叉璺冲姩
+ if ((DateTime.Now - delayDateTime).TotalMilliseconds < DelayTime)
+ {
+ return;
+ }
+
+ if (Max < progress)
+ {
+ progress = Max;
+ }
+ var frameThum = btnThum.Frame;
+ frameThum.Y = 1.0f*(Max - progress) / Max * validHeight;
+ btnThum.Frame = frameThum;
+
+ var frameProgress = btnProgressColor.Frame;
+ frameProgress.Y = frameThum.Y + frameThum.Height / 2;
+ frameProgress.Height = uiView.Frame.Height - frameProgress.Y;
+ btnProgressColor.Frame = frameProgress;
+ }
+ }
+ /// <summary>
+ /// 婊戝姩浼戠湢鏃堕棿
+ /// </summary>
+ public int SleepTime = 0;
+
+ uint progressColor = 0x99000099;
+ /// <summary>
+ /// 杩涘害棰滆壊
+ /// </summary>
+ /// <value>The color of the progress.</value>
+ public uint ProgressColor
+ {
+ get
+ {
+ return progressColor;
+ }
+ set
+ {
+ progressColor = value;
+ if (!IsCanRefresh)
+ {
+ return;
+ }
+ int r = (byte)(progressColor / 256 / 256 % 256);
+ int g = (byte)(progressColor / 256 % 256);
+ int b = (byte)(progressColor % 256);
+ int a = (byte)(progressColor / 256 / 256 / 256 % 256);
+ btnProgressColor.BackgroundColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+ }
+
+ uint backgroundColor = 0xFFFFFFFF;
+ /// <summary>
+ /// 搴曢儴棰滆壊
+ /// </summary>
+ /// <value>The color of the background.</value>
+ public new uint BackgroundColor
+ {
+ get
+ {
+ return backgroundColor;
+ }
+ set
+ {
+ backgroundColor = value;
+ if (!IsCanRefresh)
+ {
+ return;
+ }
+ int r = (byte)(backgroundColor / 256 / 256 % 256);
+ int g = (byte)(backgroundColor / 256 % 256);
+ int b = (byte)(backgroundColor % 256);
+ int a = (byte)(backgroundColor / 256 / 256 / 256 % 256);
+ btnBackgroundColor.BackgroundColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+ }
+
+ uint thumbColor = 0xFFFFFFFF;
+ /// <summary>
+ /// 婊戝潡棰滆壊
+ /// </summary>
+ /// <value>The color of the background.</value>
+ public uint ThumbColor
+ {
+ get
+ {
+ return thumbColor;
+ }
+ set
+ {
+ thumbColor = value;
+ if (!IsCanRefresh)
+ {
+ return;
+ }
+ int r = (byte)(thumbColor / 256 / 256 % 256);
+ int g = (byte)(thumbColor / 256 % 256);
+ int b = (byte)(thumbColor % 256);
+ int a = (byte)(thumbColor / 256 / 256 / 256 % 256);
+
+ btnThum.SetBackgroundImage(createImageWithColor(UIColor.FromRGBA(r, g, b, a)), UIControlState.Disabled);
+ }
+ }
+
+ internal override bool TouchEvent(EventActions e, CGPoint point)
+ {
+ switch (e)
+ {
+ case EventActions.Down:
+ dateTime = DateTime.Now;
+ setButtonLoaction(point.Y);
+ break;
+ case EventActions.Move:
+ setButtonLoaction(point.Y);
+ break;
+ case EventActions.Cancel:
+ case EventActions.Up:
+ dateTime = DateTime.MinValue;
+ setButtonLoaction(point.Y);
+ break;
+ }
+ return base.TouchEvent(e,point);
+ }
+ int beforValue = 0;
+ void setButtonLoaction(nfloat y)
+ {
+ if (!IsCanScrolled)
+ {
+ return;
+ }
+ delayDateTime = DateTime.Now;
+ if (y < 0)
+ {
+ y = 0;
+ }
+
+ if (validHeight < y)
+ {
+ y = validHeight;
+ }
+
+ var frameThum = btnThum.Frame;
+ frameThum.Y = y;
+ btnThum.Frame = frameThum;
+
+ var frameProgress = btnProgressColor.Frame;
+ frameProgress.Y = frameThum.Y + frameThum.Height / 2;
+ frameProgress.Height = uiView.Frame.Height - frameProgress.Y;
+ btnProgressColor.Frame = frameProgress;
+
+ if (dateTime == DateTime.MinValue)
+ {
+ if (ProgressChanged != null && beforValue != Progress)
+ {
+ dateTime = DateTime.Now;
+ delayDateTime = DateTime.Now;
+ ProgressChanged(this, beforValue = Progress);
+ }
+ }
+ else
+ {
+ //鍙樺寲澶т簬500姣鐨勬椂鍊欐墠閫氱煡
+ if (SleepTime < (DateTime.Now - dateTime).TotalMilliseconds)
+ {
+ dateTime = DateTime.Now;
+ delayDateTime = DateTime.Now;
+ if (ProgressChanged != null && beforValue != Progress)
+ {
+ ProgressChanged(this, beforValue = Progress);
+ }
+ }
+ }
+ }
+
+
+ class MyVerticalSeekBar : UIView
+ {
+ [Weak] VerticalSeekBar view;
+ public MyVerticalSeekBar(VerticalSeekBar view) {
+ this.view = view;
+ }
+ public override UIView HitTest(CGPoint point, UIEvent uievent)
+ {
+ //濡傛灉鐐瑰嚮鏄繖涓尯鍩燂紝涓嶈鍏跺畠瑙嗗浘鎵ц浜嬩欢
+ if (PointInside(point, uievent))
+ {
+ return this;
+ }
+ return null;
+ }
+ nfloat startPointX;
+
+ /// <summary>
+ /// 鐐瑰嚮寮�濮�
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesBegan(NSSet touches, UIEvent evt)
+ {
+ parentScrolled(false);
+ var cgpoint = (touches.AnyObject as UITouch).LocationInView(this);
+ startPointX = cgpoint.X;
+ view?.TouchEvent(EventActions.Down, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+ /// <summary>
+ /// 绉诲姩
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesMoved(NSSet touches, UIEvent evt)
+ {
+ var cgpoint = (touches.AnyObject as UITouch).LocationInView(this);
+ if (20 < Math.Abs(cgpoint.X - startPointX))
+ {
+ parentScrolled(true);
+ }
+ view?.TouchEvent(EventActions.Move, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮寮硅捣
+ /// </summary>
+ /// <param name="touches">Touches.</param>
+ /// <param name="evt">Evt.</param>
+ public override void TouchesEnded(NSSet touches, UIEvent evt)
+ {
+ parentScrolled(true);
+ view?.TouchEvent(EventActions.Up, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ public override void TouchesCancelled(NSSet touches, UIEvent evt)
+ {
+ parentScrolled(true);
+ view?.TouchEvent(EventActions.Cancel, (touches.AnyObject as UITouch).LocationInView(this));
+ }
+
+ /// <summary>
+ /// 璁剧疆鐖惰鍥炬槸鍚﹀彲浠ユ粦鍔�
+ /// </summary>
+ /// <param name="b">If set to <c>true</c> b.</param>
+ void parentScrolled(bool b)
+ {
+ var tempParent = Superview;
+ while (null != tempParent)
+ {
+ if (tempParent.GetType() == typeof(UIScrollView))
+ {
+ (tempParent as UIScrollView).ScrollEnabled = b;
+ }
+ tempParent = tempParent.Superview;
+ }
+ }
+ }
+ }
+}
+
diff --git a/Shared.IOS/UI/Video.cs b/Shared.IOS/UI/Video.cs
new file mode 100644
index 0000000..7a4ca69
--- /dev/null
+++ b/Shared.IOS/UI/Video.cs
@@ -0,0 +1,93 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using UIKit;
+using Foundation;
+using Shared.IO;
+
+namespace Shared
+{
+ /// <summary>
+ /// Button 鎸夐敭
+ /// </summary>
+ public class Video : View
+ {
+ //VitamioIOSBinding.VMediaPlayer player;
+ /// <summary>
+ /// 褰撳墠瑙嗗浘
+ /// </summary>
+ /// <value>The android button.</value>
+ private UIView playUIView
+ {
+ get
+ {
+ return this.uiView as UIView;
+ }
+ set
+ {
+ this.uiView = value;
+ }
+ }
+
+ public Video()
+ {
+ this.playUIView = new UIView { };
+ this.playUIView.Frame = new CoreGraphics.CGRect (0, 0, 1024, 1024);
+ //this.player = VMediaPlayer.SharedInstance ();
+ //player.SetupPlayerWithCarrierView (this.playUIView, new VdoDelegate());
+ //player.SetVideoFillMode (FillMode.Stretch);
+
+ }
+
+ public void init()
+ {
+ //player.SetDataSource (new NSUrl (this.URL));
+ //player.PrepareAsync ();
+ }
+
+ public void Start()
+ {
+ //player.Start ();
+ }
+
+ private string url;
+
+ public string URL
+ {
+ get
+ {
+ return this.url;
+ }
+ set
+ {
+ this.url = value;
+ }
+ }
+
+ public void Stop()
+ {
+
+ }
+
+ }
+
+// public class VdoDelegate : VitamioIOSBinding.VMediaPlayerDelegate
+// {
+// public override void DidPrepared(VMediaPlayer player,NSObject obj)
+// {
+// //player.Start ();
+// }
+//
+// public override void PlaybackCompleted(VMediaPlayer player,NSObject obj)
+// {
+//
+// }
+//
+// public override void Error(VMediaPlayer player,NSObject obj)
+// {
+//
+// }
+// }
+}
+
diff --git a/Shared.IOS/UI/View.cs b/Shared.IOS/UI/View.cs
new file mode 100644
index 0000000..44dbd59
--- /dev/null
+++ b/Shared.IOS/UI/View.cs
@@ -0,0 +1,1082 @@
+锘縰sing System;
+using System.Collections.Generic;
+using CoreAnimation;
+using CoreGraphics;
+using UIKit;
+
+//涓や釜闂锛岀涓�涓槸RCU鍗忚锛岀浜屼釜鏄疻IFI杩囧 23涓�
+ namespace Shared{
+
+ /// <summary>
+ /// 鏍硅鍥撅紝鎵�鏈夎鍥剧殑鐖惰鍥�
+ /// </summary>
+ class RootView : ViewGroup { }
+ /// <summary>
+ /// 鎵�鏈夌被鐨勫熀绫伙紝宸茬粡鍏ㄩ潰妫�鏌�
+ /// </summary>
+ public abstract class View
+ {
+ ~View()
+ {
+#if DEBUG
+ Shared.HDLUtils.WriteLine("=====" + GetType() + " " + Name);
+#endif
+ if (this is ViewGroup)
+ {
+ var viewGroup = this as ViewGroup;
+ if (viewGroup.realViewGroup != RealView)
+ {
+ foreach (var view in viewGroup.viewList)
+ {
+ view.RealView.Dispose();
+ }
+ viewGroup.realViewGroup?.Dispose();
+ }
+ }
+
+ RealView?.Dispose();
+ }
+
+
+ /// <summary>
+ /// 鏄惁闇�瑕佹洿鏂版帶浠�
+ /// </summary>
+ /// <value>The is need refresh.</value>
+ protected bool IsCanRefresh
+ {
+ get
+ {
+ View tempView = Parent;
+ while (tempView != null)
+ {
+ //濡傛灉鐖惰鍥炬槸RootView锛岄偅璇存槑瑙嗗浘宸茬粡鍔犺浇瀹屾垚锛屽彲浠ュ埛鏂拌鍥�
+ if (tempView.GetType() == typeof(RootView))
+ {
+ return true;
+ }
+ tempView = tempView.Parent;
+ }
+ return false;
+ }
+ }
+
+
+ /// <summary>
+ /// 褰撳墠瀵瑰簲鐨処OS鎺т欢
+ /// </summary>
+ protected UIView uiView;
+
+ /// <summary>
+ /// 鍐呰竟璺�
+ /// </summary>
+ /// <value>The padding.</value>
+ public virtual Padding Padding
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// 鏄惁浣胯兘
+ /// </summary>
+ /// <value><c>true</c> if enable; otherwise, <c>false</c>.</value>
+ public virtual bool Enable
+ {
+ get;
+ set;
+ }
+
+ int height=LayoutParams.MatchParent;
+ /// <summary>
+ /// 鎺т欢鐨勯珮搴�
+ /// </summary>
+ /// <value>The height.</value>
+ public virtual int Height
+ {
+ get
+ {
+ return IsCanRefresh ? (int)uiView.Frame.Height : height;
+ }
+ set
+ {
+
+ height = value;
+
+ if (!IsCanRefresh)
+ return;
+
+ var frame = uiView.Frame;
+ var beforeValue = frame.Height;
+ if (value == LayoutParams.MatchParent)
+ {
+ frame.Height = Parent.Height;
+ uiView.Frame = frame;
+ }
+ else
+ {
+ frame.Height = value;
+ uiView.Frame = frame;
+ }
+
+ if (frame.Height != beforeValue)
+ {
+ SizeChangeEventHandler?.Invoke(this, new Size((int)frame.Width, (int)frame.Height));
+ }
+
+ //濡傛灉鐖惰鍥炬槸VerticalScrolViewLayout锛岄偅闇�瑕侀噸鏂板埛鏂版帓鍒�
+ if (Parent is VerticalScrolViewLayout)
+ {
+ (Parent as VerticalScrolViewLayout).ReLocation();
+ }
+
+ if (Parent is VerticalRefreshLayout)
+ {
+ (Parent as VerticalRefreshLayout).ReLocation();
+ }
+ }
+ }
+
+ int width = LayoutParams.MatchParent;
+ /// <summary>
+ /// 鎺т欢瀹藉害
+ /// </summary>
+ /// <value>The width.</value>
+ public virtual int Width
+ {
+ get
+ {
+ return IsCanRefresh ? (int)uiView.Frame.Width : width;
+ }
+ set
+ {
+ width = value;
+
+ if (!IsCanRefresh)
+ return;
+
+
+ var frame = uiView.Frame;
+ var beforeValue = frame.Width;
+ if (value == LayoutParams.MatchParent)
+ {
+ frame.Width = Parent.Width;
+ uiView.Frame = frame;
+ }
+ else
+ {
+ frame.Width = value;
+ uiView.Frame = frame;
+ }
+
+ if (frame.Width != beforeValue)
+ {
+ SizeChangeEventHandler?.Invoke(this, new Size((int)frame.Width, (int)frame.Height));
+ }
+
+ //濡傛灉鐖惰鍥炬槸HorizontalScrolViewLayout锛岄偅闇�瑕侀噸鏂板埛鏂版帓鍒�
+ if (Parent is HorizontalScrolViewLayout)
+ {
+ (Parent as HorizontalScrolViewLayout).ReLocation();
+ }
+
+ }
+ }
+
+ Gravity gravity = Gravity.Frame;
+ /// <summary>
+ /// 褰撳墠瑙嗗浘瀵归綈鏂瑰紡
+ /// </summary>
+ /// <value>The gravity.</value>
+ public Gravity Gravity
+ {
+ get
+ {
+ return gravity;
+ }
+ set
+ {
+ gravity = value;
+ if (uiView.Superview == null)
+ {
+ return;
+ }
+ switch (value)
+ {
+ case Gravity.TopLeft:
+ X = 0;
+ Y = 0;
+ break;
+ case Gravity.TopCenter:
+ X = ((int)uiView.Superview.Frame.Width - Width) / 2;
+ Y = 0;
+ break;
+ case Gravity.TopRight:
+ X = (int)uiView.Superview.Frame.Width - Width;
+ Y = 0;
+ break;
+ case Gravity.CenterLeft:
+ X = 0;
+ Y = ((int)uiView.Superview.Frame.Height - Height) / 2;
+ break;
+ case Gravity.Center:
+ X = ((int)uiView.Superview.Frame.Width - Width) / 2;
+ Y = ((int)uiView.Superview.Frame.Height - Height) / 2;
+ break;
+ case Gravity.CenterRight:
+ X = (int)uiView.Superview.Frame.Width - Width;
+ Y = ((int)uiView.Superview.Frame.Height - Height) / 2;
+ break;
+ case Gravity.BottomLeft:
+ X = 0;
+ Y = (int)uiView.Superview.Frame.Height - Height;
+ break;
+ case Gravity.BottomCenter:
+ X = ((int)uiView.Superview.Frame.Width - Width) / 2;
+ Y = (int)uiView.Superview.Frame.Height - Height;
+ break;
+ case Gravity.BottomRight:
+ X = (int)uiView.Superview.Frame.Width - Width;
+ Y = (int)uiView.Superview.Frame.Height - Height;
+ break;
+ case Gravity.CenterVertical:
+ Y = ((int)uiView.Superview.Frame.Height - Height) / 2;
+ break;
+ case Gravity.CenterHorizontal:
+ X = ((int)uiView.Superview.Frame.Width - Width) / 2;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ /// <summary>
+ /// 鍒涙柊闇�瑕佸垱鏂扮殑淇℃伅
+ /// </summary>
+ public virtual void Refresh()
+ {
+ Width = width;
+ Height = height;
+ Gravity = gravity;
+ Animate = animate;
+ Radius = radius;
+ }
+
+ /// <summary>
+ /// 宸﹁竟绾夸綅缃�
+ /// </summary>
+ /// <value>The bottom.</value>
+ public int Bottom
+ {
+ get
+ {
+ return Height + Y;
+ }
+ }
+
+ /// <summary>
+ /// 鍙宠竟绾夸綅缃�
+ /// </summary>
+ /// <value>The right.</value>
+ public int Right
+ {
+ get
+ {
+ return Width + X;
+ }
+ }
+
+ /// <summary>
+ /// 鍚嶇О
+ /// </summary>
+ /// <value>The name.</value>
+ public string Name { get; set; }
+
+ int x;
+ /// <summary>
+ /// X杞村潗鏍�
+ /// </summary>
+ /// <value>The x.</value>
+ public virtual int X
+ {
+ get
+ {
+ if (Parent != null && Parent is HorizontalScrolViewLayout)
+ {
+ return (int)uiView.Frame.X;
+ }
+ else
+ {
+ return x;
+ }
+ }
+ set
+ {
+ x = value;
+
+ //杩欎釜閮ㄥ眬锛屼笉闇�瑕佸鐞嗗潗鏍�
+ if (Parent != null && Parent is HorizontalScrolViewLayout)
+ {
+ return;
+ }
+ else
+ {
+ var frame = uiView.Frame;
+ frame.X = value;
+ uiView.Frame = frame;
+ }
+ }
+ }
+
+ int y;
+ /// <summary>
+ /// Y杞村潗鏍�
+ /// </summary>
+ /// <value>The y.</value>
+ public virtual int Y
+ {
+ get
+ {
+ if (Parent != null && (Parent is VerticalScrolViewLayout || Parent is VerticalRefreshLayout))
+ {
+ return (int)uiView.Frame.Y;
+ }
+ else
+ {
+ return y;
+ }
+ }
+ set
+ {
+ y = value;
+
+ //杩欎釜閮ㄥ眬锛屼笉闇�瑕佸鐞嗗潗鏍�
+ if (Parent != null && (Parent is VerticalScrolViewLayout || Parent is VerticalRefreshLayout))
+ {
+ return;
+ }
+ else {
+ var frame = uiView.Frame;
+ frame.Y = value;
+ uiView.Frame = frame;
+ }
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠绐楀彛澶у皬鍙婁綅缃�
+ /// </summary>
+ /// <value>The frame.</value>
+ public virtual Size Size
+ {
+ get
+ {
+ return new Size(Width, Height);
+ }
+ set
+ {
+ Width = value.Width;
+ Height = value.Height;
+ }
+ }
+
+ /// <summary>
+ /// 鐖跺鍣�
+ /// </summary>
+ /// <value>The parent.</value>
+ public ViewGroup Parent;
+ bool isUp;
+ bool longClicked;
+ System.Threading.Thread thread;
+ /// <summary>
+ /// 鐐瑰嚮浜嬩欢
+ /// </summary>
+ /// <returns>鍙嶉褰撳墠浜嬩欢鏄惁宸茬粡澶勭悊</returns>
+ /// <param name="e">浜嬩欢</param>
+ /// <param name="point">褰撳墠鐐瑰嚮浣嶇疆</param>
+ internal virtual bool TouchEvent(EventActions eventAction, CGPoint point)
+ {
+ try
+ {
+ switch (eventAction)
+ {
+ case EventActions.Down:
+ isUp = false;
+ longClicked = false;
+
+ MouseDownEventHandler?.Invoke(this, new MouseEventArgs { X = (int)point.X, Y = (int)point.Y });
+ if (MouseLongEventHandler != null)
+ {
+ try
+ {
+ if (thread != null && thread.IsAlive)
+ {
+ thread.Abort();
+ }
+ thread = new System.Threading.Thread(() =>
+ {
+ System.Threading.Thread.Sleep(800);
+ if (!isUp)
+ {
+ longClicked = true;
+ Application.RunOnMainThread(() =>
+ {
+ MouseLongEventHandler(this, new MouseEventArgs { X = (int)point.X, Y = (int)point.Y });
+ });
+ }
+ })
+ { IsBackground = true };
+ thread.Start();
+ }
+ catch { }
+ }
+ break;
+ case EventActions.Move:
+ MouseMoveEventHandler?.Invoke(this, new MouseEventArgs { X = (int)point.X, Y = (int)point.Y });
+ break;
+ case EventActions.Up:
+ //isUp = true;
+ //if (!longClicked)
+ //{
+ // MouseUpEventHandler?.Invoke(this, new MouseEventArgs { X = (int)point.X, Y = (int)point.Y });
+ //}
+
+ //2020-07-20 鍜孉ndroid缁熶竴锛屾墜鍔挎姮璧锋椂褰撳墠鍧愭爣涓嶅湪瑙嗗浘涓婏紝鍙栨秷鍥炶皟鎶捣浜嬩欢
+ isUp = true;
+ bool bUpInside = this.uiView.Layer.Contains(point);
+ //if (bUpInside) {
+ // if (!longClicked)
+ // {
+ // MouseUpEventHandler?.Invoke(this, new MouseEventArgs { X = (int)point.X, Y = (int)point.Y });
+ // }
+ //}
+
+ //2021-04-13 澧炲姞MouseUpOutsideEventHandler浜嬩欢
+ if (!longClicked)
+ {
+ if (bUpInside)
+ {
+ MouseUpEventHandler?.Invoke(this, new MouseEventArgs { X = (int)point.X, Y = (int)point.Y });
+ }
+ else
+ {
+ MouseUpOutsideEventHandler?.Invoke(this, new MouseEventArgs { X = (int)point.X, Y = (int)point.Y });
+ }
+ }
+
+
+ break;
+ case EventActions.Cancel:
+ isUp = true;
+ break;
+ }
+ }catch (Exception ex)
+ {
+ Console.WriteLine($"Touch Event error : {eventAction.ToString()} ; msg : {ex.Message}");
+ CommonClass.ExcptionEvent(ex);
+
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮鎸変笅浜嬩欢
+ /// </summary>
+ public EventHandler<MouseEventArgs> MouseDownEventHandler;
+ /// <summary>
+ /// 鎺т欢涓婄Щ鍔ㄤ簨浠�
+ /// </summary>
+ public EventHandler<MouseEventArgs> MouseMoveEventHandler;
+
+ /// <summary>
+ /// 鐐瑰嚮寮硅捣浜嬩欢
+ /// </summary>
+ public EventHandler<MouseEventArgs> MouseUpEventHandler;
+ /// <summary>
+ /// 鐐瑰嚮寮硅捣浜嬩欢 UpOutside
+ /// </summary>
+ public EventHandler<MouseEventArgs> MouseUpOutsideEventHandler;
+ /// <summary>
+ /// 闀挎寜鐐瑰嚮浜嬩欢
+ /// </summary>
+ public EventHandler<MouseEventArgs> MouseLongEventHandler;
+
+ /// <summary>
+ /// 澶у皬鍙樺寲浜嬩欢
+ /// </summary>
+ public EventHandler<Size> SizeChangeEventHandler;
+
+
+ uint backgroundColor;
+ /// <summary>
+ /// 鑳屾櫙棰滆壊
+ /// </summary>
+ /// <value>The color of the background.</value>
+ public virtual uint BackgroundColor
+ {
+ get
+ {
+ return backgroundColor;
+ }
+ set
+ {
+ backgroundColor = value;
+ if (!IsCanRefresh)
+ {
+ return;
+ }
+ byte r, g, b, a;
+ r = (byte)(backgroundColor / 256 / 256 % 256);
+ g = (byte)(backgroundColor / 256 % 256);
+ b = (byte)(backgroundColor % 256);
+ a = (byte)(backgroundColor / 256 / 256 / 256 % 256);
+ uiView.BackgroundColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+ }
+
+ /// <summary>
+ /// 鑾峰彇鐪熷疄鐨勬帶浠�
+ /// </summary>
+ /// <value>The real view.</value>
+ internal UIKit.UIView RealView
+ {
+ get { return uiView; }
+ }
+
+ /// <summary>
+ /// 灏嗘帶鍒剁Щ鍒版渶鍓�
+ /// </summary>
+ public virtual void BringToFront()
+ {
+ if (!IsCanRefresh)
+ {
+ return;
+ }
+ uiView.Superview.BringSubviewToFront(uiView);
+ }
+
+ /// <summary>
+ /// 灏嗘帶浠剁Щ鍒版渶鍚�
+ /// </summary>
+ public virtual void SendToBack()
+ {
+ if (!IsCanRefresh)
+ {
+ return;
+ }
+ uiView.Superview.SendSubviewToBack(uiView);
+ }
+
+ System.Collections.Generic.Dictionary<string, object> tag;
+
+ /// <summary>
+ /// 閿�煎锛屾柟渚垮紑鍙戠敤
+ /// </summary>
+ /// <param name="key">Key.</param>
+ /// <param name="value">Value.</param>
+ public void AddTag(string key, object value)
+ {
+ if (tag == null)
+ {
+ tag = new System.Collections.Generic.Dictionary<string, object>();
+ }
+ tag.Remove(key);
+ tag.Add(key, value);
+ }
+
+ /// <summary>
+ /// 鍒犻櫎鎸囧畾閿�煎
+ /// </summary>
+ /// <param name="key">Key.</param>
+ public void RemoveTag(string key)
+ {
+ if (tag == null)
+ {
+ return;
+ }
+ tag.Remove(key);
+ }
+
+ /// <summary>
+ /// 鏍规嵁閿幏鍙栧��
+ /// </summary>
+ /// <returns>The tag by key.</returns>
+ /// <param name="key">Key.</param>
+ public object GetTagByKey(string key)
+ {
+ if (tag == null)
+ {
+ return null;
+ }
+ object value;
+ tag.TryGetValue(key, out value);
+ return value;
+ }
+
+ /// <summary>
+ /// 鍏ㄩ儴鍒犻櫎Tag
+ /// </summary>
+ /// <returns>The tag.</returns>
+ public void ClearTag()
+ {
+ if (tag != null)
+ {
+ tag.Clear();
+ }
+ }
+
+ /// <summary>
+ /// 鏂逛究寮�鍙戣�呭紑鍙戠敤
+ /// </summary>
+ public object Tag;
+
+ /// <summary>
+ /// 鏄惁鏄剧ず
+ /// </summary>
+ /// <value><c>true</c> if visible; otherwise, <c>false</c>.</value>
+ public bool Visible
+ {
+ get
+ {
+ return !uiView.Hidden;
+ }
+ set
+ {
+ uiView.Hidden = !value;
+ }
+ }
+
+
+ /// <summary>
+ /// 浠庣埗瑙嗗浘閲岄潰绉婚櫎鎺�
+ /// </summary>
+ public virtual void RemoveFromParent()
+ {
+ if (Parent == null)
+ {
+ return;
+ }
+
+ Parent.Remove(this);
+ }
+
+ /// <summary>
+ /// 鍔ㄧ敾鏁堟灉 閫熷害
+ /// 2020-06-15
+ /// </summary>
+ public float AnimateSpeed = 0.6f;
+
+ Animate animate = Animate.None;
+ /// <summary>
+ /// 鍔ㄧ敾鏂瑰紡
+ /// </summary>
+ /// <value>The animate.</value>
+ public Animate Animate
+ {
+ get
+ {
+ return animate;
+ }
+ set
+ {
+ animate = value;
+ if (!IsCanRefresh)
+ {
+ return;
+ }
+
+ var frameBefore = RealView.Frame;
+ var frame = frameBefore;
+ switch (animate)
+ {
+ case Animate.DownToUp:
+ frame.Y += RealView.Frame.Height;
+ RealView.Frame = frame;
+ UIView.AnimateNotify(AnimateSpeed, 0.001f, UIViewAnimationOptions.CurveLinear, () =>
+ {
+ RealView.Frame = frameBefore;
+ }, null);
+ break;
+ case Animate.UpToDown:
+ frame.Y -= RealView.Frame.Height;
+ RealView.Frame = frame;
+ UIView.AnimateNotify(AnimateSpeed, 0.001f, UIViewAnimationOptions.CurveLinear, () =>
+ {
+ RealView.Frame = frameBefore;
+ }, null);
+ break;
+ case Animate.LeftToRight:
+ System.Threading.Tasks.Task.Run(() =>
+ {
+ System.Threading.Thread.Sleep(1);
+ Application.RunOnMainThread(() =>
+ {
+ UIView.BeginAnimations("");
+ UIView.SetAnimationCurve(UIViewAnimationCurve.EaseInOut);
+ UIView.SetAnimationDuration(1.0);
+ UIView.SetAnimationTransition(UIViewAnimationTransition.FlipFromLeft, RealView, true);// cache:YES];
+ UIView.CommitAnimations();
+ });
+ });
+ break;
+ case Animate.RightToLeft:
+ System.Threading.Tasks.Task.Run(() =>
+ {
+ System.Threading.Thread.Sleep(1);
+ Application.RunOnMainThread(() =>
+ {
+ UIView.BeginAnimations("");
+ UIView.SetAnimationCurve(UIViewAnimationCurve.EaseInOut);
+ UIView.SetAnimationDuration(1.0);
+ UIView.SetAnimationTransition(UIViewAnimationTransition.FlipFromRight, RealView, true);// cache:YES];
+ UIView.CommitAnimations();
+ });
+ });
+ break;
+ case Animate.Rotation:
+ rotation();
+ break;
+
+ }
+
+ }
+ }
+ void rotation()
+ {
+ UIView.Animate(4, 0, UIViewAnimationOptions.CurveLinear, () =>
+ {
+ RealView.Transform = CGAffineTransform.Rotate(RealView.Transform, 3.1415926535898f / 2);
+ }, () =>
+ {
+ if (IsCanRefresh)
+ rotation();
+ });
+ }
+
+ /// <summary>
+ /// 閫忔槑搴﹁缃�
+ /// </summary>
+ /// <value>The alpha.</value>
+ public nfloat Alpha
+ {
+ get
+ {
+ return uiView.Alpha;
+ }
+ set
+ {
+ uiView.Alpha = value;
+ }
+ }
+
+
+
+
+
+ //4涓渾瑙掑垎鍒搴旂殑鍊�
+ //float topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius;
+ ///鏈疄鐜帮紝浠e畬鍠�
+ //public void SetAloneRadius(float topLeft, float topRight, float bottomLeft, float bottomRight)
+ //{
+ // IsSetAloneRadius = true;
+ // topLeftRadius = topLeft;
+ // topRightRadius = topRight;
+ // bottomLeftRadius = bottomLeft;
+ // bottomRightRadius = bottomRight;
+ // RefreshAloneCorner();
+ //}
+
+ //鏄惁鍗曠嫭璁剧疆鍦嗚
+ private bool IsSetAloneRadius;
+ float mAloneRadius;
+ float mRadiusId;
+ /// <summary>
+ /// 鎸囧畾浣嶇疆 璁剧疆鐩稿悓鐨勫渾瑙�
+ /// </summary>
+ public void SetCornerWithSameRadius(float mRadius, int mSetID)
+ {
+ //bool btopLeft, btopRight, bbottomLeft, bbottomRight;
+ IsSetAloneRadius = true;
+ mAloneRadius = mRadius;
+ mRadiusId = mSetID;
+ RefreshAloneCorner();
+ }
+
+ /// <summary>
+ /// 鏇存柊鍦嗚
+ /// </summary>
+ /// <returns>The corner.</returns>
+ private void RefreshAloneCorner()
+ {
+ BackgroundColor = backgroundColor;
+ uiView.Layer.MasksToBounds = true;
+ UIRectCorner corner = (UIRectCorner)(mRadiusId);
+ if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0))
+ {
+ uiView.Layer.CornerRadius = mAloneRadius;
+ uiView.Layer.MaskedCorners = (CACornerMask)corner;
+ }
+ else
+ {
+ UIBezierPath mUIBezierPath = UIBezierPath.FromRoundedRect(uiView.Bounds, corner, new CoreGraphics.CGSize(mAloneRadius, mAloneRadius));
+ CAShapeLayer mCAShapeLayer = new CAShapeLayer();
+ mCAShapeLayer.Frame = uiView.Bounds;
+ mCAShapeLayer.Path = mUIBezierPath.CGPath;
+ uiView.Layer.Mask = mCAShapeLayer;
+ }
+ uiView.Layer.BorderWidth = BorderWidth;
+ byte r, g, b, a;
+ r = (byte)(borderColor / 256 / 256 % 256);
+ g = (byte)(borderColor / 256 % 256);
+ b = (byte)(borderColor % 256);
+ a = (byte)(borderColor / 256 / 256 / 256 % 256);
+ uiView.Layer.BorderColor = new CGColor(r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f);
+
+ }
+
+
+
+ uint radius;
+ /// <summary>
+ /// 鍦嗚澶у皬
+ /// </summary>
+ /// <value>The corner.</value>
+ public uint Radius
+ {
+ get
+ {
+ return radius;
+ }
+ set
+ {
+ IsSetAloneRadius = false;
+ radius = value;
+ if (!IsCanRefresh)
+ {
+ return;
+ }
+ refreshCorner();
+ }
+ }
+
+
+ /// <summary>
+ /// 鏇存柊鍦嗚
+ /// </summary>
+ /// <returns>The corner.</returns>
+ void refreshCorner()
+ {
+ BackgroundColor = backgroundColor;
+
+ if (Radius == 0)
+ {
+ return;
+ }
+
+ uiView.Layer.MasksToBounds = true;
+ uiView.Layer.CornerRadius = Radius;
+ uiView.Layer.BorderWidth = BorderWidth;
+
+ byte r, g, b, a;
+ r = (byte)(borderColor / 256 / 256 % 256);
+ g = (byte)(borderColor / 256 % 256);
+ b = (byte)(borderColor % 256);
+ a = (byte)(borderColor / 256 / 256 / 256 % 256);
+ uiView.Layer.BorderColor = new CGColor(r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f);
+
+ }
+
+
+ uint borderWidth;
+ /// <summary>
+ /// 杈规绾垮ぇ灏�
+ /// </summary>
+ /// <value>The width of the border.</value>
+ public uint BorderWidth
+ {
+ get
+ {
+ return borderWidth;
+ }
+ set
+ {
+ borderWidth = value;
+ Radius = radius;
+ }
+ }
+
+ uint borderColor = 0xFFCCCCCC;
+ /// <summary>
+ /// 杈规绾块鑹�
+ /// </summary>
+ public uint BorderColor
+ {
+ get
+ {
+ return borderColor;
+ }
+ set
+ {
+ borderColor = value;
+ Radius = radius;
+ }
+ }
+
+ /// <summary>
+ /// 鏃嬭浆View
+ /// </summary>
+ /// <value>鏃嬭浆瑙掑害</value>
+ public void SetRotation(float mRotation)
+ {
+ if (mRotation > 180) {
+ mRotation = mRotation - 360f;
+ }
+ var mCGAffineTransform = CGAffineTransform.MakeRotation((nfloat)(mRotation * Math.PI / 180.0));
+ uiView.Transform = mCGAffineTransform;
+ }
+
+ /// <summary>
+ /// 璁剧疆闃村奖鏁堟灉
+ /// </summary>
+ /// <value>鏄惁鏄剧ず闃村奖</value>
+ public void SetViewShadow(bool bShow, float mOffsetY = 5.0f)
+ {
+ if (bShow)
+ {
+ uiView.Layer.ShadowOffset = new CGSize(0, mOffsetY);
+ uiView.Layer.ShadowOpacity = 0.5f;
+ uiView.Layer.ShadowColor = UIColor.Gray.CGColor;
+ uiView.ClipsToBounds = false;
+ }
+ else
+ {
+ //uiView.Layer.ShadowOffset = new CGSize(0, 0);
+ //uiView.Layer.ShadowOpacity = 0f;
+ uiView.ClipsToBounds = true;
+ }
+
+ }
+
+ }
+
+ /// <summary>
+ /// 瑙嗗浘澶у皬
+ /// </summary>
+ public class Size
+ {
+ /// <summary>
+ /// 瑙嗗浘澶у皬
+ /// </summary>
+ /// <param name="width">Width.</param>
+ /// <param name="height">Height.</param>
+ public Size(int width,int height)
+ {
+ Width = width;
+ Height = height;
+ }
+
+
+ /// <summary>
+ /// 瀹藉害
+ /// </summary>
+ public int Width {
+ get;
+ set;
+ }
+ /// <summary>
+ /// 楂樺害
+ /// </summary>
+ public int Height {
+ get;
+ set;
+ }
+
+ }
+
+ /// <summary>
+ /// 鍐呰竟璺�
+ /// </summary>
+ public class Padding
+ {
+ /// <summary>
+ /// 鍐呰竟璺�
+ /// </summary>
+ /// <param name="top">Top.</param>
+ /// <param name="left">Left.</param>
+ /// <param name="bottom">Bottom.</param>
+ /// <param name="right">Right.</param>
+ public Padding(int top,int left,int bottom,int right)
+ {
+ Top = top;
+ Left = left;
+ Bottom = bottom;
+ Right = right;
+ }
+ /// <summary>
+ /// 椤堕儴
+ /// </summary>
+ public int Top {
+ get;
+ set;
+ }
+ /// <summary>
+ /// 宸﹁竟
+ /// </summary>
+ public int Left {
+ get;
+ set;
+ }
+ /// <summary>
+ /// 搴曢儴
+ /// </summary>
+ public int Bottom {
+ get;
+ set;
+ }
+ /// <summary>
+ /// 鍙宠竟
+ /// </summary>
+ public int Right {
+ get;
+ set;
+ }
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮鏃跺熀鏈弬鏁�
+ /// </summary>
+ public class MouseEventArgs : EventArgs
+ {
+ /// <summary>
+ /// X鍧愭爣
+ /// </summary>
+ public float X;
+ /// <summary>
+ /// Y鍧愭爣
+ /// </summary>
+ public float Y;
+ }
+
+ /// <summary>
+ /// 鐐瑰嚮浜嬩欢
+ /// </summary>
+ enum EventActions
+ {
+ /// <summary>
+ /// Down
+ /// </summary>
+ Down,
+ /// <summary>
+ /// Move
+ /// </summary>
+ Move,
+ /// <summary>
+ /// UP
+ /// </summary>
+ Up,
+ /// <summary>
+ /// Cancel
+ /// </summary>
+ Cancel,
+ }
+}
diff --git a/Shared.IOS/UI/ViewGroup.cs b/Shared.IOS/UI/ViewGroup.cs
new file mode 100644
index 0000000..69523fa
--- /dev/null
+++ b/Shared.IOS/UI/ViewGroup.cs
@@ -0,0 +1,293 @@
+using System;
+using System.Collections.Generic;
+using Shared.IO;
+using UIKit;
+
+namespace Shared
+{
+
+ /// <summary>
+ /// ViewGroup 鎸夐敭
+ /// </summary>
+ public class ViewGroup : View
+ {
+ /// <summary>
+ /// 褰撳墠鐪熷疄鐨勬帶浠�
+ /// </summary>
+ internal UIView realViewGroup;
+ /// <summary>
+ /// 褰撳墠鎺т欢
+ /// </summary>
+ /// <value>The view group.</value>
+ internal UIView viewGroup
+ {
+ get
+ {
+ return uiView as UIView;
+ }
+ set
+ {
+ uiView = value;
+
+ uiView.AddSubview(backgroundImage);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠鑳屾櫙鍥�
+ /// </summary>
+ UIKit.UIImageView backgroundImage = new UIImageView() { Tag = int.MinValue};
+
+ /// <summary>
+ /// 鎺т欢瀹藉害
+ /// </summary>
+ public override int Width
+ {
+ get
+ {
+ return base.Width;
+ }
+ set
+ {
+ base.Width = value;
+
+ if (!IsCanRefresh)
+ return;
+ var frame = backgroundImage.Frame;
+ frame.Width = base.Width;
+ backgroundImage.Frame = frame;
+
+ var frame2 = realViewGroup.Frame;
+ frame2.Width = base.Width;
+ realViewGroup.Frame = frame2;
+ }
+ }
+
+ /// <summary>
+ /// 鎺т欢鐨勯珮搴�
+ /// </summary>
+ /// <value>The height.</value>
+ public override int Height
+ {
+ get
+ {
+ return base.Height;
+ }
+ set
+ {
+ base.Height = value;
+
+ if (!IsCanRefresh)
+ return;
+
+ var frame = backgroundImage.Frame;
+ frame.Height = base.Height;
+ backgroundImage.Frame = frame;
+
+ var frame2 = realViewGroup.Frame;
+ frame2.Height = base.Height;
+ realViewGroup.Frame = frame2;
+ }
+ }
+
+
+ /// <summary>
+ /// 澧炲姞瀛愭帶浠�
+ /// </summary>
+ /// <param name="view">View.</param>
+ public virtual void AddChidren(View view)
+ {
+ view.Parent = this;
+ viewList.Add(view);
+ realViewGroup.AddSubview(view.RealView);
+ if (!IsCanRefresh)
+ {
+ return;
+ }
+ view.Refresh();
+
+ addParentToAllSubViews(view);
+
+ if (view is ViewGroup)
+ {
+ var tempViewGroup = (ViewGroup)view;
+ for (int i = 0; i < tempViewGroup.ChildrenCount; i++)
+ {
+ tempViewGroup.GetChildren(i).Refresh();
+ }
+ }
+ }
+
+ internal void addParentToAllSubViews(View view)
+ {
+ if (view is ViewGroup)
+ {
+ var viewgroup = view as ViewGroup;
+ for (int i = 0; i < viewgroup.viewList.Count; i++)
+ {
+ var _view = viewgroup.viewList[i];
+ if (_view == null) continue;
+ _view.Parent = viewgroup;
+
+ addParentToAllSubViews(_view);//閫掑綊锛屽皢瀛愭帶浠舵墍鍖呭惈鐨勬帶浠朵篃涓�骞剁Щ闄わ紱
+ }
+ }
+ }
+
+ /// <summary>
+ /// 鎺т欢鏁伴噺
+ /// </summary>
+ /// <value>The children count.</value>
+ public virtual int ChildrenCount { get { return viewList.Count; } }
+
+ /// <summary>
+ /// 鎺т欢鍒楄〃
+ /// </summary>
+ internal System.Collections.Generic.List<View> viewList = new System.Collections.Generic.List<View>();
+
+ string backgroundImagePath;
+ /// <summary>
+ /// 鑳屾櫙鍥剧墖
+ /// </summary>
+ /// <value>The background image path.</value>
+ public virtual string BackgroundImagePath
+ {
+ get
+ {
+ return backgroundImagePath;
+ }
+ set
+ {
+ backgroundImagePath = value;
+
+ if (!IsCanRefresh || Radius != 0)
+ {
+ return;
+ }
+
+ backgroundImage.Image = UIImage.FromFile(FileUtils.GetImageFilePath(backgroundImagePath));
+
+ }
+ }
+
+ /// <summary>
+ /// 鍒锋柊鐣岄潰
+ /// </summary>
+ public override void Refresh()
+ {
+ base.Refresh();
+ BackgroundImagePath = backgroundImagePath;
+ }
+
+ /// <summary>
+ /// 绉婚櫎鎺т欢
+ /// </summary>
+ /// <param name="view">View.</param>
+ internal virtual void Remove(View view)
+ {
+ if (view == null)
+ {
+ return;
+ }
+
+ viewList.Remove(view);
+ if (view.RealView.Superview != null)
+ {
+ view.RealView.RemoveFromSuperview();
+ }
+ view.Parent = null;
+ }
+
+ internal virtual void removeChildParent()
+ {
+ for (int i = 0; i < viewList.Count; i++)
+ {
+ var view = viewList[i];
+ if (view == null) continue;
+ if (view is ViewGroup)
+ {
+ (view as ViewGroup).removeChildParent();
+ }
+ view.Parent = null;
+ }
+ }
+
+ public override void RemoveFromParent()
+ {
+ removeChildParent();
+ base.RemoveFromParent();
+ }
+
+
+
+ /// <summary>
+ /// 娓呯┖鎵�鏈夌殑鎺т欢
+ /// </summary>
+ public virtual void RemoveAll()
+ {
+ while (0 < viewList.Count)
+ {
+ GetChildren(0)?.RemoveFromParent();
+ }
+ }
+
+ /// <summary>
+ /// 绉婚櫎鎸囧畾绱㈠紩瀵硅薄
+ /// </summary>
+ /// <param name="index">Index.</param>
+ public virtual void RemoveAt(int index)
+ {
+ //Remove(GetChildren(index));
+ GetChildren(index)?.RemoveFromParent();
+
+ }
+
+ /// <summary>
+ /// 鑾峰彇鎸囧畾绱㈠紩瀵硅薄
+ /// </summary>
+ /// <returns>The children.</returns>
+ /// <param name="index">Index.</param>
+ public View GetChildren(int index)
+ {
+ if (index < 0 || viewList.Count - 1 < index)
+ {
+ return null;
+ }
+ return viewList[index];
+ }
+
+ /// <summary>
+ /// 鏍规嵁绫诲瀷绉婚櫎鎺т欢
+ /// </summary>
+ /// <param name="type">Type.</param>
+ public void RemoveViewByType(System.Type type)
+ {
+ for (int i = 0; i < viewList.Count; i++)
+ {
+ if (viewList[i].GetType() == type)
+ {
+ viewList[i].RemoveFromParent();
+ i--;
+ }
+ }
+ }
+
+ /// <summary>
+ /// 鏍规嵁Tag绉婚櫎鎺т欢
+ /// </summary>
+ /// <param name="type">Type.</param>
+ public void RemoveViewByTag(object tag)
+ {
+ for (int i = 0; i < viewList.Count; i++)
+ {
+ if (viewList[i].Tag == tag)
+ {
+ viewList[i].RemoveFromParent();
+ i--;
+ }
+ }
+ }
+
+ }
+}
+
diff --git a/Shared.IOS/UI/WaveSeekBar.cs b/Shared.IOS/UI/WaveSeekBar.cs
new file mode 100644
index 0000000..8626676
--- /dev/null
+++ b/Shared.IOS/UI/WaveSeekBar.cs
@@ -0,0 +1,384 @@
+using System;
+using Shared.IOS.TBL;
+
+
+namespace Shared
+{
+
+ /// <summary>
+ /// HDLWaveSeekbar 鎺т欢
+ /// </summary>
+ public class WaveSeekBar : BaseSeekBar
+ {
+ /// <summary>
+ /// 褰撳墠瑙嗗浘
+ /// </summary>
+ /// <value>The HDLWaveSeekbar.</value>
+ HDLWaveSeekbar mHDLWaveSeekbar
+ {
+ get
+ {
+ return uiView as HDLWaveSeekbar;
+ }
+ set
+ {
+ uiView = value;
+ }
+ }
+
+
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public WaveSeekBar()
+ {
+ mHDLWaveSeekbar = new HDLWaveSeekbar
+ {
+ MProgressChangedDelegate = new OnProgressChangeListener(this)
+ };
+
+ }
+
+
+ /// <summary>
+ /// 鍒锋柊甯冨眬
+ /// </summary>
+ private void RefreshFrame()
+ {
+ mHDLWaveSeekbar.InitWithFrameWaveSeekBar(new CoreGraphics.CGRect(base.X, base.Y, base.Width, base.Height));
+ }
+
+ /// <summary>
+ /// 鎺т欢瀹藉害
+ /// </summary>
+ public override int Width
+ {
+ get
+ {
+ return base.Width;
+ }
+ set
+ {
+ base.Width = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨勯珮搴�
+ /// </summary>
+ public override int Height
+ {
+ get
+ {
+ return base.Height;
+ }
+ set
+ {
+ base.Height = value;
+ RefreshFrame();
+
+ }
+ }
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int X
+ {
+ get
+ {
+ return base.X;
+ }
+ set
+ {
+ base.X = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int Y
+ {
+ get
+ {
+ return base.Y;
+ }
+ set
+ {
+ base.Y = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 杩涘害鍊兼樉绀哄崟浣�
+ /// </summary>
+ /// <value>鍗曚綅瀛楃</value>
+ public String ProgressBarUnitSring
+ {
+ set
+ {
+ mHDLWaveSeekbar.SetProgressBarUnitSring(value);
+ }
+ }
+
+ int minValue = 0;
+ int maxValue = 100;
+ /// <summary>
+ /// 杩涘害鍊兼渶澶у��
+ /// </summary>
+ /// <value>鏈�澶у��</value>
+ public int MaxValue
+ {
+ set
+ {
+ maxValue = value;
+ mHDLWaveSeekbar.SetMinAndMaxValue(minValue, maxValue);
+ }
+ }
+
+ /// <summary>
+ /// 杩涘害鍊兼渶灏忓��
+ /// </summary>
+ /// <value>鏈�灏忓��</value>
+ public int MinValue
+ {
+ set
+ {
+ minValue = value;
+ mHDLWaveSeekbar.SetMinAndMaxValue(minValue, maxValue);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊�
+ /// </summary>
+ /// <value>杩涘害鍊�</value>
+ public int Progress
+ {
+ set
+ {
+ mHDLWaveSeekbar.SetProgress(value);
+ }
+
+ get
+ {
+ return (int)mHDLWaveSeekbar.MProgress;
+ }
+ }
+
+ /// <summary>
+ /// 鑳屾櫙杈规瀹藉害
+ /// </summary>
+ /// <value>鍗婂緞</value>
+ public int WaveBorderWidth
+ {
+ set
+ {
+ mHDLWaveSeekbar.SetBorderWidth(value);
+ }
+ }
+
+ ///// <summary>
+ ///// 娉㈡氮杩涘害棰滆壊
+ ///// </summary>
+ ///// <value>娉㈡氮杩涘害棰滆壊</value>
+ //public uint WaveColor
+ //{
+ // set
+ // {
+ // byte r, g, b, a;
+ // r = (byte)(value / 256 / 256 % 256);
+ // g = (byte)(value / 256 % 256);
+ // b = (byte)(value % 256);
+ // a = (byte)(value / 256 / 256 / 256 % 256);
+ // mHDLWaveSeekbar.MWaveProgressBarColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ // mHDLWaveSeekbar.SetNeedsDisplay();
+ // }
+ //}
+
+ /// <summary>
+ /// 璁剧疆杩涘害鏉� 娓愬彉棰滆壊鐨勫紑濮嬮鑹插拰缁撴潫棰滆壊
+ /// </summary>
+ /// <value>寮�濮嬮鑹层�佺粨鏉熼鑹�</value>
+ public void SetProgressBarColors(uint startColor, uint endColor)
+ {
+ byte r, g, b, a;
+ r = (byte)(startColor / 256 / 256 % 256);
+ g = (byte)(startColor / 256 % 256);
+ b = (byte)(startColor % 256);
+ a = (byte)(startColor / 256 / 256 / 256 % 256);
+
+ var start = UIKit.UIColor.FromRGBA(r, g, b, a);
+
+ byte r2, g2, b2, a2;
+ r2 = (byte)(endColor / 256 / 256 % 256);
+ g2 = (byte)(endColor / 256 % 256);
+ b2 = (byte)(endColor % 256);
+ a2 = (byte)(endColor / 256 / 256 / 256 % 256);
+ var end = UIKit.UIColor.FromRGBA(r2, g2, b2, a2);
+
+ mHDLWaveSeekbar.SetProgressBarColors(start, end);
+ mHDLWaveSeekbar.SetNeedsDisplay();
+ }
+
+ /// <summary>
+ /// 鑳屾櫙杈规棰滆壊
+ /// </summary>
+ /// <value>鑳屾櫙杈规棰滆壊</value>
+ public uint WaveBorderColor
+ {
+ set
+ {
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+ mHDLWaveSeekbar.MWaveBorderColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ mHDLWaveSeekbar.SetNeedsDisplay();
+ }
+ }
+
+ /// <summary>
+ /// 鍦嗚
+ /// </summary>
+ /// <value>鍦嗚</value>
+ public int CornerRadius
+ {
+ set
+ {
+ mHDLWaveSeekbar.MCornerRadius = value;
+ }
+ }
+
+ /// <summary>
+ /// 杩涘害鏉′笌杈规杈硅窛
+ /// </summary>
+ /// <value>鍗婂緞</value>
+ public int WavePadding
+ {
+ set
+ {
+ mHDLWaveSeekbar.SetWavePadding(value);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊兼樉绀虹殑鏂囧瓧棰滆壊
+ /// </summary>
+ /// <value>鏂囧瓧棰滆壊</value>
+ public uint ProgressTextColor
+ {
+ set
+ {
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+
+ mHDLWaveSeekbar.MProgressTextColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊兼樉绀虹殑鏂囧瓧澶у皬
+ /// </summary>
+ /// <value>鏂囧瓧澶у皬</value>
+ public int ProgressTextSize
+ {
+ set
+ {
+ mHDLWaveSeekbar.MProgressTextSize = value;
+ }
+
+ }
+
+ /// <summary>
+ /// 鏄惁鍙互婊戝姩
+ /// </summary>
+ /// <value>鏄惁鍙互婊戝姩</value>
+ public bool IsClickable
+ {
+ set
+ {
+ mHDLWaveSeekbar.IsClickable = value;
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁鏄剧ず杩涘害鏂囧瓧
+ /// </summary>
+ /// <value>鏄惁鏄剧ず杩涘害鏂囧瓧</value>
+ public bool IsProgressTextShow
+ {
+ set
+ {
+ mHDLWaveSeekbar.IsProgressTextShow = value;
+ mHDLWaveSeekbar.SetNeedsDisplay();
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊� Y鍧愭爣
+ /// </summary>
+ /// <value>Y鍧愭爣</value>
+ public int NowProgressY
+ {
+ get
+ {
+ return (int)mHDLWaveSeekbar.ProgressY;
+ }
+ }
+
+
+ /// <summary>
+ /// EventHandler
+ /// </summary>
+ public EventHandler<int> OnProgressChangedEvent;
+ public EventHandler<bool> OnStartTrackingTouchEvent;
+ public EventHandler<int> OnStopTrackingTouchEvent;
+
+ ///// <summary>
+ ///// OnProgressChangeListener 缁ф壙鍝嶅簲浜嬩欢
+ ///// </summary>
+ OnProgressChangeListener mOnProgressChangeListener;
+
+ public class OnProgressChangeListener : HDLWaveSeekbarProgressChangedDelegate
+ {
+
+ [Weak] WaveSeekBar _WaveSeekBar;
+
+ public OnProgressChangeListener(WaveSeekBar view)
+ {
+ _WaveSeekBar = view;
+ }
+
+ public override void OnProgressChanged(int mProgress)
+ {
+ //if (_WaveSeekBar.IsProgressChangeDelay()) return;
+
+ _WaveSeekBar.OnProgressChangedEvent?.Invoke(this, mProgress);
+ }
+
+ public override void OnStartTrackingTouch()
+ {
+ _WaveSeekBar.OnStartTrackingTouchEvent?.Invoke(this, true);
+ }
+
+ public override void OnStopTrackingTouch(int mProgress)
+ {
+ _WaveSeekBar.OnProgressChangedEvent?.Invoke(this, mProgress);
+ _WaveSeekBar.OnStopTrackingTouchEvent?.Invoke(this, mProgress);
+ }
+ }
+
+ }
+}
diff --git a/Shared.IOS/UI/WaveSeekBarOn.cs b/Shared.IOS/UI/WaveSeekBarOn.cs
new file mode 100644
index 0000000..37be566
--- /dev/null
+++ b/Shared.IOS/UI/WaveSeekBarOn.cs
@@ -0,0 +1,413 @@
+using System;
+using Shared.IOS.TBL;
+
+
+namespace Shared
+{
+
+ /// <summary>
+ /// HDLOnWaveSeekbar 鎺т欢
+ /// 榛樿鍦嗚20 鎷栧姩鎸夐挳榛樿楂樺害10 鐧借壊
+ /// </summary>
+ public class WaveSeekBarOn : BaseSeekBar
+ {
+ /// <summary>
+ /// 褰撳墠瑙嗗浘
+ /// </summary>
+ /// <value>The HDLOnWaveSeekbar.</value>
+ HDLOnWaveSeekbar mHDLOnWaveSeekbar
+ {
+ get
+ {
+ return uiView as HDLOnWaveSeekbar;
+ }
+ set
+ {
+ uiView = value;
+ }
+ }
+
+
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ public WaveSeekBarOn()
+ {
+ mHDLOnWaveSeekbar = new HDLOnWaveSeekbar
+ {
+ MProgressChangedDelegate = new OnProgressChangeListener(this)
+ };
+
+ }
+
+
+ /// <summary>
+ /// 鍒锋柊甯冨眬
+ /// </summary>
+ private void RefreshFrame()
+ {
+ mHDLOnWaveSeekbar.InitWithFrameWaveSeekBar(new CoreGraphics.CGRect(base.X, base.Y, base.Width, base.Height));
+ }
+
+ /// <summary>
+ /// 鎺т欢瀹藉害
+ /// </summary>
+ public override int Width
+ {
+ get
+ {
+ return base.Width;
+ }
+ set
+ {
+ base.Width = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨勯珮搴�
+ /// </summary>
+ public override int Height
+ {
+ get
+ {
+ return base.Height;
+ }
+ set
+ {
+ base.Height = value;
+ RefreshFrame();
+
+ }
+ }
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int X
+ {
+ get
+ {
+ return base.X;
+ }
+ set
+ {
+ base.X = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 鎺т欢鐨刋鍧愭爣
+ /// </summary>
+ public override int Y
+ {
+ get
+ {
+ return base.Y;
+ }
+ set
+ {
+ base.Y = value;
+ RefreshFrame();
+ }
+ }
+
+
+ /// <summary>
+ /// 杩涘害鍊兼樉绀哄崟浣�
+ /// </summary>
+ /// <value>鍗曚綅瀛楃</value>
+ public String ProgressBarUnitSring
+ {
+ set
+ {
+ mHDLOnWaveSeekbar.SetProgressBarUnitSring(value);
+ }
+ }
+
+ int minValue = 0;
+ int maxValue = 100;
+ /// <summary>
+ /// 杩涘害鍊兼渶澶у��
+ /// </summary>
+ /// <value>鏈�澶у��</value>
+ public int MaxValue
+ {
+ set
+ {
+ maxValue = value;
+ mHDLOnWaveSeekbar.SetMinAndMaxValue(minValue, maxValue);
+ }
+ }
+
+ /// <summary>
+ /// 杩涘害鍊兼渶灏忓��
+ /// </summary>
+ /// <value>鏈�灏忓��</value>
+ public int MinValue
+ {
+ set
+ {
+ minValue = value;
+ mHDLOnWaveSeekbar.SetMinAndMaxValue(minValue, maxValue);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊�
+ /// </summary>
+ /// <value>杩涘害鍊�</value>
+ public int Progress
+ {
+ set
+ {
+ mHDLOnWaveSeekbar.SetProgress(value);
+ }
+
+ get
+ {
+ return (int)mHDLOnWaveSeekbar.MProgress;
+ }
+ }
+
+
+ /// <summary>
+ /// 璁剧疆杩涘害鏉� 娓愬彉棰滆壊鐨勫紑濮嬮鑹插拰缁撴潫棰滆壊
+ /// </summary>
+ /// <value>寮�濮嬮鑹层�佺粨鏉熼鑹�</value>
+ public void SetProgressBarColors(uint startColor, uint endColor)
+ {
+ byte r, g, b, a;
+ r = (byte)(startColor / 256 / 256 % 256);
+ g = (byte)(startColor / 256 % 256);
+ b = (byte)(startColor % 256);
+ a = (byte)(startColor / 256 / 256 / 256 % 256);
+
+ var start = UIKit.UIColor.FromRGBA(r, g, b, a);
+
+ byte r2, g2, b2, a2;
+ r2 = (byte)(endColor / 256 / 256 % 256);
+ g2 = (byte)(endColor / 256 % 256);
+ b2 = (byte)(endColor % 256);
+ a2 = (byte)(endColor / 256 / 256 / 256 % 256);
+ var end = UIKit.UIColor.FromRGBA(r2, g2, b2, a2);
+
+ mHDLOnWaveSeekbar.SetProgressBarColors(start, end);
+ mHDLOnWaveSeekbar.SetNeedsDisplay();
+ }
+
+ /// <summary>
+ /// 鍦嗚
+ /// </summary>
+ /// <value>鍦嗚</value>
+ public int CornerRadius
+ {
+ set
+ {
+ mHDLOnWaveSeekbar.MCornerRadius = value;
+ }
+ }
+
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊兼樉绀虹殑鏂囧瓧棰滆壊
+ /// </summary>
+ /// <value>鏂囧瓧棰滆壊</value>
+ public uint ProgressTextColor
+ {
+ set
+ {
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+
+ mHDLOnWaveSeekbar.MProgressTextColor = UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊兼樉绀虹殑鏂囧瓧澶у皬
+ /// </summary>
+ /// <value>鏂囧瓧澶у皬</value>
+ public int ProgressTextSize
+ {
+ set
+ {
+ mHDLOnWaveSeekbar.MProgressTextSize = value;
+ }
+
+ }
+
+ /// <summary>
+ /// 鏄惁鍙互婊戝姩
+ /// </summary>
+ /// <value>鏄惁鍙互婊戝姩</value>
+ public bool IsClickable
+ {
+ set
+ {
+ mHDLOnWaveSeekbar.IsClickable = value;
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁鏄剧ず杩涘害鏂囧瓧
+ /// </summary>
+ /// <value>鏄惁鏄剧ず杩涘害鏂囧瓧</value>
+ public bool IsProgressTextShow
+ {
+ set
+ {
+ mHDLOnWaveSeekbar.IsProgressTextShow = value;
+ mHDLOnWaveSeekbar.SetNeedsDisplay();
+ }
+ }
+
+ /// <summary>
+ /// 褰撳墠杩涘害鍊� Y鍧愭爣
+ /// </summary>
+ /// <value>Y鍧愭爣</value>
+ public int NowProgressY
+ {
+ get
+ {
+ return (int)mHDLOnWaveSeekbar.ProgressY;
+ }
+ }
+
+ /// <summary>
+ /// 鏄惁绂荤嚎 绂荤嚎鐨勮瘽绂佹婊戝姩骞剁粯鍒剁伆鑹茶儗鏅�
+ /// </summary>
+ /// <value>鏄惁绂荤嚎</value>
+ public bool IsOffline
+ {
+ set
+ {
+ mHDLOnWaveSeekbar.SetOffline(value);
+ }
+ }
+
+ /// <summary>
+ /// 绂荤嚎鏁堟灉鏃� 杩涘害鏉¢鑹� 鍗曚竴棰滆壊涓嶆笎鍙�
+ /// </summary>
+ /// <value>鍗曚竴杩涘害鏉¢鑹�</value>
+ public uint OfflineProgressBarColor
+ {
+ set
+ {
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+ mHDLOnWaveSeekbar.SetOfflineProgressBarColor(UIKit.UIColor.FromRGBA(r, g, b, a));
+ }
+
+ }
+
+ /// <summary>
+ /// 鏄惁鏄剧ず鎷栧姩鎸夐挳 鐩寸嚎鍥惧舰
+ /// </summary>
+ /// <value>鏄惁绂荤嚎</value>
+ public bool IsThumbBtnShow
+ {
+ set
+ {
+ mHDLOnWaveSeekbar.SetThumbBtnShow(value);
+ }
+ }
+
+ /// <summary>
+ /// 鎷栧姩鎸夐挳楂樺害
+ /// </summary>
+ public int ThumbBtnHeight
+ {
+ set
+ {
+ mHDLOnWaveSeekbar.ThumbBtnHeight = value;
+ }
+ }
+
+ /// <summary>
+ /// 鎷栧姩鎸夐挳棰滆壊
+ /// </summary>
+ public uint ThumbBtnColor
+ {
+ set
+ {
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+ mHDLOnWaveSeekbar.ThumbBtnColor = (UIKit.UIColor.FromRGBA(r, g, b, a));
+ }
+ }
+
+ /// <summary>
+ /// 鐭╁舰鐨勮儗鏅鑹�
+ /// </summary>
+ /// <value>鑳屾櫙棰滆壊</value>
+ public uint WaveBackgroundColor
+ {
+ set
+ {
+ byte r, g, b, a;
+ r = (byte)(value / 256 / 256 % 256);
+ g = (byte)(value / 256 % 256);
+ b = (byte)(value % 256);
+ a = (byte)(value / 256 / 256 / 256 % 256);
+ mHDLOnWaveSeekbar.MWaveBackgroundColor = (UIKit.UIColor.FromRGBA(r, g, b, a));
+ }
+
+ }
+
+ /// <summary>
+ /// EventHandler
+ /// </summary>
+ public EventHandler<int> OnProgressChangedEvent;
+ public EventHandler<bool> OnStartTrackingTouchEvent;
+ public EventHandler<int> OnStopTrackingTouchEvent;
+
+ ///// <summary>
+ ///// OnProgressChangeListener 缁ф壙鍝嶅簲浜嬩欢
+ ///// </summary>
+ OnProgressChangeListener mOnProgressChangeListener;
+
+ public class OnProgressChangeListener : HDLSeekBarProgressChangedDelegate
+ {
+
+ [Weak] WaveSeekBarOn _WaveSeekBar;
+
+ public OnProgressChangeListener(WaveSeekBarOn view)
+ {
+ _WaveSeekBar = view;
+ }
+
+ public override void OnProgressChanged(int mProgress)
+ {
+ //if (_WaveSeekBar.IsProgressChangeDelay()) return;
+
+ _WaveSeekBar.OnProgressChangedEvent?.Invoke(this, mProgress);
+ }
+
+ public override void OnStartTrackingTouch()
+ {
+ _WaveSeekBar.OnStartTrackingTouchEvent?.Invoke(this, true);
+ }
+
+ public override void OnStopTrackingTouch(int mProgress)
+ {
+ _WaveSeekBar.OnProgressChangedEvent?.Invoke(this, mProgress);
+ _WaveSeekBar.OnStopTrackingTouchEvent?.Invoke(this, mProgress);
+ }
+ }
+
+ }
+}
diff --git a/Shared.IOS/UI/WebView.cs b/Shared.IOS/UI/WebView.cs
new file mode 100644
index 0000000..a5bdd79
--- /dev/null
+++ b/Shared.IOS/UI/WebView.cs
@@ -0,0 +1,167 @@
+锘縰sing System;
+using Foundation;
+using WebKit;
+using System.Collections.Generic;
+namespace Shared
+{
+ /// <summary>
+ /// WebView
+ /// </summary>
+ public class WebView:View
+ {
+ public Action<Dictionary<string,string>> JSToNativeAction;
+
+ /// <summary>
+ /// DidFinishAction
+ /// </summary>
+ public Action DidFinishAction;
+
+ /// <summary>
+ /// WKWebView
+ /// </summary>
+ private InnerWKWebView uiWebView
+ {
+ get
+ {
+ return this.uiView as InnerWKWebView;
+ }
+ set
+ {
+ this.uiView = value;
+ }
+ }
+
+ /// <summary>
+ /// WebView
+ /// </summary>
+ public WebView ()
+ {
+ // 閰嶇疆缃戦〉鐨勯厤缃枃浠�
+ WKWebViewConfiguration configuration = new WKWebViewConfiguration { };
+
+
+ //榛樿甯冨眬锛屽楂樹负0鐨勮瘽浼氬紓甯�
+ var mFrame = new CoreGraphics.CGRect(base.X, base.Y, 10, 10);
+ this.uiWebView = new InnerWKWebView(this, mFrame, configuration) { };
+ uiWebView.ScrollView.Bounces = false;
+ //uiWebView.NavigationDelegate = new OnWKNavigationDelegate(this);
+ configuration.UserContentController.AddScriptMessageHandler(this.uiWebView, "call");
+
+ }
+
+ /// <summary>
+ /// 鍔犺浇缃戦〉
+ /// </summary>
+ /// <param name="url"></param>
+ public void LoadRequest(string url)
+ {
+ uiWebView.LoadRequest ( Foundation.NSUrlRequest.FromUrl ( Foundation.NSUrl .FromString(url)));
+ }
+
+ public void CallJS(string js)
+ {
+ uiWebView.EvaluateJavaScript(js,(result, error) => {
+ System.Console.WriteLine(error + "");
+ });
+ }
+
+ /// <summary>
+ /// 鍔犺浇鏈湴HTML
+ /// </summary>
+ public void LoadFileUrl(string url)
+ {
+ var urls = url.Split("?");
+ url = urls[0];
+ Console.WriteLine(url + "xxxxxxxxxxxxx");
+ string parameter = null;
+ if (1 < urls.Length)
+ {
+ parameter = urls[1];
+ }
+ if (url.EndsWith(".html"))
+ {
+ url = url.Substring(0, url.Length - ".html".Length);
+ }
+ var filePath = NSBundle.MainBundle.PathForResource(url, "html");
+ if (parameter == null)
+ {
+ var nsUrl = new NSUrl(filePath,false);
+ uiWebView.LoadFileUrl(nsUrl, nsUrl);
+ }
+ else
+ {
+ var path = $"file://{filePath}?{parameter}"; //杞垚file璺緞锛屽苟涓旀嫾涓婂弬鏁�
+ //var newPath = NSUrl..Encode(path);
+ NSUrlComponents nSUrl = new NSUrlComponents(path);
+ var nsUrl = nSUrl.Url;//NSUrl.FromString(newPath.ToString());
+ uiWebView.LoadFileUrl(nsUrl, nsUrl);
+
+ }
+ }
+
+
+ /// <summary>
+ /// 鍔犺浇Html鏍囩鐨勫瘜鏂囨湰
+ /// </summary>
+ /// <param name="htmlStr"></param>
+ public void LoadHTMLString(string htmlStr)
+ {
+ uiWebView.LoadHtmlString(htmlStr, null);
+ }
+
+ class InnerWKWebView : WKWebView, IWKScriptMessageHandler
+ {
+ [Weak] WebView webView;
+ public InnerWKWebView(WebView webView, CoreGraphics.CGRect cGRect, WKWebViewConfiguration wKWebViewConfiguration) : base(cGRect, wKWebViewConfiguration)
+ {
+ this.webView = webView;
+ }
+ public void DidReceiveScriptMessage(WKUserContentController userContentController, WKScriptMessage message)
+ {
+ if (message.Name == "call")
+ {
+ if (message.Body == null)
+ {
+ return;
+ }
+ var nsDictionary = (NSDictionary)message.Body;
+
+ if (nsDictionary == null)
+ {
+ return;
+ }
+ var dictionary = new Dictionary<string, string> { };
+
+ foreach (var nsKey in nsDictionary.Keys)
+ {
+ var key = nsKey.ToString();
+ dictionary.Add(key, nsDictionary.ValueForKey(new NSString(key))?.ToString());
+ }
+ webView?.JSToNativeAction?.Invoke(dictionary);
+ }
+ }
+ }
+
+
+
+ /// <summary>
+ /// OnWKNavigationDelegate
+ /// </summary>
+ class OnWKNavigationDelegate : WKNavigationDelegate
+ {
+ [Weak] WebView _WebView;
+
+ public OnWKNavigationDelegate(WebView view)
+ {
+ _WebView = view;
+ }
+
+ public override void DidFinishNavigation(WKWebView webView, WKNavigation navigation)
+ {
+ HDLUtils.WriteLine("WKWebView DidFinishNavigation");
+ _WebView.DidFinishAction?.Invoke();
+ }
+ }
+ }
+}
+
diff --git a/Shared.IOS/UI/WiimuUPnP.cs b/Shared.IOS/UI/WiimuUPnP.cs
new file mode 100644
index 0000000..fefb994
--- /dev/null
+++ b/Shared.IOS/UI/WiimuUPnP.cs
@@ -0,0 +1,91 @@
+锘縰sing System;
+using Foundation;
+
+namespace Shared
+{
+
+
+ public static class WiimuUPnP
+ {
+ /// <summary>
+ /// 鑾峰彇褰撳墠WIFI鐨勫悕绉�
+ /// </summary>
+ /// <value>The ssid.</value>
+ public static string SSID
+ {
+ get
+ {
+ string[] supportedInterface;
+ SystemConfiguration.CaptiveNetwork.TryGetSupportedInterfaces(out supportedInterface);
+ foreach (var s in supportedInterface)
+ {
+ NSDictionary nSDictionary;
+ SystemConfiguration.CaptiveNetwork.TryCopyCurrentNetworkInfo(s, out nSDictionary);
+ if (nSDictionary != null)
+ {
+ return nSDictionary.ValueForKey(SystemConfiguration.CaptiveNetwork.NetworkInfoKeySSID).ToString();
+ }
+ }
+ return null;
+ }
+ }
+ static Action<string> currentAction;
+ /// <summary>
+ /// 鍚姩閰嶇疆鏃犵嚎涓婄綉
+ /// </summary>
+ /// <returns>The start.</returns>
+ /// <param name="password">瀵嗙爜</param>
+ /// <param name="a">閰嶇疆瀹屾垚鍚庡弽棣堢殑缁撴灉</param>
+ public static void Start(string password,Action<string> action)
+ {
+ if (SSID == null)
+ {
+ return;
+ }
+
+ Stop();
+ dateTime = DateTime.Now;
+ currentAction = action;
+ Shared.WiimuSmartlink.SharedInstance.StartProvision(SSID, password, (obj) => {
+ if(action!=null){
+ action(obj);
+ Stop();
+ }
+ });
+ }
+
+ static WiimuUPnP()
+ {
+ //瀹氭椂妫�鏌�
+ System.Threading.Tasks.Task.Run(() =>
+ {
+ while (true)
+ {
+ System.Threading.Thread.Sleep(1000);
+ if (30 <= (System.DateTime.Now - dateTime).TotalSeconds)
+ {
+ Stop();
+ if (currentAction != null)
+ {
+ currentAction("TimeOut");
+ }
+ }
+ }
+ });
+ }
+
+ /// <summary>
+ /// 璁板綍寮�濮嬫椂闂�
+ /// </summary>
+ static DateTime dateTime = DateTime.MaxValue;
+
+ /// <summary>
+ /// 鍋滄閰嶇疆鏃犵嚎涓婄綉
+ /// </summary>
+ public static void Stop()
+ {
+ dateTime = DateTime.MaxValue;
+ Shared.WiimuSmartlink.SharedInstance.StopProvision((obj) => { });
+ }
+ }
+}
diff --git a/Shared.IOS/Utils/HDLUtils.cs b/Shared.IOS/Utils/HDLUtils.cs
new file mode 100644
index 0000000..b328699
--- /dev/null
+++ b/Shared.IOS/Utils/HDLUtils.cs
@@ -0,0 +1,80 @@
+锘縰sing System;
+using UIKit;
+
+namespace Shared
+{
+ public class HDLUtils
+ {
+
+ public static int RectCornerTopLeft = 1;
+ public static int RectCornerTopRight = 2;
+ public static int RectCornerBottomLeft = 4;
+ public static int RectCornerBottomRight = 8;
+
+ /// <summary>
+ /// 鍏ㄥ眬鎵撳嵃
+ /// </summary>
+ public static void WriteLine(object mes)
+ {
+#if DEBUG
+ Console.WriteLine (mes);
+#endif
+ }
+
+ public static void RestartApp() {
+
+ //Com.Hdl.Widget.
+
+ BaseApplicationDelegate DD = (BaseApplicationDelegate)UIApplication.SharedApplication.Delegate;
+ DD.setHDLRootViewController();
+ }
+
+
+ public static UIColor GetUIColorWithUint(uint uintColor)
+ {
+
+ byte r, g, b, a;
+ r = (byte)(uintColor / 256 / 256 % 256);
+ g = (byte)(uintColor / 256 % 256);
+ b = (byte)(uintColor % 256);
+ a = (byte)(uintColor / 256 / 256 / 256 % 256);
+
+ return UIKit.UIColor.FromRGBA(r, g, b, a);
+ }
+
+ /// <summary>
+ /// 鐢熸垚浜岀淮鐮�
+ /// </summary>
+ public static UIImage createQRCode(string url, int size = 500)
+ {
+ //return HDLUtlisXM.CreateQRCode(url, size);
+
+ return null;
+ }
+
+ /// <summary>
+ /// 璺宠浆鎵撳紑APP鎴栬�匒pp Store涓嬭浇鍦板潃
+ /// </summary>
+ /// <param name="url"></param>
+ public static void OpenUrl(string url)
+ {
+ UIApplication.SharedApplication.OpenUrl(new Foundation.NSUrl(url));
+ }
+
+ /// <summary>
+ /// 璺宠浆鎵撳紑APP
+ /// </summary>
+ /// <param name="url"></param>
+ public static bool OpenApp(string url)
+ {
+ //鎵撳紑鐨勭洰鏍嘇pp锛屾病璁剧疆鐧藉悕鍗� 鎴栬�� 娌″畨瑁呯殑浼氭墦寮�澶辫触CanOpenUrl 杩斿洖false
+ if (UIApplication.SharedApplication.CanOpenUrl(new Foundation.NSUrl(url)))
+ {
+ UIApplication.SharedApplication.OpenUrl(new Foundation.NSUrl(url));
+ return true;
+ }
+ return false;
+ }
+
+ }
+}
diff --git a/Shared.IOS/Utils/TouchIDUtils.cs b/Shared.IOS/Utils/TouchIDUtils.cs
new file mode 100644
index 0000000..2c9646c
--- /dev/null
+++ b/Shared.IOS/Utils/TouchIDUtils.cs
@@ -0,0 +1,110 @@
+锘縰sing System;
+using Shared.IOS.TBL;
+
+
+namespace Shared
+{
+ public class TouchIDUtils
+ {
+
+ public enum TouchIDSupperType
+ {
+ TouchID,
+ FaceID,
+ None
+ }
+
+ public enum TouchIDState
+ {
+ NotSupport,
+ Success,
+ Fail,
+ InputPassword,
+ TouchIDLockout
+ }
+
+
+ public static TouchIDSupperType getTouchIDSupperType()
+ {
+
+ TouchIDSupperType type = TouchIDSupperType.None;
+
+ HDLTouchIDSupperType mHDLTouchIDSupperType = HDLTouchID.SharedInstance.HDL_canSupperBiometrics;
+
+ if (mHDLTouchIDSupperType == HDLTouchIDSupperType.TouchID)
+ {
+ type = TouchIDSupperType.TouchID;
+ }
+ else if (mHDLTouchIDSupperType == HDLTouchIDSupperType.FaceID)
+ {
+ type = TouchIDSupperType.FaceID;
+ }
+ else
+ {
+ type = TouchIDSupperType.None;
+ }
+
+ return type;
+
+ }
+
+
+ public EventHandler<TouchIDState> OnHDLTouchIDStateBackEvent;
+
+
+ //StateBlock mStateBlock;
+
+ /// <summary>
+ /// 寮圭獥鎸囩汗楠岃瘉 descTitle锛氳緭鍏ュ瘑鐮侀獙璇佹寜閽爣棰� mLocalizedReason锛歍ouch鏄剧ず鐨勬弿杩�
+ /// </summary>
+ /// <value>descTitle锛氳緭鍏ュ瘑鐮侀獙璇佹寜閽爣棰� mLocalizedReason锛歍ouch鏄剧ず鐨勬弿杩�</value>
+ public void showTouchIDWithDescribe(string descTitle, string mLocalizedReason)
+ {
+ if(descTitle == null)
+ {
+ descTitle = "杈撳叆瀵嗙爜楠岃瘉";
+ }
+
+ if (mLocalizedReason == null)
+ {
+ mLocalizedReason = "閫氳繃Home閿獙璇佸凡鏈夋寚绾�";
+ }
+
+
+ HDLTouchID.SharedInstance.HDL_showTouchIDWithDescribe(descTitle, mLocalizedReason, (mState, mError) => {
+ if (mState == HDLTouchIDState.NotSupport)
+ {
+ OnHDLTouchIDStateBackEvent?.Invoke(this, TouchIDState.NotSupport);
+ }
+ else if (mState == HDLTouchIDState.Success)
+ {
+ OnHDLTouchIDStateBackEvent?.Invoke(this, TouchIDState.Success);
+ }
+ else if (mState == HDLTouchIDState.InputPassword)
+ {
+ OnHDLTouchIDStateBackEvent?.Invoke(this, TouchIDState.InputPassword);
+ }
+ else if (mState == HDLTouchIDState.TouchIDLockout)
+ {
+ OnHDLTouchIDStateBackEvent?.Invoke(this, TouchIDState.TouchIDLockout);
+ }
+ });
+
+ }
+
+
+
+
+ // 鍗曚緥
+ static TouchIDUtils ourInstance = new TouchIDUtils();
+
+ public static TouchIDUtils Instance
+ {
+ get
+ {
+ return ourInstance;
+ }
+ }
+
+ }
+}
diff --git a/Shared.IOS/Volume.cs b/Shared.IOS/Volume.cs
new file mode 100755
index 0000000..6c4ed88
--- /dev/null
+++ b/Shared.IOS/Volume.cs
@@ -0,0 +1,77 @@
+锘縰sing System;
+using AVFoundation;
+using Foundation;
+using MediaPlayer;
+using Shared;
+using UIKit;
+
+namespace com.hdl.on
+{
+ public static class Volume
+ {
+ /// <summary>
+ /// 澹伴煶鍙樺寲浜嬩欢
+ /// </summary>
+ public static Action<int> VolumeChange;
+ /// <summary>
+ /// 璁剧疆褰撳墠闊抽噺
+ /// </summary>
+ /// <param name="volume">Volume.</param>
+ public static int MusicVolume
+ {
+ set
+ {
+ if ((DateTime.Now - dateTime).TotalMilliseconds < 2000)
+ {
+ return;
+ }
+ foreach (var view in BaseViewController.MPVolumeView.Subviews)
+ {
+ if (view.GetType().Name == "UISlider")
+ {
+ (view as UISlider).SetValue((float)Math.Round(value / 100.0f, 2, MidpointRounding.AwayFromZero), false);
+ beforeVolume = (view as UISlider).Value;
+ //Shared.HDLUtils.WriteLine("鎺ユ敹鍒版洿鏂伴煶閲忥細" + (float)Math.Round(value / 100.0f, 2, MidpointRounding.AwayFromZero) + " " + beforeVolume);
+ break;
+ }
+ }
+ }
+ }
+ static System.DateTime dateTime = DateTime.MinValue;
+ /// <summary>
+ /// 涔嬪墠鐨勯煶閲�
+ /// </summary>
+ static float beforeVolume;
+ public static void Init()
+ {
+ NSNotificationCenter.DefaultCenter.AddObserver(new NSString("AVSystemController_SystemVolumeDidChangeNotification"),
+ (obj) =>
+ {
+ //濡傛灉搴旂敤杩涘叆鍚庡彴锛屼笉鎵ц闊抽噺鍙樺寲
+ if (UIApplication.SharedApplication.ApplicationState != UIApplicationState.Active || "Audio/Video" != obj.UserInfo.ObjectForKey(new NSString("AVSystemController_AudioCategoryNotificationParameter")).ToString())
+ {
+ return;
+ }
+ //Shared.HDLUtils.WriteLine("鎺ユ敹鍒伴煶閲忓彉鍖栦簨浠�");
+ dateTime = DateTime.Now;
+ var tempValue = obj.UserInfo.ObjectForKey(new NSString("AVSystemController_AudioVolumeNotificationParameter"));
+ if (tempValue == null)
+ {
+ return;
+ }
+ try
+ {
+ //鏈夋椂杞崲澶辫触锛屽彲鑳芥湁鏃跺�兼湁闂
+ var volume = 100 * float.Parse(tempValue.ToString());
+ volume = (float)Math.Round(volume, 2, MidpointRounding.AwayFromZero);
+ //Shared.HDLUtils.WriteLine("闊抽噺鍙樺寲浜嬩欢锛�" + volume + " " + beforeVolume * 100);
+ if (VolumeChange != null && beforeVolume * 100 != volume)
+ {
+ VolumeChange((int)volume);
+ }
+ }
+ catch { }
+ });
+ }
+ }
+}
diff --git a/Shared.IOS/packages.config b/Shared.IOS/packages.config
new file mode 100644
index 0000000..5cd2f7b
--- /dev/null
+++ b/Shared.IOS/packages.config
@@ -0,0 +1,8 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="Microsoft.CSharp" version="4.6.0" targetFramework="xamarinios10" />
+ <package id="Microsoft.NETCore.Platforms" version="3.0.0" targetFramework="xamarinios10" />
+ <package id="NETStandard.Library" version="2.0.3" targetFramework="xamarinios10" />
+ <package id="System.Numerics.Vectors" version="4.5.0" targetFramework="xamarinios10" />
+ <package id="Xamarin.iOS.MJRefresh" version="3.2.2" targetFramework="xamarinios10" />
+</packages>
\ No newline at end of file
--
Gitblit v1.8.0