.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -1,6 +1,9 @@ <Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default"> <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008030-00014C392121802E" /> <MonoDevelop.Ide.Workbench> <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneSimulatorTarget.08FD445C-3EE8-4ED2-BF28-B42ADD0DA92C" /> <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/4-PersonalCenter/SmartSpeaker/SmartSpeakerListPage.cs"> <Files> <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/SmartSpeaker/SmartSpeakerListPage.cs" Line="437" Column="36" /> </Files> <Pads> <Pad Id="ProjectPad"> <State name="__root__"> @@ -8,27 +11,18 @@ <Node name="HDL_ON" expanded="True"> <Node name="Common" expanded="True" /> <Node name="DAL" expanded="True"> <Node name="DriverLayer" expanded="True" /> <Node name="Mqtt" expanded="True" /> <Node name="Server" expanded="True"> <Node name="HttpUtil.cs" selected="True" /> </Node> <Node name="Server" expanded="True" /> </Node> <Node name="UI" expanded="True"> <Node name="UI0-Public" expanded="True"> <Node name="Widget" expanded="True" /> </Node> <Node name="UI2" expanded="True"> <Node name="4-PersonalCenter" expanded="True"> <Node name="AboutOn" expanded="True" /> </Node> <Node name="FuntionControlView" expanded="True"> <Node name="Video" expanded="True" /> <Node name="SmartSpeaker" expanded="True"> <Node name="SmartSpeakerListPage.cs" selected="True" /> </Node> </Node> </Node> </Node> </Node> <Node name="HDL-ON_iOS" expanded="True" /> </Node> </State> </Pad> @@ -40,11 +34,10 @@ <String>Shared.Droid.TouchID/Shared.Droid.TouchID.csproj</String> <String>Shared.IOS/Shared.IOS.csproj</String> </DisabledProjects> <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|iPhone" /> <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" /> <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.Android_Accelerated_Oreo" /> <MonoDevelop.Ide.DebuggingService.Breakpoints> <BreakpointStore> <Breakpoint file="/Users/jlchen/JLChen/ProjectsCode/HDLGit/ON+/HDL_ON/UI/UI0-Public/Widget/WebViewDialog.cs" relfile="HDL_ON/UI/UI0-Public/Widget/WebViewDialog.cs" line="50" column="1" /> </BreakpointStore> <BreakpointStore /> </MonoDevelop.Ide.DebuggingService.Breakpoints> <MultiItemStartupConfigurations /> </Properties> DLL/Shared.IOS.TBL.dllBinary files differ
HDL-ON_Android/Assets/Language.ini
@@ -424,9 +424,7 @@ 437=Device List 438=humidity:{0}% air:{1} wind:{2} 1000=Indoor Humidity 1000=Room Humidity 1001=V-chip 1002=Anion 1003=Sterilization @@ -739,6 +737,10 @@ 9061=Find your password by clicking on "Forgot Password", or try again in {0} minute. 9062=Check 9063=You still have {0} times. 9064=Smart speaker 9065=Data management 9066=Remarks 9067=Remarks cannot be blank. 10000=Invalid password, please log in again. 10001=Fail to request server, please try again later. @@ -1290,7 +1292,6 @@ 1086=风速3档 4000=可视对讲 4001=通话记录 4002=*云端照片只保留30天 @@ -1306,7 +1307,6 @@ 4012=配置参数有异常! 4013=门禁二维码 4014=临时密码 5000=音乐 5001=组合 @@ -1626,6 +1626,10 @@ 9061=请通过忘记密码找回密码或{0}分钟后重试. 9062=查看 9063=还有{0}次机会。 9064=智能音箱 9065=数据管理 9066=备注 9067=备注不能为空 10000=无效登录密钥,请重新登录! 10001=请求服务器失败,请稍后再试! HDL-ON_Android/Assets/Phone/PersonalCenter/SmartSpeaker.png
HDL-ON_Android/HDL-ON_Android.csproj
@@ -1112,6 +1112,7 @@ <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\airFreshjinmao.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\HomeIcon\airFreshjinmao_blue.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\HomeIcon\airFreshjinmao_white.png" /> <AndroidAsset Include="Assets\Phone\PersonalCenter\SmartSpeaker.png" /> </ItemGroup> <ItemGroup> <AndroidNativeLibrary Include="libs\armeabi-v7a\libelianjni.so" /> HDL-ON_iOS/HDL-ON_iOS.csproj
@@ -1219,6 +1219,7 @@ <BundleResource Include="Resources\Phone\FunctionIcon\Icon\airFreshjinmao.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\Icon\HomeIcon\airFreshjinmao_blue.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\Icon\HomeIcon\airFreshjinmao_white.png" /> <BundleResource Include="Resources\Phone\PersonalCenter\SmartSpeaker.png" /> </ItemGroup> <ItemGroup> <ITunesArtwork Include="iTunesArtwork" /> HDL-ON_iOS/Resources/Language.ini
@@ -737,6 +737,10 @@ 9061=Find your password by clicking on "Forgot Password", or try again in {0} minute. 9062=Check 9063=You still have {0} times. 9064=Smart speaker 9065=Data management 9066=Remarks 9067=Remarks cannot be blank. 10000=Invalid password, please log in again. 10001=Fail to request server, please try again later. @@ -1622,6 +1626,10 @@ 9061=请通过忘记密码找回密码或{0}分钟后重试. 9062=查看 9063=还有{0}次机会。 9064=智能音箱 9065=数据管理 9066=备注 9067=备注不能为空 10000=无效登录密钥,请重新登录! 10001=请求服务器失败,请稍后再试! HDL-ON_iOS/Resources/Phone/PersonalCenter/SmartSpeaker.png
HDL_ON/Common/Constant.cs
@@ -284,7 +284,35 @@ /// </summary> Error, } public enum SpeakerType { /// <summary> /// 小度 /// </summary> DuerOS = 0, /// <summary> /// Google Home /// </summary> Google, /// <summary> /// Alexa Echo /// </summary> Alexa, /// <summary> /// Alice /// </summary> Alice, /// <summary> /// 天猫精灵 /// </summary> Aligenie, /// <summary> /// 思必驰 /// </summary> AISpeech } #endregion } } HDL_ON/Common/R.cs
@@ -1313,6 +1313,25 @@ /// 还有{0}次机会。 /// </summary> public const int AFewMoreChances = 9063; /// <summary> /// 智能音箱 /// </summary> public const int SmartSpeaker = 9064; /// <summary> /// 数据管理 /// </summary> public const int DataManagement = 9065; /// <summary> /// 备注 /// </summary> public const int Remarks = 9066; /// <summary> /// 备注不能为空 /// </summary> public const int RemarksCannotBeBlank = 9067; #region 网络请求响应错误提示信息 /// <summary> HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -928,6 +928,9 @@ { try { //先清空推送ID,避免使用缓存的PushId为其它账号的情况,导致查询到其它账号的推送记录 OnAppConfig.Instance.PushId = ""; string deviceType = PhoneDeviceType.Android.ToString(); #if __IOS__ deviceType = PhoneDeviceType.IOS.ToString(); @@ -2218,7 +2221,7 @@ #endregion #region 萤石云SDK相关接口 #region ■ 萤石云SDK相关接口_________________________ /// <summary> /// 河东获取萤石云子账号token的接口 /// </summary> @@ -2231,7 +2234,7 @@ #endregion #region 可视对讲 #region ■ 可视对讲_________________________ /// <summary> /// 检查住宅是否绑定丰林,并获取门口机列表 /// </summary> @@ -2245,5 +2248,60 @@ return pack; } #endregion #region ■ 音箱语言控制相关_________________________ /// <summary> /// 获取已授权的音箱列表 /// </summary> /// <returns></returns> public ResponsePackNew GetSpeakerList() { var requestJson = HttpUtil.GetSignRequestJson(new GetSpeakerObj { homeId = DB_ResidenceData.Instance.CurrentRegion.RegionID, }); return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Speaker_List_Get, requestJson); } /// <summary> /// 编辑音箱授权备注 /// </summary> /// <returns></returns> public ResponsePackNew UpdateSpeakerRemark(UpdateSpeakerRemarkObj remarkObj) { var requestJson = HttpUtil.GetSignRequestJson(remarkObj); return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Speaker_Remark_Update, requestJson); } /// <summary> /// 获取音箱分配的设备和场景列表 /// </summary> /// <param name="getType">0 是查询全部 1是查询设备 2是查询场景</param> /// <param name="tokenId"></param> /// <returns></returns> public ResponsePackNew GetSpeakerDeviceList(int getType, string tokenId) { Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); d.Add("tokenId", tokenId); if (getType > 0) { d.Add("isDevice", getType == 1); } var requestJson = HttpUtil.GetSignRequestJson(d); return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Speaker_DeviceList_Get, requestJson); } /// <summary> /// 更新音箱控制的设备和场景目标 /// </summary> /// <returns></returns> public ResponsePackNew UpdateSpeakerDeviceList(UpdateSpeakerDeviceListObj updateSpeakerDeviceListObj) { var requestJson = HttpUtil.GetSignRequestJson(updateSpeakerDeviceListObj); return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Speaker_DeviceList_Update, requestJson); } #endregion } } HDL_ON/DAL/Server/NewAPI.cs
@@ -235,29 +235,23 @@ #endregion #region ■ zigbeespeakerservice -- 语音控制服务___________________________ ///// <summary> ///// 获取音箱列表 ///// </summary> //public const string API_GET_Speaker_Auth = "/speakerservices/Auth"; ///// <summary> ///// 修改音箱备注 ///// </summary> //public const string API_PUT_Speaker_Auth_Rename = "/speakerservices/Auth"; ///// <summary> ///// 获取设备和场景列表 ///// </summary> //public const string API_GET_Speaker_BatchEdit_V2 = "/speakerservices/BatchEdit_V2"; ///// <summary> ///// 添加设备和场景列表 ///// </summary> //public const string API_POST_Speaker_BatchEdit_V2 = "/speakerservices/BatchEdit_V2"; #region ■ Speaker -- 语音控制服务___________________________ /// <summary> /// 获取已授权的音箱列表 /// </summary> public const string API_POST_Speaker_List_Get = "/smart-footstone/app/token/list"; /// <summary> /// 编辑音箱授权备注 /// </summary> public const string API_POST_Speaker_Remark_Update = "/smart-footstone/app/token/update"; /// <summary> /// 获取音箱分配的设备和场景列表 /// </summary> public const string API_POST_Speaker_DeviceList_Get = "/home-wisdom/app/tokenRelation/list"; /// <summary> /// 更新音箱控制的设备和场景目标 /// </summary> public const string API_POST_Speaker_DeviceList_Update = "/home-wisdom/app/tokenRelation/save"; #endregion #region ■ PushSerivce -- 推送服务接口___________________________ HDL_ON/DAL/Server/NewApiRes.cs
@@ -1486,7 +1486,146 @@ /// </summary> public string expireTime; } #region 音箱 /// <summary> /// 获取音箱列表 /// </summary> [System.Serializable] public class GetSpeakerObj : HomeIdObj { /// <summary> /// 平台名称 /// </summary> public string platformName; /// <summary> /// 页面大小 /// </summary> public int pageSize = 100; /// <summary> /// 页面序号 /// </summary> public int pageNo = 1; } [System.Serializable] public class SpeakerObj : HomeIdObj { /// <summary> /// 记录的主键id /// </summary> public string tokenId; } /// <summary> /// 更新音箱备注 /// </summary> [System.Serializable] public class UpdateSpeakerRemarkObj : SpeakerObj { /// <summary> /// 备注 /// </summary> public string remark; } /// <summary> /// 获取音箱分配的设备和场景列表 /// </summary> [System.Serializable] public class GetSpeakerDeviceListObj : HomeIdObj { /// <summary> /// 记录的主键id /// </summary> public string tokenId; } /// <summary> /// /// </summary> [System.Serializable] public class TargetInfo { /// <summary> /// 控制的目标Id,云端的设备Id或者场景Id /// </summary> public string targetId; /// <summary> /// 是否是设备,场景为false /// </summary> public bool isDevice; /// <summary> /// 目标名称 /// </summary> public string targetName; } /// <summary> /// 更新音箱控制的设备和场景目标 /// </summary> [System.Serializable] public class UpdateSpeakerDeviceListObj : SpeakerObj { /// <summary> /// 备注 /// </summary> public List<TargetInfo> targetInfos; } /// <summary> /// 更新音箱控制的设备和场景目标 /// </summary> [System.Serializable] public class SpeakerListRes { /// <summary> /// 音箱列表 /// </summary> public List<SpeakerInfo> list; } /// <summary> /// 音箱信息 /// </summary> [System.Serializable] public class SpeakerInfo { /// <summary> /// /// </summary> public string platformName { get; set; } /// <summary> /// /// </summary> public string remark { get; set; } /// <summary> /// /// </summary> public string tokenId { get; set; } /// <summary> /// /// </summary> public string userId { get; set; } /// <summary> /// /// </summary> public string userRegion { get; set; } /// <summary> /// /// </summary> public string homeId { get; set; } /// <summary> /// /// </summary> public string homeRegion { get; set; } } #endregion //#region 旧接口 ///// <summary> HDL_ON/HDL_ON.projitems
@@ -395,6 +395,7 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Video\VideoSend.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Video\VideoMainView.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Video\ObjectClass.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\SmartSpeaker\SmartSpeakerListPage.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)DAL\" /> @@ -438,5 +439,6 @@ <Folder Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Video\View\" /> <Folder Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Energy\" /> <Folder Include="$(MSBuildThisFileDirectory)DAL\ThirdPartySdk\" /> <Folder Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\SmartSpeaker\" /> </ItemGroup> </Project> HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs
@@ -140,7 +140,7 @@ /// <summary> /// 获取支持小区域 /// </summary> FrameLayout supportView; VerticalScrolViewLayout supportView; /// <summary> /// 获取支持文本 /// </summary> @@ -150,6 +150,10 @@ /// 关于On文本 /// </summary> Button btnAboutOnText; /// <summary> /// 智能音箱文本 /// </summary> Button btnSmartSpeakerText; #endregion @@ -724,9 +728,11 @@ //softSettingView.AddChidren(btnGeneralSettingsRight); #endregion #endregion #region 获取支持 #region 智能音箱、获取支持、关于ON+ 等菜单列表 contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8) }); supportView = new FrameLayout() supportView = new VerticalScrolViewLayout() { Gravity = Gravity.CenterHorizontal, Width = Application.GetRealWidth(343), @@ -735,18 +741,87 @@ Radius = (uint)Application.GetRealHeight(12), BorderColor = 0x00FFFFFF, BorderWidth = 0, ScrollEnabled = false, VerticalScrollBarEnabled = false,//隐藏滚动条 }; contentView.AddChidren(supportView); #region 智能音箱 if (!DB_ResidenceData.Instance.CurrentRegion.IsOthreShare) { //supportView 加高 显示3行 3*44 supportView.Height = Application.GetRealWidth(3*44); FrameLayout smartSpeakerView = new FrameLayout() { Height = Application.GetRealWidth(44), }; supportView.AddChidren(smartSpeakerView); //住宅为当前账号才显示智能音箱入口 Button btnSmartSpeakerIcon = new Button() { X = Application.GetRealWidth(12), Y = Application.GetRealWidth(10), Width = Application.GetMinRealAverage(24), Height = Application.GetMinRealAverage(24), UnSelectedImagePath = "PersonalCenter/SmartSpeaker.png", }; smartSpeakerView.AddChidren(btnSmartSpeakerIcon); btnSmartSpeakerText = new Button() { X = Application.GetRealWidth(48), Width = Application.GetRealWidth(270), Height = Application.GetRealWidth(44), TextID = StringId.SmartSpeaker, TextColor = CSS_Color.FirstLevelTitleColor, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.TextFontSize }; smartSpeakerView.AddChidren(btnSmartSpeakerText); Button btnSmartSpeakerRight = new Button() { X = Application.GetRealWidth(315), Y = Application.GetRealWidth(14), Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/Right.png", }; smartSpeakerView.AddChidren(btnSmartSpeakerRight); var btnSmartSpeakerViewLine = new Button() { X = Application.GetRealWidth(48), Y = Application.GetRealWidth(43), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(279), BackgroundColor = CSS_Color.DividingLineColor }; smartSpeakerView.AddChidren(btnSmartSpeakerViewLine); } #endregion #region 获取支持 FrameLayout supView = new FrameLayout() { Height = Application.GetRealWidth(44), }; supportView.AddChidren(supView); Button btnSupportIcon = new Button() { X = Application.GetRealWidth(12), Y = Application.GetRealHeight(10), Y = Application.GetRealWidth(10), Width = Application.GetMinRealAverage(24), Height = Application.GetMinRealAverage(24), UnSelectedImagePath = "PersonalCenter/SupportIcon.png", }; supportView.AddChidren(btnSupportIcon); supView.AddChidren(btnSupportIcon); btnSupportText = new Button() { @@ -758,7 +833,8 @@ TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.TextFontSize }; supportView.AddChidren(btnSupportText); supView.AddChidren(btnSupportText); Button btnSupportRight = new Button() { X = Application.GetRealWidth(315), @@ -767,33 +843,39 @@ Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/Right.png", }; supportView.AddChidren(btnSupportRight); supView.AddChidren(btnSupportRight); var btnSupportViewLine = new Button() { X = Application.GetRealWidth(48), Y = btnSupportText.Bottom, Y = Application.GetRealWidth(43), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(279), BackgroundColor = CSS_Color.DividingLineColor }; supportView.AddChidren(btnSupportViewLine); supView.AddChidren(btnSupportViewLine); #endregion #region 关于ON+ FrameLayout aboutView = new FrameLayout() { Height = Application.GetRealWidth(44), }; supportView.AddChidren(aboutView); Button btnAboutOnIcon = new Button() { X = Application.GetRealWidth(12), Y = Application.GetRealWidth(54), Y = Application.GetRealWidth(10), Width = Application.GetMinRealAverage(24), Height = Application.GetMinRealAverage(24), UnSelectedImagePath = "PersonalCenter/InfoOnIcon.png", }; supportView.AddChidren(btnAboutOnIcon); aboutView.AddChidren(btnAboutOnIcon); btnAboutOnText = new Button() { X = Application.GetRealWidth(48), Y = btnSupportViewLine.Bottom, Width = Application.GetRealWidth(370), Height = Application.GetRealWidth(44), TextID = StringId.AboutOn, @@ -801,18 +883,18 @@ TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.TextFontSize }; supportView.AddChidren(btnAboutOnText); aboutView.AddChidren(btnAboutOnText); Button btnAboutOnRight = new Button() { X = Application.GetRealWidth(315), Y = Application.GetRealWidth(58), Y = Application.GetRealWidth(14), Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/Right.png", }; supportView.AddChidren(btnAboutOnRight); aboutView.AddChidren(btnAboutOnRight); #endregion #endregion HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs
@@ -1,4 +1,5 @@ using System; using System.Collections.Generic; using HDL_ON.DAL.Server; using HDL_ON.Entity; using Shared; @@ -23,6 +24,7 @@ LoadEvent_SkipResdentialManagePage(); LoadEvent_GoMemberManagement(); LoadEvent_SkipbtnAddFunctionPage(); LoadEvent_SkipSmartSpeakerPage(); } } @@ -299,6 +301,39 @@ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; } /// <summary> /// 跳转智能音箱页面 /// </summary> void LoadEvent_SkipSmartSpeakerPage() { btnSmartSpeakerText.MouseUpEventHandler = (sender, e) => { //var page = new SmartSpeakerListPage(); //MainPage.BasePageView.AddChidren(page); //page.LoadPage(); //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; var mList = new List<string>(); mList.Add("广东"); mList.Add("湖南"); mList.Add("广西"); var mList2 = new List<List<string>>(); mList2.Add(new List<string> { "广州", "深圳", "东莞", "佛山", "惠州" }); mList2.Add(new List<string> { "长沙", "岳阳", "株洲", "株洲" }); mList2.Add(new List<string> { "桂林", "南宁", "玉林" }); //PickerView.ShowOneList(mList, null); PickerView.ShowSecondary(mList, mList2, (selectIndex1, selectIndex2) => { System.Console.WriteLine("selectIndex:" + mList[selectIndex1] + " - " + mList2[selectIndex1][selectIndex2]); //textView.Text = "selectIndex:" + mList[selectIndex1] + " - " + mList2[selectIndex1][selectIndex2]; }, 1, 3, "请选择0", "确认0", "取消0"); }; } #endregion HDL_ON/UI/UI2/4-PersonalCenter/SmartSpeaker/SmartSpeakerListPage.cs
New file @@ -0,0 +1,490 @@ using System; using Shared; using HDL_ON.UI.CSS; using System.Collections.Generic; using System.Threading; using HDL_ON.DAL.Server; namespace HDL_ON.UI { /// <summary> /// 智能音箱列表 /// </summary> public class SmartSpeakerListPage : FrameLayout { FrameLayout bodyView; /// <summary> /// /// </summary> FrameLayout emptyTipFrameLayout; /// <summary> /// 当前 /// </summary> VerticalScrolViewLayout bodyScrolView; /// <summary> /// 内容为空提示View /// </summary> FrameLayout emptyTipView; /// 目前对接的音箱类型 /// 小度=DuerOS /// Google Home = Google /// Alexa Echo = Alexa /// Alice = Alice /// 天猫精灵=Aligenie /// 思必驰=AISpeech /// <summary> /// /// </summary> public SmartSpeakerListPage() { bodyView = this; bodyView.BackgroundColor = CSS_Color.BackgroundColor; } /// <summary> /// /// </summary> public void LoadPage() { new TopViewDiv(bodyView, Language.StringByID(StringId.SmartSpeaker)).LoadTopView(); int bodyY = Application.GetRealHeight(64); bodyScrolView = new VerticalScrolViewLayout() { Y = bodyY, Height = bodyView.Height - bodyY, BackgroundColor = CSS_Color.BackgroundColor, }; bodyView.AddChidren(bodyScrolView); //AddEmptyTipView(); LoadSmartSpeakertListView(bodyScrolView); } /// <summary> /// 添加内容为空提示页面 /// </summary> void AddEmptyTipView() { emptyTipView = new FrameLayout() { Height = bodyScrolView.Height, Width = bodyScrolView.Width, }; bodyScrolView.AddChidren(emptyTipView); var tipView = new EmptyTipView() { Gravity = Gravity.Center }; emptyTipView.AddChidren(tipView); } /// <summary> /// 加载音箱列表 /// </summary> /// <param name="VerticalScrolViewMiddle"></param> void LoadSmartSpeakertListView(VerticalScrolViewLayout VerticalScrolViewMiddle) { VerticalScrolViewMiddle.RemoveAll(); var waitPage = new Loading(); bodyView.AddChidren(waitPage); waitPage.Start(Language.StringByID(StringId.PleaseWait)); System.Threading.Tasks.Task.Run(() => { try { var revertObj = new HttpServerRequest().GetSpeakerList(); if (revertObj.Code == StateCode.SUCCESS) { var speakerListRes = Newtonsoft.Json.JsonConvert.DeserializeObject<SpeakerListRes>(revertObj.Data.ToString()); if (speakerListRes != null && speakerListRes.list != null && speakerListRes.list.Count > 0) { Application.RunOnMainThread(() => { foreach (var speaker in speakerListRes.list) { AddRowView(speaker, VerticalScrolViewMiddle); } }); } else { Application.RunOnMainThread(() => { AddEmptyTipView(); }); } } else { Application.RunOnMainThread(() => { AddEmptyTipView(); }); //提示错误 IMessageCommon.Current.ShowErrorInfoAlter(revertObj.Code); } } catch { } finally { Application.RunOnMainThread(() => { if (waitPage != null) { waitPage.RemoveFromParent(); waitPage = null; } }); } }); } /// <summary> /// /// </summary> /// <param name="speakerInfo"></param> /// <param name="VerticalScrolViewMiddle"></param> void AddRowView(SpeakerInfo speakerInfo, VerticalScrolViewLayout VerticalScrolViewMiddle) { //透明填充分割view var lineView = new FrameLayout() { Height = Application.GetRealWidth(12), }; VerticalScrolViewMiddle.AddChidren(lineView); var rowView = new FrameLayout() { Gravity = Gravity.CenterHorizontal, Width = Application.GetRealWidth(343), Height = Application.GetRealWidth(200), BackgroundColor = CSS_Color.MainBackgroundColor, Radius = (uint)Application.GetRealWidth(12), BorderColor = 0x00000000, BorderWidth = 0, }; VerticalScrolViewMiddle.AddChidren(rowView); #region 音箱类型 var view1 = new FrameLayout() { Height = Application.GetRealWidth(49), }; rowView.AddChidren(view1); var btnSpeakerNameTitle = new Button() { X = Application.GetRealWidth(16), Width = Application.GetRealWidth(200), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, Text = GetSpeakerTypeString(speakerInfo.platformName) }; view1.AddChidren(btnSpeakerNameTitle); Button line1 = new Button() { Y = view1.Bottom, Gravity = Gravity.CenterHorizontal, Height = Application.GetRealWidth(1), Width = Application.GetRealWidth(311), BackgroundColor = CSS_Color.DividingLineColor, }; rowView.AddChidren(line1); #endregion #region 备注 var view2 = new FrameLayout() { Y = line1.Bottom, Height = Application.GetRealWidth(49), }; rowView.AddChidren(view2); var btnNicknameTitle = new Button() { X = Application.GetRealWidth(16), Width = Application.GetRealWidth(200), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, TextID = StringId.Remarks, }; view2.AddChidren(btnNicknameTitle); var btnNickname = new Button() { Width = Application.GetRealWidth(295), TextAlignment = TextAlignment.CenterRight, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.TextFontSize, Text = speakerInfo.remark }; view2.AddChidren(btnNickname); if (string.IsNullOrEmpty(speakerInfo.remark)) { btnNickname.TextID = StringId.SmartSpeaker; } var btnNicknameRight = new Button() { X = Application.GetRealWidth(311), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/Right.png", }; view2.AddChidren(btnNicknameRight); Button line2 = new Button() { Y = view2.Bottom, Gravity = Gravity.CenterHorizontal, Height = Application.GetRealWidth(1), Width = Application.GetRealWidth(311), BackgroundColor = CSS_Color.DividingLineColor, }; rowView.AddChidren(line2); //保存事件 Action<string> renameAction = (newName) => { RenameAlexaRemark(newName, speakerInfo, btnNickname); }; btnNickname.MouseUpEventHandler += (sender, e) => { new PublicAssmebly().LoadDialog_EditParater(StringId.Remarks, speakerInfo.remark, renameAction, StringId.RemarksCannotBeBlank, 0, new List<string>()); //HDLCommon.Current.ShowEditTextDialog(speakerInfo.remark, renameAction, Language.StringByID(R.MyInternationalizationString.rename)); }; #endregion #region 数据管理 var view3 = new FrameLayout() { Y = line2.Bottom, Height = Application.GetRealWidth(49), }; rowView.AddChidren(view3); var btnDataTitle = new Button() { X = Application.GetRealWidth(16), Width = Application.GetRealWidth(200), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, TextID = StringId.DataManagement, }; view3.AddChidren(btnDataTitle); var btnDataRight = new Button() { X = Application.GetRealWidth(311), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/Right.png", }; view3.AddChidren(btnDataRight); Button line3 = new Button() { Y = view3.Bottom, Gravity = Gravity.CenterHorizontal, Height = Application.GetRealWidth(1), Width = Application.GetRealWidth(311), BackgroundColor = CSS_Color.DividingLineColor, }; rowView.AddChidren(line3); EventHandler<MouseEventArgs> eHandler = (sender, e) => { //跳转页面 GotoSpeakerManagementPage(speakerInfo); }; view3.MouseUpEventHandler += eHandler; btnDataTitle.MouseUpEventHandler += eHandler; btnDataRight.MouseUpEventHandler += eHandler; #endregion #region 解除绑定 var view4 = new FrameLayout() { Y = line3.Bottom, Height = Application.GetRealWidth(49), }; rowView.AddChidren(view4); var btnUnbindTitle = new Button() { X = Application.GetRealWidth(16), Width = Application.GetRealWidth(200), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, TextID = StringId.Unbind, }; view4.AddChidren(btnUnbindTitle); var btnUnbindRight = new Button() { X = Application.GetRealWidth(311), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/Right.png", }; view4.AddChidren(btnUnbindRight); #endregion } /// <summary> /// 请求修改备注 /// </summary> /// <param name="newName"></param> /// <param name="speakerInfo"></param> /// <param name="btnName"></param> void RenameAlexaRemark(string newName, SpeakerInfo speakerInfo, Button btnName) { var waitPage = new Loading(); bodyView.AddChidren(waitPage); waitPage.Start(Language.StringByID(StringId.PleaseWait)); System.Threading.Tasks.Task.Run(() => { try { var updateSpeakerRemarkObj = new UpdateSpeakerRemarkObj() { homeId = speakerInfo.homeId, tokenId = speakerInfo.tokenId, remark = newName }; var revertObj = new HttpServerRequest().UpdateSpeakerRemark(updateSpeakerRemarkObj); if (revertObj.Code == StateCode.SUCCESS) { //AmendTheSuccess 修改成功 Application.RunOnMainThread(() => { speakerInfo.remark = newName; btnName.Text = newName; Utlis.ShowTip(Language.StringByID(StringId.ModifySuccess)); //Utlis.ShowAlertOnMainThread(Language.StringByID(R.MyInternationalizationString.AmendTheSuccess)); }); } else { //提示错误 IMessageCommon.Current.ShowErrorInfoAlter(revertObj.Code); } } catch { } finally { Application.RunOnMainThread(() => { if (waitPage != null) { waitPage.RemoveFromParent(); waitPage = null; } }); } }); } /// <summary> /// /// </summary> /// <param name="platformName"></param> /// <returns></returns> string GetSpeakerTypeString(string platformName){ var name = platformName; if (platformName == SpeakerType.DuerOS.ToString()) { name = "小度"; } else if (platformName == SpeakerType.Google.ToString()){ name = "Google Home"; } else if (platformName == SpeakerType.Alexa.ToString()) { name = "Alexa Echo"; } else if (platformName == SpeakerType.Alice.ToString()) { name = "Alice"; } else if (platformName == SpeakerType.Aligenie.ToString()) { name = "天猫精灵"; } else if (platformName == SpeakerType.AISpeech.ToString()) { name = "思必驰"; } return name; } /// <summary> /// 跳转AlexaDeviceListPage页面 /// </summary> /// <param name="speakerInfo"></param> void GotoSpeakerManagementPage(SpeakerInfo speakerInfo) { ////没绑定忘记提示先绑定网关,禁止跳转 //if (!UserConfig.Instance.CheckWhetherGatewayIdNotNull()) //{ // Utlis.ShowAlertOnMainThread(Language.StringByID(R.MyInternationalizationString.PleaseBindTheGatewayFirst)); // return; //} ////跳转Alexa管理页面 //AlexaDeviceListPage speakerInfoDeviceListPage = new AlexaDeviceListPage(speakerInfo); //UserMiddle.SettingPageView.AddChidren(speakerInfoDeviceListPage); //speakerInfoDeviceListPage.ShowPage(); //UserMiddle.SettingPageView.PageIndex = UserMiddle.SettingPageView.ChildrenCount - 1; } } }