From dea10bee3b12994e153ae4b08e07d7314608684e Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期一, 22 三月 2021 09:06:54 +0800
Subject: [PATCH] 更新环境功能UI

---
 HDL-ON_iOS/Other/JLCountrycode.cs |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/HDL-ON_iOS/Other/JLCountrycode.cs b/HDL-ON_iOS/Other/JLCountrycode.cs
index f6a2451..176a7df 100644
--- a/HDL-ON_iOS/Other/JLCountrycode.cs
+++ b/HDL-ON_iOS/Other/JLCountrycode.cs
@@ -1,5 +1,7 @@
 锘縰sing System;
 using Shared.IOS.JLCountryCode;
+using Foundation;
+using System.Collections.Generic;
 
 namespace JLCountrycode
 {
@@ -40,5 +42,60 @@
             Shared.Application.currentVC.NavigationController.PushViewController(mJLCountryCodeController, true);
 
         }
+
+
+        /// <summary>
+        /// 閫夋嫨
+        /// </summary>
+        /// <param name="titleStr"></param>
+        /// <param name="dic"></param>
+        /// <param name="action"></param>
+        public void ShowSortSelection(string titleStr, Dictionary<string, List<string>> dic, Action<string> action)
+        {
+            try
+            {
+                JLSortSelectionViewController vc = new JLSortSelectionViewController();
+                vc.TitleStr = titleStr;
+                vc.SortedNameDict = ConvertToNativeDictionary(dic);
+                vc.SortSelectionBlock += (countryName) =>
+                {
+                    action?.Invoke(countryName);
+                };
+
+                Shared.Application.currentVC.NavigationController.PushViewController(vc, true);
+            }
+            catch (Exception ex)
+            {
+                Console.WriteLine(ex.ToString());
+            }
+
+        }
+
+        /// <summary>
+        /// Dictionary 杞� iOS鍘熺敓 NSMutableDictionary
+        /// </summary>
+        /// <param name="dict"></param>
+        /// <returns></returns>
+        NSMutableDictionary ConvertToNativeDictionary(Dictionary<string, List<string>> dict)
+        {
+            NSMutableDictionary newDictionary = new NSMutableDictionary();
+            try
+            {
+                //var dictDataList = new NSMutableArray();
+                foreach (string key in dict.Keys)
+                {
+                    var value = dict[key];
+                    newDictionary.Add(new NSString(key), NSArray.FromObjects(value.ToArray()));
+                }
+            }
+            catch (Exception Ex)
+            {
+                Console.WriteLine(Ex.ToString());
+            }
+            return newDictionary;
+        }
+
+
+
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0