old mode 100755
new mode 100644
| | |
| | | //场景点击事件 |
| | | sceneView.btnClick.MouseUpEventHandler += (sen, e) => |
| | | { |
| | | |
| | | FrameLayout fLayout = new FrameLayout |
| | | { |
| | | BackgroundColor = CSS.CSS_Color.viewTrans60lucence, |
| | | }; |
| | | this.AddChidren(fLayout); |
| | | SceneMethod(fLayout); |
| | | SceneMethod(); |
| | | }; |
| | | //延时点击事件 |
| | | delayView.btnClick.MouseUpEventHandler += (sen, e) => |
| | |
| | | /// <summary> |
| | | /// 添加场景 |
| | | /// </summary> |
| | | /// <param name="fLayout">弹框主控件</param> |
| | | public void SceneMethod(FrameLayout fLayout) |
| | | public void SceneMethod() |
| | | { |
| | | int line = 0; |
| | | var sceneList = LogicMethod.GetSceneList(); |
| | | if (sceneList.Count == 0|| sceneList.Count>5) |
| | | { |
| | | line = 5; |
| | | } |
| | | else { |
| | | line = sceneList.Count; |
| | | } |
| | | LogicView.DateView view = new LogicView.DateView(); |
| | | view.btnTitle.TextID = StringId.addSceneLogic; |
| | | view.FLayoutView(fLayout, line); |
| | | |
| | | view.btnCancel.MouseUpEventHandler += (sender2, e2) => |
| | | { |
| | | fLayout.RemoveFromParent(); |
| | | }; |
| | | FrameLayout frameL = new FrameLayout |
| | | { |
| | | Y = Application.GetRealHeight(56), |
| | | Height = Application.GetRealHeight(50 * line), |
| | | }; |
| | | |
| | | VerticalRefreshLayout verticalRefresh = new VerticalRefreshLayout |
| | | { |
| | | Y = Application.GetRealHeight(56), |
| | | Height = Application.GetRealHeight(50 * 5), |
| | | |
| | | }; |
| | | verticalRefresh.BeginHeaderRefreshingAction += () => |
| | | { |
| | | //关闭刷新View; |
| | | verticalRefresh.EndHeaderRefreshing(); |
| | | }; |
| | | |
| | | if (sceneList.Count == 0) |
| | | { |
| | | Button btnTipNot = new Button |
| | | { |
| | | X=Application.GetRealWidth(93), |
| | | Y = Application.GetRealHeight(80), |
| | | Width = Application.GetRealWidth(158), |
| | | Height = Application.GetRealWidth(158), |
| | | UnSelectedImagePath = "TipNot.png", |
| | | |
| | | }; |
| | | view.frameLayout.AddChidren(btnTipNot); |
| | | |
| | | Button btnTipNotText = new Button() |
| | | { |
| | | Y = btnTipNot.Bottom+ Application.GetRealHeight(16), |
| | | Height = Application.GetRealHeight(20), |
| | | TextID = StringId.secnenull, |
| | | TextColor = CSS.CSS_Color.textColor, |
| | | TextSize =LogicView.TextSize.text14, |
| | | TextAlignment = TextAlignment.Center, |
| | | }; |
| | | view.frameLayout.AddChidren(btnTipNotText); |
| | | } |
| | | else if (sceneList.Count <=5 ) { |
| | | view.frameLayout.AddChidren(frameL); |
| | | } |
| | | else if(sceneList.Count>5) { |
| | | view.frameLayout.AddChidren(verticalRefresh); |
| | | |
| | | } |
| | | |
| | | |
| | | //定义一个局部变量记录选中状态 |
| | | Button buttonClick = new Button(); |
| | | HDL_ON.Entity.Scene sceneSelecetd = null; |
| | | verticalRefresh.BeginHeaderRefreshingAction += () => |
| | | { |
| | | //关闭刷新View; |
| | | verticalRefresh.EndHeaderRefreshing(); |
| | | }; |
| | | |
| | | for (int i = 0; i < sceneList.Count; i++) |
| | | { |
| | | List<string> nameList = new List<string>(); |
| | | for (int i = 0; i < sceneList.Count; i++) { |
| | | var scene = sceneList[i]; |
| | | LogicView.CheckView sceneView = new LogicView.CheckView(); |
| | | sceneView.btnText.Text = scene.name; |
| | | sceneView.btnText.TextSize = LogicView.TextSize.text14; |
| | | if (sceneList.Count <= 5) |
| | | { |
| | | sceneView.frameLayout.Y = Application.GetRealWidth(i*50); |
| | | frameL.AddChidren(sceneView.FLayoutView()); |
| | | if (sceneList.Count-1==i) { |
| | | sceneView.btnLine.BackgroundColor = CSS.CSS_Color.view; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | verticalRefresh.AddChidren(sceneView.FLayoutView()); |
| | | } |
| | | sceneView.btnClick.Tag = scene;//标记索引 |
| | | //场景的点击事件 |
| | | sceneView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | buttonClick.IsSelected = false; |
| | | sceneView.btnCheckIcon.IsSelected = true; |
| | | buttonClick = sceneView.btnCheckIcon; |
| | | sceneSelecetd = sceneView.btnClick.Tag as HDL_ON.Entity.Scene; |
| | | }; |
| | | |
| | | nameList.Add(scene.name); |
| | | } |
| | | //确认点击事件 |
| | | view.btnConfirm.MouseUpEventHandler += (sender1, e1) => |
| | | PublicInterface publicInterface = new PublicInterface(); |
| | | publicInterface.FrameOrVv(this, nameList, StringId.addSceneLogic, (index) => |
| | | { |
| | | |
| | | if (sceneSelecetd == null) |
| | | { |
| | | //提示:还没选中执行周期 |
| | | return; |
| | | } |
| | | var sceneSelecetd = sceneList[index]; |
| | | Output outputDevice = new Output(); |
| | | outputDevice.target_type = "2"; |
| | | outputDevice.sid = sceneSelecetd.sid; |
| | | //没啥作用,为了发送数据格式统一; |
| | | outputDevice.status = new List<Dictionary<string, string>> { new Dictionary<string, string> { { "key", "scene"},{ "value", "0" } } }; |
| | | outputDevice.status = new List<Dictionary<string, string>> { new Dictionary<string, string> { { "key", "scene" }, { "value", "0" } } }; |
| | | AddOutput(outputDevice); |
| | | fLayout.RemoveFromParent(); |
| | | LogicMethod.RemoveAllView(); |
| | | AddLogic addLogic = new AddLogic(); |
| | | MainPage.BasePageView.AddChidren(addLogic); |
| | | addLogic.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |