| | |
| | | |
| | | public void Show() |
| | | { |
| | | |
| | | |
| | | |
| | | #region 界面布局 |
| | | this.BackgroundColor = CSS.CSS_Color.viewMiddle; |
| | | LogicView.TopView topView = new LogicView.TopView(); |
| | |
| | | } |
| | | |
| | | // 条件处理方法 |
| | | InpOrOutLogicMethod.InputCondition(this, viewLayout); |
| | | InpOrOutLogicMethod.Current.InputCondition(this, viewLayout); |
| | | ///添加图标的View |
| | | LogicView.LogicAddView addInputIcon = new LogicView.LogicAddView(); |
| | | addInputIcon.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight); |
| | |
| | | titleOutpu.btnNextIcon.Visible = false; |
| | | viewLayout.AddChidren(titleOutpu.FLayoutView()); |
| | | //目标处理方法 |
| | | InpOrOutLogicMethod.OutputTarget(this, viewLayout); |
| | | InpOrOutLogicMethod.Current.OutputTarget(this, viewLayout); |
| | | ///添加图标的View |
| | | LogicView.LogicAddView addOutputIcon = new LogicView.LogicAddView(); |
| | | addOutputIcon.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight); |
| | |
| | | ///保存点击事件 |
| | | saveView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | if (Logic.currlogic.input.Count == 0 && Logic.currlogic.output.Count == 0) |
| | | { |
| | | new LogicView.TipPopView().TipBox(StringId.tip, StringId.conditioncNullOrtargetNull); |
| | | return; |
| | | } |
| | | //if (Logic.currlogic.input.Count == 0 && Logic.currlogic.output.Count == 0) |
| | | //{ |
| | | // new LogicView.TipPopView().TipBox(StringId.tip, StringId.conditioncNullOrtargetNull); |
| | | // return; |
| | | //} |
| | | if (Logic.currlogic.input.Count == 0) |
| | | { |
| | | new LogicView.TipPopView().TipBox(StringId.tip, StringId.conditioncNull); |
| | | return; |
| | | } |
| | | if (Logic.currlogic.output.Count == 0) |
| | | if (Logic.currlogic.output.Count == 0&&!push.btnNextIcon.IsSelected) |
| | | { |
| | | new LogicView.TipPopView().TipBox(StringId.tip, StringId.targetNull); |
| | | return; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | Loading loading = new Loading(); |
| | | this.AddChidren(loading); |
| | | HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; |
| | | HDL_ON.DAL.Server.ResponsePackNew r = null; |
| | | if (string.IsNullOrEmpty(Logic.currlogic.userLogicId)) |
| | | { |
| | | List<string> list = new List<string>(); |
| | |
| | | { |
| | | list.Add(logic.name); |
| | | } |
| | | new LogicView.TipPopView().InputBox(StringId.editName, InpOrOutLogicMethod.GetLogicName(Logic.currlogic), StringId.nameNull, StringId.NameAlreadyExists, list, (logicName, view |
| | | new LogicView.TipPopView().InputBox(StringId.editName, InpOrOutLogicMethod.Current.GetLogicName(Logic.currlogic), StringId.nameNull, StringId.NameAlreadyExists, list, (logicName, view |
| | | ) => |
| | | { |
| | | Logic.currlogic.name = logicName; |
| | | Logic.currlogic.sid = LogicMethod.CurrLogicMethod.NewSid(); |
| | | Logic.currlogic.sid = LogicMethod.Current.NewSid(); |
| | | loading.Start(); |
| | | new System.Threading.Thread(() => |
| | | { |
| | |
| | | if (!MainPage.NoLoginMode) |
| | | { |
| | | //发送新加逻辑命令; |
| | | responsePackNew = Send.AddLogic(Logic.currlogic); |
| | | r = Send.Current.AddLogic(Logic.currlogic,true); |
| | | } |
| | | |
| | | } |
| | |
| | | if(MainPage.NoLoginMode) |
| | | { |
| | | Logic.LogicList.Add(Logic.currlogic); |
| | | LogicMethod.CurrLogicMethod.RemoveAllView(); |
| | | LogicMethod.Current.RemoveAllView(); |
| | | MainView.MainShow(); |
| | | return; |
| | | } |
| | | |
| | | if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | if (r != null) |
| | | { |
| | | //获取逻辑详细返回是一个数组(object类型转换为数组); |
| | | var jArray = Newtonsoft.Json.Linq.JArray.Parse(responsePackNew.Data.ToString()); |
| | | for (int a = 0; a < jArray.Count; a++) |
| | | var userLogicIdList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Logic>>(r.Data.ToString()); |
| | | for (int i = 0; i < userLogicIdList.Count; i++) |
| | | { |
| | | var jay = jArray[a]; |
| | | //数据返序列化为Logic对象 |
| | | var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); |
| | | var logic = Newtonsoft.Json.JsonConvert.DeserializeObject<Logic>(str); |
| | | if (logic.userLogicId != "") |
| | | { |
| | | //更新云端唯一自动化id; |
| | | Logic.currlogic.userLogicId = logic.userLogicId; |
| | | } |
| | | else |
| | | var logic = userLogicIdList[i]; |
| | | if (string.IsNullOrEmpty(logic.userLogicId)) |
| | | { |
| | | //自己看的所以不需要支持中英文 |
| | | new LogicView.TipPopView().FlashingBox("没有返回云端唯一自动化id"); |
| | | } |
| | | |
| | | //更新云端唯一自动化id; |
| | | Logic.currlogic.userLogicId = logic.userLogicId; |
| | | } |
| | | |
| | | Logic.LogicList.Add(Logic.currlogic); |
| | | LogicMethod.CurrLogicMethod.RemoveAllView(); |
| | | LogicMethod.Current.RemoveAllView(); |
| | | MainView.MainShow(); |
| | | } |
| | | else |
| | | { |
| | | if (responsePackNew != null) |
| | | { |
| | | new LogicView.TipPopView().FlashingBox(responsePackNew.message); |
| | | } |
| | | |
| | | } |
| | | |
| | | }); |
| | | } |
| | | |
| | |
| | | try |
| | | { |
| | | //发送修改逻辑命令; |
| | | responsePackNew = Send.UpdateLogic(Logic.currlogic); |
| | | r = Send.Current.UpdateLogic(Logic.currlogic,true); |
| | | |
| | | } |
| | | catch { } |
| | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | loading.Hide(); |
| | | if (responsePackNew != null && responsePackNew.Code == "0") |
| | | if (r != null ) |
| | | { |
| | | LogicMethod.CurrLogicMethod.RemoveAllView(); |
| | | LogicMethod.Current.RemoveAllView(); |
| | | MainView.MainShow(); |
| | | } |
| | | else |
| | | { |
| | | if (responsePackNew != null) |
| | | { |
| | | new LogicView.TipPopView().FlashingBox(responsePackNew.message); |
| | | } |
| | | |
| | | } |
| | | |
| | | }); |
| | | } |
| | | |
| | | |
| | | |
| | | }) |
| | | { IsBackground = true }.Start(); |