| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.DAL.Server; |
| | | using HDL_ON.Entity; |
| | | using Shared; |
| | | |
| | |
| | | { |
| | | LoadEvent_SwitchHome(); |
| | | LoadEvent_GoPersonalDataPage(); |
| | | if (MainPage.LoginUser.accountType == 0) |
| | | LoadEvent_SkipAboutOnPage(); |
| | | LoadEvent_SkipGetSupportPage(); |
| | | if (!DB_ResidenceData.Instance.CurrentRegion.isOtherShare) |
| | | { |
| | | LoadEvent_SkipResdentialManagePage(); |
| | | LoadEvent_GoMemberManagement(); |
| | | LoadEvent_SkipbtnAddFunctionPage(); |
| | | LoadEvent_SkipSmartSpeakerPage(); |
| | | } |
| | | if(DB_ResidenceData.Instance.GatewayType == 1) |
| | | { |
| | | LoadEvent_SecurityEvent(); |
| | | } |
| | | } |
| | | |
| | | LoadEvent_GoMemberManagement(); |
| | | /// <summary> |
| | | /// 安防部分事件 |
| | | /// </summary> |
| | | void LoadEvent_SecurityEvent() |
| | | { |
| | | if (btnResidenceArmIcon != null) |
| | | { |
| | | btnResidenceArmIcon.IsSelected = false; |
| | | lock (FunctionList.List.securities) |
| | | { |
| | | foreach (var temp in FunctionList.List.securities) |
| | | { |
| | | if (temp.status == "enable") |
| | | { |
| | | if (temp.alarm) |
| | | { |
| | | btnResidenceArmIcon.SelectedImagePath = "PersonalCenter/ResidenceInAlarmIcon.png"; |
| | | } |
| | | else |
| | | { |
| | | btnResidenceArmIcon.SelectedImagePath = "PersonalCenter/ResidenceDefenseIcon.png"; |
| | | } |
| | | btnResidenceArmIcon.IsSelected = true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | btnResidenceArmIcon.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | var page = new ArmCenterPage(); |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | } |
| | | if (btnResidenceArmText != null) |
| | | { |
| | | btnResidenceArmText.TextID = StringId.Undefense; |
| | | foreach (var temp in FunctionList.List.securities) |
| | | { |
| | | if (temp.status == "enable") |
| | | { |
| | | btnResidenceArmText.TextID = StringId.Defense; |
| | | break; |
| | | } |
| | | } |
| | | btnResidenceArmText.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | var page = new ArmCenterPage(); |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | } |
| | | } |
| | | |
| | | #region 切换住宅 |
| | |
| | | /// </summary> |
| | | void LoadEvent_SwitchHome() |
| | | { |
| | | #if DEBUG |
| | | btnUserTypeName.MouseUpEventHandler = (sender, e) => |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | var pm = new HDL_ON.DAL.Server.HttpServerRequest(); |
| | | var iddd = pm.GetRegionLastBackupId(); |
| | | Dialog dialog = new Dialog(); |
| | | |
| | | FrameLayout bodyView = new FrameLayout(); |
| | | dialog.AddChidren(bodyView); |
| | | bodyView.MouseUpEventHandler = (sender3, e3) => { |
| | | dialog.Close(); |
| | | }; |
| | | |
| | | FrameLayout frame = new FrameLayout() |
| | | { |
| | | Gravity = Gravity.Center, |
| | | Width = Application.GetRealWidth(280), |
| | | Height =Application.GetRealHeight(300), |
| | | BackgroundColor = CSS.CSS_Color.MainBackgroundColor, |
| | | Radius = (uint)Application.GetRealWidth(16), |
| | | }; |
| | | dialog.AddChidren(frame); |
| | | |
| | | Button btnTitleDialog = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(60), |
| | | TextAlignment = TextAlignment.Center, |
| | | Text = "数据恢复", |
| | | TextSize = CSS.CSS_FontSize.SubheadingFontSize, |
| | | TextColor = CSS.CSS_Color.SecondLevelTitleColor, |
| | | BackgroundColor = CSS.CSS_Color.PromptingColor2, |
| | | }; |
| | | frame.AddChidren(btnTitleDialog); |
| | | |
| | | VerticalScrolViewLayout view = new VerticalScrolViewLayout() |
| | | { |
| | | Y = Application.GetRealHeight(60), |
| | | Height = Application.GetRealHeight(240), |
| | | }; |
| | | frame.AddChidren(view); |
| | | |
| | | foreach(var dd in iddd) |
| | | { |
| | | Button btn = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS.CSS_FontSize.TextFontSize, |
| | | TextColor = CSS.CSS_Color.TextualColor, |
| | | Text = dd.Value, |
| | | }; |
| | | view.AddChidren(btn); |
| | | |
| | | btn.MouseUpEventHandler = (sender1, e1) => |
| | | { |
| | | dialog.Close(); |
| | | pm.GetBackupFileList(dd.Key); |
| | | }; |
| | | |
| | | view.AddChidren(new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Height = Application.GetRealHeight(1), |
| | | BackgroundColor = CSS.CSS_Color.BackgroundColor |
| | | }); |
| | | } |
| | | |
| | | dialog.Show(); |
| | | |
| | | }; |
| | | #endif |
| | | |
| | | |
| | | btnCurResidenceName.MouseUpEventHandler += (sender, e) => { |
| | | var dialog = new Dialog(); |
| | | var dialogBody = new FrameLayout(); |
| | | dialog.AddChidren(dialogBody); |
| | | dialogBody.MouseUpEventHandler += (sender1, e1) => { |
| | | dialogBody.MouseUpEventHandler = (sender1, e1) => |
| | | { |
| | | dialog.Close(); |
| | | }; |
| | | |
| | | var dispalyView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(22), |
| | | X = Application.GetRealWidth(10), |
| | | Y = Application.GetRealHeight(268), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealHeight(198), |
| | | BackgroundImagePath = "PersonalCenter/HomeListbg.png", |
| | | Height = Application.GetRealHeight(110), |
| | | BackgroundImagePath = "PersonalCenter/HomeList1bg.png", |
| | | }; |
| | | dialogBody.AddChidren(dispalyView); |
| | | |
| | | var contentView = new VerticalScrolViewLayout() { |
| | | X = Application.GetRealWidth(8), |
| | | var contentView = new VerticalScrolViewLayout() |
| | | { |
| | | X = Application.GetRealWidth(22), |
| | | Y = Application.GetRealHeight(15), |
| | | Width = Application.GetRealWidth(150), |
| | | Height = Application.GetRealHeight(45*4), |
| | | Height = Application.GetRealHeight(45), |
| | | ScrollEnabled = false |
| | | }; |
| | | dispalyView.AddChidren(contentView); |
| | | |
| | | foreach(var home in MainPage.LoginUser.regionList) |
| | | if (UserInfo.Current.regionList.Count < 2) |
| | | { |
| | | |
| | | } |
| | | else if (UserInfo.Current.regionList.Count < 3) |
| | | { |
| | | dispalyView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(10), |
| | | Y = Application.GetRealHeight(268), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealHeight(105), |
| | | BackgroundImagePath = "PersonalCenter/HomeList1bg.png", |
| | | }; |
| | | dialogBody.AddChidren(dispalyView); |
| | | |
| | | contentView.Height = Application.GetRealHeight(45 * 2); |
| | | dispalyView.AddChidren(contentView); |
| | | } |
| | | else if (UserInfo.Current.regionList.Count < 4) |
| | | { |
| | | dispalyView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(10), |
| | | Y = Application.GetRealHeight(268), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealHeight(155), |
| | | BackgroundImagePath = "PersonalCenter/HomeList2bg.png", |
| | | }; |
| | | dialogBody.AddChidren(dispalyView); |
| | | |
| | | contentView.Height = Application.GetRealHeight(45 * 3); |
| | | dispalyView.AddChidren(contentView); |
| | | } |
| | | else if (UserInfo.Current.regionList.Count < 5) |
| | | { |
| | | dispalyView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(10), |
| | | Y = Application.GetRealHeight(268), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealHeight(200), |
| | | BackgroundImagePath = "PersonalCenter/HomeList3bg.png", |
| | | }; |
| | | dialogBody.AddChidren(dispalyView); |
| | | |
| | | contentView.Height = Application.GetRealHeight(45 * 4); |
| | | dispalyView.AddChidren(contentView); |
| | | } |
| | | else |
| | | { |
| | | dispalyView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(10), |
| | | Y = Application.GetRealHeight(268), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealHeight(245), |
| | | BackgroundImagePath = "PersonalCenter/HomeList4bg.png", |
| | | }; |
| | | dialogBody.AddChidren(dispalyView); |
| | | |
| | | contentView.Height = Application.GetRealHeight(45 * 5); |
| | | contentView.ScrollEnabled = true; |
| | | dispalyView.AddChidren(contentView); |
| | | } |
| | | |
| | | |
| | | |
| | | foreach (var home in UserInfo.Current.regionList) |
| | | { |
| | | var btnHomeName = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(44), |
| | | Height = Application.GetRealHeight(40), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS.CSS_Color.FirstLevelTitleColor, |
| | | SelectedTextColor = CSS.CSS_Color.MainColor, |
| | | Text = home.Name, |
| | | TextSize = home.Name.Length > 14 ? CSS.CSS_FontSize.TextFontSize : CSS.CSS_FontSize.SubheadingFontSize, |
| | | IsSelected = DB_ResidenceData.residenceData.residecenInfo.RegionID == home.RegionID, |
| | | Text = home.homeName, |
| | | TextSize = home.homeName.Length > 14 ? CSS.CSS_FontSize.TextFontSize : CSS.CSS_FontSize.SubheadingFontSize, |
| | | IsSelected = DB_ResidenceData.Instance.CurrentRegion.id == home.id, |
| | | IsMoreLines = true, |
| | | Tag = MainPage.LoginUser.regionList.IndexOf(home) |
| | | Tag = home.id |
| | | }; |
| | | contentView.AddChidren(btnHomeName); |
| | | //if(btnHomeName) |
| | | |
| | | if (MainPage.LoginUser.regionList.IndexOf(home) < MainPage.LoginUser.regionList.Count - 1) |
| | | if (UserInfo.Current.regionList.IndexOf(home) < UserInfo.Current.regionList.Count - 1) |
| | | { |
| | | contentView.AddChidren(new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(1), |
| | | BackgroundColor = CSS.CSS_Color.BackgroundColor |
| | |
| | | |
| | | btnHomeName.MouseUpEventHandler += (senderH, en) => |
| | | { |
| | | var regionIndex = (int)btnHomeName.Tag; |
| | | var regionId = (string)btnHomeName.Tag; |
| | | dialog.Close(); |
| | | |
| | | DB_ResidenceData.residenceData.CurReginIndex = regionIndex; |
| | | btnCurResidenceName.Text = DB_ResidenceData.residenceData.residecenInfo.Name; |
| | | OnAppConfig.Instance.SaveUserConfig(); |
| | | LoadEvent_ChangeCurHome(home); |
| | | LoadContentView(); |
| | | }; |
| | | } |
| | | |
| | | dialog.Show(); |
| | | }; |
| | | } |
| | | |
| | | btnResidenceDownIcon.MouseUpEventHandler = eventHandler; |
| | | btnCurResidenceName.MouseUpEventHandler = eventHandler; |
| | | } |
| | | /// <summary> |
| | | /// 更换当前选中住宅 |
| | | /// </summary> |
| | | /// <param name="homeTemp"></param> |
| | | void LoadEvent_ChangeCurHome(RegionInfoRes homeTemp) |
| | | { |
| | | if (DB_ResidenceData.Instance.CurrentRegion.id == homeTemp.id) |
| | | { |
| | | return; |
| | | } |
| | | DB_ResidenceData.Instance.CurrentRegion = homeTemp; |
| | | DB_ResidenceData.Instance.SaveResidenceData(); |
| | | btnCurResidenceName.Text = DB_ResidenceData.Instance.CurrentRegion.homeName; |
| | | DB_ResidenceData.Instance.EixtAccount(); |
| | | //刷新住宅数据 |
| | | Common.ApiUtlis.Ins.DownloadData(); |
| | | } |
| | | #endregion |
| | | |
| | | #region 住宅管理 |
| | | void LoadEvent_SkipResdentialManagePage() |
| | | { |
| | | if (MainPage.LoginUser.accountType == 0) |
| | | if (!DB_ResidenceData.Instance.CurrentRegion.isOtherShare) |
| | | { |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | Action updateResidenceName = () => { |
| | | btnCurResidenceName.Text = DB_ResidenceData.residenceData.residecenInfo.Name; |
| | | Action updateResidenceName = () => |
| | | { |
| | | btnCurResidenceName.Text = DB_ResidenceData.Instance.CurrentRegion.homeName; |
| | | }; |
| | | var residentialManagePage = new ResidentialManagePage(updateResidenceName); |
| | | MainPage.BasePageView.AddChidren(residentialManagePage); |
| | |
| | | #region 个人中心 |
| | | void LoadEvent_GoPersonalDataPage() |
| | | { |
| | | userHeadImageView.MouseUpEventHandler += (sender, e) => { |
| | | Action updataHeadImage = () => { |
| | | userHeadImageView.ImagePath = MainPage.LoginUser.headImagePagePath; |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | Action updataHeadImage = () => |
| | | { |
| | | userHeadImageView.ImagePath = UserInfo.Current.headImagePagePath; |
| | | }; |
| | | Action updataUserName = () => { |
| | | btnUserName.Text = MainPage.LoginUser.userName; |
| | | Action updataUserName = () => |
| | | { |
| | | btnUserName.Text = UserInfo.Current.userName; |
| | | }; |
| | | |
| | | var personalDataView = new PersonalDataPage(updataHeadImage,updataUserName); |
| | | var personalDataView = new PersonalDataPage(updataHeadImage, updataUserName); |
| | | MainPage.BasePageView.AddChidren(personalDataView); |
| | | personalDataView.LoadView(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | userHeadImageView.MouseUpEventHandler = eventHandler; |
| | | btnUserName.MouseUpEventHandler = eventHandler; |
| | | btnEmail.MouseUpEventHandler = eventHandler; |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | #region 成员管理 |
| | | void LoadEvent_GoMemberManagement() |
| | | { |
| | | |
| | | EventHandler<MouseEventArgs> eHandler = (sender, e) => { |
| | | //}; |
| | | //residenceMemberView.MouseUpEventHandler = (sender, e) => { |
| | | //Action updataHeadImage = () => { |
| | | // userHeadImageView.ImagePath = MainPage.LoginUser.headImagePagePath; |
| | | //}; |
| | | //Action updataUserName = () => { |
| | | // btnUserName.Text = MainPage.LoginUser.userName; |
| | | //}; |
| | | |
| | | EventHandler<MouseEventArgs> eHandler = (sender, e) => |
| | | { |
| | | var mmp = new MemberManagementPage(); |
| | | MainPage.BasePageView.AddChidren(mmp); |
| | | mmp.LoadPage(); |
| | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 添加设备 |
| | | void LoadEvent_SkipbtnAddFunctionPage() |
| | | { |
| | | if (DB_ResidenceData.Instance.GatewayType == 1) |
| | | { |
| | | try |
| | | { |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | var page = new BrandListPage(); |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | btnResidenceAddFunctionIcon.MouseUpEventHandler = eventHandler; |
| | | btnResidenceAddFunctionText.MouseUpEventHandler = eventHandler; |
| | | } |
| | | catch { } |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 关于On、获取支持 |
| | | /// <summary> |
| | | /// 跳转至关于On页面 |
| | | /// </summary> |
| | | void LoadEvent_SkipAboutOnPage() |
| | | { |
| | | btnAboutOnText.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | var aboutOnPage = new AboutOnPage(); |
| | | MainPage.BasePageView.AddChidren(aboutOnPage); |
| | | aboutOnPage.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | } |
| | | /// <summary> |
| | | /// 跳转至获取支持页面 |
| | | /// </summary> |
| | | void LoadEvent_SkipGetSupportPage() |
| | | { |
| | | btnSupportText.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | var getsupportPage = new FAQHelpPage(); |
| | | MainPage.BasePageView.AddChidren(getsupportPage); |
| | | getsupportPage.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 跳转智能音箱页面 |
| | | /// </summary> |
| | | void LoadEvent_SkipSmartSpeakerPage() |
| | | { |
| | | btnSmartSpeakerText.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | var page = new SmartSpeakerListPage(); |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | } |
| | | } |
| | | } |