old mode 100644
new mode 100755
| | |
| | | /// </summary> |
| | | public class Category : FrameLayout, ZigBee.Common.IStatus |
| | | { |
| | | |
| | | #region ◆ 变量____________________________ |
| | | /// <summary> |
| | | /// The instance. |
| | |
| | | /// 场景 |
| | | /// </summary> |
| | | private ButtonLineForm sceneBtn; |
| | | ///// <summary> |
| | | ///// 自动化 |
| | | ///// </summary> |
| | | //private ButtonLineForm automationBtn; |
| | | /// <summary> |
| | | /// 自动化 |
| | | /// </summary> |
| | | public static ButtonLineForm automationBtn; |
| | | private ButtonLineForm automationBtn; |
| | | /// <summary> |
| | | /// 场景功能中部背景bodyView |
| | | /// </summary> |
| | |
| | | X = Application.GetRealWidth(58), |
| | | //Radius = (uint)Application.GetRealHeight(50), |
| | | Y = Application.GetRealHeight(30), |
| | | |
| | | }; |
| | | functionSceneAutoBodyView.AddChidren(bjFrameLayout); |
| | | bjFrameLayout.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerBottomLeft); |
| | | //图标控件 |
| | | var sigBtn = new Button |
| | | { |
| | | Width = Application.GetMinRealAverage(84), |
| | |
| | | Gravity = Gravity.CenterVertical, |
| | | }; |
| | | bjFrameLayout.AddChidren(sigBtn); |
| | | //推荐模板文本控件 |
| | | |
| | | var recommendtextBtn = new Button |
| | | { |
| | | Width = Application.GetMinRealAverage(300), |
| | |
| | | TextSize = 15, |
| | | }; |
| | | bjFrameLayout.AddChidren(recommendtextBtn); |
| | | //推荐模板开关控件 |
| | | |
| | | var recommendswitchBtn = new Button |
| | | { |
| | | Width = Application.GetRealWidth(104), |
| | | Height = Application.GetRealHeight(63), |
| | | Width = Application.GetMinRealAverage(104), |
| | | Height = Application.GetMinRealAverage(63), |
| | | UnSelectedImagePath = "ZigeeLogic/logicclose.png", |
| | | SelectedImagePath = "ZigeeLogic/logicopen.png", |
| | | X = bjFrameLayout.Width - Application.GetRealWidth(104 + 58), |
| | | Gravity = Gravity.CenterVertical, |
| | | }; |
| | | bjFrameLayout.AddChidren(recommendswitchBtn); |
| | | #endregion |
| | | //默认推荐模板左右可滑控件 |
| | | |
| | | |
| | | var scenehorizontalScrol = new HorizontalScrolViewLayout |
| | | { |
| | | Width = Application.GetRealWidth(1080 - 58), |
| | |
| | | Height = Application.GetRealHeight(0), |
| | | }; |
| | | functionSceneAutoBodyView.AddChidren(scenehorizontalScrol); |
| | | //显示自动化列表上下可滑控件 |
| | | |
| | | var logicScrolView = new VerticalRefreshLayout//VerticalScrolViewLayout |
| | | { |
| | | Height = functionSceneAutoBodyView.Height - bjFrameLayout.Height - bjFrameLayout.Y - scenehorizontalScrol.Height - Application.GetRealHeight(30), |
| | |
| | | functionSceneAutoBodyView.AddChidren(logicScrolView); |
| | | logicScrolView.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft); |
| | | bool no = false; |
| | | //显示默认模板的界面事件 |
| | | recommendswitchBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | int Yheight = 0; |
| | |
| | | logicScrolView.Height = functionSceneAutoBodyView.Height - bjFrameLayout.Height - bjFrameLayout.Y - scenehorizontalScrol.Height - Application.GetRealHeight(30) - Yheight; |
| | | Automationview(logicScrolView, no); |
| | | }; |
| | | //下拉刷新自动化列表的事件 |
| | | logicScrolView.BeginHeaderRefreshingAction += () => |
| | | { |
| | | //重新刷新logic列表 |
| | |
| | | //关闭刷新View; |
| | | logicScrolView.EndHeaderRefreshing(); |
| | | }; |
| | | logicScrolView.BeginHeaderRefreshingAction += () => |
| | | { |
| | | //重新刷新logic列表 |
| | | Common.Logic.LogicList.Clear(); |
| | | Read(logicScrolView, no); |
| | | //关闭刷新View; |
| | | logicScrolView.EndHeaderRefreshing(); |
| | | };
|
| | |
|
| | | Read(logicScrolView, no); |
| | | |
| | | Read(logicScrolView, no); |
| | | |
| | |
| | | refresview.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; |
| | | } |
| | | } |
| | | |
| | | foreach (var logic in Common.Logic.LogicList) |
| | | { |
| | | var fLayout = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(190 + 30), |
| | | Width = Application.GetRealWidth(1080 - 58), |
| | | BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, |
| | | }; |
| | | refresview.AddChidren(fLayout); |
| | |
|
| | | |
| | | var logicRowlayout = new RowLayout |
| | | { |
| | |
| | | Width = Application.GetRealWidth(1080 - 58), |
| | | LineColor = ZigbeeColor.Current.LogicBackgroundColor, |
| | | BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, |
| | | SubViewWidth = Application.GetRealWidth(184),//改变编辑控件宽度多少; |
| | | |
| | | }; |
| | | fLayout.AddChidren(logicRowlayout); |
| | | refresview.AddChidren(logicRowlayout); |
| | | |
| | | |
| | | |
| | | var logicnameBtn = new Button |
| | | { |
| | |
| | | }; |
| | | logicRowlayout.AddChidren(logicnameBtn); |
| | | |
| | | |
| | | var logicswitchBtn = new Button |
| | | { |
| | | Width = Application.GetMinRealAverage(104), |
| | |
| | | SelectedImagePath = "ZigeeLogic/logicopen.png", |
| | | X = logicRowlayout.Width - Application.GetRealWidth(104 + 58), |
| | | Y = Application.GetRealHeight(58 + 30 + 9 + 30), |
| | | |
| | | }; |
| | | logicRowlayout.AddChidren(logicswitchBtn); |
| | | |
| | | |
| | | |
| | | logicswitchBtn.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | |
| | | var logicCommunalPage = new Logic.LogicCommunalPage(); |
| | | HomePage.Instance.AddChidren(logicCommunalPage); |
| | | HomePage.Instance.PageIndex += 1; |
| | | logicCommunalPage.Show(() => { logicnameBtn.Text = logic.LogicName; Automationview(refresview, no); }); |
| | | logicCommunalPage.Show(() => {
|
| | | logicnameBtn.Text = logic.LogicName; |
| | | Automationview(refresview, no); |
| | | }); |
| | | |
| | | }; |
| | | |
| | | |
| | | ///删除 |
| | | var del = new Button |
| | |
| | | logicRowlayout.AddRightView(del); |
| | | del.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var alert = new Alert(Language.StringByID(MyInternationalizationString.tip), Language.StringByID(MyInternationalizationString.doyouwanttodelete), |
| | | Language.StringByID(MyInternationalizationString.cancel), Language.StringByID(MyInternationalizationString.confrim)); |
| | | alert.ResultEventHandler += (sender1, e1) => |
| | | { |
| | | if (e1) |
| | | var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm,
|
| | | Language.StringByID(MyInternationalizationString.doyouwanttodelete),
|
| | | Language.StringByID(MyInternationalizationString.confrim));
|
| | | alert.Show();
|
| | | alert.ConfirmClickEvent += () =>
|
| | | { |
| | | Common.Logic.LogicList.Remove(logic); |
| | | Automationview(refresview, no); |
| | | Logic.Send.DelLogic(logic.LogicId); |
| | | } |
| | | }; |
| | | |
| | | }; |
| | | var line = new Button |
| | | { |
| | | Y = fLayout.Height-1, |
| | | Height =1, |
| | | X = Application.GetRealWidth(58), |
| | | Y = Application.GetRealHeight(215), |
| | | Height = Application.GetRealHeight(5),
|
| | | Width = Application.GetRealWidth(1080 - 58), |
| | | BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor, |
| | | X = Application.GetRealWidth(58), |
| | | }; |
| | | fLayout.AddChidren(line); |
| | | logicRowlayout.AddChidren(line); |
| | | } |
| | | |
| | | } |
| | |
| | | logicRowlayout.AddChidren(logictimeBtn); |
| | | |
| | | ///显示执行周期 |
| | | Logic.Method.UpdateWeek(logictimeBtn, logic); |
| | | switch (logic.TimeAttribute.Repeat) |
| | | { |
| | | ///0:只执行一次,执行后IsEnable值置;1,今年内执行;2:每天执行;3:每月执行;4:每年执行;5:周重复。 |
| | | case 0: |
| | | { |
| | | logictimeBtn.Text = Language.StringByID(MyInternationalizationString.executeonce); |
| | | }; break; |
| | | case 1: { }; break; |
| | | case 2: |
| | | { |
| | | logictimeBtn.Text = Language.StringByID(MyInternationalizationString.everyday); |
| | | }; break; |
| | | case 3: |
| | | { |
| | | |
| | | string len = "", value = ""; |
| | | var stringvalue = Convert.ToString(logic.TimeAttribute.MonthDate, 2); |
| | | var str = stringvalue.Insert(0, new string('0', 32 - stringvalue.Length)); |
| | | for (int j = 31; j >= 0; j--) |
| | | { |
| | | len += str.Substring(j, 1); |
| | | } |
| | | for (int j = 0; j < len.Length; j++) |
| | | { |
| | | var strvalue = len.Substring(j, 1); |
| | | if (strvalue == "1") |
| | | { |
| | | value += (j + 1).ToString() + ","; |
| | | } |
| | | } |
| | | logictimeBtn.Text = Language.StringByID(MyInternationalizationString.monthly) + value.TrimEnd(',') + Language.StringByID(MyInternationalizationString.day); |
| | | |
| | | }; break; |
| | | case 4: |
| | | { |
| | | |
| | | Dictionary<int, int> dictionary = new Dictionary<int, int>(); |
| | | ///找出执行的月份和天数 |
| | | if (logic.TimeAttribute.SelectMonDate.Count != 0) |
| | | { |
| | | for (int i = 0; i < logic.TimeAttribute.SelectMonDate.Count; i++) |
| | | { |
| | | var dayvalue = logic.TimeAttribute.SelectMonDate[i]; |
| | | if (dayvalue != 0) |
| | | { |
| | | dictionary.Add(i + 1, dayvalue); |
| | | } |
| | | } |
| | | } |
| | | if (dictionary.Count != 0 && dictionary.Count == 1) |
| | | { |
| | | string len = "", leng = ""; |
| | | int minvalue = 0, Maximum = 0; |
| | | foreach (var value in dictionary) |
| | | { |
| | | ///取出月份 |
| | | var month = value.Key; |
| | | ///取出日数 |
| | | var day = value.Value; |
| | | var maxvalue = Convert.ToString(day, 2); |
| | | var str = maxvalue.Insert(0, new string('0', 32 - maxvalue.Length)); |
| | | for (int j = 31; j >= 0; j--) |
| | | { |
| | | len += str.Substring(j, 1); |
| | | } |
| | | |
| | | for (int j = 0; j < len.Length; j++) |
| | | { |
| | | var strvalue = len.Substring(j, 1); |
| | | if (strvalue == "1") |
| | | { |
| | | minvalue = j + 1; |
| | | break; |
| | | } |
| | | } |
| | | for (int j = 0; j < len.Length; j++) |
| | | { |
| | | var strvalue = len.Substring(j, 1); |
| | | if (strvalue == "1") |
| | | { |
| | | Maximum = j + 1; |
| | | } |
| | | } |
| | | |
| | | if (month.ToString().Length < 2) |
| | | { |
| | | leng = "0" + month.ToString(); |
| | | } |
| | | else |
| | | { |
| | | leng = month.ToString(); |
| | | } |
| | | if (minvalue == Maximum) |
| | | { |
| | | logictimeBtn.Text = Language.StringByID(MyInternationalizationString.everyyear) + leng + "/" + (minvalue.ToString().Length < 2 ? "0" + minvalue.ToString() : minvalue.ToString()); |
| | | } |
| | | else |
| | | { |
| | | logictimeBtn.Text = Language.StringByID(MyInternationalizationString.everyyear) + leng + "/" + (minvalue.ToString().Length < 2 ? "0" + minvalue.ToString() : minvalue.ToString()) + "-" + leng + "/" + (Maximum.ToString().Length < 2 ? "0" + Maximum.ToString() : Maximum.ToString()); |
| | | } |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | int b = 0; |
| | | string stringtext = ""; |
| | | foreach (var value in dictionary) |
| | | { |
| | | string len = "", leng = ""; |
| | | int minvalue = 0, Maximum = 0; |
| | | ///取出月份 |
| | | var month = value.Key; |
| | | ///取出日数 |
| | | var day = value.Value; |
| | | var maxvalue = Convert.ToString(day, 2); |
| | | var str = maxvalue.Insert(0, new string('0', 32 - maxvalue.Length)); |
| | | for (int j = 31; j >= 0; j--) |
| | | { |
| | | len += str.Substring(j, 1); |
| | | } |
| | | |
| | | |
| | | if (month.ToString().Length < 2) |
| | | { |
| | | leng = "0" + month.ToString(); |
| | | } |
| | | else |
| | | { |
| | | leng = month.ToString(); |
| | | } |
| | | |
| | | |
| | | |
| | | if (b == 0) |
| | | { |
| | | for (int j = 0; j < len.Length; j++) |
| | | { |
| | | var strvalue = len.Substring(j, 1); |
| | | if (strvalue == "1") |
| | | { |
| | | minvalue = j + 1; |
| | | break; |
| | | } |
| | | } |
| | | stringtext += leng + "/" + (minvalue.ToString().Length < 2 ? "0" + minvalue.ToString() : minvalue.ToString()) + "-"; |
| | | |
| | | } |
| | | |
| | | if (b == dictionary.Count - 1) |
| | | { |
| | | for (int j = 0; j < len.Length; j++) |
| | | { |
| | | var strvalue = len.Substring(j, 1); |
| | | if (strvalue == "1") |
| | | { |
| | | Maximum = j + 1; |
| | | } |
| | | } |
| | | stringtext += leng + "/" + (Maximum.ToString().Length < 2 ? "0" + Maximum.ToString() : Maximum.ToString()); |
| | | |
| | | } |
| | | b++; |
| | | } |
| | | logictimeBtn.Text = Language.StringByID(MyInternationalizationString.everyyear) + stringtext; |
| | | } |
| | | |
| | | }; break; |
| | | case 5: |
| | | { |
| | | string len = "", text = ""; |
| | | List<int> listvalueInt = new List<int>(); |
| | | listvalueInt.Clear(); |
| | | var maxvalue = Convert.ToString(logic.TimeAttribute.WeekDay, 2); |
| | | var str = maxvalue.Insert(0, new string('0', 8 - maxvalue.Length)); |
| | | for (int j = 7; j >= 0; j--) |
| | | { |
| | | len += str.Substring(j, 1); |
| | | } |
| | | |
| | | for (int j = 0; j < len.Length; j++) |
| | | { |
| | | var strvalue = len.Substring(j, 1); |
| | | if (strvalue == "1") |
| | | { |
| | | listvalueInt.Add(j + 1); |
| | | |
| | | |
| | | if ((j + 1) == 1) |
| | | { |
| | | text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.mon1) + ","; |
| | | //text += Language.StringByID(MyInternationalizationString.mon) + ","; |
| | | } |
| | | else if ((j + 1) == 2) |
| | | { |
| | | text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.tue1) + ","; |
| | | //text += Language.StringByID(MyInternationalizationString.tue) + ","; |
| | | } |
| | | else if ((j + 1) == 3) |
| | | { |
| | | text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.wed1) + ","; |
| | | //text += Language.StringByID(MyInternationalizationString.wed) + ","; |
| | | } |
| | | else if ((j + 1) == 4) |
| | | { |
| | | text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.thu1) + ","; |
| | | //text += Language.StringByID(MyInternationalizationString.thu) + ","; |
| | | } |
| | | else if ((j + 1) == 5) |
| | | { |
| | | text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.frl1) + ","; |
| | | //text += Language.StringByID(MyInternationalizationString.frl) + ","; |
| | | } |
| | | else if ((j + 1) == 6) |
| | | { |
| | | text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.sat1) + ","; |
| | | //text += Language.StringByID(MyInternationalizationString.sat) + ","; |
| | | } |
| | | else if ((j + 1) == 7) |
| | | { |
| | | text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.sun1) + ","; |
| | | //text += Language.StringByID(MyInternationalizationString.sun) + ","; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | //暂时隐藏掉,需要显示周末和工作日再放开; |
| | | //if (listvalueInt.Count == 5 && !listvalueInt.Contains(6) && !listvalueInt.Contains(7)) |
| | | //{ |
| | | // btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.workingday); |
| | | //} |
| | | //else if (listvalueInt.Count == 2 && listvalueInt.Contains(6) && listvalueInt.Contains(7)) |
| | | //{ |
| | | // btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.weekend); |
| | | //} |
| | | //else if (listvalueInt.Count == 7) |
| | | //{ |
| | | // btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.everyday); |
| | | //} |
| | | //else |
| | | //{ |
| | | // btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.week1) + text.Replace(Language.StringByID(MyInternationalizationString.week1), "").TrimEnd(','); |
| | | //} |
| | | logictimeBtn.Text = Language.StringByID(MyInternationalizationString.week1) + text.Replace(Language.StringByID(MyInternationalizationString.week1), "").TrimEnd(','); |
| | | //btndisplaycycle.Text = text.TrimEnd(','); |
| | | }; break; |
| | | } |
| | | |
| | | List<string> indexlist = new List<string>(); |
| | | List<string> iconIndexlist = new List<string>(); |
| | |
| | | var iconindex = iconIndexlist[i]; |
| | | var typebjBtn = new FrameLayout |
| | | { |
| | | Width = Application.GetMinRealAverage(82), |
| | | Height = Application.GetMinRealAverage(82), |
| | | Width = Application.GetRealWidth(82), |
| | | Height = Application.GetRealHeight(82), |
| | | X = Application.GetRealWidth(58) + Application.GetRealWidth(12 + (12 + 82 + 45 + 12) * i), |
| | | Y = Application.GetRealHeight(58 + 30 + 30), |
| | | Radius = (uint)Application.GetMinRealAverage(41), |
| | | Radius = (uint)Application.GetRealHeight(41), |
| | | BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, |
| | | }; |
| | | logicRowlayout.AddChidren(typebjBtn); |
| | | |
| | | var typeIconBtn = new Button |
| | | { |
| | | Width = Application.GetMinRealAverage(58), |
| | | Height = Application.GetMinRealAverage(58), |
| | | Width = Application.GetRealWidth(58), |
| | | Height = Application.GetRealHeight(58), |
| | | Gravity = Gravity.Center, |
| | | |
| | | }; |