| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using Shared.Phone.UserCenter.SmartSound.Util; |
| | | |
| | | namespace Shared.Phone.UserCenter.SmartSound.Forms |
| | | { |
| | |
| | | /// </summary> |
| | | private FrameLayout TipLayout = null; |
| | | |
| | | private List<string> TabList = new List<string>() { "灯光", "窗帘" }; |
| | | private List<string> TabList = new List<string>() { Language.StringByID(R.MyInternationalizationString.uLight), Language.StringByID(R.MyInternationalizationString.uDeviceBelongId100) }; |
| | | |
| | | private int CurrentSelectIndex = 0; |
| | | |
| | | private int imageWith = 683; |
| | | private int imageHeight = 392; |
| | | |
| | |
| | | switchContr.Width = Application.GetRealWidth(650);
|
| | | switchContr.Y = Application.GetRealHeight(40); |
| | | |
| | | |
| | | ContentLayout = new FrameLayout(); |
| | | this.bodyFrameLayout.AddChidren(ContentLayout); |
| | | ContentLayout.Height = this.bodyFrameLayout.Height - switchContr.Height - Application.GetRealHeight(40); |
| | |
| | | |
| | | //开始初始化 |
| | | switchContr.InitControl(listTitle);
|
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | roomRowLayout.InitControl(); |
| | | } |
| | | |
| | | if (SceneListView.ChildrenCount > 5) |
| | | { |
| | | TextView textView = new TextView(); |
| | | textView.Height = Application.GetRealHeight(127 * 3); |
| | | SceneListView.AddChidren(textView); |
| | | } |
| | | |
| | | if (SceneListView.ChildrenCount == 0) |
| | | { |
| | | tipLayout.Visible = true; |
| | |
| | | { |
| | | try |
| | | { |
| | | //2.功能类型选择(灯光、遮阳、空调) |
| | | //3.设备列表 ListView |
| | | |
| | | ContentLayout.RemoveAll(); |
| | | |
| | | FrameLayout tab_layout = new FrameLayout(); |
| | |
| | | break; |
| | | } |
| | | |
| | | if (DeviceListView.ChildrenCount > 5) |
| | | { |
| | | TextView textView = new TextView(); |
| | | textView.Height = Application.GetRealHeight(127 * 3); |
| | | DeviceListView.AddChidren(textView); |
| | | } |
| | | |
| | | if (DeviceListView.ChildrenCount == 0) |
| | | { |
| | | TipLayout.Visible = true; |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 修改场景昵称 |
| | | /// </summary> |
| | | /// <param name="scene"></param> |
| | | /// <param name="sceneRowLayout"></param> |
| | | private void ShowSetNicknameDialog(SmartSound.Scene scene, SceneRowLayout sceneRowLayout) |
| | | { |
| | | //生成一个弹窗画面 |
| | |
| | | dialogForm.Text = scene.NicksName; |
| | | |
| | | //按下确认按钮 |
| | | dialogForm.ComfirmClickEvent += ((textValue) => |
| | | dialogForm.ComfirmClickEvent += (async (textValue) => |
| | | { |
| | | scene.NicksName = textValue; |
| | | string remark = scene.SceneName; |
| | |
| | | remark += "(" + scene.NicksName + ")"; |
| | | } |
| | | sceneRowLayout.btnCaption.Text = remark; |
| | | string json = await postBatchEdit(); |
| | | //画面关闭 |
| | | dialogForm.CloseDialog(); |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 修改设备昵称 |
| | | /// </summary> |
| | | /// <param name="device"></param> |
| | | /// <param name="deviceRowLayout"></param> |
| | | private void ShowSetNicknameDialog(SmartSound.Device device, DeviceRowLayout deviceRowLayout) |
| | | { |
| | | //生成一个弹窗画面 |
| | |
| | | dialogForm.Text = device.NicksName; |
| | | |
| | | //按下确认按钮 |
| | | dialogForm.ComfirmClickEvent += ((textValue) => |
| | | dialogForm.ComfirmClickEvent += (async (textValue) => |
| | | { |
| | | device.NicksName = textValue; |
| | | string remark = device.DeviceName; |
| | |
| | | remark += "(" + device.NicksName + ")"; |
| | | } |
| | | deviceRowLayout.btnCaption.Text = remark; |
| | | |
| | | string json = await postBatchEdit(); |
| | | |
| | | //画面关闭 |
| | | dialogForm.CloseDialog(); |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 解除绑定弹窗 |
| | | /// 场景删除 |
| | | /// </summary> |
| | | private void ShowSceneDelectDialog(SmartSound.Scene scene) |
| | | { |
| | | this.ShowMassage(ShowMsgType.Confirm, "确认删除该控制内容?", () => |
| | | this.ShowMassage(ShowMsgType.Confirm, "确认删除该控制内容?", async () => |
| | | { |
| | | try |
| | | { |
| | | CurrentRoom.SceneList.Remove(scene); |
| | | LoadSceneView(); |
| | | //SceneListView.RemoveAt(index); |
| | | |
| | | string json = await postBatchEdit(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | string sss = e.Message; |
| | | } |
| | | |
| | | }, "确认"); |
| | | }, Language.StringByID(R.MyInternationalizationString.OkMsg)); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 解除绑定弹窗 |
| | | /// 设备删除 |
| | | /// </summary> |
| | | private void ShowDeviceDelectDialog(SmartSound.Device device) |
| | | { |
| | | this.ShowMassage(ShowMsgType.Confirm, "确认删除该控制内容?", () => |
| | | this.ShowMassage(ShowMsgType.Confirm, "确认删除该控制内容?", async () => |
| | | { |
| | | try |
| | | { |
| | | //DeviceListView.RemoveAt(index); |
| | | CurrentRoom.DeviceList.Remove(device); |
| | | RefreshFunctionListView(); |
| | | |
| | | string json = await postBatchEdit(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | string sss = e.Message; |
| | | } |
| | | |
| | | }, "确认"); |
| | | }, Language.StringByID(R.MyInternationalizationString.OkMsg)); |
| | | } |
| | | |
| | | /// <summary>
|
| | |
| | | } |
| | | } |
| | | |
| | | private async Task<string> postBatchEdit() |
| | | { |
| | | // 提交数据至服务器 |
| | | string url = "https://developer.hdlcontrol.com/zigbeespeakerservice/BatchEdit"; |
| | | string json = Newtonsoft.Json.JsonConvert.SerializeObject(SmartSound.getInstantiate()); |
| | | string response_str = await MyHttpWebResponse.PostWebRequest(url, json, Encoding.UTF8); |
| | | return response_str; |
| | | } |
| | | |
| | | #region ■ 自定义场景选择控件_____________________
|
| | | |
| | | /// <summary>
|
| | |
| | | nicknameIcon.AddTag("obj", scene); |
| | | nicknameIcon.ButtonClickEvent += (sender, e) => |
| | | { |
| | | // 添加昵称 |
| | | var btn = sender as IconViewControl; |
| | | SmartSound.Scene tmpScene = (SmartSound.Scene)btn.GetTagByKey("obj"); |
| | | smartSoundContentForDeviceChange.ShowSetNicknameDialog(tmpScene, this); |
| | |
| | | frameTable.AddBottomLine(); |
| | | |
| | | btnDelect = base.AddDeleteControl(); |
| | | btnDelect.Text = "删除"; |
| | | btnDelect.Text = Language.StringByID(R.MyInternationalizationString.Delete); |
| | | btnDelect.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //删除场景 |
| | | smartSoundContentForDeviceChange.ShowSceneDelectDialog(scene); |
| | | }; |
| | | }
|