New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using Shared; |
| | | using Shared.R; |
| | | using Shared.Phone; |
| | | using Shared.Common; |
| | | namespace Shared.Phone.Device.Logic |
| | | { |
| | | public class WeekPage : FrameLayout |
| | | { |
| | | public WeekPage () |
| | | { |
| | | Tag = "Logic"; |
| | | } |
| | | |
| | | public void Show (string titlename) |
| | | { |
| | | |
| | | #region 界面的布局代码 |
| | | TopView view = new TopView(); |
| | | this.AddChidren(view.TopRowView()); |
| | | view.toptitleNameBtn.Text=titlename; |
| | | view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; |
| | | var middle = new VerticalScrolViewLayout |
| | | { |
| | | Y = view.topRowLayout.Bottom, |
| | | Height = Application.GetRealHeight(Method.H - 184-260), |
| | | BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, |
| | | }; |
| | | this.AddChidren(middle); |
| | | LogicView.SaveView saveView = new LogicView.SaveView(); |
| | | saveView.frameLayout.Y = middle.Bottom; |
| | | this.AddChidren(saveView.Show()); |
| | | #endregion |
| | | |
| | | var weeklist = new List<string>(); |
| | | if (Common.Logic.CurrentLogic.TimeAttribute.Repeat == 5) |
| | | { |
| | | string len = ""; |
| | | var maxvalue = Convert.ToString(Common.Logic.CurrentLogic.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") |
| | | { |
| | | if ((j + 1) == 1) |
| | | { |
| | | weeklist.Add(Language.StringByID(MyInternationalizationString.mon)); |
| | | } |
| | | else if ((j + 1) == 2) |
| | | { |
| | | weeklist.Add(Language.StringByID(MyInternationalizationString.tue)); |
| | | } |
| | | else if ((j + 1) == 3) |
| | | { |
| | | weeklist.Add(Language.StringByID(MyInternationalizationString.wed)); |
| | | } |
| | | else if ((j + 1) == 4) |
| | | { |
| | | weeklist.Add(Language.StringByID(MyInternationalizationString.thu)); |
| | | } |
| | | else if ((j + 1) == 5) |
| | | { |
| | | weeklist.Add(Language.StringByID(MyInternationalizationString.frl)); |
| | | } |
| | | else if ((j + 1) == 6) |
| | | { |
| | | weeklist.Add(Language.StringByID(MyInternationalizationString.sat)); |
| | | } |
| | | else if ((j + 1) == 7) |
| | | { |
| | | weeklist.Add(Language.StringByID(MyInternationalizationString.sun)); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | var cyclelist = new List<string> (); |
| | | cyclelist.AddRange (new string [] { |
| | | Language.StringByID(MyInternationalizationString.mon), |
| | | Language.StringByID(MyInternationalizationString.tue), |
| | | Language.StringByID(MyInternationalizationString.wed), |
| | | Language.StringByID(MyInternationalizationString.thu), |
| | | Language.StringByID(MyInternationalizationString.frl), |
| | | Language.StringByID(MyInternationalizationString.sat), |
| | | Language.StringByID(MyInternationalizationString.sun), |
| | | }); |
| | | foreach (var name in cyclelist) |
| | | { |
| | | |
| | | FunView monView = new FunView(); |
| | | monView.iconBtn.UnSelectedImagePath = "ZigeeLogic/point.png"; |
| | | monView.funnameBtn.Text= name; |
| | | monView.funnextBtn.Width = Application.GetMinRealAverage(60); |
| | | monView.funnextBtn.Height = Application.GetMinRealAverage(60); |
| | | monView.funnextBtn.UnSelectedImagePath = "ZigeeLogic/selected.png"; |
| | | monView.funnextBtn.Visible = false; |
| | | middle.AddChidren(monView.FunFrameView()); |
| | | if (Language.StringByID(MyInternationalizationString.sun) == name) |
| | | { |
| | | monView.funFrameLayout.Height = Application.GetRealHeight(160 + 20);//最后一行增加20高度; |
| | | monView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; ///改变最后功能快线条颜色 |
| | | } |
| | | |
| | | var str = weeklist.Find((o) => { return o == name; }); |
| | | if (str != null) |
| | | { |
| | | monView.funnextBtn.Visible = true; |
| | | } |
| | | monView.clickviewBtn.MouseUpEventHandler+= (sender, e) => |
| | | { |
| | | monView.funnextBtn.Visible = !monView.funnextBtn.Visible; |
| | | if (monView.funnextBtn.Visible) |
| | | { |
| | | var d = weeklist.Find((o) => { return o == name; }); |
| | | if (d == null) |
| | | { |
| | | weeklist.Add(name); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | weeklist.RemoveAll((o) => |
| | | { |
| | | return o == name; |
| | | }); |
| | | } |
| | | |
| | | }; |
| | | |
| | | } |
| | | saveView.clickviewBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | |
| | | int weekvalue = 0; |
| | | foreach (var strname in weeklist) |
| | | { |
| | | if (Language.StringByID(MyInternationalizationString.mon) == strname) |
| | | { |
| | | weekvalue += 1; |
| | | } |
| | | else if (Language.StringByID(MyInternationalizationString.tue) == strname) |
| | | { |
| | | weekvalue += 2; |
| | | } |
| | | else if (Language.StringByID(MyInternationalizationString.wed) == strname) |
| | | { |
| | | weekvalue += 4; |
| | | } |
| | | else if (Language.StringByID(MyInternationalizationString.thu) == strname) |
| | | { |
| | | weekvalue += 8; |
| | | } |
| | | else if (Language.StringByID(MyInternationalizationString.frl) == strname) |
| | | { |
| | | weekvalue += 16; |
| | | } |
| | | else if (Language.StringByID(MyInternationalizationString.sat) == strname) |
| | | { |
| | | weekvalue += 32; |
| | | } |
| | | else if (Language.StringByID(MyInternationalizationString.sun) == strname) |
| | | { |
| | | weekvalue += 64; |
| | | } |
| | | } |
| | | if (weekvalue == 0) |
| | | { |
| | | var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, |
| | | Language.StringByID(MyInternationalizationString.selectweek), |
| | | Language.StringByID(MyInternationalizationString.confrim)); |
| | | alert.Show(); |
| | | return; |
| | | } |
| | | Common.Logic.CurrentLogic.TimeAttribute.Repeat = 5; |
| | | Common.Logic.CurrentLogic.TimeAttribute.WeekDay = weekvalue; |
| | | |
| | | var logicCommunalPage = new LogicCommunalPage { }; |
| | | UserView.HomePage.Instance.AddChidren(logicCommunalPage); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | logicCommunalPage.Show(() => { }); |
| | | }; |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | } |