| | |
| | | //初始化添加目标
|
| | | this.InitAddTargetControl();
|
| | |
|
| | | //分享的场景不能保存
|
| | | if (this.editorScene == null || this.editorScene.IsSharedScene == false)
|
| | | //完成
|
| | | var btnSave = new BottomClickButton();
|
| | | btnSave.TextID = R.MyInternationalizationString.uFinish;
|
| | | bodyFrameLayout.AddChidren(btnSave);
|
| | | btnSave.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //完成
|
| | | var btnSave = new BottomClickButton();
|
| | | btnSave.TextID = R.MyInternationalizationString.uFinish;
|
| | | bodyFrameLayout.AddChidren(btnSave);
|
| | | btnSave.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //保存场景数据
|
| | | this.SaveSceneData();
|
| | | };
|
| | | //保存场景数据
|
| | | this.SaveSceneData();
|
| | | };
|
| | |
|
| | | //分享的场景不能保存
|
| | | if (this.editorScene != null && this.editorScene.IsSharedScene == true)
|
| | | {
|
| | | btnSave.CanClick = false;
|
| | | }
|
| | | else if (Config.Instance.Home.IsShowTemplate == true)
|
| | | {
|
| | | //模板场景不能保存
|
| | | btnSave.CanClick = false;
|
| | | }
|
| | | //如果是有模板,有设备的时候,在没有发送成功之前
|
| | | else if (Common.Config.Instance.Home.TemplateMode == 2
|
| | | && Common.Config.Instance.Home.SendTemplateSuccess == false)
|
| | | {
|
| | | btnSave.CanClick = false;
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | //分享的场景不能编辑
|
| | | if (this.editorScene == null || this.editorScene.IsSharedScene == false)
|
| | | {
|
| | | if (Config.Instance.Home.IsShowTemplate == true)
|
| | | {
|
| | | //模板场景不允许编辑
|
| | | return;
|
| | | }
|
| | | btnZhezhao.MouseUpEventHandler += (sender, e) =>
|
| | | {
|
| | | //房间图片选择
|
| | |
| | |
|
| | | //信息编辑
|
| | | var btnTitle = new NormalViewControl(300, 60, true);
|
| | | btnTitle.X = ControlCommonResourse.XXLeft;
|
| | | btnTitle.X = HdlControlResourse.XXLeft;
|
| | | btnTitle.Y = Application.GetRealHeight(46);
|
| | | btnTitle.TextSize = 15;
|
| | | btnTitle.TextID = R.MyInternationalizationString.uInfoEditor;
|
| | |
| | | //场景名称
|
| | | var rowScene = new FrameCaptionInputControl(Language.StringByID(R.MyInternationalizationString.SceneName), this.cloneScene.Name);
|
| | | rowScene.txtInput.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputSceneName);
|
| | | rowScene.txtInput.MaxByte = 32;//限制只能输入32个字节
|
| | | rowScene.Y = btnTitle.Bottom + Application.GetRealHeight(23);
|
| | | frameBack.AddChidren(rowScene);
|
| | | rowScene.InitControl();
|
| | |
| | | {
|
| | | this.nowRoomId = selectId;
|
| | | };
|
| | | }
|
| | | if (Config.Instance.Home.IsShowTemplate == true)
|
| | | {
|
| | | //模板场景不允许编辑
|
| | | rowBelong.CanClick = false;
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | //显示添加目标菜单
|
| | | this.ShowAddTargetMenu();
|
| | | };
|
| | | if (Config.Instance.Home.IsShowTemplate == true)
|
| | | {
|
| | | //模板场景不允许编辑
|
| | | rowAddTarget.CanClick = false;
|
| | | }
|
| | | //如果是有模板,有设备的时候,在没有发送成功之前
|
| | | if (Common.Config.Instance.Home.TemplateMode == 2
|
| | | && Common.Config.Instance.Home.SendTemplateSuccess == false)
|
| | | {
|
| | | rowAddTarget.CanClick = false;
|
| | | }
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | |
| | | if (listAdjustTarget[i].Type == 0)
|
| | | {
|
| | | //设备
|
| | | var device = Common.LocalDevice.Current.GetDevice(listAdjustTarget[i].DeviceAddr, listAdjustTarget[i].Epoint);
|
| | | var device = HdlDeviceCommonLogic.Current.GetDevice(listAdjustTarget[i].DeviceAddr, listAdjustTarget[i].Epoint);
|
| | | if (device == null)
|
| | | {
|
| | | //不显示这个不存在本地的设备
|
| | |
| | | private void AddDeviceTargetRow(Scene.DeviceListData data, int index, bool addLine)
|
| | | {
|
| | | //设备
|
| | | var device = Common.LocalDevice.Current.GetDevice(data.DeviceAddr, data.Epoint);
|
| | | var device = HdlDeviceCommonLogic.Current.GetDevice(data.DeviceAddr, data.Epoint);
|
| | | var rowDevice = new DeviceRoomControl(device, frameTargetTableControl.rowSpace / 2);
|
| | | rowDevice.MainKeys = index.ToString();
|
| | | this.frameTargetTableControl.AddChidren(rowDevice);
|
| | | //控件向右偏移
|
| | | rowDevice.frameTable.LeftOffset = Application.GetRealWidth(104) - ControlCommonResourse.XXLeft;
|
| | | rowDevice.frameTable.LeftOffset = Application.GetRealWidth(104) - HdlControlResourse.XXLeft;
|
| | | rowDevice.InitControl();
|
| | | rowDevice.frameTable.UseClickStatu = false;
|
| | |
|
| | |
| | | //分享的场景不能编辑
|
| | | if (this.editorScene == null || this.editorScene.IsSharedScene == false)
|
| | | {
|
| | | if (Config.Instance.Home.IsShowTemplate == true)
|
| | | {
|
| | | //模板场景不允许编辑
|
| | | return;
|
| | | }
|
| | | //编辑
|
| | | var btnEditor = rowDevice.AddEditorControl();
|
| | | btnEditor.ButtonClickEvent += (sender, e) =>
|
| | |
| | | rowScene.MainKeys = index.ToString();
|
| | | frameTargetTableControl.AddChidren(rowScene);
|
| | | //控件向右偏移
|
| | | rowScene.frameTable.LeftOffset = Application.GetRealWidth(104) - ControlCommonResourse.XXLeft;
|
| | | rowScene.frameTable.LeftOffset = Application.GetRealWidth(104) - HdlControlResourse.XXLeft;
|
| | | rowScene.InitControl();
|
| | | if (addLine == true)
|
| | | {
|
| | |
| | | //分享的场景不能编辑
|
| | | if (this.editorScene == null || this.editorScene.IsSharedScene == false)
|
| | | {
|
| | | if (Config.Instance.Home.IsShowTemplate == true)
|
| | | {
|
| | | //模板场景不允许编辑
|
| | | return;
|
| | | }
|
| | | //删除
|
| | | var btnDelete = rowScene.AddDeleteControl();
|
| | | btnDelete.ButtonClickEvent += (sender, e) =>
|
| | |
| | | rowDelay.MainKeys = index.ToString();
|
| | | frameTargetTableControl.AddChidren(rowDelay);
|
| | | //控件向右偏移
|
| | | rowDelay.frameTable.LeftOffset = Application.GetRealWidth(104) - ControlCommonResourse.XXLeft;
|
| | | rowDelay.frameTable.LeftOffset = Application.GetRealWidth(104) - HdlControlResourse.XXLeft;
|
| | | rowDelay.frameTable.UseClickStatu = false;
|
| | | //图标
|
| | | var btnIcon = rowDelay.frameTable.AddLeftIcon();
|
| | |
| | | //分享的场景不能编辑
|
| | | if (this.editorScene == null || this.editorScene.IsSharedScene == false)
|
| | | {
|
| | | if (Common.Config.Instance.Home.IsShowTemplate == true)
|
| | | {
|
| | | //模板场景不允许编辑
|
| | | return;
|
| | | }
|
| | | //编辑
|
| | | var btnEditor = rowDelay.AddEditorControl();
|
| | | btnEditor.ButtonClickEvent += (sender, e) =>
|
| | |
| | | this.isAdjustTargetChanged = true;
|
| | | foreach (var mainKey in dicData.Keys)
|
| | | {
|
| | | var device = LocalDevice.Current.GetDevice(mainKey);
|
| | | var device = HdlDeviceCommonLogic.Current.GetDevice(mainKey);
|
| | | var data = new Scene.DeviceListData();
|
| | | data.Type = 0;
|
| | | data.DeviceAddr = device.DeviceAddr;
|
| | |
| | | var fileName = $"SceneIcon_{tradeTime}.png";
|
| | | //生成文件图片
|
| | | IO.FileUtils.WriteFileByBytes(System.IO.Path.Combine(Config.Instance.FullPath, fileName), this.btnScenePic.ImageBytes);
|
| | | HdlAutoBackupLogic.AddOrEditorFile(fileName);
|
| | | HdlBackupLogic.Current.AddOrEditorAutoBackFileStatu(fileName);
|
| | | this.cloneScene.IconPath = fileName;
|
| | | }
|
| | | //转移属性
|
| | |
| | | {
|
| | | //删除自定义图片
|
| | | HdlFileLogic.Current.DeleteFile(System.IO.Path.Combine(Config.Instance.FullPath, this.editorScene.IconPath));
|
| | | HdlAutoBackupLogic.DeleteFile(this.editorScene.IconPath);
|
| | | HdlBackupLogic.Current.DeleteAutoBackFileStatu(this.editorScene.IconPath);
|
| | | }
|
| | | if (this.cloneScene.IconPathType != 0)
|
| | | {
|
| | |
| | | var fileName = $"SceneIcon_{tradeTime}.png";
|
| | | //生成文件图片
|
| | | IO.FileUtils.WriteFileByBytes(System.IO.Path.Combine(Config.Instance.FullPath, fileName), this.btnScenePic.ImageBytes);
|
| | | HdlAutoBackupLogic.AddOrEditorFile(fileName);
|
| | | HdlBackupLogic.Current.AddOrEditorAutoBackFileStatu(fileName);
|
| | | this.cloneScene.IconPath = fileName;
|
| | | }
|
| | | }
|