| | |
| | | using 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> |
| | | /// 底部按钮图片的Y值 -5 |
| | | /// </summary> |
| | | private static readonly int tabBarEnumIMG_Y = 5; |
| | | /// <summary> |
| | | /// 底部按钮文字的高度 -50 |
| | | /// </summary> |
| | | private static readonly int tabBarEnumName_Height = 50; |
| | | /// <summary> |
| | | /// 底部按钮文字的Y值 100 |
| | | /// </summary> |
| | | private static readonly int tabBarEnumName_Y = tabBarEnumIMG_Height - 10; |
| | | #endregion |
| | | |
| | | #region ◆ 接口____________________________ |
| | | |
| | | /// <summary> |
| | | /// 该接口将弃用 !!!!!! |
| | | /// 改用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) |
| | | { |
| | | //设备上报状态中 当CluterID=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; |
| | | } |
| | | //当CluterID=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; |
| | | |
| | | } |
| | | //当CluterID=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,实际温度为“LocalTemperature / 100”,单位:℃ |
| | | ac.currentLocalTemperature = attriButeList[0].AttriButeData / 100; |
| | | ac.LastDateTime = DateTime.Now; |
| | | break; |
| | | |
| | | case 17: |
| | | //此属性表明此设备当前的制冷温度,实际温度为“CoolingSetpoint / 100”,单位:℃。 |
| | | ac.currentCoolingSetpoint = attriButeList[0].AttriButeData / 100; |
| | | ac.LastDateTime = DateTime.Now; |
| | | break; |
| | | |
| | | case 18: |
| | | //此属性表明此设备当前的制热温度,实际温度为“HeatingSetpoint / 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; |
| | | |
| | | } |
| | | |
| | | } |
| | | //当CluterID=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; |
| | | } |
| | | } |
| | | //当CluterID=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> |
| | |
| | | } |
| | | return userMenuPage; |
| | | } |
| | | } |
| | | |
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 用户主体界面(中间部分)
|
| | | /// </summary>
|
| | | private NormalFrameLayout 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.User.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.IsFullScreen == true)
|
| | | {
|
| | | //高版本的苹果机型,屏幕底部会有一个黑色的杠
|
| | | ControlCommonResourse.BottomFrameHeight = Application.GetRealHeight(242);
|
| | | }
|
| | | #endif
|
| | | //用户主体界面(中间部分)
|
| | | this.bodyFrameView = new NormalFrameLayout();
|
| | | 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 |
| | | } |
| | | } |