From 8e5edbe461cb589ac1fa6a0604fc4fc63e72203a Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期二, 18 八月 2020 14:11:21 +0800
Subject: [PATCH] 2020-08-18-01
---
ZigbeeApp/Shared/Phone/UserView/UserPage.cs | 890 +++++++++++++++++++++++------------------------------------
1 files changed, 346 insertions(+), 544 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserView/UserPage.cs b/ZigbeeApp/Shared/Phone/UserView/UserPage.cs
index 3849b40..908cda3 100755
--- a/ZigbeeApp/Shared/Phone/UserView/UserPage.cs
+++ b/ZigbeeApp/Shared/Phone/UserView/UserPage.cs
@@ -1,333 +1,26 @@
锘縰sing System;
using System.Collections.Generic;
using Shared.Common;
-using ZigBee.Device;
-
+using System.Text;
+using Shared.Phone.UserCenter;
+
namespace Shared.Phone.UserView
{
/// <summary>
/// User page.
/// </summary>
- public class UserPage : FrameLayout,ZigBee.Common.IStatus
- {
- #region 鈼� 鍙橀噺_______________________
- /// <summary>
- /// The user menu page.
+ public class UserPage : FrameLayout
+ {
+ #region 鈻� 鍙橀噺澹版槑___________________________
+
+ /// <summary>
+ /// 褰撳墠閫夋嫨鐨勮彍鍗�
/// </summary>
- static UserPage userMenuPage;
+ private MenuSelectEnum nowSelectMenu = MenuSelectEnum.A鏈�夋嫨;
/// <summary>
- /// 搴曢儴鍗曠嫭鑿滃崟鐨勫搴�-360
+ /// 鐢ㄦ埛鐣岄潰
/// </summary>
- private static readonly int tabBarEnum_Width = CommonPage.AppRealWidth / 3;
- /// <summary>
- /// 搴曢儴鎸夐挳鍥剧墖鐨勯珮搴�-110
- /// </summary>
- private static readonly int tabBarEnumIMG_Height = 110;
- /// <summary>
- /// 搴曢儴鎸夐挳鍥剧墖鐨勫搴�-110
- /// </summary>
- private static readonly int tabBarEnumIMG_Width = 110;
- /// <summary>
- /// 搴曢儴鎸夐挳鍥剧墖鐨刌鍊� -5
- /// </summary>
- private static readonly int tabBarEnumIMG_Y = 5;
- /// <summary>
- /// 搴曢儴鎸夐挳鏂囧瓧鐨勯珮搴� -50
- /// </summary>
- private static readonly int tabBarEnumName_Height = 50;
- /// <summary>
- /// 搴曢儴鎸夐挳鏂囧瓧鐨刌鍊� 100
- /// </summary>
- private static readonly int tabBarEnumName_Y = tabBarEnumIMG_Height - 10;
- #endregion
-
- #region 鈼� 鎺ュ彛____________________________
-
- /// <summary>
- /// 璇ユ帴鍙e皢寮冪敤 !!!!!!
- /// 鏀圭敤DeviceInfoChange()
- /// </summary>
- /// <returns>The changed.</returns>
- /// <param name="common">Common.</param>
- public void Changed(CommonDevice common)
- {
-
- }
-
- /// <summary>
- /// 璁惧鐘舵�佹洿鏂版帴鍙�
- /// <para>type锛氬鏋滀负 DeviceInComingRespon:璁惧鏂颁笂鎶�</para>
- /// <para>type锛氬鏋滀负 IASInfoReport:RemoveDeviceRespon</para>
- /// <para>type锛氬鏋滀负 DeviceStatusReport:璁惧涓婃姤</para>
- /// <para>type锛氬鏋滀负 IASInfoReport:IAS瀹夐槻淇℃伅涓婃姤</para>
- /// <para>type锛氬鏋滀负 OnlineStatusChange: 璁惧鍦ㄧ嚎鐘舵�佹洿鏂�</para>
- /// </summary>
- /// <param name="common">Common.</param>
- /// <param name="typeTag">Type tag.</param>
- public void DeviceInfoChange(CommonDevice common, string typeTag)
- {
- //璁惧涓婃姤鐘舵�佷腑 褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁�
- if (typeTag == "DeviceStatusReport")
- {
- try
- {
- for (int i = 0; i < Room.AllRoomDeviceUIList.Count; i++)
- {
- var deviceUI = Room.AllRoomDeviceUIList[i];
- if (deviceUI.CommonDevice == null)
- {
- //璁惧涓虹┖
- continue;
- }
- if (common.DeviceAddr != deviceUI.CommonDevice.DeviceAddr || common.DeviceEpoint != deviceUI.CommonDevice.DeviceEpoint)
- {
- //鍒ゆ柇鏄惁涓哄綋鍓嶈澶�
- continue;
- }
- switch (deviceUI.CommonDevice.Type)
- {
- case DeviceType.OnOffOutput:
- //寮�鍏冲姛鑳�
- if ((common as ZigBee.Device.ToggleLight).DeviceStatusReport.CluterID == 6)
- {
- var onOffOutputLight = deviceUI.CommonDevice as ZigBee.Device.ToggleLight;
- onOffOutputLight.DeviceStatusReport = (common as ZigBee.Device.ToggleLight).DeviceStatusReport;
- //璁板綍銆佹洿鏂扮姸鎬�
- if (onOffOutputLight.DeviceStatusReport.AttriBute == null || onOffOutputLight.DeviceStatusReport.AttriBute.Count == 0)
- {
- continue;
- }
- onOffOutputLight.OnOffStatus = onOffOutputLight.DeviceStatusReport.AttriBute[0].AttriButeData;
- //璁板綍鍥炲鏃堕棿
- onOffOutputLight.LastDateTime = DateTime.Now;
- }
- //褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁�
- if ((common as ZigBee.Device.ToggleLight).DeviceStatusReport.CluterID == 3)
- {
- var onOffOutputLight = deviceUI.CommonDevice as ToggleLight;
- onOffOutputLight.IsOnline = 1;
- //璁板綍鍥炲鏃堕棿
- onOffOutputLight.LastDateTime = DateTime.Now;
- }
- break;
-
- case DeviceType.AirSwitch:
- //寮�鍏冲姛鑳�
- if ((common as ZigBee.Device.AirSwitch).DeviceStatusReport.CluterID == 6)
- {
- var airSwitch = deviceUI.CommonDevice as ZigBee.Device.AirSwitch;
- airSwitch.DeviceStatusReport = (common as ZigBee.Device.AirSwitch).DeviceStatusReport;
- //璁板綍銆佹洿鏂扮姸鎬�
- if (airSwitch.DeviceStatusReport.AttriBute == null || airSwitch.DeviceStatusReport.AttriBute.Count == 0)
- {
- return;
- }
- airSwitch.OnOffStatus = airSwitch.DeviceStatusReport.AttriBute[0].AttriButeData;
- //璁板綍鍥炲鏃堕棿
- airSwitch.LastDateTime = DateTime.Now;
-
- }
- //褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁�
- if ((common as ZigBee.Device.AirSwitch).DeviceStatusReport.CluterID == 3)
- {
- var airSwitch = deviceUI.CommonDevice as AirSwitch;
- airSwitch.IsOnline = 1;
- //璁板綍鍥炲鏃堕棿
- airSwitch.LastDateTime = DateTime.Now;
- }
- break;
-
- case DeviceType.WindowCoveringDevice:
- if ((common as ZigBee.Device.Rollershade).DeviceStatusReport.CluterID == 3)
- {
- var rollershade = deviceUI.CommonDevice as ZigBee.Device.Rollershade;
- rollershade.IsOnline = 1;
- //璁板綍鍥炲鏃堕棿
- rollershade.LastDateTime = DateTime.Now;
- }
- break;
-
- case DeviceType.Thermostat:
- //AC鍔熻兘
- if ((common as ZigBee.Device.AC).DeviceStatusReport.CluterID == 513)
- {
- var ac = deviceUI.CommonDevice as ZigBee.Device.AC;
- ac.DeviceStatusReport = (common as ZigBee.Device.AC).DeviceStatusReport;
- var attriButeList = ac.DeviceStatusReport.AttriBute;
- if (attriButeList == null || attriButeList.Count == 0)
- {
- continue;
- }
- switch (attriButeList[0].AttributeId)
- {
- case 0:
- //姝ゅ睘鎬ц〃鏄庡鍐呭綋鍓嶇殑娓╁害 * 100锛屽疄闄呮俯搴︿负鈥淟ocalTemperature / 100鈥濓紝鍗曚綅锛氣剝
- ac.currentLocalTemperature = attriButeList[0].AttriButeData / 100;
- ac.LastDateTime = DateTime.Now;
- break;
-
- case 17:
- //姝ゅ睘鎬ц〃鏄庢璁惧褰撳墠鐨勫埗鍐锋俯搴︼紝瀹為檯娓╁害涓衡�淐oolingSetpoint / 100鈥濓紝鍗曚綅锛氣剝銆�
- ac.currentCoolingSetpoint = attriButeList[0].AttriButeData / 100;
- ac.LastDateTime = DateTime.Now;
- break;
-
- case 18:
- //姝ゅ睘鎬ц〃鏄庢璁惧褰撳墠鐨勫埗鐑俯搴︼紝瀹為檯娓╁害涓衡�淗eatingSetpoint / 100鈥濓紝鍗曚綅锛氣剝銆�
- ac.currentHeatingSetpoint = attriButeList[0].AttriButeData / 100;
- ac.LastDateTime = DateTime.Now;
- break;
-
- case 28:
- //姝ゅ睘鎬ф弿杩版亽娓╄澶囨澶勪簬鍝妯″紡
- //Off = 0 Auto = 1 Cool = 3 Heat = 4 FanOnly = 7 Dry = 8
- ac.currentSystemMode = attriButeList[0].AttriButeData;
- ac.LastDateTime = DateTime.Now;
- break;
-
- }
-
- }
- //褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁�
- if ((common as ZigBee.Device.AC).DeviceStatusReport.CluterID == 3)
- {
- var ac = deviceUI.CommonDevice as AC;
- ac.IsOnline = 1;
- //璁板綍鍥炲鏃堕棿
- ac.LastDateTime = DateTime.Now;
-
- }
- break;
-
- case DeviceType.DimmableLight:
- //璋冨厜鐏姛鑳�
- //寮�鍏冲姛鑳�
- if ((common as ZigBee.Device.DimmableLight).DeviceStatusReport.CluterID == 6)
- {
- var dimmableLight = deviceUI.CommonDevice as ZigBee.Device.DimmableLight;
- dimmableLight.DeviceStatusReport = (common as ZigBee.Device.DimmableLight).DeviceStatusReport;
- //璁板綍銆佹洿鏂扮姸鎬�
- if (dimmableLight.DeviceStatusReport.AttriBute == null || dimmableLight.DeviceStatusReport.AttriBute.Count == 0)
- {
- return;
- }
- dimmableLight.OnOffStatus = dimmableLight.DeviceStatusReport.AttriBute[0].AttriButeData;
- //璁板綍鍥炲鏃堕棿
- dimmableLight.LastDateTime = DateTime.Now;
- }
- //浜害
- if ((common as ZigBee.Device.DimmableLight).DeviceStatusReport.CluterID == 8)
- {
- var dimmableLight = deviceUI.CommonDevice as ZigBee.Device.DimmableLight;
- dimmableLight.DeviceStatusReport = (common as ZigBee.Device.DimmableLight).DeviceStatusReport;
- var attriButeList = dimmableLight.DeviceStatusReport.AttriBute;
- if (attriButeList == null || attriButeList.Count == 0)
- {
- continue;
- }
- switch (attriButeList[0].AttributeId)
- {
- case 0:
- //姝ゅ睘鎬ц〃鏄庡綋鍓嶄寒搴︾▼搴�
- dimmableLight.Level = attriButeList[0].AttriButeData;
- dimmableLight.LastDateTime = DateTime.Now;
- break;
- }
- }
- //褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁�
- if ((common as ZigBee.Device.DimmableLight).DeviceStatusReport.CluterID == 3)
- {
- var dimmableLight = deviceUI.CommonDevice as DimmableLight;
- dimmableLight.IsOnline = 1;
- //璁板綍鍥炲鏃堕棿
- dimmableLight.LastDateTime = DateTime.Now;
- }
- break;
- }
- }
- }
- catch (Exception ex)
- {
- System.Console.WriteLine($"Error:{ex.Message}");
- }
- }
- //璁惧鍦ㄧ嚎鐘舵�佷笂鎶�
- else if (typeTag == "OnlineStatusChange")
- {
- try
- {
- for (int i = 0; i < Room.AllRoomDeviceUIList.Count; i++)
- {
- var deviceUI = Room.AllRoomDeviceUIList[i];
- if (deviceUI.CommonDevice == null)
- {
- //璁惧涓虹┖鎴栬�呮帶浠朵负绌�
- continue;
- }
- if (common.DeviceAddr != deviceUI.CommonDevice.DeviceAddr || common.DeviceEpoint != deviceUI.CommonDevice.DeviceEpoint)
- {
- //鍒ゆ柇鏄惁涓哄綋鍓嶈澶�
- continue;
- }
- switch (deviceUI.CommonDevice.Type)
- {
- case DeviceType.OnOffOutput:
- var onOffOutputLight = deviceUI.CommonDevice as ToggleLight;
- onOffOutputLight.IsOnline = (common as ToggleLight).IsOnline;
- //璁板綍鍥炲鏃堕棿
- onOffOutputLight.LastDateTime = DateTime.Now;
- break;
- case DeviceType.AirSwitch:
- var airSwitch = deviceUI.CommonDevice as AirSwitch;
- airSwitch.IsOnline = (common as AirSwitch).IsOnline;
- //璁板綍鍥炲鏃堕棿
- airSwitch.LastDateTime = DateTime.Now;
- break;
- case DeviceType.WindowCoveringDevice:
- var rollershade = deviceUI.CommonDevice as ZigBee.Device.Rollershade;
- rollershade.IsOnline = (common as Rollershade).IsOnline;
- //璁板綍鍥炲鏃堕棿
- rollershade.LastDateTime = DateTime.Now;
- break;
- case DeviceType.Thermostat:
- var ac = deviceUI.CommonDevice as ZigBee.Device.AC;
- ac.IsOnline = (common as ZigBee.Device.AC).IsOnline;
- //璁板綍鍥炲鏃堕棿
- ac.LastDateTime = DateTime.Now;
- break;
- case DeviceType.DimmableLight:
- var dimmableLight = deviceUI.CommonDevice as ZigBee.Device.DimmableLight;
- dimmableLight.IsOnline = (common as ZigBee.Device.DimmableLight).IsOnline;
- //璁板綍鍥炲鏃堕棿
- dimmableLight.LastDateTime = DateTime.Now;
- break;
- }
- }
- }
- catch (Exception ex)
- {
- System.Console.WriteLine($"userpage鍔熻兘鍒锋柊-Error:{ex.Message}");
- }
- }
- }
- /// <summary>
- /// Changeds the IL ogic status.
- /// </summary>
- /// <param name="logic">Logic.</param>
- public void ChangedILogicStatus(ZigBee.Device.Logic logic)
- {
- //throw new NotImplementedException();
- }
- /// <summary>
- /// Changeds the IS cene status.
- /// </summary>
- /// <param name="scene">Scene.</param>
- public void ChangedISceneStatus(Scene scene)
- {
- //throw new NotImplementedException();
- }
- #endregion
-
+ private static UserPage userMenuPage = null;
/// <summary>
/// 鐢ㄦ埛鐣岄潰
/// </summary>
@@ -342,243 +35,352 @@
}
return userMenuPage;
}
- }
-
+ }
+
+ /// <summary>
+ /// 鐢ㄦ埛涓讳綋鐣岄潰锛堜腑闂撮儴鍒嗭級
+ /// </summary>
+ private FrameLayout bodyFrameView = null;
+ /// <summary>
+ /// 鐣岄潰缂撳瓨(2020.05.07:鍒囨崲鏃朵笉绉婚櫎鐣岄潰,鐩存帴闅愯棌)
+ /// </summary>
+ private List<EditorCommonForm> listForm = new List<EditorCommonForm>() { null, null, null };
+ /// <summary>
+ /// 鎺т欢缂撳瓨(鐪嬩笉鎳傜殑璇�,涓嶈鍔ㄥ畠)
+ /// </summary>
+ private List<ButtonBase> listButton = new List<ButtonBase>();
+ /// <summary>
+ /// 濡傛灉璁剧疆姝ゅ彉閲忎负true,鍒欏湪鍗曞嚮搴曢儴鑿滃崟鏃�,寮哄埗鏃犳潯浠跺叏閮ㄥ埛鏂�
+ /// </summary>
+ public bool RefreshForm = false;
+
+ #endregion
+
+ #region 鈻� 鍒濆鍖朹____________________________
+
/// <summary>
- /// Initializes a new instance of the <see cref="T:Shared.Phone.UserView.UserPage"/> class.
+ /// 鍒濆鍖�
/// </summary>
public UserPage()
{
BackgroundColor = Shared.Common.ZigbeeColor.Current.MainColor;
- ZbGateway.StatusList.Add(this);
- }
-
- /// <summary>
- /// 鐢ㄦ埛涓讳綋鐣岄潰锛堜腑闂撮儴鍒嗭級
- /// </summary>
- public FrameLayout BodyView = new FrameLayout
- {
- Height = Application.GetRealHeight(CommonPage.AppRealHeight - CommonPage.TabbarHeight),
- BackgroundColor = Shared.Common.ZigbeeColor.Current.MainColor,
- };
- /// <summary>
- /// 鐢ㄦ埛鑿滃崟鐣岄潰锛堝簳閮ㄩ儴鍒嗭級
- /// </summary>
- public FrameLayout BottomMenuView = new FrameLayout
- {
- Y = Application.GetRealHeight(CommonPage.AppRealHeight - CommonPage.TabbarHeight),
- Height = Application.GetRealHeight(CommonPage.TabbarHeight),
- BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor,
- };
-
- #region 搴曢儴-涓婚〉鎸夐挳
- /// <summary>
- /// 搴曢儴-涓婚〉鎸夐挳
- /// </summary>
- public FrameLayout homePageFL = new FrameLayout
- {
- Width = Application.GetRealWidth(tabBarEnum_Width),
- Height = Application.GetRealHeight(CommonPage.TabbarHeight),
-
- };
- /// <summary>
- /// The home page image.
- /// </summary>
- public Button homePageIMG = new Button
- {
- Y = Application.GetRealHeight(tabBarEnumIMG_Y),
- Height = Application.GetMinRealAverage(tabBarEnumIMG_Height),
- Width = Application.GetMinRealAverage(tabBarEnumIMG_Width),
- UnSelectedImagePath = "Navigation/Home.png",
- SelectedImagePath = "Navigation/HomeSelected.png",
- IsSelected = true,
- Gravity = Gravity.CenterHorizontal
- };
- /// <summary>
- /// The name of the home page.
- /// </summary>
- public Button homePageName = new Button
- {
- Y = Application.GetRealHeight(tabBarEnumName_Y),
- Height = Application.GetRealHeight(tabBarEnumName_Height),
- TextID = R.MyInternationalizationString.HomePage,
- TextColor = Shared.Common.ZigbeeColor.Current.GXCTextBlackColor,
- SelectedTextColor = Shared.Common.ZigbeeColor.Current.GXCTextBlueColor,
- IsSelected = true,
- Gravity = Gravity.CenterHorizontal
- };
- #endregion
-
- #region 鍒嗙被-搴曢儴鎸夐挳
- /// <summary>
- /// 鍒嗙被-搴曢儴鎸夐挳
- /// </summary>
- public FrameLayout categoryFL = new FrameLayout
- {
- X=Application.GetRealWidth(tabBarEnum_Width),
- Width = Application.GetRealWidth(tabBarEnum_Width),
- Height = Application.GetRealHeight(CommonPage.TabbarHeight)
- };
- /// <summary>
- /// The category image.
- /// </summary>
- public Button categoryIMG = new Button
- {
- Y = Application.GetRealHeight(tabBarEnumIMG_Y),
- Height = Application.GetMinRealAverage(tabBarEnumIMG_Height),
- Width = Application.GetMinRealAverage(tabBarEnumIMG_Width),
- UnSelectedImagePath = "Navigation/Category.png",
- SelectedImagePath = "Navigation/CategorySelected.png",
- Gravity = Gravity.CenterHorizontal
- };
- /// <summary>
- /// The name of the category.
- /// </summary>
- public Button categoryName = new Button
- {
- Y = Application.GetRealHeight(tabBarEnumName_Y),
- Height = Application.GetRealHeight(tabBarEnumName_Height),
- TextID = R.MyInternationalizationString.Category,
- TextColor = Shared.Common.ZigbeeColor.Current.GXCTextBlackColor,
- SelectedTextColor = Shared.Common.ZigbeeColor.Current.GXCTextBlueColor,
- IsSelected = false,
- Gravity = Gravity.CenterHorizontal
- };
- #endregion
-
- #region 涓汉涓績-搴曢儴鎸夐挳
- /// <summary>
- /// 涓汉涓績-搴曢儴鎸夐挳
- /// </summary>
- public FrameLayout settingFL = new FrameLayout
- {
- X = Application.GetRealWidth(tabBarEnum_Width*2),
- Width = Application.GetRealWidth(tabBarEnum_Width),
- Height = Application.GetRealHeight(CommonPage.TabbarHeight)
- };
- /// <summary>
- /// The setting image.
- /// </summary>
- public Button settingIMG = new Button
- {
- Y = Application.GetRealHeight(tabBarEnumIMG_Y),
- Height = Application.GetMinRealAverage(tabBarEnumIMG_Height),
- Width = Application.GetMinRealAverage(tabBarEnumIMG_Width),
- UnSelectedImagePath = "Navigation/Setting.png",
- SelectedImagePath = "Navigation/SettingSelected.png",
- Gravity = Gravity.CenterHorizontal
- };
- /// <summary>
- /// 涓汉涓績
- /// </summary>
- public Button settingName = new Button
- {
- Y = Application.GetRealHeight(tabBarEnumName_Y),
- Height = Application.GetRealHeight(tabBarEnumName_Height),
- TextID = R.MyInternationalizationString.Me,
- TextColor = ZigbeeColor.Current.GXCTextBlackColor,
- SelectedTextColor = ZigbeeColor.Current.GXCTextBlueColor,
- IsSelected = false,
- Gravity = Gravity.CenterHorizontal
- };
- #endregion
-
- #region 鍒嗗壊绾�
-
- private FrameLayout bottomLine = new FrameLayout
- {
- Height = 3,
- BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
- };
-
- #endregion
-
- EventHandler<MouseEventArgs> BottomEventHandler = (sender, e) =>
- {
- Room.GetAllRoomDeviceUIList();
-
- Instance.homePageName.IsSelected = false;
- Instance.homePageIMG.IsSelected = false;
-
- Instance.categoryName.IsSelected = false;
- Instance.categoryIMG.IsSelected = false;
-
- Instance.settingName.IsSelected = false;
- Instance.settingIMG.IsSelected = false;
-
- Instance.BodyView.RemoveAll();
- if (sender == Instance.homePageIMG || sender == Instance.homePageName)
+ Shared.Application.LocationAction += (lon, lat) =>
{
- //涓婚〉
- Instance.homePageName.IsSelected = true;
- Instance.homePageIMG.IsSelected = true;
- var home = new UserHomeView { };
- Instance.BodyView.AddChidren(home);
- home.Show();
- }
- else if (sender == Instance.categoryIMG || sender==Instance.categoryName)
- {
- //鍒嗙被
- Instance.categoryName.IsSelected = true;
- Instance.categoryIMG.IsSelected = true;
- var category = new Phone.Device.Category.Category { };
- Instance.BodyView.AddChidren(category);
- category.Show();
- }
- else if (sender == Instance.settingIMG || sender==Instance.settingName)
- {
- //涓汉涓績
- Instance.settingName.IsSelected = true;
- Instance.settingIMG.IsSelected = true;
- var form = new UserCenter.UserMain.UserMainForm();
- Instance.BodyView.AddChidren(form);
- form.ShowForm();
- }
- };
-
+ Login.AccountLogic.Instance.ReceiveAppLatAndLon(lon.ToString(), lat.ToString());
+ };
+ }
+
/// <summary>
- /// Fresh this instance.
- /// </summary>
- public void Fresh()
- {
- BottomEventHandler(Instance.homePageIMG, null);
- }
-
- /// <summary>
- /// Inits the page.
+ /// 鍒濆鍖�
/// </summary>
public void InitPage()
{
- if (0 < ChildrenCount)
+ if (this.ChildrenCount > 0)
{
return;
+ }
+#if iOS
+ if (Shared.Application.PhoneType >= 10)
+ {
+ //楂樼増鏈殑鑻规灉鏈哄瀷锛屽睆骞曞簳閮ㄤ細鏈変竴涓粦鑹茬殑鏉�
+ ControlCommonResourse.BottomFrameHeight = Application.GetRealHeight(242);
+ }
+#endif
+ //鐢ㄦ埛涓讳綋鐣岄潰锛堜腑闂撮儴鍒嗭級
+ this.bodyFrameView = new FrameLayout();
+ bodyFrameView.Height = this.Height - UserCenter.ControlCommonResourse.BottomFrameHeight;
+ bodyFrameView.BackgroundColor = Shared.Common.ZigbeeColor.Current.MainColor;
+ this.AddChidren(bodyFrameView);
+
+ //鐢ㄦ埛鑿滃崟鐣岄潰锛堝簳閮ㄩ儴鍒嗭級
+ var bottomMenuFrame = new FrameLayout();
+ bottomMenuFrame.Gravity = Gravity.BottomCenter;
+ bottomMenuFrame.Height = ControlCommonResourse.BottomFrameHeight;
+ bottomMenuFrame.BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCBottomColor;
+ this.AddChidren(bottomMenuFrame);
+ //搴曢儴鑿滃崟鐨勫ご閮ㄧ嚎
+ var bottomLine = new NormalViewControl(bottomMenuFrame.Width, ControlCommonResourse.BottomLineHeight, false);
+ bottomLine.BackgroundColor = 0xffc8c8c9;
+ bottomMenuFrame.AddChidren(bottomLine);
+
+ //涓婚〉瀹瑰櫒
+ var frameHomePage = new FrameLayout();
+ frameHomePage.Width = bottomMenuFrame.Width / 3;
+ frameHomePage.Height = bottomMenuFrame.Height;
+ bottomMenuFrame.AddChidren(frameHomePage);
+ //涓婚〉鍥炬爣
+ var btnHomeIcon = new PicViewControl(138, 98);
+ btnHomeIcon.Y = Application.GetRealHeight(3);
+ btnHomeIcon.UnSelectedImagePath = "Navigation/Home.png";
+ btnHomeIcon.SelectedImagePath = "Navigation/HomeSelected.png";
+ btnHomeIcon.Gravity = Gravity.CenterHorizontal;
+ frameHomePage.AddChidren(btnHomeIcon);
+ this.listButton.Add(btnHomeIcon);
+ btnHomeIcon.ButtonClickEvent += (sender, e) =>
+ {
+ this.BottomMenuClickEvent(MenuSelectEnum.A涓婚〉, true);
+ };
+ //涓婚〉
+ var btnHomeName = new NormalViewControl(btnHomeIcon.Width, Application.GetRealHeight(40), false);
+ btnHomeName.Y = btnHomeIcon.Bottom;
+ btnHomeName.TextID = R.MyInternationalizationString.HomePage;
+ btnHomeName.TextColor = Shared.Common.ZigbeeColor.Current.GXCTextBottomUnSelectedColor;
+ btnHomeName.SelectedTextColor = Shared.Common.ZigbeeColor.Current.GXCTextBlackColor2;
+ btnHomeName.TextSize = 10;
+ btnHomeName.Gravity = Gravity.CenterHorizontal;
+ btnHomeName.TextAlignment = TextAlignment.Center;
+ frameHomePage.AddChidren(btnHomeName);
+ this.listButton.Add(btnHomeName);
+ btnHomeName.ButtonClickEvent += (sender, e) =>
+ {
+ this.BottomMenuClickEvent(MenuSelectEnum.A涓婚〉, true);
+ };
+
+ //鍒嗙被瀹瑰櫒
+ var frameCategory = new FrameLayout();
+ frameCategory.X = frameHomePage.Right;
+ frameCategory.Width = bottomMenuFrame.Width / 3;
+ frameCategory.Height = bottomMenuFrame.Height;
+ bottomMenuFrame.AddChidren(frameCategory);
+ //鍒嗙被鍥炬爣
+ var btnCategoryIcon = new PicViewControl(138, 98);
+ btnCategoryIcon.Y = Application.GetRealHeight(3);
+ btnCategoryIcon.UnSelectedImagePath = "Navigation/Category.png";
+ btnCategoryIcon.SelectedImagePath = "Navigation/CategorySelected.png";
+ btnCategoryIcon.Gravity = Gravity.CenterHorizontal;
+ frameCategory.AddChidren(btnCategoryIcon);
+ this.listButton.Add(btnCategoryIcon);
+ btnCategoryIcon.ButtonClickEvent += (sender, e) =>
+ {
+ this.BottomMenuClickEvent(MenuSelectEnum.A鍒嗙被, true);
+ };
+ //鍒嗙被
+ var btnCategoryName = new NormalViewControl(btnCategoryIcon.Width, Application.GetRealHeight(40), false);
+ btnCategoryName.Y = btnCategoryIcon.Bottom;
+ btnCategoryName.TextID = R.MyInternationalizationString.Category;
+ btnCategoryName.TextColor = Shared.Common.ZigbeeColor.Current.GXCTextBottomUnSelectedColor;
+ btnCategoryName.SelectedTextColor = Shared.Common.ZigbeeColor.Current.GXCTextBlackColor2;
+ btnCategoryName.TextSize = 10;
+ btnCategoryName.Gravity = Gravity.CenterHorizontal;
+ btnCategoryName.TextAlignment = TextAlignment.Center;
+ frameCategory.AddChidren(btnCategoryName);
+ this.listButton.Add(btnCategoryName);
+ btnCategoryName.ButtonClickEvent += (sender, e) =>
+ {
+ this.BottomMenuClickEvent(MenuSelectEnum.A鍒嗙被, true);
+ };
+
+
+ //鎴戠殑瀹瑰櫒
+ var frameSetting = new FrameLayout();
+ frameSetting.X = frameCategory.Right;
+ frameSetting.Width = bottomMenuFrame.Width / 3;
+ frameSetting.Height = bottomMenuFrame.Height;
+ bottomMenuFrame.AddChidren(frameSetting);
+ //鎴戠殑鍥炬爣
+ var btnSettingIcon = new PicViewControl(138, 98);
+ btnSettingIcon.Y = Application.GetRealHeight(3);
+ btnSettingIcon.UnSelectedImagePath = "Navigation/Setting.png";
+ btnSettingIcon.SelectedImagePath = "Navigation/SettingSelected.png";
+ btnSettingIcon.Gravity = Gravity.CenterHorizontal;
+ frameSetting.AddChidren(btnSettingIcon);
+ this.listButton.Add(btnSettingIcon);
+ btnSettingIcon.ButtonClickEvent += (sender, e) =>
+ {
+ this.BottomMenuClickEvent(MenuSelectEnum.A涓汉涓績, true);
+ };
+ //鎴戠殑
+ var btnSettingName = new NormalViewControl(btnCategoryIcon.Width, Application.GetRealHeight(40), false);
+ btnSettingName.Y = btnSettingIcon.Bottom;
+ btnSettingName.TextID = R.MyInternationalizationString.Me;
+ btnSettingName.TextColor = Shared.Common.ZigbeeColor.Current.GXCTextBottomUnSelectedColor;
+ btnSettingName.SelectedTextColor = Shared.Common.ZigbeeColor.Current.GXCTextBlackColor2;
+ btnSettingName.TextSize = 10;
+ btnSettingName.Gravity = Gravity.CenterHorizontal;
+ btnSettingName.TextAlignment = TextAlignment.Center;
+ frameSetting.AddChidren(btnSettingName);
+ this.listButton.Add(btnSettingName);
+ btnSettingName.ButtonClickEvent += (sender, e) =>
+ {
+ this.BottomMenuClickEvent(MenuSelectEnum.A涓汉涓績, true);
+ };
+ }
+
+ /// <summary>
+ /// 鍒锋柊鎺т欢
+ /// </summary>
+ public void ReFreshControl()
+ {
+ //杩欓噷鍋氬叏鍒锋柊澶勭悊
+ this.listForm = new List<EditorCommonForm>() { null, null, null };
+ this.bodyFrameView.RemoveAll();
+
+ this.BottomMenuClickEvent(MenuSelectEnum.A涓婚〉, false);
+ }
+
+ #endregion
+
+ #region 鈻� 涓�鑸柟娉昣__________________________
+
+ /// <summary>
+ /// 搴曢儴鑿滃崟鐨勭偣鍑讳簨浠�
+ /// </summary>
+ /// <param name="selectEnum">鑿滃崟閫夋嫨鏋氫妇</param>
+ /// <param name="handClick">鏄惁鏄墜鍔ㄧ偣鍑�</param>
+ private void BottomMenuClickEvent(MenuSelectEnum selectEnum, bool handClick)
+ {
+ if (this.RefreshForm == false && selectEnum == this.nowSelectMenu && handClick == true)
+ {
+ //鎵嬪姩鐐瑰嚮鍚屼竴涓彍鍗�,鍒欎笉鍋氬鐞�
+ return;
+ }
+
+ //濡傛灉寮哄埗鎸囧畾鍒锋柊鐣岄潰鐨勮瘽
+ if (this.RefreshForm == true)
+ {
+ //鍏ㄩ儴鍒锋柊
+ this.listForm = new List<EditorCommonForm>() { null, null, null };
+ this.bodyFrameView.RemoveAll();
+
+ this.RefreshForm = false;
+ }
+
+ this.nowSelectMenu = selectEnum;
+
+ //涓婚〉
+ if (selectEnum == MenuSelectEnum.A涓婚〉)
+ {
+ //宸︽粦鑿滃崟鍙�
+ CommonPage.Instance.IsDrawerLockMode = false;
+ if (listForm[0] == null)
+ {
+ var form = new MainPage.HomeMainPageForm();
+ this.bodyFrameView.AddChidren(form);
+ form.ShowForm();
+ //鍔犵紦瀛�
+ listForm[0] = form;
+ }
}
-
- AddChidren(BodyView);
- AddChidren(BottomMenuView);
-
- Instance.homePageFL.AddChidren(Instance.homePageIMG);
- Instance.homePageFL.AddChidren(Instance.homePageName);
- BottomMenuView.AddChidren(Instance.homePageFL);
-
- Instance.categoryFL.AddChidren(Instance.categoryIMG);
- Instance.categoryFL.AddChidren(Instance.categoryName);
- BottomMenuView.AddChidren(Instance.categoryFL);
-
- Instance.settingFL.AddChidren(Instance.settingIMG);
- Instance.settingFL.AddChidren(Instance.settingName);
- BottomMenuView.AddChidren(Instance.settingFL);
-
- BottomMenuView.AddChidren(Instance.bottomLine);
-
- homePageIMG.MouseUpEventHandler += BottomEventHandler;
- homePageName.MouseUpEventHandler += BottomEventHandler;
-
- categoryIMG.MouseUpEventHandler += BottomEventHandler;
- categoryName.MouseUpEventHandler += BottomEventHandler;
-
- settingIMG.MouseUpEventHandler += BottomEventHandler;
- settingName.MouseUpEventHandler += BottomEventHandler;
- }
+ else if (selectEnum == MenuSelectEnum.A鍒嗙被)
+ {
+ //宸︽粦鑿滃崟涓嶅彲
+ CommonPage.Instance.IsDrawerLockMode = true;
+ if (listForm[1] == null)
+ {
+ var form = new Category.CategoryMainForm();
+ this.bodyFrameView.AddChidren(form);
+ form.ShowForm();
+ //鍔犵紦瀛�
+ listForm[1] = form;
+ }
+ }
+ else if (selectEnum == MenuSelectEnum.A涓汉涓績)
+ {
+ //宸︽粦鑿滃崟涓嶅彲
+ CommonPage.Instance.IsDrawerLockMode = true;
+ if (listForm[2] == null)
+ {
+ var form = new UserCenter.UserMain.UserMainForm();
+ this.bodyFrameView.AddChidren(form);
+ form.ShowForm();
+ //鍔犵紦瀛�
+ listForm[2] = form;
+ }
+ }
+ //璁剧疆鍏ㄩ儴鎺т欢鐨勫悇绉嶇姸鎬佺姸鎬�
+ this.SetAllControlStatu();
+ }
+
+ /// <summary>
+ /// 璁剧疆鍏ㄩ儴鎺т欢鐨勫悇绉嶇姸鎬佺姸鎬�
+ /// </summary>
+ private void SetAllControlStatu()
+ {
+ int index = (int)this.nowSelectMenu - 1;
+ for (int i = 0; i < listForm.Count; i++)
+ {
+ if (i == index)
+ {
+ //褰撳墠閫夋嫨鐨勮彍鍗曠殑璇�,鍒欏叏閮ㄥ彲瑙�
+ listForm[i].Visible = true;
+ //鎺т欢鍥剧墖鍜岄鑹插彉鏇�
+ this.listButton[i * 2].IsSelected = true;
+ this.listButton[i * 2 + 1].IsSelected = true;
+ }
+ else
+ {
+ //涓嶆槸褰撳墠閫夋嫨鐨勮彍鍗曠殑璇�,鍏ㄩ儴涓嶅彲瑙�
+ if (listForm[i] != null)
+ {
+ listForm[i].Visible = false;
+ }
+ //鎺т欢鍥剧墖鍜岄鑹插彉鏇�
+ this.listButton[i * 2].IsSelected = false;
+ this.listButton[i * 2 + 1].IsSelected = false;
+ }
+ }
+ }
+
+ /// <summary>
+ /// 寮哄埗鏄剧ず鑷姩鍖栧垪琛ㄧ晫闈�
+ /// </summary>
+ public void ShowCategoryAutoListForm()
+ {
+ //鍏抽棴鍏ㄩ儴鐣岄潰,鐩村埌涓婚〉涓烘
+ UserCenterLogic.CloseAllOpenForm();
+ //寮哄埗鏄剧ず鑷姩鍖栧垪琛ㄧ晫闈�
+ UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex = 2;
+
+ this.nowSelectMenu = MenuSelectEnum.A鍒嗙被;
+
+ //宸︽粦鑿滃崟涓嶅彲
+ CommonPage.Instance.IsDrawerLockMode = true;
+ if (listForm[1] == null)
+ {
+ var form = new Category.CategoryMainForm();
+ this.bodyFrameView.AddChidren(form);
+ form.ShowForm();
+ //鍔犵紦瀛�
+ listForm[1] = form;
+ }
+ else
+ {
+ ((Category.CategoryMainForm)listForm[1]).RefreshBodyView();
+ }
+ //璁剧疆鍏ㄩ儴鎺т欢鐨勫悇绉嶇姸鎬佺姸鎬�
+ this.SetAllControlStatu();
+ }
+
+ /// <summary>
+ /// 鑾峰彇褰撳墠婵�娲荤殑鐣岄潰
+ /// </summary>
+ /// <returns></returns>
+ public EditorCommonForm GetNowActionForm()
+ {
+ int index = ((int)this.nowSelectMenu) - 1;
+ if (index != -1)
+ {
+ //璋冪敤姝ょ晫闈㈢殑婵�娲诲嚱鏁�
+ return this.listForm[index];
+ }
+ return null;
+ }
+
+ #endregion
+
+ #region 鈻� 缁撴瀯浣揰____________________________
+
+ /// <summary>
+ /// 鑿滃崟閫夋嫨鐨勬灇涓�
+ /// </summary>
+ private enum MenuSelectEnum
+ {
+ A鏈�夋嫨 = 0,
+ A涓婚〉 = 1,
+ A鍒嗙被 = 2,
+ A涓汉涓績 = 3
+ }
+
+ #endregion
}
}
--
Gitblit v1.8.0