| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Threading; |
| | | using HDL_ON.DAL.Server; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | |
| | | UnSelectedImagePath = "Collection/CollectionGrayIcon.png", |
| | | IsSelected = scene.collect |
| | | }; |
| | | if (scene.sceneType != SceneType.LightScene) |
| | | { |
| | | this.AddChidren(btnCollectionIcon); |
| | | } |
| | | |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/Scene/SceneIcon.png"; |
| | | if (scene.sceneType == SceneType.MovieScene) |
| | |
| | | /// </summary> |
| | | void LoadEvent_ControlScene(Button btnName, Button btnFromFloor, Scene scene) |
| | | { |
| | | EventHandler<MouseEventArgs> upEvent = (sender, e) => { |
| | | if (scene.sceneType == SceneType.LightScene) |
| | | { |
| | | EventHandler<MouseEventArgs> upEvent = (sender, e) => |
| | | { |
| | | if (scene.functions.Count == 0) |
| | | { |
| | | |
| | | var waitPage = new Loading(); |
| | | new Thread(() => |
| | | { |
| | | try |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | MainPage.BaseView.AddChidren(waitPage); |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | }); |
| | | var pm = new HttpServerRequest(); |
| | | var pack = pm.GetSceneInfo(scene.userSceneId); |
| | | if (pack.Code == StateCode.SUCCESS) |
| | | { |
| | | var sceneList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(pack.Data.ToString()); |
| | | var tempScene = sceneList.Find((obj) => obj.userSceneId == scene.userSceneId); |
| | | if (tempScene != null) |
| | | { |
| | | scene.name = tempScene.name; |
| | | scene.delay = tempScene.delay; |
| | | scene.roomIds = tempScene.roomIds; |
| | | scene.functions = tempScene.functions; |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | var sceneLishtList = new List<Function>(); |
| | | foreach (var light in FunctionList.List.GetLightList()) |
| | | { |
| | | var temp = scene.functions.Find((obj) => obj.sid == light.sid); |
| | | if (temp != null) |
| | | { |
| | | sceneLishtList.Add(light); |
| | | } |
| | | } |
| | | Action<Scene> action = (Scene) => { }; |
| | | var lightSceneDialog = new LightSceneEditDialog(sceneLishtList, scene, action); |
| | | lightSceneDialog.ShowDialog(); |
| | | |
| | | waitPage.Hide(); |
| | | waitPage.RemoveFromParent(); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | IMessageCommon.Current.ShowErrorInfoAlter(pack.Code); |
| | | } |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | waitPage.Hide(); |
| | | waitPage.RemoveFromParent(); |
| | | }); |
| | | } |
| | | }).Start(); |
| | | } |
| | | else |
| | | { |
| | | var sceneLishtList = new List<Function>(); |
| | | foreach (var light in FunctionList.List.GetLightList()) |
| | | { |
| | | var temp = scene.functions.Find((obj) => obj.sid == light.sid); |
| | | if (temp != null) |
| | | { |
| | | sceneLishtList.Add(light); |
| | | } |
| | | } |
| | | Action<Scene> action = (Scene) => { }; |
| | | var lightSceneDialog = new LightSceneEditDialog(sceneLishtList, scene, action); |
| | | lightSceneDialog.ShowDialog(); |
| | | } |
| | | }; |
| | | btnName.MouseUpEventHandler = upEvent; |
| | | btnFromFloor.MouseUpEventHandler = upEvent; |
| | | this.MouseUpEventHandler = upEvent; |
| | | } |
| | | else |
| | | { |
| | | EventHandler<MouseEventArgs> upEvent = (sender, e) => |
| | | { |
| | | DriverLayer.Control.Ins.ControlScene(scene); |
| | | string msg = scene.name + Language.StringByID(StringId.AlreadyOpened); |
| | | new PublicAssmebly().TipMsgAutoClose(msg, false); |
| | |
| | | btnFromFloor.MouseUpEventHandler = upEvent; |
| | | this.MouseUpEventHandler = upEvent; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |