| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Diagnostics; |
| | | using System.Threading.Tasks; |
| | | using Shared.Common; |
| | | using Shared.Phone.UserCenter.Device; |
| | | using ZigBee.Device; |
| | |
| | | { |
| | | } |
| | | |
| | | private List<SmartSound> smartSoundList = null; |
| | | //private List<SmartSoundInfo> smartSoundList = null; |
| | | private SmartSoundInfo smartSoundInfo = null; |
| | | |
| | | /// <summary>
|
| | | /// 列表控件
|
| | |
| | | /// </summary>
|
| | | private RowLayoutControl oldShowRightMuneRow = null; |
| | | |
| | | private static string dataString = ""; |
| | | |
| | | |
| | | #region ■ 初始化_____________________________
|
| | | |
| | |
| | | /// </summary>
|
| | | public void ShowForm()
|
| | | {
|
| | | iniData();//先加载模拟数据
|
| | | // iniData();//先加载模拟数据
|
| | |
|
| | | this.ScrollEnabled = false;
|
| | |
|
| | |
| | | //这里是加载帮组的界面
|
| | | }; |
| | | |
| | | string room_id = Common.Config.Instance.Home.Id;//住宅 ID
|
| | | string gu_id = Common.Config.Instance.Guid; |
| | | |
| | | Console.WriteLine("room_id =" + room_id);
|
| | | Console.WriteLine("gu_id =" + gu_id); |
| | | |
| | | |
| | | }
|
| | |
|
| | |
| | | /// 初始化中部控件(外部可以调用)
|
| | | /// </summary>
|
| | | /// <param name="i_reGetDeviceOnlineStatu">重新获取设备的在线状态</param>
|
| | | public void InitMiddleFrame()
|
| | | public async void InitMiddleFrame()
|
| | | { |
| | | // show出没有设备的图标文字提示 |
| | | this.ShowNotDataImage(bodyFrameLayout, new string[] { "还没有音箱哦,", "绑定智能音箱请前往第三方 APP 进行操作" }); |
| | | |
| | | |
| | | var frame = new FrameLayout(); |
| | | this.bodyFrameLayout.AddChidren(frame); |
| | | frame.BackgroundColor = UserCenterColor.Current.White; |
| | |
| | | frame.AddChidren(listView);
|
| | | listView.BeginHeaderRefreshingAction += () =>
|
| | | {
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | | await getData();
|
| | | //下拉刷新
|
| | | iniView(); |
| | | |
| | |
| | | });
|
| | | }; |
| | | |
| | | this.ShowProgressBar(); |
| | | |
| | | await getData(); |
| | | |
| | | this.CloseProgressBar( ShowReLoadMode.YES); |
| | | iniView(); |
| | | }
|
| | | |
| | | private async Task getData() |
| | | { |
| | | SmartSoundInfo.Auth auth = new SmartSoundInfo.Auth(); |
| | | auth.HomeID = Common.Config.Instance.Home.Id; |
| | | auth.UserID = Common.Config.Instance.Guid; |
| | | auth.Platform = ""; |
| | | |
| | | dataString = await UserCenterLogic.GetResponseDataByRequestHttps("zigbeespeakerservice/Auth", true, auth);
|
| | | smartSoundInfo = (SmartSoundInfo)Newtonsoft.Json.JsonConvert.DeserializeObject(dataString); |
| | | }
|
| | |
|
| | | private void iniView()
|
| | |
| | | //
|
| | | listView.RemoveAll();
|
| | |
|
| | | if (smartSoundList == null)
|
| | | if (smartSoundInfo==null)
|
| | | return;
|
| | |
|
| | | for (int i = 0; i < smartSoundList.Count; i++) |
| | | for (int i = 0; i < smartSoundInfo.ResponseData.Data.Count; i++) |
| | | {
|
| | | //
|
| | | var smartSound = smartSoundList[i];
|
| | | var smartSound = smartSoundInfo.ResponseData.Data[i];
|
| | | var row = new SoundRowLayout();
|
| | | listView.AddChidren(row); |
| | | |
| | | switch (smartSound.Type) |
| | | {
|
| | | case SmartSound.SMARTSOUND_XIAODU:
|
| | | row.Account = "小度:" + smartSound.UserName;
|
| | | row.ImagePath = "SmartSound/Xiaodu.png";
|
| | | row.Remark = smartSound.Remark;
|
| | | break; |
| | | case SmartSound.SMARTSOUND_XIAOAI: |
| | | row.Account = "小爱:" + smartSound.UserName;
|
| | | row.ImagePath = "SmartSound/Xiaoai.png";
|
| | | row.Remark = smartSound.Remark;
|
| | | break; |
| | | case SmartSound.SMARTSOUND_TIANMAO: |
| | | row.Account = "天猫精灵:" + smartSound.UserName;
|
| | | row.ImagePath = "SmartSound/Tianmao.png";
|
| | | row.Remark = smartSound.Remark;
|
| | | break;
|
| | | if (smartSound.Platform == "Xiaodu") |
| | | { |
| | | row.Account = "小度:" + smartSound.UserName; |
| | | row.ImagePath = "SmartSound/Xiaodu.png"; |
| | | row.Remark = smartSound.Remark; |
| | | } |
| | | |
| | | row.InitControl(); |
| | |
| | | { |
| | | // |
| | | int index = (int)(((NormalViewControl)sender).GetTagByKey("index"));
|
| | | var smartSound = smartSoundList[index]; |
| | | var smartSound = smartSoundInfo.ResponseData.Data[index]; |
| | | ShowRenameDialog(row, smartSound); |
| | | |
| | | };
|
| | |
| | | { |
| | | this.ShowMassage(ShowMsgType.Confirm, "接触绑定需要第三方 APP 进行操作", () => |
| | | { |
| | | // |
| | | smartSoundList.RemoveAt(index); |
| | | // 移除绑定的逻辑 |
| | | //smartSoundList.RemoveAt(index); |
| | | listView.RemoveAt(index); |
| | | },"跳转至小度 APP"); |
| | | } |
| | |
| | | /// 重命名弹窗
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | private void ShowRenameDialog(SoundRowLayout soundRowLayout, SmartSound smartSound)
|
| | | private void ShowRenameDialog(SoundRowLayout soundRowLayout, SmartSoundInfo.SoundInfo smartSound)
|
| | | {
|
| | | //生成一个弹窗画面
|
| | | var dialogForm = new DialogInputControl();
|
| | |
| | | soundRowLayout.btnRemark.Text= textValue;
|
| | | });
|
| | | }
|
| | |
|
| | | /// <summary> |
| | | /// 初始化模拟一些数据,用来加载界面用的 |
| | | /// </summary>
|
| | | private void iniData() |
| | | {
|
| | | smartSoundList = new List<SmartSound>();
|
| | |
|
| | | // 增加小度音箱
|
| | | SmartSound smartSound = new SmartSound();
|
| | | smartSound.Remark = "我的音箱";
|
| | | smartSound.UserName = "123456@qq.com";
|
| | | smartSound.Type = SmartSound.SMARTSOUND_XIAODU;
|
| | | smartSoundList.Add(smartSound);
|
| | |
|
| | | // 增加小爱音箱
|
| | | smartSound = new SmartSound(); |
| | | smartSound.Remark = "我的音箱";
|
| | | smartSound.UserName = "234567@qq.com";
|
| | | smartSound.Type = SmartSound.SMARTSOUND_XIAOAI;
|
| | | smartSoundList.Add(smartSound); |
| | | |
| | | // 增加天猫精灵 |
| | | smartSound = new SmartSound(); |
| | | smartSound.Remark = "我的音箱";
|
| | | smartSound.UserName = "345678@qq.com";
|
| | | smartSound.Type = SmartSound.SMARTSOUND_TIANMAO;
|
| | | smartSoundList.Add(smartSound);
|
| | | } |
| | | |
| | | #endregion
|
| | | |