From 4f92fe4e4397b05bc97d17e8ad02818a689acdb8 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期四, 10 十月 2019 13:13:33 +0800 Subject: [PATCH] 个人中心添加楼层和创建房间,实装二级验证 --- ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceInfoWithZoneRow.cs | 123 + ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs | 1021 +++++----------- ZigbeeApp/GateWay.Droid/Assets/Language.ini | 19 ZigbeeApp/Shared/Phone/Device/Room/AddRoomScene.cs | 2 ZigbeeApp/Shared/Phone/Device/Room/RoomShareSetting.cs | 105 + ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs | 307 ++-- ZigbeeApp/Shared/Phone/Device/CommonForm/SceneMainView.cs | 183 ++ ZigbeeApp/Shared/Phone/Device/Room/RoomTemperatureSetting.cs | 110 + ZigbeeApp/Shared/R.cs | 73 ZigbeeApp/Shared/Phone/Device/CommonForm/CommonEnum.cs | 9 ZigbeeApp/Shared/Phone/Device/CommonForm/FunctionMainView.cs | 223 +++ ZigbeeApp/GateWay.Droid/Application.cs | 1 ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs | 217 +++ ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceDetailInfo.cs | 2 ZigbeeApp/Shared/Phone/Device/Room/RoomHumiditySetting.cs | 110 + ZigbeeApp/Shared/Common/SceneUI.cs | 25 ZigbeeApp/Shared/Phone/Device/CommonForm/RoomMainView.cs | 97 + ZigbeeApp/Shared/Phone/Device/Light/LightControl.cs | 459 +++--- ZigbeeApp/Shared/Phone/Device/Room/RoomManagement.cs | 158 +- ZigbeeApp/Shared/Phone/Device/AC/ACControlBase.cs | 4 ZigbeeApp/Shared/Phone/Device/CommonForm/CommonFormResouce.cs | 52 ZigbeeApp/Shared/Phone/ZigBee/Common/Config.cs | 5 ZigbeeApp/Shared/Phone/Device/CommonForm/TopFrameLayout.cs | 2 ZigbeeApp/Shared/Phone/Device/Account/PhoneEmailForm.cs | 26 ZigbeeApp/Shared/Phone/Device/CommonForm/SelectTime.cs | 248 ++++ ZigbeeApp/Shared/Shared.projitems | 10 ZigbeeApp/Shared/Common/ZigbeeColor.cs | 35 ZigbeeApp/Shared/Phone/Device/Room/AddRoom.cs | 2 ZigbeeApp/Shared/Common/Room.cs | 87 + 29 files changed, 2,475 insertions(+), 1,240 deletions(-) diff --git a/ZigbeeApp/GateWay.Droid/Application.cs b/ZigbeeApp/GateWay.Droid/Application.cs index 985559c..856ef99 100755 --- a/ZigbeeApp/GateWay.Droid/Application.cs +++ b/ZigbeeApp/GateWay.Droid/Application.cs @@ -73,6 +73,7 @@ } }; 鈥� BaseActivity.OnCreateActoin += (activity, application) => { + Shared.Application.FontSize = 12; AppCenter.Start("4802834a-e7e9-4dd8-93f1-c2f88f0bd464", typeof(Analytics), typeof(Crashes));鈥�#if Release鈥� //淇濆瓨鑾峰彇鐨勬瀬鍏夋湇鍔″櫒涓婄殑娉ㄥ唽ID鍒版湰鍦版枃浠垛�� var registrationId = JPushInterface.GetRegistrationID(activity); System.Console.WriteLine("registrationId-鏋佸厜id=" + registrationId); if (!string.IsNullOrEmpty(registrationId))鈥� {鈥� Shared.Common.Config.Instance.RegistrationID = registrationId;鈥� Shared.Common.Config.Instance.Save();鈥� }鈥�#endif鈥� };鈥� BaseActivity.RefreshUIAction += (activity) => {鈥� Shared.Language.CurrentLanguage = "Chinese";鈥� Shared.Common.CommonPage.Instance.Show();鈥� };鈥� BaseActivity.OnResumeAction += (activity) => {鈥� };鈥� BaseActivity.NetworkStateChanged += (v) =>鈥� {鈥� //缃戠粶鐘舵�佸彉鍖栧鐞嗕簨浠� diff --git a/ZigbeeApp/GateWay.Droid/Assets/Language.ini b/ZigbeeApp/GateWay.Droid/Assets/Language.ini index c39f87a..5db47c2 100755 --- a/ZigbeeApp/GateWay.Droid/Assets/Language.ini +++ b/ZigbeeApp/GateWay.Droid/Assets/Language.ini @@ -556,7 +556,7 @@ 11001=鍦烘櫙 11002=鑷姩鍖� -11010=娌℃湁鍔熻兘 \n 璇峰湪涓汉涓績涓�--璁惧绠$悊澶勬坊鍔� +11010=娌℃湁鍔熻兘 {\r\n} 璇峰湪涓汉涓績涓�--璁惧绠$悊澶勬坊鍔� 11011=缂栬緫 11012=璁剧疆鍔熻兘 11013=淇℃伅缂栬緫 @@ -570,7 +570,7 @@ 11021=淇濆瓨 11022=鎻愮ず 11023=鍙栨秷 -11024=娌℃湁鍦烘櫙 \n 璇风偣鍑诲彸涓婅娣诲姞 +11024=娌℃湁鍦烘櫙 {\r\n} 璇风偣鍑诲彸涓婅娣诲姞 11025=璁剧疆 11026=瀹氭椂 11027=纭畾鍒犻櫎鍚楋紵 @@ -587,9 +587,18 @@ 13102=閫夋嫨浣忓畢 13103=鏂扮敤鎴风櫥褰曪紝璇峰厛缁戝畾缃戝叧 13104=娣诲姞鏅鸿兘缃戝叧 - - - +13105=缂栬緫鎴块棿 +13106=鎴块棿鍚嶇О +13107=鎵�灞炴ゼ灞� +13108=娓╁害 +13109=婀垮害 +13110=褰撳墠 +13111=寮� +13112=鍏� +13113=涓嶅紑鍚� +13114=绉� +13115=鍒嗛挓 +13116=灏忔椂 diff --git a/ZigbeeApp/Shared/Common/Room.cs b/ZigbeeApp/Shared/Common/Room.cs index e3440a1..c7ef0ed 100755 --- a/ZigbeeApp/Shared/Common/Room.cs +++ b/ZigbeeApp/Shared/Common/Room.cs @@ -36,14 +36,24 @@ /// 妤煎眰Id /// 鏂板鏃朵娇鐢℅uid /// </summary> - public string FloorId = string.Empty; + public string FloorId = "Floor1"; + /// <summary> + /// 妤煎眰鍚嶇О + /// </summary> + public string FloorName + { + get + { + return GetFloorNameById(FloorId); + } + } /// <summary> /// 鎴块棿鍚� /// </summary> public string Name = string.Empty; /// <summary> - /// 鎴块棿鐨勬椂鍊欒儗鏅浘 + /// 鎴块棿鑳屾櫙鍥� /// </summary> public string BackgroundImage = string.Empty; @@ -73,6 +83,11 @@ public readonly List<string> DeviceUIFilePathList = new List<string>(); /// <summary> + /// 鍠滅埍鎴块棿id + /// </summary> + public const string LoveRoomId= "Favorite"; + + /// <summary> /// 鏄惁鏄粯璁ゅ枩鐖辨埧闂� /// </summary> /// <value><c>true</c> if is love; otherwise, <c>false</c>.</value> @@ -81,7 +96,7 @@ { get { - return Id == "Favorite"; + return Id == LoveRoomId; } } @@ -110,8 +125,7 @@ { return new List<string> { }; } - var loveRoom = Lists[0]; - return loveRoom.DeviceUIFilePathList; + return GetLoveRoom().DeviceUIFilePathList; } } @@ -204,7 +218,7 @@ if (Config.Instance.Home.RoomFilePathList.Contains("Room_Favorite.json") == false) { //榛樿娣诲姞鍠滅埍鐨勬埧闂�--绂佹淇敼鎴块棿鍚� - var love = new Room { Name = Language.StringByID(R.MyInternationalizationString.Favorite), BackgroundImage = "Room/r0.png", Id = "Favorite" }; + var love = new Room { Name = Language.StringByID(R.MyInternationalizationString.Favorite), BackgroundImage = "Room/r0.png", Id = LoveRoomId }; love.Save(true); //娣诲姞鍒癶ouse 鎴块棿璺緞鍒楄〃 var currentHome = Config.Instance.Home; @@ -321,6 +335,15 @@ #endregion #region 鈼� 鑾峰彇鎴块棿________________________ + + /// <summary> + /// 鑾峰彇鍠滅埍鎴块棿 + /// </summary> + /// <returns></returns> + public static Room GetLoveRoom() + { + return CurrentRoom.GetRoomById(LoveRoomId); + } /// <summary> /// 閫氳繃璺緞鑾峰彇鎴块棿 @@ -897,6 +920,28 @@ #endregion + #region 鈼� 璁惧鏄惁鏀惰棌______________________ + + /// <summary> + /// 鏄惁鏄敹钘忚澶� + /// </summary> + /// <param name="room"></param> + /// <param name="filePath"></param> + /// <returns></returns> + public bool IsCollectInRoom(Room room,string filePath) + { + if(room.IsLove) + { + return true; + } + if (GetLoveRoom().DeviceUIFilePathList.Find((obj) => obj == filePath) == null) + { + return false; + } + return true; + } + #endregion + #region 鈼� 淇敼鍦烘櫙________________________ /// <summary> @@ -1121,7 +1166,7 @@ var dicRoom = new Dictionary<string, Common.Room>(); foreach (var room in Common.Room.Lists) { - if (room.FloorId != i_floorKeys) + if (room.FloorId != i_floorKeys || room.IsLove == true) { //涓嶆槸鍚屼竴涓ゼ灞� continue; @@ -1245,5 +1290,33 @@ } #endregion + + #region 鈼� 妤煎眰___________________________ + + /// <summary> + /// 鑾峰彇妤煎眰鍚嶇О + /// </summary> + /// <param name="floorId"></param> + /// <returns></returns> + public string GetFloorNameById(string floorId) + { + if (Config.Instance.Home.FloorDics.Count == 0) + { + return null; + } + + foreach (var floor in Config.Instance.Home.FloorDics) + { + if (floorId == floor.Key) + { + return floor.Value; + } + } + return null; + } + + #endregion + + } } diff --git a/ZigbeeApp/Shared/Common/SceneUI.cs b/ZigbeeApp/Shared/Common/SceneUI.cs index 360a30d..3c02d15 100755 --- a/ZigbeeApp/Shared/Common/SceneUI.cs +++ b/ZigbeeApp/Shared/Common/SceneUI.cs @@ -61,6 +61,10 @@ /// 鏍囪瘑褰撳墠鍦烘櫙鏄惁鏄垎浜殑鍦烘櫙 /// </summary> public bool IsSharedScene = false; + /// <summary> + /// 鏄惁鏀惰棌 + /// </summary> + public bool IsCollected = false; /// <summary> /// 寤舵椂鎵ц鏃堕棿--鏁翠釜鍦烘櫙寤舵椂(涓嶆槸寤舵椂鍦烘櫙閲岄潰鐨勬墽琛岀洰鏍�) @@ -77,7 +81,11 @@ #endregion #region 鈼� 閫氳繃鍦烘櫙id鑾峰彇鍦烘櫙璺緞_____________ - + /// <summary> + /// GetSceneFilePathBySceneId + /// </summary> + /// <param name="sceneId"></param> + /// <returns></returns> public static string GetSceneFilePathBySceneId(int sceneId) { return $"Scene_{sceneId}.json"; @@ -85,6 +93,21 @@ #endregion + #region 鈼� 鏀惰棌____________________________ + + /// <summary> + /// collect + /// </summary> + /// <param name="collected"></param> + /// <param name="autoBackup"></param> + public void Collect(bool collected, bool autoBackup = true) + { + IsCollected = collected; + Save(autoBackup); + } + + #endregion + #region 鈼� 淇濆瓨____________________________ /// <summary> diff --git a/ZigbeeApp/Shared/Common/ZigbeeColor.cs b/ZigbeeApp/Shared/Common/ZigbeeColor.cs index 41288ba..9cc4ae4 100755 --- a/ZigbeeApp/Shared/Common/ZigbeeColor.cs +++ b/ZigbeeApp/Shared/Common/ZigbeeColor.cs @@ -135,10 +135,22 @@ /// 瀛椾綋娴呰壊 0xFFCBCACA /// </summary> public uint GXCTextGrayColor3 = 0xFFCBCACA; + /// <summary> + /// 瀛椾綋娴呰壊 0xFF666666 + /// </summary> + public uint GXCTextGrayColor4 = 0xFF666666; + /// <summary> + /// 瀛椾綋閫変腑棰滆壊 0xFFFC744B + /// </summary> + public uint GXCTextSelectedColor = 0xFFFC744B; /// <summary> - /// 瀛椾綋閫変腑棰滆壊 0xFFFC744B + /// 瀛椾綋閫変腑棰滆壊 0xFFFB744A /// </summary> - public uint GXCTextSelectedColor = 0xFFFC744B; + public uint GXCTextSelectedColor2 = 0xFFFB744A; + /// <summary> + /// 瀛椾綋閫変腑棰滆壊 0xFFFFB400 + /// </summary> + public uint GXCTextSelectedColor3 = 0xFFFFB400; /// <summary> /// 搴曢儴鏈�変腑棰滆壊 0xFF8E8E93 /// </summary> @@ -159,6 +171,14 @@ /// 榛戣壊鑳屾櫙 0xFF333333 /// </summary> public uint GXCBlackBackgroundColor2 = 0xFF333333; + /// <summary> + /// functionView 0x1AFC744B + /// </summary> + public uint GXCForFunctionUnSelectedBackgroundColor = 0x1AFC744B; + /// <summary> + /// functionView 0xFFFC744B + /// </summary> + public uint GXCForFunctionBackgroundColor = 0xFFFC744B; /// <summary> /// 0xFFFEF1ED /// </summary> @@ -234,7 +254,7 @@ /// <summary> /// topview color 0xD1F8F8F8 /// </summary> - public uint GXCTopViewBackgroundColor = 0xD1F8F8F8; + public uint GXCTopViewBackgroundColor = 0xFFF9F9F9; /// <summary> /// title color 0xFF030303 /// </summary> @@ -251,7 +271,14 @@ /// 搴曢儴绾挎潯棰滆壊 0xFFBABABA /// </summary> public uint GXCBottomLineColor = 0xFFBABABA; - + /// <summary> + /// GXCWaveSeekBarUnSelectedColor 0xFFEBEBED + /// </summary> + public uint GXCWaveSeekBarUnSelectedColor = 0xFFEBEBED; + /// <summary> + /// GXCWaveSeekBarColor 0xFFFE4F35 + /// </summary> + public uint GXCWaveSeekBarColor = 0xFFFE4F35; diff --git a/ZigbeeApp/Shared/Phone/Device/AC/ACControlBase.cs b/ZigbeeApp/Shared/Phone/Device/AC/ACControlBase.cs index 5ffc2d2..73a886b 100755 --- a/ZigbeeApp/Shared/Phone/Device/AC/ACControlBase.cs +++ b/ZigbeeApp/Shared/Phone/Device/AC/ACControlBase.cs @@ -409,8 +409,8 @@ Application.RunOnMainThread(() => { string msg = Language.StringByID(R.MyInternationalizationString.TheACIsClose); - //var tip = new Phone.UserCenter.TipViewControl(msg, 1000, 1); - //tip.ShowView(); + var tip = new Phone.UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Tip, msg); + tip.Show(); }); } diff --git a/ZigbeeApp/Shared/Phone/Device/Account/PhoneEmailForm.cs b/ZigbeeApp/Shared/Phone/Device/Account/PhoneEmailForm.cs index 07a7ced..cb975be 100755 --- a/ZigbeeApp/Shared/Phone/Device/Account/PhoneEmailForm.cs +++ b/ZigbeeApp/Shared/Phone/Device/Account/PhoneEmailForm.cs @@ -34,17 +34,28 @@ PhoneEmailFL = new FrameLayout() { Y = Application.GetRealHeight(y), - Height = Application.GetRealHeight(height), - Width = Application.GetRealWidth(width), - BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, - Radius = (uint)Application.GetRealHeight(height / 2), + Width = Application.GetMinRealAverage(905), + Height = Application.GetMinRealAverage(170), + //BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor, + //Radius = (uint)Application.GetRealHeight(height / 2), Gravity = Gravity.CenterHorizontal }; frameLayout.AddChidren(PhoneEmailFL); + var bg = new Button + { + Width = Application.GetMinRealAverage(905), + Height = Application.GetMinRealAverage(170), + UnSelectedImagePath = "Account/PhoneEmail_White.png", + Gravity = Gravity.CenterHorizontal + }; + PhoneEmailFL.AddChidren(bg); + SelectedPhone = new Button() { - Width = Application.GetRealWidth(width / 2 + 20), + X=Application.GetRealWidth(10), + Width = Application.GetMinRealAverage(905 / 2 + 20), + Height=Application.GetMinRealAverage(height), SelectedBackgroundColor = ZigbeeColor.Current.GXCButtonSelectedColor, TextID = R.MyInternationalizationString.PhoneNum, TextColor = ZigbeeColor.Current.GXCTextColor, @@ -57,8 +68,9 @@ SelectedEmail = new Button() { - X = Application.GetRealWidth(width / 2 - 20), - Width = Application.GetRealWidth(width / 2 + 20), + X = Application.GetMinRealAverage(905 / 2 - 20), + Width = Application.GetMinRealAverage(905 / 2 + 20), + Height = Application.GetMinRealAverage(height), SelectedBackgroundColor = ZigbeeColor.Current.GXCButtonSelectedColor, TextID = R.MyInternationalizationString.Email, TextColor = ZigbeeColor.Current.GXCTextColor, diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/CommonEnum.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/CommonEnum.cs new file mode 100755 index 0000000..354b902 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/CommonEnum.cs @@ -0,0 +1,9 @@ +锘縰sing System; +namespace Shared.Phone.Device.CommonForm +{ + public enum Direction + { + Left = 1, + Right = 2 + } +} diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/CommonFormResouce.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/CommonFormResouce.cs index 92785ff..3823419 100755 --- a/ZigbeeApp/Shared/Phone/Device/CommonForm/CommonFormResouce.cs +++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/CommonFormResouce.cs @@ -6,6 +6,11 @@ public class CommonFormResouce { /// <summary> + /// AppRealWidth + /// </summary> + public const int AppRealWidth = 1080; + + /// <summary> /// 瀛椾綋12 /// </summary> public const int loginTextSize = 12; @@ -164,11 +169,48 @@ return null; } } + + + /// <summary> + /// GetSwitchStatu + /// </summary> + /// <param name="statu"></param> + /// <returns></returns> + public static string GetSwitchStatu(bool statu) + { + if (statu) + { + return $"{Language.StringByID(R.MyInternationalizationString.Current)} : {Language.StringByID(R.MyInternationalizationString.Open)}"; + } + else + { + return $"{Language.StringByID(R.MyInternationalizationString.Current)} : {Language.StringByID(R.MyInternationalizationString.Close)}"; + } + } + + + /// <summary> + /// 鑾峰彇鍦烘櫙寤舵椂瀛楃涓� + /// </summary> + /// <param name="second"></param> + /// <returns></returns> + public static string GetTimeString(int second) + { + string tStr; + if (second / 3600 > 0) + { + tStr = $"{second / 3600}{Language.StringByID(R.MyInternationalizationString.Hour)}"; + } + else if (second / 60 > 0) + { + tStr = $"{second / 60}{Language.StringByID(R.MyInternationalizationString.Minute)}"; + } + else + { + tStr = $"{second}{Language.StringByID(R.MyInternationalizationString.Second)}"; + } + return tStr; + } } - public enum Direction - { - Left=1, - Right=2 - } } diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceDetailInfo.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceDetailInfo.cs index 51e053c..61d8f23 100755 --- a/ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceDetailInfo.cs +++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceDetailInfo.cs @@ -161,7 +161,7 @@ var nameRow = new DeviceInfoEditRow(170); nameRow.Init(); nameRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.FunctionName)} : "); - nameRow.SetTitle(string.IsNullOrEmpty(device.CommonDevice.DeviceEpointName) ? Language.StringByID(R.MyInternationalizationString.UNKnown) : device.CommonDevice.DeviceName); + nameRow.SetTitle(string.IsNullOrEmpty(device.CommonDevice.DeviceEpointName) ? Language.StringByID(R.MyInternationalizationString.UNKnown) : device.CommonDevice.DeviceEpointName); infoFL.AddChidren(nameRow); var zoneRow = new DeviceInfoRow(308); diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceInfoWithZoneRow.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceInfoWithZoneRow.cs new file mode 100755 index 0000000..2da32e0 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceInfoWithZoneRow.cs @@ -0,0 +1,123 @@ +锘縰sing System; +using Shared.Common; +namespace Shared.Phone.Device.CommonForm +{ + public class DeviceInfoWithZoneRow : FrameLayout + { + /// <summary> + /// 鍥剧墖 + /// </summary> + public Button IconButton; + /// <summary> + /// NameBtn + /// </summary> + public Button NameButton; + /// <summary> + /// ZoneButton + /// </summary> + public Button ZoneButton; + /// <summary> + /// NextBtn + /// </summary> + public Button NextBtn; + /// <summary> + /// DeviceInfoWithZoneRow + /// </summary> + /// <param name="y"></param> + public DeviceInfoWithZoneRow(int y) + { + X = Application.GetRealWidth(0); + Y = Application.GetRealHeight(y); + Width = Application.GetRealWidth(1080); + Height = Application.GetRealHeight(127); + } + + /// <summary> + /// Init + /// </summary> + public void Init() + { + IconButton = new Button() + { + X = Application.GetRealWidth(CommonFormResouce.X_Left), + Height = Application.GetMinRealAverage(80), + Width = Application.GetMinRealAverage(80), + Gravity = Gravity.CenterVertical, + }; + AddChidren(IconButton); + + NameButton = new Button + { + X = Application.GetRealWidth(176), + Y=Application.GetRealHeight(12), + Width = Application.GetRealWidth(600), + Height = Application.GetRealHeight(60), + TextColor = ZigbeeColor.Current.GXCTextBlackColor, + TextAlignment = TextAlignment.CenterLeft + }; + AddChidren(NameButton); + + ZoneButton = new Button + { + X = Application.GetRealWidth(176), + Y = Application.GetRealHeight(72), + Width = Application.GetRealWidth(600), + Height = Application.GetRealHeight(50), + TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor2, + TextAlignment = TextAlignment.CenterLeft + }; + AddChidren(ZoneButton); + + NextBtn = new Button + { + X = Application.GetRealWidth(910), + Width = Application.GetMinRealAverage(100), + Height = Application.GetMinRealAverage(100), + Gravity = Gravity.CenterVertical, + SelectedImagePath = "Item/Next.png", + UnSelectedImagePath = "Item/NextSelected.png" + }; + AddChidren(NextBtn); + + var line = new Button() + { + X = Application.GetRealWidth(CommonFormResouce.X_Left), + Y = Height - 2, + Width = Application.GetRealWidth(965), + Height = 2, + BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor2, + }; + AddChidren(line); + } + + /// <summary> + /// SetName + /// </summary> + /// <param name="title"></param> + public void SetName(string title) + { + ZoneButton.Text = title; + } + + + /// <summary> + /// SetZone + /// </summary> + /// <param name="title"></param> + public void SetZone(string title) + { + NameButton.Text = title; + } + + /// <summary> + /// SetIcon + /// </summary> + /// <param name="imagePath"></param> + public void SetIcon(string imagePath) + { + IconButton.UnSelectedImagePath = imagePath; + } + + + } +} diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/FunctionMainView.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/FunctionMainView.cs new file mode 100755 index 0000000..8d6e9e6 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/FunctionMainView.cs @@ -0,0 +1,223 @@ +锘縰sing System; +using Shared.Common; + +namespace Shared.Phone.Device.CommonForm +{ + public class FunctionMainView : FrameLayout + { + /// <summary> + /// name + /// </summary> + public Button NameButton; + /// <summary> + /// collect + /// </summary> + public Button CollectButton; + /// <summary> + /// Image + /// </summary> + public Button IconButton; + /// <summary> + /// ImageBG + /// </summary> + public Button ImageBG; + + + /// <summary> + /// statu + /// </summary> + public Button StatuButton; + /// <summary> + /// switch + /// </summary> + public Button SwitchButton; + + /// <summary> + /// CardBG + /// </summary> + public Button CardBG; + + /// <summary> + /// v_Selected + /// </summary> + private bool v_Selected; + + /// <summary> + /// IsSelected + /// </summary> + public bool IsSelected + { + set + { + try + { + v_Selected = value; + SetStatu(v_Selected); + } + catch { }; + } + get + { + return v_Selected; + } + } + + public FunctionMainView(int x,int y) + { + X = Application.GetRealWidth(x); + Y = Application.GetRealHeight(y); + Width = Application.GetMinRealAverage(487); + Height = Application.GetMinRealAverage(348); + } + + /// <summary> + /// init + /// </summary> + public void Init() + { + //var bg = new Button + //{ + // Width = Application.GetMinReal(487), + // Height = Application.GetMinReal(348), + //UnSelectedImagePath = "Item/FunctionViewBG.png" + //}; + //AddChidren(bg); + + CardBG = new Button + { + Width = Application.GetMinRealAverage(487), + Height = Application.GetMinRealAverage(348), + UnSelectedImagePath = "Item/FunctionCardView.png", + SelectedImagePath = "Item/FunctionCardViewSelected.png", + Gravity=Gravity.CenterHorizontal + }; + AddChidren(CardBG); + + NameButton = new Button() + { + X=Application.GetMinRealAverage(40), + Y = Application.GetMinRealAverage(17), + Width = Application.GetMinRealAverage(320), + Height = Application.GetMinRealAverage(63), + TextColor = ZigbeeColor.Current.GXCTextGrayColor, + SelectedTextColor = ZigbeeColor.Current.GXCTextWhiteColor, + TextAlignment=TextAlignment.CenterLeft + }; + AddChidren(NameButton); + + CollectButton = new Button + { + X = Application.GetMinRealAverage(366), + Y = Application.GetMinRealAverage(14), + Width = Application.GetMinRealAverage(107), + Height = Application.GetMinRealAverage(107), + UnSelectedImagePath="Item/Collection1.png", + SelectedImagePath="Item/CollectionSelected1.png" + }; + AddChidren(CollectButton); + + var imgFL = new FrameLayout + { + X = Application.GetMinRealAverage(40), + Y = Application.GetMinRealAverage(101), + Width = Application.GetMinRealAverage(124), + Height = Application.GetMinRealAverage(124) + }; + AddChidren(imgFL); + + ImageBG = new Button() + { + //X=Application.GetMinRealAverage(40), + //Y = Application.GetMinRealAverage(101), + Width = Application.GetMinRealAverage(124), + Height = Application.GetMinRealAverage(124), + Gravity=Gravity.Center, + BackgroundColor = ZigbeeColor.Current.GXCForFunctionUnSelectedBackgroundColor, + SelectedBackgroundColor = ZigbeeColor.Current.GXCForFunctionBackgroundColor, + Radius=(uint)Application.GetMinRealAverage(124/2) + }; + imgFL.AddChidren(ImageBG); + + IconButton = new Button() + { + //X=Application.GetMinRealAverage(63), + //Y = Application.GetMinRealAverage(121), + Width = Application.GetMinRealAverage(84), + Height = Application.GetMinRealAverage(84), + Gravity=Gravity.Center + }; + imgFL.AddChidren(IconButton); + + StatuButton = new Button() + { + X=Application.GetMinRealAverage(46), + Y = Application.GetMinRealAverage(239), + Width = Application.GetMinRealAverage(279), + Height = Application.GetMinRealAverage(60), + TextColor = ZigbeeColor.Current.GXCTextBlackColor, + SelectedTextColor = ZigbeeColor.Current.GXCTextSelectedColor, + TextAlignment=TextAlignment.CenterLeft + }; + AddChidren(StatuButton); + + SwitchButton = new Button + { + X = Application.GetMinRealAverage(325), + Y = Application.GetMinRealAverage(202), + Width = Application.GetMinRealAverage(109), + Height = Application.GetMinRealAverage(104), + UnSelectedImagePath = "Item/Switch1.png", + SelectedImagePath = "Item/SwitchSelected1.png" + }; + AddChidren(SwitchButton); + } + + + /// <summary> + /// SetStatu + /// </summary> + /// <param name="statu"></param> + public void SetStatu(bool statu) + { + NameButton.IsSelected = IconButton.IsSelected = SwitchButton.IsSelected = StatuButton.IsSelected = CardBG.IsSelected = statu; + } + + /// <summary> + /// SetDeviceImage + /// </summary> + /// <param name="img"></param> + /// <param name="seletedImg"></param> + public void SetDeviceImage(string img,string seletedImg) + { + IconButton.UnSelectedImagePath = img; + IconButton.SelectedImagePath = seletedImg; + } + + /// <summary> + /// SetDeviceName + /// </summary> + /// <param name="name"></param> + public void SetDeviceName(string name) + { + NameButton.Text = name; + } + + /// <summary> + /// SetStatu + /// </summary> + /// <param name="statu"></param> + public void SetStatuText(string statu) + { + StatuButton.Text = statu; + } + + /// <summary> + /// SetCollect + /// </summary> + /// <param name="collect"></param> + public void SetCollect(bool collect) + { + CollectButton.IsSelected = collect; + } + } +} diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/RoomMainView.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/RoomMainView.cs new file mode 100755 index 0000000..a39d1ff --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/RoomMainView.cs @@ -0,0 +1,97 @@ +锘縰sing System; +using Shared.Common; + +namespace Shared.Phone.Device.CommonForm +{ + public class RoomMainView : FrameLayout + { + /// <summary> + /// SceneIcon + /// </summary> + public Button Icon; + /// <summary> + /// RoomNameButton + /// </summary> + public Button RoomNameButton; + /// <summary> + /// CardBG + /// </summary> + private Button CardBG; + + /// <summary> + /// RoomMainView + /// </summary> + /// <param name="x"></param> + /// <param name="y"></param> + public RoomMainView(int x, int y) + { + X = Application.GetRealWidth(x); + Y = Application.GetRealHeight(y); + Width = Application.GetMinRealAverage(487); + Height = Application.GetMinRealAverage(348); + } + + /// <summary> + /// init + /// </summary> + public void Init() + { + CardBG = new Button + { + Width = Application.GetMinRealAverage(495), + Height = Application.GetMinRealAverage(354), + UnSelectedImagePath = "Room/RoomCardView.png", + Gravity = Gravity.CenterHorizontal + }; + AddChidren(CardBG); + + Icon = new Button + { + X = Application.GetMinRealAverage(14), + Width = Application.GetMinRealAverage(467), + Height = Application.GetMinRealAverage(311), + Gravity = Gravity.CenterHorizontal, + Radius=(uint)Application.GetMinRealAverage(29) + }; + AddChidren(Icon); + + var nameBG = new Button + { + X=Application.GetMinRealAverage(14), + Width = Application.GetMinRealAverage(141), + Height = Application.GetMinRealAverage(84), + UnSelectedImagePath = "Room/RoomCardView_Name.png", + }; + AddChidren(nameBG); + + RoomNameButton = new Button() + { + X = Application.GetMinRealAverage(14), + Width = Application.GetMinRealAverage(141), + Height = Application.GetMinRealAverage(84), + TextColor = ZigbeeColor.Current.GXCTextWhiteColor + }; + AddChidren(RoomNameButton); + } + + /// <summary> + /// SetRoomName + /// </summary> + /// <param name="name"></param> + public void SetRoomName(string name) + { + RoomNameButton.Text = name; + } + + /// <summary> + /// SetRoomIcon + /// </summary> + /// <param name="imagePath"></param> + public void SetRoomIcon(string imagePath) + { + Icon.UnSelectedImagePath = imagePath; + } + + + } +} diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/SceneMainView.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/SceneMainView.cs new file mode 100755 index 0000000..9318ae8 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/SceneMainView.cs @@ -0,0 +1,183 @@ +锘縰sing System; +using Shared.Common; + +namespace Shared.Phone.Device.CommonForm +{ + public class SceneMainView : FrameLayout + { + /// <summary> + /// name + /// </summary> + public Button TimeButton; + /// <summary> + /// collect + /// </summary> + public Button CollectButton; + /// <summary> + /// SceneIcon + /// </summary> + public Button SceneIcon; + /// <summary> + /// statu + /// </summary> + public Button SceneNameButton; + /// <summary> + /// CardBG + /// </summary> + private Button CardBG; + /// <summary> + /// v_Selected + /// </summary> + private bool v_Selected; + + /// <summary> + /// IsSelected + /// </summary> + public bool IsSelected + { + set + { + try + { + v_Selected = value; + //SetStatu(v_Selected); + } + catch { }; + } + get + { + return v_Selected; + } + } + + public SceneMainView(int x, int y) + { + X = Application.GetRealWidth(x); + Y = Application.GetRealHeight(y); + Width = Application.GetMinRealAverage(487); + Height = Application.GetMinRealAverage(348); + } + + /// <summary> + /// init + /// </summary> + public void Init() + { + + CardBG = new Button + { + Width = Application.GetMinRealAverage(487), + Height = Application.GetMinRealAverage(348), + UnSelectedImagePath = "Item/FunctionCardView.png", + Gravity = Gravity.CenterHorizontal + }; + AddChidren(CardBG); + + SceneIcon = new Button + { + X = Application.GetMinRealAverage(14), + Width = Application.GetMinRealAverage(458), + Height = Application.GetRealHeight(305), + Gravity = Gravity.CenterHorizontal + }; + AddChidren(SceneIcon); + + var sceneBG = new Button + { + Width = Application.GetMinRealAverage(487), + Height = Application.GetMinRealAverage(348), + UnSelectedImagePath = "Item/SceneCard.png", + Gravity = Gravity.CenterHorizontal + }; + AddChidren(sceneBG); + + TimeButton = new Button() + { + X = Application.GetMinRealAverage(40), + Y = Application.GetMinRealAverage(17), + Width = Application.GetMinRealAverage(320), + Height = Application.GetMinRealAverage(63), + TextColor = ZigbeeColor.Current.GXCTextSelectedColor3, + TextAlignment = TextAlignment.CenterLeft, + Text="58s" + }; + AddChidren(TimeButton); + + CollectButton = new Button + { + X = Application.GetMinRealAverage(366), + Y = Application.GetMinRealAverage(14), + Width = Application.GetMinRealAverage(107), + Height = Application.GetMinRealAverage(107), + UnSelectedImagePath = "Item/Collection1.png", + SelectedImagePath = "Item/CollectionSelected1.png" + }; + AddChidren(CollectButton); + + SceneNameButton = new Button() + { + X = Application.GetMinRealAverage(46), + Y = Application.GetMinRealAverage(239), + Width = Application.GetMinRealAverage(279), + Height = Application.GetMinRealAverage(60), + TextColor = ZigbeeColor.Current.GXCTextBlackColor, + SelectedTextColor = ZigbeeColor.Current.GXCTextSelectedColor, + TextAlignment = TextAlignment.CenterLeft, + Text="璧峰簥" + }; + AddChidren(SceneNameButton); + + } + + + /// <summary> + /// SetTimeText + /// </summary> + /// <param name="name"></param> + public void SetTimeText(string name) + { + TimeButton.Width = Application.GetMinRealAverage(320); + TimeButton.Height = Application.GetMinRealAverage(63); + TimeButton.UnSelectedImagePath = string.Empty; + TimeButton.Text = name; + } + + /// <summary> + /// SetTimeImage + /// </summary> + public void SetTimeImage() + { + TimeButton.Width = Application.GetMinRealAverage(63); + TimeButton.Height = Application.GetMinRealAverage(63); + TimeButton.UnSelectedImagePath = "Item/Time.png"; + TimeButton.Text = string.Empty; + } + + /// <summary> + /// SetStatu + /// </summary> + /// <param name="statu"></param> + public void SetSceneNameText(string statu) + { + SceneNameButton.Text = statu; + } + + /// <summary> + /// SetIcon + /// </summary> + /// <param name="iconPath"></param> + public void SetIcon(string iconPath) + { + SceneIcon.UnSelectedImagePath = iconPath; + } + + /// <summary> + /// SetCollect + /// </summary> + /// <param name="collect"></param> + public void SetCollect(bool collect) + { + CollectButton.IsSelected = collect; + } + } +} diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectTime.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectTime.cs new file mode 100755 index 0000000..5044d9c --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectTime.cs @@ -0,0 +1,248 @@ +锘縰sing System; +using System.Collections.Generic; +using Shared.Common; + +namespace Shared.Phone.Device.CommonForm +{ + public class SelectTime:FrameLayout + { + public Action<int> TimeAction; + + Button TempSelectBtn; + + Button TempTimeBtn; + + public int TempTime; + + /// <summary> + /// Init + /// </summary> + public void Init() + { + var dialog = new FrameLayout() + { + BackgroundColor = ZigbeeColor.Current.GXCDailogBackGroundColor + }; + AddChidren(dialog); + + dialog.MouseUpEventHandler += (sender, e) => + { + RemoveFromParent(); + }; + + var backgroundFL = new FrameLayout + { + Y = Application.GetRealHeight(596), + Height = Application.GetRealHeight(1425), + BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, + Radius=(uint)Application.GetRealHeight(20) + }; + dialog.AddChidren(backgroundFL); + + var topView = new FrameLayout + { + Height = Application.GetRealHeight(138) + }; + backgroundFL.AddChidren(topView); + + var cancle = new Button + { + X=Application.GetRealWidth(80), + Width=Application.GetRealWidth(300), + TextAlignment = TextAlignment.CenterLeft, + TextColor = ZigbeeColor.Current.GXCTextGrayColor, + TextID=R.MyInternationalizationString.Cancel, + TextSize=16 + }; + topView.AddChidren(cancle); + + var title = new Button + { + Width = Application.GetRealWidth(300), + Gravity=Gravity.CenterHorizontal, + TextColor = ZigbeeColor.Current.GXCTextBlackColor2, + TextID=R.MyInternationalizationString.Delay, + TextSize = 16 + }; + topView.AddChidren(title); + + var confrim=new Button + { + X = Application.GetRealWidth(CommonFormResouce.AppRealWidth-80-300), + Width = Application.GetRealWidth(300), + TextAlignment = TextAlignment.CenterRight, + TextColor = ZigbeeColor.Current.GXCTextSelectedColor2, + TextID = R.MyInternationalizationString.Confrim, + TextSize = 16 + }; + topView.AddChidren(confrim); + + var timeLayout = new VerticalScrolViewLayout + { + Y = Application.GetRealHeight(207), + Height = Application.GetRealHeight(703+127*2+12*2) + }; + backgroundFL.AddChidren(timeLayout); + + TempSelectBtn = new Button(); + TempTimeBtn = new Button(); + + var unKe = new FrameLayout + { + Y = timeLayout.Bottom, + Height = Application.GetRealHeight(161), + BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor + }; + backgroundFL.AddChidren(unKe); + + var notOpen = new Button + { + X = Application.GetRealWidth(80), + TextColor = ZigbeeColor.Current.GXCTextGrayColor4, + TextID = R.MyInternationalizationString.NotOpen, + TextAlignment = TextAlignment.CenterLeft, + Gravity = Gravity.CenterVertical, + TextSize=16 + }; + unKe.AddChidren(notOpen); + + cancle.MouseUpEventHandler += Close; + confrim.MouseUpEventHandler += Confrim_MouseEvent; + notOpen.MouseUpEventHandler += NotOpen_MouseEvent; + + var tList = new List<int>(); + tList.Add(15); + tList.Add(30); + tList.Add(60); + tList.Add(60 * 5); + tList.Add(60 * 15); + tList.Add(60 * 30); + tList.Add(60 * 60); + + foreach(var t in tList) + { + AddTime(timeLayout, t); + } + + } + + /// <summary> + /// AddTime + /// </summary> + /// <param name="verticalScrolView"></param> + private void AddTime(VerticalScrolViewLayout verticalScrolView, int timess) + { + var row = new FrameLayout + { + Height = Application.GetRealHeight(127+12), + BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor + }; + verticalScrolView.AddChidren(row); + + var trow = new FrameLayout + { + Y=Application.GetRealHeight(12), + Height = Application.GetRealHeight(127), + BackgroundColor=ZigbeeColor.Current.GXCBackgroundColor + }; + row.AddChidren(trow); + + var timeBtn = new Button + { + X = Application.GetRealWidth(80), + Width=Application.GetRealWidth(500), + TextAlignment = TextAlignment.CenterLeft, + TextColor = ZigbeeColor.Current.GXCTextGrayColor4, + SelectedTextColor = ZigbeeColor.Current.GXCTextBlackColor, + IsSelected=false + }; + trow.AddChidren(timeBtn); + + var selectBtn = new Button + { + X = Application.GetRealWidth(942), + Width = Application.GetMinRealAverage(60), + Height=Application.GetMinRealAverage(60), + Gravity=Gravity.CenterVertical, + UnSelectedImagePath="Item/ItemSelected.png", + Visible=false + }; + trow.AddChidren(selectBtn); + + var Line = new FrameLayout() + { + Y = trow.Height - 1, + Width = Application.GetRealWidth(919), + Height = 1, + Gravity=Gravity.CenterHorizontal, + BackgroundColor = Common.ZigbeeColor.Current.GXCGrayLineColor2 + }; + trow.AddChidren(Line); + + + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { + TempTimeBtn.IsSelected = false; + TempSelectBtn.Visible = false; + + timeBtn.IsSelected = true; + selectBtn.Visible = true; + + TempTimeBtn = timeBtn; + TempSelectBtn = selectBtn; + + TempTime = timess; + }; + + timeBtn.MouseUpEventHandler += eventHandler; + trow.MouseUpEventHandler += eventHandler; + + timeBtn.Text =CommonFormResouce.GetTimeString(timess); + + if (timess == TempTime) + { + timeBtn.IsSelected = true; + selectBtn.Visible = true; + TempTimeBtn = timeBtn; + TempSelectBtn = selectBtn; + } + + } + + + + + /// <summary> + /// Close + /// </summary> + /// <param name="sender"></param> + /// <param name="mouseEventArgs"></param> + private void Close(object sender,MouseEventArgs mouseEventArgs) + { + RemoveFromParent(); + } + + /// <summary> + /// Confrim_MouseEvent + /// </summary> + /// <param name="sender"></param> + /// <param name="mouseEventArgs"></param> + private void Confrim_MouseEvent(object sender,MouseEventArgs mouseEventArgs) + { + TimeAction.Invoke(TempTime); + RemoveFromParent(); + } + + /// <summary> + /// NotOpen_MouseEvent + /// </summary> + /// <param name="sender"></param> + /// <param name="mouseEventArgs"></param> + private void NotOpen_MouseEvent(object sender,MouseEventArgs mouseEventArgs) + { + TimeAction.Invoke(0); + RemoveFromParent(); + } + + } +} diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/TopFrameLayout.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/TopFrameLayout.cs index 8448127..e3379a5 100755 --- a/ZigbeeApp/Shared/Phone/Device/CommonForm/TopFrameLayout.cs +++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/TopFrameLayout.cs @@ -33,7 +33,7 @@ public TopFrameLayout() { BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor; - Width = Application.GetRealWidth(CommonPage.AppRealWidth); + Width = Application.GetRealWidth(CommonFormResouce.AppRealWidth); Height = Application.GetRealHeight(CommonFormResouce.TopFrameLayout_Height); } diff --git a/ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs b/ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs index 06a43b9..7cdecac 100755 --- a/ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs +++ b/ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs @@ -1,5 +1,6 @@ 锘縰sing System; using Shared.Common; +using Shared.Phone.Device.CommonForm; using ZigBee.Device; namespace Shared.Phone.Device.Light @@ -17,10 +18,6 @@ ///// </summary> private CommonForm.TopFrameLayout top; /// <summary> - /// 鏇村璁剧疆 - /// </summary> - private Button moreBtn; - /// <summary> /// 浼犺繃鏉ョ殑璁惧 /// </summary> private DeviceUI device; @@ -33,25 +30,14 @@ /// </summary> private Shared.Common.Room room; /// <summary> - /// The middle fl. + /// bodyFrameLayout /// </summary> - private FrameLayout midFL; + private FrameLayout bodyFrameLayout; /// <summary> /// 鏀惰棌鎸夐挳 /// </summary> private Button collectionBtn; - /// <summary> - /// 璁惧鏄惁鍦ㄧ嚎鏍囪瘑--Online - /// </summary> - private readonly string DeviceStatus_Online = "Online"; - /// <summary> - /// 璁惧鐘舵�佸紑鍏虫爣璇�--Switch - /// </summary> - private readonly string DeviceStatus_OnOffStatus = "Switch"; - /// <summary> - /// The light image. - /// </summary> - private Button deviceIMG; + /// <summary> /// 寮�鍏� /// </summary> @@ -59,12 +45,22 @@ /// <summary> /// 婊戞潯 /// </summary> - private HorizontalSeekBar levelSeekBar; - /// <summary> - /// 寤舵椂 300姣 - /// </summary> - private int sleepSpan = 300; + private WaveSeekBar levelSeekBar; + + private Button StatuBtn; + /// <summary> + /// 鎴块棿 + /// </summary> + private Button roomBtn; + /// <summary> + /// 鎴块棿鍚� + /// </summary> + private Button roomName; + /// <summary> + /// MaxLevel + /// </summary> + private const int MaxLevel = 254; #endregion #region 鈼� 鎺ュ彛__________________________ @@ -135,6 +131,18 @@ } dimmableLight.OnOffStatus = dimmableLight.DeviceStatusReport.AttriBute[0].AttriButeData; switchBtn.IsSelected = dimmableLight.OnOffStatus == 1; + StatuBtn.Text = CommonFormResouce.GetSwitchStatu(switchBtn.IsSelected); + if (switchBtn.IsSelected == true) + { + levelSeekBar.IsClickable = true; + levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarColor; + } + else + { + levelSeekBar.IsClickable = false; + levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor; + } + //change color dimmableLight.LastDateTime = DateTime.Now; } //浜害 @@ -153,18 +161,11 @@ //姝ゅ睘鎬ц〃鏄庡綋鍓嶄寒搴︾▼搴� dimmableLight.Level = attriButeList[0].AttriButeData; dimmableLight.LastDateTime = DateTime.Now; - levelSeekBar.Progress = dimmableLight.Level; + levelSeekBar.Progress = (int)(dimmableLight.Level*1.0/MaxLevel*100); break; } } - //***鏂版敼***璁惧鐘舵�佷笂鎶ヤ腑锛屽綋CluterID=3,璇佹槑璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁� - else if ((common as DimmableLight).DeviceStatusReport.CluterID == 3) - { - dimmableLight = deviceUI.CommonDevice as DimmableLight; - dimmableLight.IsOnline = 1; - deviceIMG.IsSelected = dimmableLight.IsOnline == 1; - dimmableLight.LastDateTime = DateTime.Now; - } + } } catch (Exception ex) @@ -175,34 +176,7 @@ } else if (typeTag == "OnlineStatusChange") { - Application.RunOnMainThread(() => - { - try - { - var deviceUI = device; - //璁惧涓虹┖ - if (deviceUI.CommonDevice == null) - { - return; - } - //鏄惁涓哄綋鍓嶈澶� - if (deviceUI.CommonDevice.DeviceEpoint != common.DeviceEpoint || deviceUI.CommonDevice.DeviceAddr != common.DeviceAddr) - { - return; - } - if (deviceUI.CommonDevice.Type == DeviceType.DimmableLight) - { - dimmableLight = deviceUI.CommonDevice as DimmableLight; - dimmableLight.IsOnline = (common as DimmableLight).IsOnline; - deviceIMG.IsSelected = dimmableLight.IsOnline == 1; - dimmableLight.LastDateTime = DateTime.Now; - } - } - catch (Exception ex) - { - System.Console.WriteLine($"Error:{ex.Message}"); - } - }); + } } @@ -231,6 +205,7 @@ public DimmableLightControl() { BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor; + ZbGateway.StatusList.Add(this); } #endregion @@ -243,7 +218,6 @@ /// <param name="room">Room.</param> public void Show(DeviceUI device, Shared.Common.Room room) { - ZbGateway.StatusList.Add(this); this.device = device; this.room = room; this.dimmableLight = device.CommonDevice as ZigBee.Device.DimmableLight; @@ -251,7 +225,7 @@ //娣诲姞topview AddTopView(); //娣诲姞midview - AddMidview(); + AddBodyView(this.device); //缁戝畾浜嬩欢 BindEvent(); //鏀惰棌 @@ -296,27 +270,28 @@ RemoveFromParent(); }; - AddMoreview(); - } - - /// <summary> - /// Adds the moreview. - /// </summary> - private void AddMoreview() - { - moreBtn = new CommonForm.SelectedStatuButton() + var sharedBtn = new Button { - X = Application.GetRealWidth(CommonPage.AppRealWidth - 150), - Width = Application.GetMinReal(110), - Height = Application.GetMinReal(110), + X = Application.GetRealWidth(850), + Width = Application.GetMinReal(69), + Height = Application.GetMinReal(69), Gravity = Gravity.CenterVertical, - UnSelectedImagePath = "Item/More.png", - SelectedImagePath = "Item/MoreSelected.png", + UnSelectedImagePath = "Item/Shared.png" + }; + top.topView.AddChidren(sharedBtn); + + var moreBtn = new Button + { + X = Application.GetRealWidth(953), + Width = Application.GetMinReal(69), + Height = Application.GetMinReal(69), + Gravity = Gravity.CenterVertical, + UnSelectedImagePath = "Item/More.png" }; top.topView.AddChidren(moreBtn); + moreBtn.MouseUpEventHandler += MoreEvent; } - /// <summary> /// 鏇村璁剧疆 /// </summary> @@ -339,17 +314,17 @@ #region 鈼� midview_______________________ /// <summary> - /// Adds the midview. + /// AddBodyView /// </summary> - private void AddMidview() + public void AddBodyView(DeviceUI device) { - midFL = new FrameLayout() + bodyFrameLayout = new FrameLayout() { - Height = Application.GetRealHeight(CommonPage.AppRealHeight - CommonPage.Navigation_Height), - Y = top.Bottom, - BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor + Y = Application.GetRealHeight(184), + Height = Application.GetRealHeight(1737), + BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor, }; - AddChidren(midFL); + AddChidren(bodyFrameLayout); AddItemview(); } @@ -367,111 +342,123 @@ Y = Application.GetRealHeight(115), Width = Application.GetRealWidth(965), Height = Application.GetRealHeight(1316), - Radius = CommonPage.BigFormRadius, + Radius = (uint)Application.GetRealHeight(CommonFormResouce.BigFormRadius), Gravity = Gravity.CenterHorizontal, - BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor + BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor }; - midFL.AddChidren(itemView); - var deviceView = new FrameLayout() - { - X = 2, - Y = 2, - Width = itemView.Width - 4, - Height = itemView.Height - Application.GetRealHeight(138), - BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, - Tag = device - }; - itemView.AddChidren(deviceView); + bodyFrameLayout.AddChidren(itemView); collectionBtn = new Button() { - X = deviceView.Width - Application.GetRealWidth(130), - Y = Application.GetRealHeight(20), - Width = Application.GetMinReal(110), - Height = Application.GetMinReal(110), + X = Application.GetRealWidth(850), + Y = Application.GetRealHeight(46), + Width = Application.GetMinReal(69), + Height = Application.GetMinReal(69), UnSelectedImagePath = "Item/Collection.png", SelectedImagePath = "Item/CollectionSelected.png" }; - deviceView.AddChidren(collectionBtn); + itemView.AddChidren(collectionBtn); - deviceIMG = new Button() + var deviceNameBtn = new Button() { - Y = Application.GetRealHeight(100), - Height = Application.GetMinRealAverage(240), - Width = Application.GetMinRealAverage(240), - Gravity = Gravity.CenterHorizontal, - UnSelectedImagePath = device.IconPath, - SelectedImagePath = device.OnlineIconPath, - IsSelected = dimmableLight.IsOnline == 1, - Tag = DeviceStatus_Online - }; - deviceView.AddChidren(deviceIMG); - - var lightName = new Button() - { - Y = deviceIMG.Bottom, - Height = Application.GetRealHeight(85), + Y = Application.GetRealHeight(46), + Width = Application.GetRealWidth(500), + Height = Application.GetRealHeight(60), Gravity = Gravity.CenterHorizontal, Text = device.CommonDevice.DeviceEpointName, - TextColor = ZigbeeColor.Current.GXCTextBlackColor + TextColor = ZigbeeColor.Current.GXCTextBlackColor, + TextSize = 15 }; - deviceView.AddChidren(lightName); + itemView.AddChidren(deviceNameBtn); - levelSeekBar = new HorizontalSeekBar() + StatuBtn = new Button { - Y = lightName.Bottom + Application.GetRealHeight(150), - Width = Application.GetRealWidth(800), - Height = Application.GetRealHeight(80), + Y = Application.GetRealHeight(118), + Width = Application.GetRealWidth(600), + Height = Application.GetRealHeight(60), Gravity = Gravity.CenterHorizontal, - BackgroundColor = ZigbeeColor.Current.GXCSliderUnSelectedColor, - ThumbColor = ZigbeeColor.Current.GXCButtonBlueColor, - BorderColor = ZigbeeColor.Current.GXCButtonBlueColor, - ProgressColor = ZigbeeColor.Current.GXCButtonBlueColor, - Max = 254, - Tag = "LevelSeekBar", - Progress = dimmableLight.Level, - SleepTime=sleepSpan, + TextColor = ZigbeeColor.Current.GXCTextGrayColor, + Text = CommonFormResouce.GetSwitchStatu(device.CommonDevice.IsOnline == 1) }; - deviceView.AddChidren(levelSeekBar); - levelSeekBar.ProgressChanged += (send2, e2) => + itemView.AddChidren(StatuBtn); + + levelSeekBar = new WaveSeekBar() { - dimmableLight.SetLevel(levelSeekBar.Progress); + Y = Application.GetRealHeight(377), + Width = Application.GetRealWidth(271), + Height = Application.GetRealHeight(533), + Gravity = Gravity.CenterHorizontal, + WavePadding = 2, + MaxValue=100, + Progress = (int)(dimmableLight.Level*1.0/MaxLevel*100), + WaveColor = ZigbeeColor.Current.GXCWaveSeekBarColor + }; + itemView.AddChidren(levelSeekBar); + + if (dimmableLight.OnOffStatus==1) + { + levelSeekBar.IsClickable = true; + levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarColor; + } + else + { + levelSeekBar.IsClickable = false; + levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor; + } + + levelSeekBar.OnProgressChangedEvent += (send2, e2) => + { + dimmableLight.SetLevel((int)(levelSeekBar.Progress*MaxLevel/100.0)); }; switchBtn = new Button() { - Y = levelSeekBar.Bottom + Application.GetRealHeight(150), + Y = Application.GetRealHeight(1005), + Width = Application.GetMinRealAverage(81), + Height = Application.GetMinRealAverage(81), Gravity = Gravity.CenterHorizontal, - Width = Application.GetMinRealAverage(180), - Height = Application.GetMinRealAverage(120), UnSelectedImagePath = "Item/Switch.png", SelectedImagePath = "Item/SwitchSelected.png", - Tag = DeviceStatus_OnOffStatus, - IsSelected = dimmableLight.OnOffStatus == 1 + IsSelected = (device.CommonDevice as DimmableLight).OnOffStatus == 1 }; - deviceView.AddChidren(switchBtn); + itemView.AddChidren(switchBtn); - var roomBtn = new Button() + var roomBG = new Button { - X = Application.GetRealWidth(50), - Y = Application.GetRealHeight(25) + deviceView.Bottom, + Y = Application.GetRealHeight(1178 - 50), + Height = Application.GetRealHeight(138 + 50), + BackgroundColor = ZigbeeColor.Current.GXCBlackBackgroundColor, + Radius = (uint)Application.GetRealHeight(CommonFormResouce.BigFormRadius) + }; + itemView.AddChidren(roomBG); + + var roomBG2 = new Button + { + Y = Application.GetRealHeight(1178 - 50), + Height = Application.GetRealHeight(50), + BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, + }; + itemView.AddChidren(roomBG2); + + roomBtn = new Button() + { + X = Application.GetRealWidth(CommonFormResouce.X_Left), + Y = Application.GetRealHeight(1207), Width = Application.GetMinReal(80), Height = Application.GetMinReal(80), - UnSelectedImagePath = "Item/Room.png", - SelectedImagePath = "Item/RoomSelected.png" + UnSelectedImagePath = "Item/Room.png" }; itemView.AddChidren(roomBtn); - var roomName = new Button() + roomName = new Button() { - X = roomBtn.Right + Application.GetRealWidth(20), - Y = roomBtn.Y, + X = Application.GetRealWidth(150), + Y = Application.GetRealHeight(1224), Width = Application.GetRealWidth(400), - Height = Application.GetRealHeight(80), + Height = Application.GetRealHeight(50), Text = room.Name, TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.GXCTextBlackColor, - SelectedTextColor = ZigbeeColor.Current.GXCTextBlueColor + TextColor = ZigbeeColor.Current.GXCTextWhiteColor }; itemView.AddChidren(roomName); } @@ -486,7 +473,6 @@ { switchBtn.MouseUpEventHandler += Switch_MouseUpEvent; collectionBtn.MouseUpEventHandler += Collection; - moreBtn.MouseUpEventHandler += MoreEvent; } #endregion @@ -501,13 +487,18 @@ private void Switch_MouseUpEvent(object sender, MouseEventArgs eventArgs) { switchBtn.IsSelected = !switchBtn.IsSelected; + StatuBtn.Text = CommonFormResouce.GetSwitchStatu(switchBtn.IsSelected); if (switchBtn.IsSelected == true) { dimmableLight.SwitchControl(1); + levelSeekBar.IsClickable = true; + levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarColor; } else { dimmableLight.SwitchControl(0); + levelSeekBar.IsClickable = false; + levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor; } } @@ -538,15 +529,15 @@ private void Collection(object sender, MouseEventArgs e) { //collection - if (collectionBtn.IsSelected) + if ((sender as Button).IsSelected) { - Shared.Common.Room.Lists[0].DeleteDevice(device.FileName); - collectionBtn.IsSelected = false; + Shared.Common.Room.GetLoveRoom().DeleteDevice(device.FileName); + (sender as Button).IsSelected = false; } else { - Shared.Common.Room.Lists[0].AddDevice(device.FileName); - collectionBtn.IsSelected = true; + Shared.Common.Room.GetLoveRoom().AddDevice(device.FileName); + (sender as Button).IsSelected = true; } } diff --git a/ZigbeeApp/Shared/Phone/Device/Light/LightControl.cs b/ZigbeeApp/Shared/Phone/Device/Light/LightControl.cs index fc3c116..3e280d9 100755 --- a/ZigbeeApp/Shared/Phone/Device/Light/LightControl.cs +++ b/ZigbeeApp/Shared/Phone/Device/Light/LightControl.cs @@ -1,6 +1,7 @@ 锘縰sing System; using System.Collections.Generic; using Shared.Common; +using Shared.Phone.Device.CommonForm; using Shared.Phone.UserView; using ZigBee.Device; namespace Shared.Phone.Device.Light @@ -12,14 +13,6 @@ { #region 鈼� 鍙橀噺__________________________ /// <summary> - /// 璁惧鏄惁鍦ㄧ嚎鏍囪瘑--Online - /// </summary> - private readonly string DeviceStatus_Online = "Online"; - /// <summary> - /// 璁惧鐘舵�佸紑鍏虫爣璇�--Switch - /// </summary> - private readonly string DeviceStatus_OnOffStatus = "Switch"; - /// <summary> /// 寮�鍏� /// </summary> private Button switchBtn; @@ -27,10 +20,7 @@ /// The action. /// </summary> public Action action; - /// <summary> - /// The light view. - /// </summary> - private FrameLayout deviceView; + /// <summary> /// The light image. /// </summary> @@ -47,10 +37,7 @@ /// 浼犺繃鏉ョ殑鎴块棿 /// </summary> private Shared.Common.Room room; - /// <summary> - /// 鏇村璁剧疆 - /// </summary> - private Button moreBtn; + /// <summary> /// 鎴块棿 /// </summary> @@ -67,6 +54,13 @@ /// 鏄惁鍙戦�佹帶鍒跺懡浠ゆ垚鍔熶簡 /// </summary> private bool sendedControlCommand = false; + + /// <summary> + /// bodyFrameLayout + /// </summary> + private FrameLayout bodyFrameLayout; + + private Button StatuBtn; #endregion @@ -114,7 +108,7 @@ { try { - var deviceUI = deviceView.Tag as DeviceUI; + var deviceUI = device; //璁惧涓虹┖ if (deviceUI.CommonDevice == null) { @@ -132,20 +126,13 @@ var light = deviceUI.CommonDevice as ToggleLight; light.DeviceStatusReport = (common as ToggleLight).DeviceStatusReport; //璁板綍銆佹洿鏂扮姸鎬� - if(light.DeviceStatusReport.AttriBute==null || light.DeviceStatusReport.AttriBute.Count==0) + if (light.DeviceStatusReport.AttriBute == null || light.DeviceStatusReport.AttriBute.Count == 0) { return; } light.OnOffStatus = light.DeviceStatusReport.AttriBute[0].AttriButeData; - switchBtn.IsSelected = light.OnOffStatus == 1; - light.LastDateTime = DateTime.Now; - } - //***鏂版敼***璁惧鐘舵�佷笂鎶ヤ腑锛屽綋CluterID=3,璇佹槑璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁� - else if ((common as ToggleLight).DeviceStatusReport.CluterID == 3) - { - var light = deviceUI.CommonDevice as ToggleLight; - light.IsOnline = 1; - deviceIMG.IsSelected = light.IsOnline == 1; + deviceIMG.IsSelected = switchBtn.IsSelected = light.OnOffStatus == 1; + StatuBtn.Text = CommonFormResouce.GetSwitchStatu(deviceIMG.IsSelected); light.LastDateTime = DateTime.Now; } } @@ -158,75 +145,49 @@ } else if (typeTag == "OnlineStatusChange") { - Application.RunOnMainThread(() => - { - try - { - var deviceUI = deviceView.Tag as DeviceUI; - //璁惧涓虹┖ - if (deviceUI.CommonDevice == null) - { - return; - } - //鏄惁涓哄綋鍓嶈澶� - if (deviceUI.CommonDevice.DeviceEpoint != common.DeviceEpoint || deviceUI.CommonDevice.DeviceAddr != common.DeviceAddr) - { - return; - } - if (deviceUI.CommonDevice.Type == DeviceType.OnOffOutput) - { - var light = deviceUI.CommonDevice as ToggleLight; - light.IsOnline = (common as ToggleLight).IsOnline; - deviceIMG.IsSelected = light.IsOnline == 1; - light.LastDateTime = DateTime.Now; - } - } - catch (Exception ex) - { - System.Console.WriteLine($"Error:{ex.Message}"); - } - }); + } } #endregion - #region 鈼� 鍒濆鍖朹_______________________ + #region 鈼� 鍒濆鍖朹____________________ + /// <summary> + /// 閲嶅啓绉婚櫎鏂规硶 + /// </summary> + public override void RemoveFromParent() + { + ZbGateway.StatusList.Remove(this); + action(); + action = null; + RemoveUpdateControlDeviceStatuAction(); + base.RemoveFromParent(); + } + + /// <summary> + /// 鏋勯�犳柟娉� + /// </summary> + public LightControl() + { + BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor; + ZbGateway.StatusList.Add(this); + } /// <summary> /// 鏄剧ず鐣岄潰 /// </summary> - /// <param name="device">Device.</param> + /// <param name="dev">Device.</param> /// <param name="room">Room.</param> - public void Show(DeviceUI device,Shared.Common.Room room) + public void Show(DeviceUI dev,Shared.Common.Room room) { - #region topview - - var topBGView = new FrameLayout()鈥� {鈥� Height = Application.GetRealHeight(CommonPage.Navigation_Height),鈥� BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor鈥� };鈥� AddChidren(topBGView);鈥� var topView = new FrameLayout()鈥� {鈥� Y = Application.GetRealHeight(CommonPage.NavigationTitle_Y),鈥� Height = Application.GetRealHeight(CommonPage.Navigation_Height - CommonPage.NavigationTitle_Y),鈥� BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor,鈥� };鈥� AddChidren(topView); - - moreBtn = new Device.CommonForm.SelectedStatuButton() - { - X=Application.GetRealWidth(CommonPage.AppRealWidth-150), - Width=Application.GetMinReal(110), - Height=Application.GetMinReal(110), - Gravity=Gravity.CenterVertical, - UnSelectedImagePath = "Item/More.png", - SelectedImagePath = "Item/MoreSelected.png", - }; - topView.AddChidren(moreBtn); - - var back = new Device.CommonForm.BackButton() { };鈥� topView.AddChidren(back); - back.MouseUpEventHandler += (sender, e) => - { - this.RemoveFromParent(); - }; - - if (device == null || device.CommonDevice == null || room == null) - { - return; - } - this.device = device; - this.zbGateway = this.device.CommonDevice.Gateway; + device = dev; + zbGateway = this.device.CommonDevice.Gateway; this.room = room; - var light = device.CommonDevice as ToggleLight; + + AddTop(); + + AddBodyView(device); + + + var light = dev.CommonDevice as ToggleLight; //琛ヤ笂闈炶繙绋� if (light.Gateway == null) { @@ -249,122 +210,9 @@ light.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); } } - #endregion - #region midFL - var midFL = new FrameLayout() - { - Height = Application.GetRealHeight(CommonPage.AppRealHeight - CommonPage.Navigation_Height), - Y = topView.Bottom, - BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, - }; - this.AddChidren(midFL); - - var itemView = new FrameLayout() - { - X = Application.GetRealWidth(50), - Y = Application.GetRealHeight(50), - Width = Application.GetRealWidth(CommonPage.AppRealWidth - 100), - Height = Application.GetRealHeight(850), - Radius = CommonPage.BigFormRadius, - Gravity = Gravity.CenterHorizontal, - BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor - }; - midFL.AddChidren(itemView); - deviceView = new FrameLayout() - { - X = 2, - Y = 2, - Width = itemView.Width - 4, - Height = itemView.Height - Application.GetRealHeight(130), - BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, - Tag = device - }; - itemView.AddChidren(deviceView); - - collectionBtn = new Button() - { - X = deviceView.Width - Application.GetRealWidth(130), - Y = Application.GetRealHeight(20), - Width = Application.GetMinReal(110), - Height = Application.GetMinReal(110), - UnSelectedImagePath = "Item/Collection.png", - SelectedImagePath = "Item/CollectionSelected.png" - }; - deviceView.AddChidren(collectionBtn); - - deviceIMG = new Button() - { - Y = Application.GetRealHeight(100), - Height = Application.GetMinRealAverage(240), - Width = Application.GetMinRealAverage(240), - Gravity = Gravity.CenterHorizontal, - UnSelectedImagePath = device.IconPath, - SelectedImagePath = device.OnlineIconPath, - IsSelected = light.IsOnline == 1, - Tag = DeviceStatus_Online - }; - deviceView.AddChidren(deviceIMG); - - var lightName = new Button() - { - Y = deviceIMG.Bottom, - Height = Application.GetRealHeight(85), - Gravity = Gravity.CenterHorizontal, - Text = device.CommonDevice.DeviceEpointName, - TextColor = ZigbeeColor.Current.GXCTextBlackColor - }; - deviceView.AddChidren(lightName); - - switchBtn = new Button() - { - Y = lightName.Bottom + Application.GetRealHeight(70), - Gravity = Gravity.CenterHorizontal, - Width = Application.GetMinRealAverage(180), - Height = Application.GetMinRealAverage(120), - UnSelectedImagePath = "Item/Switch.png", - SelectedImagePath = "Item/SwitchSelected.png", - Tag = DeviceStatus_OnOffStatus, - IsSelected = light.OnOffStatus == 1 - }; - deviceView.AddChidren(switchBtn); - - roomBtn = new Button() - { - X = Application.GetRealWidth(50), - Y = Application.GetRealHeight(25) + deviceView.Bottom, - Width = Application.GetMinReal(80), - Height = Application.GetMinReal(80), - UnSelectedImagePath = "Item/Room.png", - SelectedImagePath = "Item/RoomSelected.png" - }; - itemView.AddChidren(roomBtn); - - roomName = new Button() - { - X = roomBtn.Right + Application.GetRealWidth(20), - Y = roomBtn.Y, - Width = Application.GetRealWidth(400), - Height = Application.GetRealHeight(80), - Text = room.Name, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.GXCTextBlackColor, - SelectedTextColor = ZigbeeColor.Current.GXCTextBlueColor - }; - itemView.AddChidren(roomName); - - //var moreBtn = new Button() - //{ - // X = itemView.Width - Application.GetRealWidth(130), - // Y = roomBtn.Y, - // Width = Application.GetMinReal(80), - // Height = Application.GetMinReal(80), - // UnSelectedImagePath = "Item/More.png", - // SelectedImagePath = "Item/MoreSelected.png", - //}; - //itemView.AddChidren(moreBtn); - var dev = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); - if (dev == null) + var de = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); + if (de == null) { collectionBtn.IsSelected = false; } @@ -372,29 +220,172 @@ { collectionBtn.IsSelected = true; } - this.BindEvent(); - #endregion + + + BindEvent(); + } - /// <summary> - /// 閲嶅啓绉婚櫎鏂规硶 - /// </summary> - public override void RemoveFromParent() - { - ZbGateway.StatusList.Remove(this); - action(); - action = null; - RemoveUpdateControlDeviceStatuAction(); - base.RemoveFromParent(); - } + #endregion + + #region 鈼� Add______________________________ /// <summary> - /// 鏋勯�犳柟娉� + /// AddTop /// </summary> - public LightControl() + public void AddTop() { - BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor; - ZbGateway.StatusList.Add(this); + var top = new TopFrameLayout(); + AddChidren(top); + top.InitTopview(); + top.backButton.MouseUpEventHandler += (sender, e) => + { + RemoveFromParent(); + }; + + var sharedBtn = new Button + { + X = Application.GetRealWidth(850), + Width = Application.GetMinReal(69), + Height = Application.GetMinReal(69), + Gravity = Gravity.CenterVertical, + UnSelectedImagePath = "Item/Shared.png" + }; + top.topView.AddChidren(sharedBtn); + + var moreBtn = new Button + { + X = Application.GetRealWidth(953), + Width = Application.GetMinReal(69), + Height = Application.GetMinReal(69), + Gravity=Gravity.CenterVertical, + UnSelectedImagePath = "Item/More.png" + }; + top.topView.AddChidren(moreBtn); + + moreBtn.MouseUpEventHandler += More; + + } + /// <summary> + /// AddBodyView + /// </summary> + public void AddBodyView(DeviceUI device) + { + bodyFrameLayout = new FrameLayout() + { + Y = Application.GetRealHeight(184), + Height = Application.GetRealHeight(1737), + BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor, + }; + AddChidren(bodyFrameLayout); + + var itemView = new FrameLayout() + { + Y = Application.GetRealHeight(115), + Width = Application.GetRealWidth(965), + Height = Application.GetRealHeight(1316), + Radius =(uint)Application.GetRealHeight(CommonFormResouce.BigFormRadius), + Gravity = Gravity.CenterHorizontal, + BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor + }; + bodyFrameLayout.AddChidren(itemView); + + collectionBtn = new Button() + { + X = Application.GetRealWidth(850), + Y = Application.GetRealHeight(46), + Width = Application.GetMinReal(69), + Height = Application.GetMinReal(69), + UnSelectedImagePath = "Item/Collection.png", + SelectedImagePath = "Item/CollectionSelected.png" + }; + itemView.AddChidren(collectionBtn); + + var deviceNameBtn = new Button() + { + Y = Application.GetRealHeight(46), + Width=Application.GetRealWidth(500), + Height = Application.GetRealHeight(60), + Gravity = Gravity.CenterHorizontal, + Text = device.CommonDevice.DeviceEpointName, + TextColor = ZigbeeColor.Current.GXCTextBlackColor, + TextSize=15 + }; + itemView.AddChidren(deviceNameBtn); + + StatuBtn = new Button + { + Y = Application.GetRealHeight(118), + Width = Application.GetRealWidth(600), + Height = Application.GetRealHeight(60), + Gravity = Gravity.CenterHorizontal, + TextColor = ZigbeeColor.Current.GXCTextGrayColor, + Text=CommonFormResouce.GetSwitchStatu(device.CommonDevice.IsOnline==1) + }; + itemView.AddChidren(StatuBtn); + + deviceIMG = new Button() + { + Y = Application.GetRealHeight(389), + Width = Application.GetMinRealAverage(377), + Height = Application.GetMinRealAverage(435), + Gravity = Gravity.CenterHorizontal, + UnSelectedImagePath = "Light/DeskLamp.png", + SelectedImagePath = "Light/DeskLampSelected.png", + IsSelected = (device.CommonDevice as ToggleLight).OnOffStatus == 1 + }; + itemView.AddChidren(deviceIMG); + + switchBtn = new Button() + { + Y = Application.GetRealHeight(996), + Width = Application.GetMinRealAverage(81), + Height = Application.GetMinRealAverage(81), + Gravity = Gravity.CenterHorizontal, + UnSelectedImagePath = "Item/Switch.png", + SelectedImagePath = "Item/SwitchSelected.png", + IsSelected = (device.CommonDevice as ToggleLight).OnOffStatus == 1 + }; + itemView.AddChidren(switchBtn); + + var roomBG = new Button + { + Y = Application.GetRealHeight(1178-50), + Height = Application.GetRealHeight(138+50), + BackgroundColor = ZigbeeColor.Current.GXCBlackBackgroundColor, + Radius = (uint)Application.GetRealHeight(CommonFormResouce.BigFormRadius) + }; + itemView.AddChidren(roomBG); + + var roomBG2 = new Button + { + Y = Application.GetRealHeight(1178 - 50), + Height = Application.GetRealHeight(50), + BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, + }; + itemView.AddChidren(roomBG2); + + roomBtn = new Button() + { + X = Application.GetRealWidth(CommonFormResouce.X_Left), + Y = Application.GetRealHeight(1207), + Width = Application.GetMinReal(80), + Height = Application.GetMinReal(80), + UnSelectedImagePath = "Item/Room.png" + }; + itemView.AddChidren(roomBtn); + + roomName = new Button() + { + X = Application.GetRealWidth(150), + Y = Application.GetRealHeight(1224), + Width = Application.GetRealWidth(400), + Height = Application.GetRealHeight(50), + Text = room.Name, + TextAlignment = TextAlignment.CenterLeft, + TextColor = ZigbeeColor.Current.GXCTextWhiteColor + }; + itemView.AddChidren(roomName); } #endregion @@ -406,10 +397,8 @@ private void BindEvent() { switchBtn.MouseUpEventHandler += Switch; + deviceIMG.MouseUpEventHandler += Switch; collectionBtn.MouseUpEventHandler += Collection; - moreBtn.MouseUpEventHandler += More; - roomBtn.MouseUpEventHandler += BackToRoomHandler; - roomName.MouseUpEventHandler += BackToRoomHandler; } #endregion @@ -426,6 +415,8 @@ sendedControlCommand = false; zbGateway.ReportAction += UpdateDeviceControllStatu; switchBtn.IsSelected = !switchBtn.IsSelected; + deviceIMG.IsSelected = !deviceIMG.IsSelected; + StatuBtn.Text = CommonFormResouce.GetSwitchStatu(deviceIMG.IsSelected); if (switchBtn.IsSelected == true) { (device.CommonDevice as ToggleLight).SwitchControl(1); @@ -448,6 +439,8 @@ } }); } + + #endregion @@ -480,30 +473,16 @@ private void Collection(object sender, MouseEventArgs e) { //collection - if (collectionBtn.IsSelected) + if ((sender as Button).IsSelected) { - Shared.Common.Room.Lists[0].DeleteDevice(device.FileName); - collectionBtn.IsSelected = false; + Shared.Common.Room.GetLoveRoom().DeleteDevice(device.FileName); + (sender as Button).IsSelected = false; } else { - Shared.Common.Room.Lists[0].AddDevice(device.FileName); - collectionBtn.IsSelected = true; + Shared.Common.Room.GetLoveRoom().AddDevice(device.FileName); + (sender as Button).IsSelected = true; } - } - - #endregion - - #region 鈼� 鍥炲埌涓婚〉________________________ - /// <summary> - /// 鍥炲埌涓婚〉 - /// </summary> - /// <param name="sender">Sender.</param> - /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param> - private void BackToRoomHandler(object sender, MouseEventArgs mouseEventArgs ) - { - //backToRoom - } #endregion diff --git a/ZigbeeApp/Shared/Phone/Device/Room/AddRoom.cs b/ZigbeeApp/Shared/Phone/Device/Room/AddRoom.cs index 09d68bd..cd60339 100755 --- a/ZigbeeApp/Shared/Phone/Device/Room/AddRoom.cs +++ b/ZigbeeApp/Shared/Phone/Device/Room/AddRoom.cs @@ -290,7 +290,7 @@ }; settingContentFL.AddChidren(settingLine); - confirm = new Device.CommonForm.CompleteButton(1700, 700, 90); + confirm = new Device.CommonForm.CompleteButton(1700, 700, 127); confirm.SetTitle(R.MyInternationalizationString.Confrim); this.AddChidren(confirm); #endregion diff --git a/ZigbeeApp/Shared/Phone/Device/Room/AddRoomScene.cs b/ZigbeeApp/Shared/Phone/Device/Room/AddRoomScene.cs index c2f1066..1df900c 100755 --- a/ZigbeeApp/Shared/Phone/Device/Room/AddRoomScene.cs +++ b/ZigbeeApp/Shared/Phone/Device/Room/AddRoomScene.cs @@ -139,7 +139,7 @@ //1-60绉� //PickerView.Show(tList, (obj) => //{ - // targetDevice.DelayTime = int.Parse(obj.Split(' ')[0]); + //targetDevice.DelayTime = int.Parse(obj.Split(' ')[0]); //}, Language.StringByID(R.MyInternationalizationString.Confrim)); }; devRight.MouseUpEventHandler += (sender, e) => diff --git a/ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs b/ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs new file mode 100755 index 0000000..e28ed1a --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs @@ -0,0 +1,217 @@ +锘縰sing System; +using System.Collections.Generic; +using Shared.Common; +using Shared.Phone.Device.CommonForm; +using Shared.Phone.UserView; + +namespace Shared.Phone.Device.Room +{ + public class EditRoom : FrameLayout + { + #region 鈼� 鍙橀噺____________________________ + /// <summary> + /// bodyFrameLayout + /// </summary> + private FrameLayout bodyFrameLayout; + + /// <summary> + /// The room. + /// </summary> + public Shared.Common.Room room; + + /// <summary> + /// The action. + /// </summary> + public Action action; + + #endregion + + public EditRoom() + { + BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor; + } + + /// <summary> + /// Show this instance. + /// </summary> + public void Show(Shared.Common.Room r) + { + room = r; + + AddTop(); + + AddBodyView(); + + } + + #region Add____________________________________ + + /// <summary> + /// AddTop + /// </summary> + public void AddTop() + { + var top = new TopFrameLayout(); + AddChidren(top); + top.InitTopview(); + top.SetTopTitle(R.MyInternationalizationString.EditRoom); + top.backButton.MouseUpEventHandler += (sender, e) => + { + RemoveFromParent(); + }; + } + + /// <summary> + /// AddBodyView + /// </summary> + public void AddBodyView() + { + bodyFrameLayout = new FrameLayout() + { + Y = Application.GetRealHeight(184), + Height = Application.GetRealHeight(1737), + BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor, + }; + AddChidren(bodyFrameLayout); + + var imgFL = new FrameLayout + { + Y=Application.GetRealHeight(60), + Width=Application.GetMinRealAverage(916), + Height = Application.GetMinRealAverage(478), + Gravity=Gravity.CenterHorizontal, + BackgroundImagePath= "Room/Room_Rectangle.png" + }; + bodyFrameLayout.AddChidren(imgFL); + + var backGround = new Button() + { + Y = Application.GetRealHeight(60), + Width = Application.GetMinRealAverage(887), + Height = Application.GetMinRealAverage(444), + Gravity = Gravity.CenterHorizontal, + Radius = (uint)Application.GetRealHeight(CommonFormResouce.BigFormRadius), + UnSelectedImagePath = room.BackgroundImage + }; + bodyFrameLayout.AddChidren(backGround); + + var infoFL = new FrameLayout + { + Y = Application.GetRealHeight(562), + Height = Application.GetRealHeight(1175), + BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor + }; + bodyFrameLayout.AddChidren(infoFL); + + var infoEdit = new Button + { + X = Application.GetRealWidth(CommonFormResouce.X_Left), + Y=Application.GetRealHeight(80), + Height = Application.GetRealHeight(60), + Width = Application.GetRealWidth(700), + TextID = R.MyInternationalizationString.EditInfo, + TextColor = ZigbeeColor.Current.GXCTextDeepBlackColor, + TextAlignment = TextAlignment.CenterLeft, + TextSize = 15 + }; + infoFL.AddChidren(infoEdit); + + var nameRow = new DeviceInfoEditRow(170); + nameRow.Init(); + nameRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.RoomName)} :"); + nameRow.SetPlaceHoldText(room.Name); + infoFL.AddChidren(nameRow); + + var floorRow = new DeviceInfoRow(308); + floorRow.Init(); + floorRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.BelongFloor)} :"); + floorRow.SetTitle(room.FloorName); + infoFL.AddChidren(floorRow); + floorRow.NextBtn.MouseUpEventHandler += (sender, e) => + { + if (Config.Instance.Home.FloorDics != null) + { + List<string> floorIds = new List<string> { }; + List<string> floorNames = new List<string> { }; + foreach (var floor in Config.Instance.Home.FloorDics) + { + floorIds.Add(floor.Key); + floorNames.Add(floor.Value); + } + + PickerView.Show(floorNames, (index) => + { + room.FloorId = floorIds[index]; + floorRow.SetTitle(room.FloorName); + }, floorIds.IndexOf(room.FloorId), Language.StringByID(R.MyInternationalizationString.BelongFloor), Language.StringByID(R.MyInternationalizationString.Confrim), Language.StringByID(R.MyInternationalizationString.Cancel)); + } + }; + + var temperatureRow = new DeviceInfoRow(446); + temperatureRow.Init(); + temperatureRow.SetTipTitle(R.MyInternationalizationString.Temperature); + temperatureRow.SetTitle("26.8鈩�"); + temperatureRow.NameText.TextAlignment = TextAlignment.CenterRight; + infoFL.AddChidren(temperatureRow); + temperatureRow.NextBtn.MouseUpEventHandler += (sender, e) => + { + var tem = new RoomTemperatureSetting { }; + HomePage.Instance.AddChidren(tem); + HomePage.Instance.PageIndex += 1; + tem.Show(room); + tem.action = (selectTemp) => + { + + }; + + }; + + + var humidityRow = new DeviceInfoRow(585); + humidityRow.Init(); + humidityRow.SetTipTitle(R.MyInternationalizationString.Humidity); + humidityRow.SetTitle("66.5%"); + humidityRow.NameText.TextAlignment = TextAlignment.CenterRight; + infoFL.AddChidren(humidityRow); + humidityRow.NextBtn.MouseUpEventHandler += (sender, e) => + { + var tem = new RoomHumiditySetting { }; + HomePage.Instance.AddChidren(tem); + HomePage.Instance.PageIndex += 1; + tem.Show(room); + tem.action = (selectTemp) => + { + + }; + }; + + var shareRow = new DeviceInfoRow(723); + shareRow.Init(); + shareRow.SetTipTitle(R.MyInternationalizationString.Share); + shareRow.SetTitle("2 浜�"); + shareRow.NameText.TextAlignment = TextAlignment.CenterRight; + infoFL.AddChidren(shareRow); + shareRow.NextBtn.MouseUpEventHandler += (sender, e) => + { + var tem = new RoomShareSetting { }; + HomePage.Instance.AddChidren(tem); + HomePage.Instance.PageIndex += 1; + tem.Show(room); + tem.action = (selectTemp) => + { + + }; + + }; + + + var confirm = new Device.CommonForm.CompleteButton(1700, 700, 127); + confirm.SetTitle(R.MyInternationalizationString.Confrim); + AddChidren(confirm); + + } + + #endregion + + } +} diff --git a/ZigbeeApp/Shared/Phone/Device/Room/RoomHumiditySetting.cs b/ZigbeeApp/Shared/Phone/Device/Room/RoomHumiditySetting.cs new file mode 100755 index 0000000..0dcac8e --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/Room/RoomHumiditySetting.cs @@ -0,0 +1,110 @@ +锘縰sing System; +using Shared.Common; +using Shared.Phone.Device.CommonForm; + +namespace Shared.Phone.Device.Room +{ + public class RoomHumiditySetting:FrameLayout + { + #region 鈼� 鍙橀噺____________________________ + /// <summary> + /// bodyFrameLayout + /// </summary> + private FrameLayout bodyFrameLayout; + /// <summary> + /// verticalScrolView + /// </summary> + private VerticalScrolViewLayout verticalScrolView; + /// <summary> + /// The room. + /// </summary> + public Shared.Common.Room room; + /// <summary> + /// The action. + /// </summary> + public Action<string> action; + + #endregion + + public RoomHumiditySetting() + { + BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor; + } + + /// <summary> + /// Show this instance. + /// </summary> + public void Show(Shared.Common.Room r) + { + room = r; + + AddTop(); + + AddBodyView(); + + } + + #region Add____________________________________ + + /// <summary> + /// AddTop + /// </summary> + public void AddTop() + { + var top = new TopFrameLayout(); + AddChidren(top); + top.InitTopview(); + top.SetTopTitle(R.MyInternationalizationString.Humidity); + top.backButton.MouseUpEventHandler += (sender, e) => + { + RemoveFromParent(); + }; + } + + /// <summary> + /// AddBodyView + /// </summary> + public void AddBodyView() + { + bodyFrameLayout = new FrameLayout() + { + Y = Application.GetRealHeight(184), + Height = Application.GetRealHeight(1737), + BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor, + }; + AddChidren(bodyFrameLayout); + + verticalScrolView = new VerticalScrolViewLayout + { + Height = Application.GetRealHeight(1737) + }; + bodyFrameLayout.AddChidren(verticalScrolView); + + var confirm = new Device.CommonForm.CompleteButton(1700, 700, 127); + confirm.SetTitle(R.MyInternationalizationString.Save); + AddChidren(confirm); + + for (int i = 0; i < 15; i++) + { + AddItem(verticalScrolView, 20 + i * (127 + 20)); + } + + } + + /// <summary> + /// AddItem + /// </summary> + /// <param name="vertical"></param> + public void AddItem(VerticalScrolViewLayout vertical, int y) + { + var dev = new DeviceInfoWithZoneRow(y); + vertical.AddChidren(dev); + dev.Init(); + dev.SetIcon("DeviceIcon/1.png"); + dev.SetName("婀垮害浼犳劅鍣�" + y); + dev.SetZone(room.FloorName + ", " + room.Name); + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/Device/Room/RoomManagement.cs b/ZigbeeApp/Shared/Phone/Device/Room/RoomManagement.cs index a70a7cd..0cbb7ae 100755 --- a/ZigbeeApp/Shared/Phone/Device/Room/RoomManagement.cs +++ b/ZigbeeApp/Shared/Phone/Device/Room/RoomManagement.cs @@ -1,5 +1,6 @@ 锘縰sing System; using Shared.Common; +using Shared.Phone.Device.Category; using Shared.Phone.Device.CommonForm; namespace Shared.Phone.Device.Room @@ -14,6 +15,10 @@ /// </summary> private FrameLayout bodyFrameLayout; + private Button floorBtn; + + private FrameLayout itemView; + #endregion @@ -23,7 +28,7 @@ public override void RemoveFromParent() { //鏇存柊鐣岄潰 - action?.Invoke(); + //action?.Invoke(); base.RemoveFromParent(); } /// <summary> @@ -52,37 +57,52 @@ RemoveFromParent(); }; - var addRoomItemBtn = new Device.CommonForm.SelectedStatuButton() + floorBtn = new Button() { - X = Application.GetRealWidth(1080 - 150), - Width = Application.GetMinRealAverage(100), - Height = Application.GetMinRealAverage(100), + X = Application.GetRealWidth(750), + Width = Application.GetRealWidth(200), + Height = Application.GetRealHeight(60), Gravity = Gravity.CenterVertical, - UnSelectedImagePath = "Item/Add.png", - SelectedImagePath = "Item/AddSelected.png" + TextAlignment = TextAlignment.CenterRight, + TextColor = ZigbeeColor.Current.GXCTextBlackColor, }; - top.AddChidren(addRoomItemBtn); - addRoomItemBtn.MouseUpEventHandler += (sender, e) => + var selectFloorBtn = new Button() { - var addRoom = new AddRoom(); - UserView.HomePage.Instance.AddChidren(addRoom); - UserView.HomePage.Instance.PageIndex += 1; - addRoom.action = () => - { - Show(); - }; - AddRoom.OldBackgroundImagePath = string.Empty; - addRoom.Show(""); + X = Application.GetRealWidth(950), + Width = Application.GetMinRealAverage(69), + Height = Application.GetMinRealAverage(69), + Gravity = Gravity.CenterVertical, + UnSelectedImagePath = "Item/Drop_Down.png" }; + + floorBtn.Text = Config.Instance.Home.GetCurrentFloorName(); + top.topView.AddChidren(floorBtn); + top.topView.AddChidren(selectFloorBtn); + selectFloorBtn.MouseUpEventHandler += SelectedFloor_MouseUpEventHandler; + floorBtn.MouseUpEventHandler += SelectedFloor_MouseUpEventHandler; } + /// <summary> + /// 閫夋嫨妤煎眰 + /// </summary> + /// <param name="sender">Sender.</param> + /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param> + private void SelectedFloor_MouseUpEventHandler(object sender, MouseEventArgs mouseEventArgs) + { + var floors = new SelectFloor(); + AddChidren(floors); + floors.Init(599, 161); + floors.FloorAction += (floorName) => + { + floorBtn.Text = floorName; + }; + } /// <summary> /// AddBodyView /// </summary> public void AddBodyView() { - RemoveAll(); bodyFrameLayout = new FrameLayout() { Y = Application.GetRealHeight(184), @@ -90,6 +110,44 @@ BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor, }; AddChidren(bodyFrameLayout); + + var roomScrolView = new VerticalScrolViewLayout { }; + bodyFrameLayout.AddChidren(roomScrolView); + for (int i = 0; i < Shared.Common.Room.Lists.Count; i++) + { + var room = Shared.Common.Room.Lists[i]; + int xx = 43 + i % 2 * (20 + 487); + int yy = 0; + + if (i == 0 || i == 1) + { + if (i % 2 == 0) + { + itemView = new FrameLayout() + { + Height = Application.GetRealHeight(354 + 58), + Tag = room + }; + roomScrolView.AddChidren(itemView); + } + yy = 58; + } + else if (i % 2 == 0) + { + itemView = new FrameLayout() + { + Height = Application.GetRealHeight(354), + Tag = room + }; + roomScrolView.AddChidren(itemView); + } + + var roomView = new RoomMainView(xx, yy); + itemView.AddChidren(roomView); + roomView.Init(); + roomView.SetRoomName(room.Name); + roomView.SetRoomIcon(room.BackgroundImage); + } } @@ -100,72 +158,18 @@ /// </summary> void RoomPage() { - RemoveAll(); - #region topview - var topBGView = new FrameLayout()鈥� {鈥� Height = Application.GetRealHeight(CommonPage.Navigation_Height),鈥� BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor鈥� };鈥� AddChidren(topBGView); - var topView = new FrameLayout()鈥� {鈥� Y = Application.GetRealHeight(CommonPage.NavigationTitle_Y),鈥� Height = Application.GetRealHeight(CommonPage.Navigation_Height - CommonPage.NavigationTitle_Y),鈥� BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor,鈥� }; - AddChidren(topView);鈥� - var title = new Button() - { - TextAlignment = TextAlignment.Center, - TextID=R.MyInternationalizationString.RoomList, - TextSize = 20, - TextColor = ZigbeeColor.Current.GXCTextBlackColor, - Width = Application.GetRealWidth(CommonPage.AppRealWidth - 500), - Gravity = Gravity.CenterHorizontal - }; - topView.AddChidren(title); + BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor; - var back = new Device.CommonForm.BackButton() { };鈥� topView.AddChidren(back); + return; + - back.MouseUpEventHandler += (sender, e) => - { - this.RemoveFromParent(); - }; - - var addRoomItemBtn = new Device.CommonForm.SelectedStatuButton() - { - Width = Application.GetMinRealAverage(100), - Height = Application.GetMinRealAverage(100), - UnSelectedImagePath = "Item/Add.png", - SelectedImagePath="Item/AddSelected.png", - X = Application.GetRealWidth(1080 - 150), - Gravity = Gravity.CenterVertical - }; - topView.AddChidren(addRoomItemBtn); - - //Action action = RoomPage; - - addRoomItemBtn.MouseUpEventHandler += (sender, e) => - { - //AddOrUpdateRoom(action); - var addRoom = new AddRoom(); - Shared.Phone.UserView.HomePage.Instance.AddChidren(addRoom); - Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; - addRoom.action = () => - { - Show(); - }; - AddRoom.OldBackgroundImagePath = string.Empty; - addRoom.Show(""); - }; - #endregion - - var middleHomePage = new FrameLayout() - { - Width = LayoutParams.MatchParent, - Height = Application.GetRealHeight(CommonPage.AppRealHeight - CommonPage.Navigation_Height), - Y = topView.Bottom, - BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, - }; - this.AddChidren(middleHomePage); var RoomBodyView = new VerticalScrolViewLayout() { Height = Application.GetRealHeight(CommonPage.AppRealHeight - CommonPage.Navigation_Height), BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, }; - middleHomePage.AddChidren(RoomBodyView); + foreach (var roomFilePath in Config.Instance.Home.RoomFilePathList) diff --git a/ZigbeeApp/Shared/Phone/Device/Room/RoomShareSetting.cs b/ZigbeeApp/Shared/Phone/Device/Room/RoomShareSetting.cs new file mode 100755 index 0000000..61e3606 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/Room/RoomShareSetting.cs @@ -0,0 +1,105 @@ +锘縰sing System; +using Shared.Common; +using Shared.Phone.Device.CommonForm; +namespace Shared.Phone.Device.Room +{ + public class RoomShareSetting:FrameLayout + { + #region 鈼� 鍙橀噺____________________________ + /// <summary> + /// bodyFrameLayout + /// </summary> + private FrameLayout bodyFrameLayout; + /// <summary> + /// verticalScrolView + /// </summary> + private VerticalScrolViewLayout verticalScrolView; + /// <summary> + /// The room. + /// </summary> + public Shared.Common.Room room; + /// <summary> + /// The action. + /// </summary> + public Action<string> action; + + #endregion + + public RoomShareSetting() + { + BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor; + } + + /// <summary> + /// Show this instance. + /// </summary> + public void Show(Shared.Common.Room r) + { + room = r; + + AddTop(); + + AddBodyView(); + + } + + #region Add____________________________________ + + /// <summary> + /// AddTop + /// </summary> + public void AddTop() + { + var top = new TopFrameLayout(); + AddChidren(top); + top.InitTopview(); + top.SetTopTitle(R.MyInternationalizationString.Share); + top.backButton.MouseUpEventHandler += (sender, e) => + { + RemoveFromParent(); + }; + } + + /// <summary> + /// AddBodyView + /// </summary> + public void AddBodyView() + { + bodyFrameLayout = new FrameLayout() + { + Y = Application.GetRealHeight(184), + Height = Application.GetRealHeight(1737), + BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor, + }; + AddChidren(bodyFrameLayout); + + verticalScrolView = new VerticalScrolViewLayout + { + Height = Application.GetRealHeight(1737) + }; + bodyFrameLayout.AddChidren(verticalScrolView); + + var confirm = new Device.CommonForm.CompleteButton(1700, 700, 127); + confirm.SetTitle(R.MyInternationalizationString.Save); + AddChidren(confirm); + + for (int i = 0; i < 15; i++) + { + AddItem(verticalScrolView, 20 + i * (127 + 20)); + } + } + /// <summary> + /// AddItem + /// </summary> + /// <param name="vertical"></param> + public void AddItem(VerticalScrolViewLayout vertical, int y) + { + var dev = new DeviceInfoRow(y); + vertical.AddChidren(dev); + dev.Init(); + dev.SetTipTitle("鐢ㄦ埛 " + y); + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/Device/Room/RoomTemperatureSetting.cs b/ZigbeeApp/Shared/Phone/Device/Room/RoomTemperatureSetting.cs new file mode 100755 index 0000000..eab1d72 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/Room/RoomTemperatureSetting.cs @@ -0,0 +1,110 @@ +锘縰sing System; +using Shared.Common; +using Shared.Phone.Device.CommonForm; + +namespace Shared.Phone.Device.Room +{ + public class RoomTemperatureSetting : FrameLayout + { + #region 鈼� 鍙橀噺____________________________ + /// <summary> + /// bodyFrameLayout + /// </summary> + private FrameLayout bodyFrameLayout; + /// <summary> + /// The action. + /// </summary> + public Action<string> action; + /// <summary> + /// verticalScrolView + /// </summary> + private VerticalScrolViewLayout verticalScrolView; + /// <summary> + /// The room. + /// </summary> + public Shared.Common.Room room; + + #endregion + + public RoomTemperatureSetting() + { + BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor; + } + + /// <summary> + /// Show this instance. + /// </summary> + public void Show(Shared.Common.Room r) + { + room = r; + + AddTop(); + + AddBodyView(); + + } + + #region Add____________________________________ + + /// <summary> + /// AddTop + /// </summary> + public void AddTop() + { + var top = new TopFrameLayout(); + AddChidren(top); + top.InitTopview(); + top.SetTopTitle(R.MyInternationalizationString.Temperature); + top.backButton.MouseUpEventHandler += (sender, e) => + { + RemoveFromParent(); + }; + } + + /// <summary> + /// AddBodyView + /// </summary> + public void AddBodyView() + { + bodyFrameLayout = new FrameLayout() + { + Y = Application.GetRealHeight(184), + Height = Application.GetRealHeight(1737), + BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor, + }; + AddChidren(bodyFrameLayout); + + verticalScrolView = new VerticalScrolViewLayout + { + Height = Application.GetRealHeight(1737) + }; + bodyFrameLayout.AddChidren(verticalScrolView); + + var confirm = new Device.CommonForm.CompleteButton(1700, 700, 127); + confirm.SetTitle(R.MyInternationalizationString.Save); + AddChidren(confirm); + + for(int i=0;i<15;i++) + { + AddItem(verticalScrolView, 20 + i * (127 + 20)); + } + + } + + /// <summary> + /// AddItem + /// </summary> + /// <param name="vertical"></param> + public void AddItem(VerticalScrolViewLayout vertical,int y) + { + var dev = new DeviceInfoWithZoneRow(y); + vertical.AddChidren(dev); + dev.Init(); + dev.SetIcon("DeviceIcon/1.png"); + dev.SetName("娓╁害浼犳劅鍣�"+y); + dev.SetZone(room.FloorName + ", " + room.Name); + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs index 8004460..8c5ef3f 100755 --- a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs +++ b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs @@ -30,14 +30,7 @@ /// 鍔熻兘鍜屽満鏅痓odyView /// </summary> private FrameLayout functionSceneBodyView; - /// <summary> - /// The height of the top frame layout -- 500 - /// </summary> - private static readonly int topFrameLayout_Height = 500; - /// <summary> - /// 1524 - /// </summary> - private static readonly int midView_Height = 1524; + /// <summary> /// The height of the room page view. -- 550 /// </summary> @@ -78,6 +71,9 @@ /// </summary> private readonly int sleepSpan = 300; + + private FrameLayout itemView; + #endregion #region 鈼� 鎺ュ彛____________________________ @@ -115,9 +111,8 @@ for (int i = 0; deviceVerticalScrolViewLayout != null && i < deviceVerticalScrolViewLayout.ChildrenCount; i++) { var rowFL = deviceVerticalScrolViewLayout.GetChildren(i) as FrameLayout; - var rowLayout = rowFL.GetChildren(0) as RowLayout; - var deviceUI = rowLayout.Tag as DeviceUI; - if (deviceUI.CommonDevice == null || rowLayout.ChildrenCount == 0) + var deviceUI = rowFL.Tag as DeviceUI; + if (deviceUI.CommonDevice == null || rowFL.ChildrenCount == 0) { //璁惧涓虹┖鎴栬�呮帶浠朵负绌� continue; @@ -128,7 +123,7 @@ //鍒ゆ柇鏄惁涓哄綋鍓嶈澶� continue; } - var frameLayout = rowLayout.GetChildren(0) as FrameLayout; + var frameLayout = rowFL.GetChildren(0) as FrameLayout; switch (deviceUI.CommonDevice.Type) { case DeviceType.OnOffOutput: @@ -137,46 +132,17 @@ { var onOffOutputLight = deviceUI.CommonDevice as ZigBee.Device.ToggleLight; onOffOutputLight.DeviceStatusReport = (common as ZigBee.Device.ToggleLight).DeviceStatusReport; - for (int j = 0; j < frameLayout.ChildrenCount; j++) - { - var tempView = frameLayout.GetChildren(j); - if (tempView.Tag == null) - { - continue; - } - if (tempView.Tag.ToString() == deviceStatus_OnOffStatus) - { - //璁板綍銆佹洿鏂扮姸鎬� - if (onOffOutputLight.DeviceStatusReport.AttriBute == null || onOffOutputLight.DeviceStatusReport.AttriBute.Count == 0) - { - continue; - } - onOffOutputLight.OnOffStatus = onOffOutputLight.DeviceStatusReport.AttriBute[0].AttriButeData; - (tempView as Button).IsSelected = onOffOutputLight.OnOffStatus == 1; - //璁板綍鍥炲鏃堕棿 - onOffOutputLight.LastDateTime = DateTime.Now; - } - } - } - //褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁� - if ((common as ZigBee.Device.ToggleLight).DeviceStatusReport.CluterID == 3) - { - var onOffOutputLight = deviceUI.CommonDevice as ToggleLight; - onOffOutputLight.IsOnline = 1; - for (int j = 0; j < frameLayout.ChildrenCount; j++) + + //璁板綍銆佹洿鏂扮姸鎬� + if (onOffOutputLight.DeviceStatusReport.AttriBute == null || onOffOutputLight.DeviceStatusReport.AttriBute.Count == 0) { - var tempView = frameLayout.GetChildren(j); - if (tempView.Tag == null) - { - continue; - } - if (tempView.Tag.ToString() == deviceStatus_Online) - { - (tempView as Button).IsSelected = onOffOutputLight.IsOnline == 1; - //璁板綍鍥炲鏃堕棿 - onOffOutputLight.LastDateTime = DateTime.Now; - } + continue; } + onOffOutputLight.OnOffStatus = onOffOutputLight.DeviceStatusReport.AttriBute[0].AttriButeData; + (rowFL.GetChildren(0) as FunctionMainView).IsSelected = onOffOutputLight.OnOffStatus == 1; + (rowFL.GetChildren(0) as FunctionMainView).StatuButton.Text = CommonFormResouce.GetSwitchStatu(onOffOutputLight.OnOffStatus == 1); + //璁板綍鍥炲鏃堕棿 + onOffOutputLight.LastDateTime = DateTime.Now; } break; @@ -356,31 +322,22 @@ case DeviceType.DimmableLight: //璋冨厜鐏姛鑳� //寮�鍏冲姛鑳� - if ((common as ZigBee.Device.DimmableLight).DeviceStatusReport.CluterID == 6) + if ((common as DimmableLight).DeviceStatusReport.CluterID == 6) { - var dimmableLight = deviceUI.CommonDevice as ZigBee.Device.DimmableLight; - dimmableLight.DeviceStatusReport = (common as ZigBee.Device.DimmableLight).DeviceStatusReport; - for (int j = 0; j < frameLayout.ChildrenCount; j++) + var dimmableLight = deviceUI.CommonDevice as DimmableLight; + dimmableLight.DeviceStatusReport = (common as DimmableLight).DeviceStatusReport; + //璁板綍銆佹洿鏂扮姸鎬� + if (dimmableLight.DeviceStatusReport.AttriBute == null || dimmableLight.DeviceStatusReport.AttriBute.Count == 0) { - var tempView = frameLayout.GetChildren(j); - if (tempView.Tag == null) - { - continue; - } - if (tempView.Tag.ToString() == deviceStatus_OnOffStatus) - { - //璁板綍銆佹洿鏂扮姸鎬� - if (dimmableLight.DeviceStatusReport.AttriBute == null || dimmableLight.DeviceStatusReport.AttriBute.Count == 0) - { - return; - } - dimmableLight.OnOffStatus = dimmableLight.DeviceStatusReport.AttriBute[0].AttriButeData; - (tempView as Button).IsSelected = dimmableLight.OnOffStatus == 1; - //璁板綍鍥炲鏃堕棿 - dimmableLight.LastDateTime = DateTime.Now; - } + return; } + dimmableLight.OnOffStatus = dimmableLight.DeviceStatusReport.AttriBute[0].AttriButeData; + (rowFL.GetChildren(0) as FunctionMainView).IsSelected = dimmableLight.OnOffStatus == 1; + (rowFL.GetChildren(0) as FunctionMainView).StatuButton.Text = CommonFormResouce.GetSwitchStatu(dimmableLight.OnOffStatus == 1); + //璁板綍鍥炲鏃堕棿 + dimmableLight.LastDateTime = DateTime.Now; } + //浜害 if ((common as ZigBee.Device.DimmableLight).DeviceStatusReport.CluterID == 8) { @@ -412,27 +369,6 @@ break; } } - //褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁� - if ((common as ZigBee.Device.DimmableLight).DeviceStatusReport.CluterID == 3) - { - var dimmableLight = deviceUI.CommonDevice as DimmableLight; - dimmableLight.IsOnline = 1; - for (int j = 0; j < frameLayout.ChildrenCount; j++) - { - var tempView = frameLayout.GetChildren(j); - if (tempView.Tag == null) - { - continue; - } - if (tempView.Tag.ToString() == deviceStatus_Online) - { - (tempView as Button).IsSelected = dimmableLight.IsOnline == 1; - //璁板綍鍥炲鏃堕棿 - dimmableLight.LastDateTime = DateTime.Now; - } - } - - } break; } @@ -444,130 +380,7 @@ } }); } - //璁惧鍦ㄧ嚎鐘舵�佷笂鎶� - else if (typeTag == "OnlineStatusChange") - { - Application.RunOnMainThread(() => - { - try - { - for (int i = 0; deviceVerticalScrolViewLayout != null && i < deviceVerticalScrolViewLayout.ChildrenCount; i++) - { - var rowFL = deviceVerticalScrolViewLayout.GetChildren(i) as FrameLayout; - var rowLayout = rowFL.GetChildren(0) as RowLayout; - var deviceUI = rowLayout.Tag as DeviceUI; - if (deviceUI.CommonDevice == null || rowLayout.ChildrenCount == 0) - { - //璁惧涓虹┖鎴栬�呮帶浠朵负绌� - continue; - } - if (common.DeviceAddr != deviceUI.CommonDevice.DeviceAddr || common.DeviceEpoint != deviceUI.CommonDevice.DeviceEpoint) - { - //鍒ゆ柇鏄惁涓哄綋鍓嶈澶� - continue; - } - var frameLayout = rowLayout.GetChildren(0) as FrameLayout; - switch (deviceUI.CommonDevice.Type) - { - case DeviceType.OnOffOutput: - var onOffOutputLight = deviceUI.CommonDevice as ToggleLight; - onOffOutputLight.IsOnline = (common as ToggleLight).IsOnline; - for (int j = 0; j < frameLayout.ChildrenCount; j++) - { - var tempView = frameLayout.GetChildren(j); - if (tempView.Tag == null) - { - continue; - } - if (tempView.Tag.ToString() == deviceStatus_Online) - { - (tempView as Button).IsSelected = onOffOutputLight.IsOnline == 1; - } - } - //璁板綍鍥炲鏃堕棿 - onOffOutputLight.LastDateTime = DateTime.Now; - break; - case DeviceType.AirSwitch: - var airSwitch = deviceUI.CommonDevice as AirSwitch; - airSwitch.IsOnline = (common as AirSwitch).IsOnline; - for (int j = 0; j < frameLayout.ChildrenCount; j++) - { - var tempView = frameLayout.GetChildren(j); - if (tempView.Tag == null) - { - continue; - } - if (tempView.Tag.ToString() == deviceStatus_Online) - { - (tempView as Button).IsSelected = airSwitch.IsOnline == 1; - } - } - //璁板綍鍥炲鏃堕棿 - airSwitch.LastDateTime = DateTime.Now; - break; - case DeviceType.WindowCoveringDevice: - var rollershade = deviceUI.CommonDevice as ZigBee.Device.Rollershade; - rollershade.IsOnline = (common as Rollershade).IsOnline; - for (int j = 0; j < frameLayout.ChildrenCount; j++) - { - var tempView = frameLayout.GetChildren(j); - if (tempView.Tag == null) - { - continue; - } - if (tempView.Tag.ToString() == deviceStatus_Online) - { - (tempView as Button).IsSelected = rollershade.IsOnline == 1; - } - } - //璁板綍鍥炲鏃堕棿 - rollershade.LastDateTime = DateTime.Now; - break; - case DeviceType.Thermostat: - var ac = deviceUI.CommonDevice as ZigBee.Device.AC; - ac.IsOnline = (common as ZigBee.Device.AC).IsOnline; - for (int j = 0; j < frameLayout.ChildrenCount; j++) - { - var tempView = frameLayout.GetChildren(j); - if (tempView.Tag == null) - { - continue; - } - if (tempView.Tag.ToString() == deviceStatus_Online) - { - (tempView as Button).IsSelected = ac.IsOnline == 1; - } - } - //璁板綍鍥炲鏃堕棿 - ac.LastDateTime = DateTime.Now; - break; - case DeviceType.DimmableLight: - var dimmableLight = deviceUI.CommonDevice as ZigBee.Device.DimmableLight; - dimmableLight.IsOnline = (common as ZigBee.Device.DimmableLight).IsOnline; - for (int j = 0; j < frameLayout.ChildrenCount; j++) - { - var tempView = frameLayout.GetChildren(j); - if (tempView.Tag == null) - { - continue; - } - if (tempView.Tag.ToString() == deviceStatus_Online) - { - (tempView as Button).IsSelected = dimmableLight.IsOnline == 1; - } - } - //璁板綍鍥炲鏃堕棿 - dimmableLight.LastDateTime = DateTime.Now; - break; - } - } - } - catch (Exception ex) - { - System.Console.WriteLine($"涓婚〉鍔熻兘鍒锋柊-Error:{ex.Message}"); - } - }); - } + } /// <summary> /// Changeds the IL ogic status. @@ -845,7 +658,10 @@ //娑堟伅 messageBtn.MouseUpEventHandler += (send, e) => { - + var roomList = new Shared.Phone.Device.Room.RoomManagement(); + HomePage.Instance.AddChidren(roomList); + HomePage.Instance.PageIndex += 1; + roomList.Show(); }; #endregion @@ -914,10 +730,10 @@ // Show(); //}; - var editRoom = new Device.Room.AddRoom(); + var editRoom = new Device.Room.EditRoom(); HomePage.Instance.AddChidren(editRoom); HomePage.Instance.PageIndex += 1; - editRoom.Show(); + editRoom.Show(room); editRoom.action += () => { Show(); @@ -1159,7 +975,7 @@ /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param> private void GoToAddGateWay(object sender, MouseEventArgs mouseEventArgs) { - UserCenter.GatewayAdd.NewGateWaySelectForm selectNewGateWayForm = new UserCenter.GatewayAdd.NewGateWaySelectForm { }; + var selectNewGateWayForm = new UserCenter.GatewayAdd.NewGateWaySelectForm { }; selectNewGateWayForm.AddForm(selectNewGateWayForm); } @@ -1172,13 +988,23 @@ /// </summary> private void ShowNoFunctionTip() { + var noFunction = new Button + { + Y = Application.GetRealHeight(69), + Width = Application.GetMinRealAverage(683), + Height = Application.GetMinRealAverage(392), + Gravity = Gravity.CenterHorizontal, + UnSelectedImagePath = "Item/NoFunction.png" + }; + functionSceneBodyView.AddChidren(noFunction); + var noFunctionTip = new Button() { + Y=noFunction.Bottom, Height = Application.GetRealHeight(200), - TextID = R.MyInternationalizationString.NoFunction, + Text = Language.StringByID(R.MyInternationalizationString.NoFunction).Replace("{\\r\\n}","\r\n"), TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor, - TextAlignment = TextAlignment.Center, - Gravity = Gravity.Center + IsMoreLines=true }; functionSceneBodyView.AddChidren(noFunctionTip); } @@ -1202,13 +1028,31 @@ else { deviceVerticalScrolViewLayout = new VerticalScrolViewLayout { }; + functionSceneBodyView.AddChidren(deviceVerticalScrolViewLayout); - foreach (var device in deviceList) + for(int i=0;i<deviceList.Count;i++) { + int t = i % 2; + int tt = i / 2; + int xx = 43 + i % 2 * (20 + 487); + int yy = 14; + var device = deviceList[i]; if (device == null || device.CommonDevice == null) { continue; } + + if (i % 2 == 0) + { + itemView = new FrameLayout() + { + Height = Application.GetRealHeight(14 + 348), + Tag = device + }; + deviceVerticalScrolViewLayout.AddChidren(itemView); + } + + //鍒犻櫎璁惧 EventHandler<MouseEventArgs> delEvent = (sender, e) => { @@ -1225,36 +1069,38 @@ }; }; //鏀惰棌 - //EventHandler<MouseEventArgs> collectionEvent = (sender, e) => - //{ - // if ((sender as Button).IsSelected) - // { - // Room.Lists[0].DeleteDevice(device.FilePath); - // (sender as Button).IsSelected = false; - // if (Room.CurrentRoom == Room.Lists[0]) - // { - // DeviceVerticalScrolViewLayout.RemoveViewByTag((sender as Button).Tag); - // } - // } - // else - // { - // Room.Lists[0].AddDevice(device.FilePath); - // (sender as Button).IsSelected = true; - // } - // //RefreshBodyView(); - //}; EventHandler<MouseEventArgs> collectionEvent = (sender, e) => { - if (Room.CurrentRoom == Room.Lists[0]) + if ((sender as Button).IsSelected) { - Room.Lists[0].DeleteDevice(device.FileName); - deviceVerticalScrolViewLayout.RemoveViewByTag((sender as Button).Tag); + Shared.Common.Room.GetLoveRoom().DeleteDevice(device.FileName); + (sender as Button).IsSelected = false; + } + else + { + Shared.Common.Room.GetLoveRoom().AddDevice(device.FileName); + (sender as Button).IsSelected = true; + } + if (Room.CurrentRoom.IsLove) + { + RefreshBodyView(); } }; //////鍒ゆ柇璁惧鏄惁鏀寔鐨勫睘鎬� 濡傚紑鍏崇瓑鎺у埗 if (device.CommonDevice.Type == ZigBee.Device.DeviceType.WindowCoveringDevice) { + var lightView = new FunctionMainView(xx, yy); + itemView.AddChidren(lightView); + lightView.Init(); + lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath); + lightView.SetStatuText("寮�"); + lightView.SetDeviceName("lightee"); + //lightView.SetStatu(true); + lightView.IsSelected = true; + lightView.SetCollect(true); + + continue; //绐楀笜 鍗峰笜 var rollerShade = (ZigBee.Device.Rollershade)device.CommonDevice; //涓嶄笂闈炶繙绋� @@ -1603,6 +1449,7 @@ { //寮�鍏崇伅 var light = device.CommonDevice as ToggleLight; + //琛ヤ笂闈炶繙绋� if (light.Gateway == null) { @@ -1626,96 +1473,29 @@ } } + var lightView = new FunctionMainView(xx,yy); + itemView.AddChidren(lightView); + lightView.Init(); + lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath); + lightView.SetStatuText(CommonFormResouce.GetSwitchStatu(light.OnOffStatus==1)); + lightView.SetDeviceName(device.CommonDevice.DeviceEpointName); + lightView.IsSelected = light.OnOffStatus==1; + lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom,device.FileName)); - var deviceFL = new FrameLayout + var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); + if (dev == null) { - Height = Application.GetRealHeight(deviceFL_Height), - BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, - Tag = device - }; - deviceVerticalScrolViewLayout.AddChidren(deviceFL); - var deviceRowLayout = new RowLayout + lightView.CollectButton.IsSelected = false; + } + else { - Y = Application.GetRealHeight(25), - Height = Application.GetRealHeight(deviceFL_Height - 25) - 1, - LineColor = ZigbeeColor.Current.GXCBackgroundColor, - BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor, - Radius = CommonPage.BigFormRadius, - Tag = device - }; - deviceFL.AddChidren(deviceRowLayout); + lightView.CollectButton.IsSelected = true; + } - var deviceItemFL = new FrameLayout() + lightView.SwitchButton.MouseUpEventHandler += (sender, e) => { - BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor, - Radius = CommonPage.BigFormRadius - }; - deviceRowLayout.AddChidren(deviceItemFL); - var deviceIMG = new Button() - { - X = Application.GetRealWidth(50), - Y = Application.GetRealHeight(30), - Width = Application.GetMinRealAverage(110), - Height = Application.GetMinRealAverage(110), - UnSelectedImagePath = device.IconPath, - SelectedImagePath = device.OnlineIconPath, - IsSelected = light.IsOnline == 1, - Tag = deviceStatus_Online - }; - deviceItemFL.AddChidren(deviceIMG); - var deviceName = new Button() - { - X = Application.GetRealWidth(10), - Y = deviceIMG.Bottom, - Width = Application.GetRealWidth(180), - Height = Application.GetRealHeight(80), - TextColor = ZigbeeColor.Current.GXCTextBlackColor, - TextAlignment = TextAlignment.Center, - Text = device.CommonDevice.DeviceEpointName, - TextSize = 10, - IsMoreLines = true - }; - deviceItemFL.AddChidren(deviceName); - - var collectionBtn = new Button() - { - X = deviceItemFL.Right - Application.GetRealWidth(150), - Y = Application.GetRealHeight(20), - Width = Application.GetMinRealAverage(80), - Height = Application.GetMinRealAverage(80), - UnSelectedImagePath = "Item/Collection.png", - SelectedImagePath = "Item/CollectionSelected.png", - Tag = device - }; - //***鍏堥殣钘�****** - //deviceItemFL.AddChidren(collectionBtn); - var switchBtnBG = new Button - { - X = deviceItemFL.Right - Application.GetRealWidth(250), - Width = Application.GetMinRealAverage(250), - Height = Application.GetMinRealAverage(250), - Gravity = Gravity.CenterVertical - }; - deviceItemFL.AddChidren(switchBtnBG); - - var switchBtn = new Button - { - X = deviceItemFL.Right - Application.GetRealWidth(200), - //Y = deviceItemFL.Bottom - Application.GetRealHeight(120), - Width = Application.GetMinRealAverage(183), - Height = Application.GetMinRealAverage(123), - UnSelectedImagePath = "Item/Switch.png", - SelectedImagePath = "Item/SwitchSelected.png", - IsSelected = light.OnOffStatus == 1, - Tag = deviceStatus_OnOffStatus, - //Visible=false - Gravity = Gravity.CenterVertical - }; - deviceItemFL.AddChidren(switchBtn); - switchBtn.MouseUpEventHandler += (send2, e2) => - { - switchBtn.IsSelected = !switchBtn.IsSelected; - if (switchBtn.IsSelected == true) + (sender as Button).IsSelected = !(sender as Button).IsSelected; + if ((sender as Button).IsSelected) { zbGateway = device.CommonDevice.Gateway; sendedControlCommand = false; @@ -1724,8 +1504,11 @@ light.SwitchControl(1); - //鎺у埗寤舵椂鍥炶皟 - DeviceUI.SendCommandDelayAction(device.CommonDevice, () => + ((sender as Button).Parent as FunctionMainView).SetStatuText(CommonFormResouce.GetSwitchStatu(true)); + ((sender as Button).Parent as FunctionMainView).IsSelected = true; + + //鎺у埗寤舵椂鍥炶皟 + DeviceUI.SendCommandDelayAction(device.CommonDevice, () => { if (Parent == null) { @@ -1747,8 +1530,11 @@ light.SwitchControl(0); - //鎺у埗寤舵椂鍥炶皟 - DeviceUI.SendCommandDelayAction(device.CommonDevice, () => + ((sender as Button).Parent as FunctionMainView).SetStatuText(CommonFormResouce.GetSwitchStatu(false)); + ((sender as Button).Parent as FunctionMainView).IsSelected = false; + + //鎺у埗寤舵椂鍥炶皟 + DeviceUI.SendCommandDelayAction(device.CommonDevice, () => { if (Parent == null) { @@ -1763,31 +1549,7 @@ } }; - - var deleteBtn = new Device.CommonForm.RowLayoutDeleteButton - { - Tag = device, - IsMoreLines = true - }; - if (Room.CurrentRoom.IsLove) - { - deleteBtn.TextID = R.MyInternationalizationString.CancelCollect; - deleteBtn.BackgroundColor = ZigbeeColor.Current.GXCCancelCollectionBGColor; - deleteBtn.MouseUpEventHandler += collectionEvent; - deviceRowLayout.AddRightView(deleteBtn); - } - else if (Room.CurrentRoom.IsSharedRoom) - { - //涓嶅鐞� - } - else - { - deleteBtn.MouseUpEventHandler += delEvent; - deviceRowLayout.AddRightView(deleteBtn); - } - - - EventHandler<MouseEventArgs> lightHandler = (sender, e) => + lightView.CardBG.MouseUpEventHandler += (sender, e) => { var lightControl = new Phone.Device.Light.LightControl(); UserView.HomePage.Instance.AddChidren(lightControl); @@ -1795,44 +1557,25 @@ lightControl.action = RefreshBodyView; lightControl.Show(device, Room.CurrentRoom); }; - //deviceItemFL.MouseLongEventHandler += lightHandler; - deviceItemFL.MouseUpEventHandler += lightHandler; - deviceName.MouseUpEventHandler += lightHandler; - deviceIMG.MouseUpEventHandler += lightHandler; - //collectionBtn.MouseUpEventHandler += (sender, e) => - //{ - // if (collectionBtn.IsSelected) - // { - // Room.Lists[0].DeleteDevice(device.FilePath); - // collectionBtn.IsSelected = false; - // if(Room.CurrentRoom==Room.Lists[0]) - // { - // RefreshBodyView(); - // } - // } - // else - // { - // Room.Lists[0].AddDevice(device.FilePath); - // collectionBtn.IsSelected = true; - // } - // //RefreshBodyView(); - //}; - collectionBtn.MouseUpEventHandler += collectionEvent; - - //var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FilePath); - //if (dev == null) - //{ - // collectionBtn.IsSelected = false; - //} - //else - //{ - // collectionBtn.IsSelected = true; - //} + lightView.CollectButton.MouseUpEventHandler += collectionEvent; } else if (device.CommonDevice.Type == ZigBee.Device.DeviceType.AirSwitch) { + + var lightView = new FunctionMainView(xx, yy); + itemView.AddChidren(lightView); + lightView.Init(); + lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath); + lightView.SetStatuText("寮�"); + lightView.SetDeviceName("airSwitch"); + //lightView.SetStatu(true); + lightView.IsSelected = true; + lightView.SetCollect(true); + + continue; + //绌烘皵寮�鍏� var airSwitch = device.CommonDevice as AirSwitch; @@ -2063,6 +1806,18 @@ } else if (device.CommonDevice.Type == ZigBee.Device.DeviceType.Thermostat) { + + var lightView = new FunctionMainView(xx, yy); + itemView.AddChidren(lightView); + lightView.Init(); + lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath); + lightView.SetStatuText("寮�"); + lightView.SetDeviceName("绌鸿皟"); + //lightView.SetStatu(true); + lightView.IsSelected = true; + lightView.SetCollect(true); + + continue; //鎭掓俯鍣�-AC-绌鸿皟 var ac = device.CommonDevice as AC; @@ -2417,7 +2172,6 @@ { //璋冨厜鐏� var dimmableLight = device.CommonDevice as DimmableLight; - //琛ヤ笂闈炶繙绋� if (dimmableLight.Gateway == null) { @@ -2430,7 +2184,6 @@ { dimmableLight.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); dimmableLight.ReadOnOffStatus(); - dimmableLight.ReadLevel(); }); } else @@ -2440,189 +2193,86 @@ { dimmableLight.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); dimmableLight.ReadOnOffStatus(); - dimmableLight.ReadLevel(); } } - var deviceFL = new FrameLayout - { - Height = Application.GetRealHeight(deviceFL_Height), - BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, - Tag = device - }; - deviceVerticalScrolViewLayout.AddChidren(deviceFL); - var deviceRowLayout = new RowLayout - { - Y = Application.GetRealHeight(25), - Height = Application.GetRealHeight(deviceFL_Height - 25) - 1, - LineColor = ZigbeeColor.Current.GXCBackgroundColor, - BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor, - Radius = CommonPage.BigFormRadius, - Tag = device - }; - deviceFL.AddChidren(deviceRowLayout); + var lightView = new FunctionMainView(xx, yy); + itemView.AddChidren(lightView); + lightView.Init(); + lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath); + lightView.SetStatuText(CommonFormResouce.GetSwitchStatu(dimmableLight.OnOffStatus == 1)); + lightView.SetDeviceName(device.CommonDevice.DeviceEpointName); + lightView.IsSelected = dimmableLight.OnOffStatus == 1; + lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName)); - var deviceItemFL = new FrameLayout() + var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); + if (dev == null) { - BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor, - Radius = CommonPage.BigFormRadius - }; - deviceRowLayout.AddChidren(deviceItemFL); - var deviceIMG = new Button() - { - X = Application.GetRealWidth(50), - Y = Application.GetRealHeight(30), - Width = Application.GetMinRealAverage(110), - Height = Application.GetMinRealAverage(110), - UnSelectedImagePath = device.IconPath, - SelectedImagePath = device.OnlineIconPath, - IsSelected = dimmableLight.IsOnline == 1, - Tag = deviceStatus_Online - }; - deviceItemFL.AddChidren(deviceIMG); - var deviceName = new Button() - { - X = Application.GetRealWidth(10), - Y = deviceIMG.Bottom, - Width = Application.GetRealWidth(180), - Height = Application.GetRealHeight(80), - TextColor = ZigbeeColor.Current.GXCTextBlackColor, - TextAlignment = TextAlignment.Center, - Text = device.CommonDevice.DeviceEpointName, - TextSize = 10, - IsMoreLines = true - }; - deviceItemFL.AddChidren(deviceName); - - var levelSeekBar = new HorizontalSeekBar() - { - X = deviceIMG.Right + Application.GetRealWidth(50), - Width = Application.GetRealWidth(500), - Height = Application.GetRealHeight(80), - Gravity = Gravity.CenterVertical, - BackgroundColor = ZigbeeColor.Current.GXCSliderUnSelectedColor, - ThumbColor = ZigbeeColor.Current.GXCButtonBlueColor, - BorderColor = ZigbeeColor.Current.GXCButtonBlueColor, - ProgressColor = ZigbeeColor.Current.GXCButtonBlueColor, - Max = 254, - Tag = "LevelSeekBar", - Progress = dimmableLight.Level, - SleepTime = sleepSpan - }; - deviceItemFL.AddChidren(levelSeekBar); - levelSeekBar.ProgressChanged += (send2, e2) => - { - dimmableLight.SetLevel(levelSeekBar.Progress); - }; - - var collectionBtn = new Button() - { - X = deviceItemFL.Right - Application.GetRealWidth(150), - Y = Application.GetRealHeight(20), - Width = Application.GetMinRealAverage(80), - Height = Application.GetMinRealAverage(80), - UnSelectedImagePath = "Item/Collection.png", - SelectedImagePath = "Item/CollectionSelected.png", - Tag = device - }; - //***鍏堥殣钘�****** - //deviceItemFL.AddChidren(collectionBtn); - var switchBtnBG = new Button - { - X = deviceItemFL.Right - Application.GetRealWidth(250), - Width = Application.GetMinRealAverage(250), - Height = Application.GetMinRealAverage(250), - Gravity = Gravity.CenterVertical - }; - deviceItemFL.AddChidren(switchBtnBG); - var switchBtn = new Button - { - X = deviceItemFL.Right - Application.GetRealWidth(200), - //Y = deviceItemFL.Bottom - Application.GetRealHeight(120), - Width = Application.GetMinRealAverage(183), - Height = Application.GetMinRealAverage(123), - UnSelectedImagePath = "Item/Switch.png", - SelectedImagePath = "Item/SwitchSelected.png", - IsSelected = dimmableLight.OnOffStatus == 1, - Tag = deviceStatus_OnOffStatus, - //Visible=false - Gravity = Gravity.CenterVertical - }; - deviceItemFL.AddChidren(switchBtn); - switchBtn.MouseUpEventHandler += (send2, e2) => - { - switchBtn.IsSelected = !switchBtn.IsSelected; - if (switchBtn.IsSelected == true) - { - //zbGateway = device.CommonDevice.Gateway; - //sendedControlCommand = false; - //zbGateway.ReportAction += UpdateDeviceControllStatu; - //AddZbGateway(zbGatewayList, zbGateway, commonDeviceList, device.CommonDevice); - - dimmableLight.SwitchControl(1); - - //鎺у埗寤舵椂鍥炶皟 - //DeviceUI.SendCommandDelayAction(device.CommonDevice, () => - //{ - //if (Parent == null) - //{ - // return; - //} - //RemoveUpdateControlDeviceStatuAction(zbGateway); - //if (sendedControlCommand == false) - //{ - // DeviceUI.ShowStatuTip(R.MyInternationalizationString.FAIL); - //} - //}); - } - else - { - //zbGateway = device.CommonDevice.Gateway; - //sendedControlCommand = false; - //zbGateway.ReportAction += UpdateDeviceControllStatu; - //AddZbGateway(zbGatewayList, zbGateway, commonDeviceList, device.CommonDevice); - - dimmableLight.SwitchControl(0); - - //鎺у埗寤舵椂鍥炶皟 - //DeviceUI.SendCommandDelayAction(device.CommonDevice, () => - //{ - // if (Parent == null) - // { - // return; - // } - // RemoveUpdateControlDeviceStatuAction(zbGateway); - // if (sendedControlCommand == false) - // { - // DeviceUI.ShowStatuTip(R.MyInternationalizationString.FAIL); - // } - //}); - } - }; - - var deleteBtn = new Device.CommonForm.RowLayoutDeleteButton - { - Tag = device, - IsMoreLines = true - }; - if (Room.CurrentRoom.IsLove) - { - deleteBtn.TextID = R.MyInternationalizationString.CancelCollect; - deleteBtn.BackgroundColor = ZigbeeColor.Current.GXCCancelCollectionBGColor; - deleteBtn.MouseUpEventHandler += collectionEvent; - deviceRowLayout.AddRightView(deleteBtn); - } - else if (Room.CurrentRoom.IsSharedRoom) - { - //涓嶅鐞� + lightView.CollectButton.IsSelected = false; } else { - deleteBtn.MouseUpEventHandler += delEvent; - deviceRowLayout.AddRightView(deleteBtn); + lightView.CollectButton.IsSelected = true; } - EventHandler<MouseEventArgs> dimmableLightHandler = (sender, e) => + lightView.SwitchButton.MouseUpEventHandler += (sender, e) => + { + (sender as Button).IsSelected = !(sender as Button).IsSelected; + if ((sender as Button).IsSelected) + { + zbGateway = device.CommonDevice.Gateway; + sendedControlCommand = false; + zbGateway.ReportAction += UpdateDeviceControllStatu; + AddZbGateway(zbGatewayList, zbGateway, commonDeviceList, device.CommonDevice); + + dimmableLight.SwitchControl(1); + + ((sender as Button).Parent as FunctionMainView).SetStatuText(CommonFormResouce.GetSwitchStatu(true)); + ((sender as Button).Parent as FunctionMainView).IsSelected = true; + + //鎺у埗寤舵椂鍥炶皟 + DeviceUI.SendCommandDelayAction(device.CommonDevice, () => + { + if (Parent == null) + { + return; + } + RemoveUpdateControlDeviceStatuAction(zbGateway); + if (sendedControlCommand == false) + { + DeviceUI.ShowStatuTip(R.MyInternationalizationString.FAIL); + } + }); + } + else + { + zbGateway = device.CommonDevice.Gateway; + sendedControlCommand = false; + zbGateway.ReportAction += UpdateDeviceControllStatu; + AddZbGateway(zbGatewayList, zbGateway, commonDeviceList, device.CommonDevice); + + dimmableLight.SwitchControl(0); + + ((sender as Button).Parent as FunctionMainView).SetStatuText(CommonFormResouce.GetSwitchStatu(false)); + ((sender as Button).Parent as FunctionMainView).IsSelected = false; + + //鎺у埗寤舵椂鍥炶皟 + DeviceUI.SendCommandDelayAction(device.CommonDevice, () => + { + if (Parent == null) + { + return; + } + RemoveUpdateControlDeviceStatuAction(zbGateway); + if (sendedControlCommand == false) + { + DeviceUI.ShowStatuTip(R.MyInternationalizationString.FAIL); + } + }); + } + }; + + lightView.CardBG.MouseUpEventHandler += (sender, e) => { var dimmableLightControl = new Phone.Device.Light.DimmableLightControl(); UserView.HomePage.Instance.AddChidren(dimmableLightControl); @@ -2631,43 +2281,22 @@ dimmableLightControl.action = RefreshBodyView; dimmableLightControl.Show(device, Room.CurrentRoom); }; - //deviceItemFL.MouseLongEventHandler += dimmableLightHandler; - deviceItemFL.MouseUpEventHandler += dimmableLightHandler; - deviceName.MouseUpEventHandler += dimmableLightHandler; - deviceIMG.MouseUpEventHandler += dimmableLightHandler; - //collectionBtn.MouseUpEventHandler += (sender, e) => - //{ - // if (collectionBtn.IsSelected) - // { - // Room.Lists[0].DeleteDevice(device.FilePath); - // collectionBtn.IsSelected = false; - // if(Room.CurrentRoom==Room.Lists[0]) - // { - // RefreshBodyView(); - // } - // } - // else - // { - // Room.Lists[0].AddDevice(device.FilePath); - // collectionBtn.IsSelected = true; - // } - // //RefreshBodyView(); - //}; - collectionBtn.MouseUpEventHandler += collectionEvent; - - //var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FilePath); - //if (dev == null) - //{ - // collectionBtn.IsSelected = false; - //} - //else - //{ - // collectionBtn.IsSelected = true; - //} + lightView.CollectButton.MouseUpEventHandler += collectionEvent; } else if (device.CommonDevice.Type == DeviceType.OnOffSwitch) { + var lightView = new FunctionMainView(xx, yy); + itemView.AddChidren(lightView); + lightView.Init(); + lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath); + lightView.SetStatuText("寮�"); + lightView.SetDeviceName("鎸夐敭"); + //lightView.SetStatu(true); + lightView.IsSelected = true; + lightView.SetCollect(true); + + continue; //鎸夐敭 var panel = (Panel)device.CommonDevice; @@ -2686,13 +2315,22 @@ /// </summary> private void ShowNoSceneTip() { + var noScene = new Button + { + Y = Application.GetRealHeight(69), + Width = Application.GetMinRealAverage(683), + Height = Application.GetMinRealAverage(392), + Gravity = Gravity.CenterHorizontal, + UnSelectedImagePath = "Item/NoFunction.png" + }; + functionSceneBodyView.AddChidren(noScene); var noScenceTip = new Button() { + Y=noScene.Bottom, Height = Application.GetRealHeight(200), - TextID = R.MyInternationalizationString.NoScene, + Text =Language.StringByID(R.MyInternationalizationString.NoScene).Replace("{\\r\\n}","\r\n"), TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor, - TextAlignment = TextAlignment.Center, - Gravity = Gravity.Center, + IsMoreLines=true }; functionSceneBodyView.AddChidren(noScenceTip); } @@ -2716,81 +2354,66 @@ { var sceneScrolView = new VerticalScrolViewLayout { }; functionSceneBodyView.AddChidren(sceneScrolView); - foreach (var scene in sceneList) + for(int i=0;i<sceneList.Count;i++) { + var scene = sceneList[i]; + int xx = 43 + i % 2 * (20 + 487); + int yy = 14; if (scene == null) { continue; } - var sceneFL = new FrameLayout() + + if (i % 2 == 0) { - Height = Application.GetRealHeight(400), - BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, - Tag = scene - }; - sceneScrolView.AddChidren(sceneFL); - var sceneRowLayout = new RowLayout() - { - Y = Application.GetRealHeight(30), - Height = Application.GetRealHeight(400 - 10 - 30), - LineColor = ZigbeeColor.Current.GXCBackgroundColor, - Radius = CommonPage.BigFormRadius - }; - sceneFL.AddChidren(sceneRowLayout); - var sceneItemFL = new FrameLayout() - { - BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, - Radius = CommonPage.BigFormRadius - }; - sceneRowLayout.AddChidren(sceneItemFL); - var sceneImg = new Button() - { - UnSelectedImagePath = scene.IconPath, - Radius = CommonPage.BigFormRadius - }; - sceneItemFL.AddChidren(sceneImg); - var hardBlackBG = new Button() - { - BackgroundColor = ZigbeeColor.Current.GXCBlack70Color, - SelectedBackgroundColor = ZigbeeColor.Current.GXCBlack80Color, - Radius = CommonPage.BigFormRadius - }; - sceneItemFL.AddChidren(hardBlackBG); - var sceneNameBtn = new Button() - { - Text = scene.Name, - TextColor = ZigbeeColor.Current.GXCTextWhiteColor, - TextSize = 20 - }; - sceneItemFL.AddChidren(sceneNameBtn); - //缂栬緫 - var editBtn = new Device.CommonForm.RowLayoutEditButton - { - TextID = R.MyInternationalizationString.Edit, - Tag = scene - }; - //鍒犻櫎 - var deleteBtn = new Device.CommonForm.RowLayoutDeleteButton - { - Tag = scene - }; - if (!Room.CurrentRoom.IsSharedRoom) - { - sceneRowLayout.AddRightView(editBtn); - sceneRowLayout.AddRightView(deleteBtn); + itemView = new FrameLayout() + { + Height = Application.GetRealHeight(14 + 348), + Tag = scene + }; + sceneScrolView.AddChidren(itemView); } - EventHandler<MouseEventArgs> sceneDownHandler = (sender, e) => + var sceneView = new SceneMainView(xx, yy); + itemView.AddChidren(sceneView); + sceneView.Init(); + sceneView.SetSceneNameText(scene.Name); + sceneView.SetIcon($"SceneIcon/{i}.png"); + sceneView.SetCollect(scene.IsCollected); + + if (scene.SceneDelayTime == 0) { - hardBlackBG.IsSelected = true; + sceneView.SetTimeImage(); + } + else + { + sceneView.SetTimeText(scene.SceneDelayTime.ToString()); + } + + sceneView.TimeButton.MouseUpEventHandler += (sender, e) => + { + var timeSelect = new SelectTime(); + CommonPage.Instance.AddChidren(timeSelect); + timeSelect.TempTime = scene.DelayTime; + timeSelect.Init(); + timeSelect.TimeAction = (t) => + { + scene.SceneDelayTime = t; + if(t>0) + { + sceneView.SetTimeText(CommonFormResouce.GetTimeString(scene.SceneDelayTime)); + } + else + { + sceneView.SetTimeImage(); + } + }; + }; - sceneNameBtn.MouseDownEventHandler += sceneDownHandler; - hardBlackBG.MouseDownEventHandler += sceneDownHandler; //璋冪敤鍦烘櫙 EventHandler<MouseEventArgs> sceneUpHandler = async (sender, e) => { - hardBlackBG.IsSelected = false; //1鎴愬姛 0澶辫触 //鍚庨潰琛ヤ笂鐩稿叧鎻愮ず // Error鍙傛暟鍚箟 @@ -2799,7 +2422,7 @@ //<para>3锛氭搷浣滆澶�/缁�/鍦烘櫙涓嶅瓨鍦�</para> //<para>4锛氬叾浠栭敊璇�</para> //<para>5锛氭暟鎹紶杈撻敊璇紙鍦ㄦ煇娆″鎴风鍚戠綉鍏冲彂閫佹暟鎹殑杩囩▼涓紝缃戝叧鍦ㄥ悎鐞嗘椂闂磋寖鍥村唴鎺ユ敹瀹㈡埛绔暟鎹笉瀹屾暣瀵艰嚧璇ラ敊璇彂鐢熴�傚瀹㈡埛绔悜缃戝叧涓�娆″彂閫�100涓瓧鑺傜殑鏁版嵁锛屼絾缃戝叧绛夊緟鎺ユ敹浜嗕竴绉掑彧鎺ユ敹浜�80涓瓧鑺傘�傚彂鐢熻閿欒锛岀綉鍏冲皢涓诲姩鍏抽棴瀹㈡埛绔繛鎺ワ級</para> - var sceneOpenAllData = await ZigBee.Device.Scene.ControlSceneAsync(scene.Id, 0); + var sceneOpenAllData = await ZigBee.Device.Scene.ControlSceneAsync(scene.Id, scene.SceneDelayTime); if (sceneOpenAllData == null || sceneOpenAllData.sceneOpenData == null) { return; @@ -2813,54 +2436,32 @@ CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.ControlSceneFail); } }; - sceneNameBtn.MouseUpEventHandler += sceneUpHandler; - hardBlackBG.MouseUpEventHandler += sceneUpHandler; - - //缂栬緫鍦烘櫙 - EventHandler<MouseEventArgs> editEvent = (sender, e) => + //鏀惰棌 + EventHandler<MouseEventArgs> collectionEvent = (sender, e) => { - SceneRoomUI.EditScene(scene, Room.CurrentRoom); - }; - editBtn.MouseUpEventHandler += editEvent; - - //鍒犻櫎鍦烘櫙 - EventHandler<MouseEventArgs> delEvent = (sender, e) => - { - var alert = new Alert(Language.StringByID(R.MyInternationalizationString.TIP), Language.StringByID(R.MyInternationalizationString.ConfirmDelete), Language.StringByID(R.MyInternationalizationString.Cancel), Language.StringByID(R.MyInternationalizationString.Confrim)); - alert.Show(); - alert.ResultEventHandler += async (send1, e1) => + if ((sender as Button).IsSelected) { - if (e1) - { - //0 绉婚櫎澶辫触 1 绉婚櫎鎴愬姛 2 娌℃湁璇ュ満鏅� - var removeSceneAllData = await ZigBee.Device.Scene.DeleteSceneAsync(scene.Id); - if (removeSceneAllData == null || removeSceneAllData.removeSceneData == null) - { - return; - } - if (removeSceneAllData.removeSceneData.Result == 1) - { - //1鎴愬姛 - Room.CurrentRoom.RemoveScene(scene); - //RefreshBodyView(); - sceneScrolView.RemoveViewByTag((sender as Button).Tag); - } - else if (removeSceneAllData.removeSceneData.Result == 0) - { - //0 绉婚櫎澶辫触 - CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.DeleteSceneFail); - } - else if (removeSceneAllData.removeSceneData.Result == 2) - { - //2 娌℃湁璇ュ満鏅� - Room.CurrentRoom.RemoveScene(scene); - //RefreshBodyView(); - sceneScrolView.RemoveViewByTag((sender as Button).Tag); - } - } - }; + scene.Collect(false); + (sender as Button).IsSelected = false; + } + else + { + scene.Collect(true); + (sender as Button).IsSelected = true; + } + scene.Save(); + //if (Room.CurrentRoom.IsLove) + //{ + // RefreshBodyView(); + //} + }; - deleteBtn.MouseUpEventHandler += delEvent; + + sceneView.CollectButton.MouseUpEventHandler += collectionEvent; + sceneView.MouseUpEventHandler += sceneUpHandler; + sceneView.SceneIcon.MouseUpEventHandler+= sceneUpHandler; + sceneView.SceneNameButton.MouseUpEventHandler += sceneUpHandler; + } } diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Common/Config.cs b/ZigbeeApp/Shared/Phone/ZigBee/Common/Config.cs index 11f8a3b..9eef470 100755 --- a/ZigbeeApp/Shared/Phone/ZigBee/Common/Config.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Common/Config.cs @@ -167,10 +167,7 @@ /// 璐︽埛鐧诲綍鎴愬姛鐨勪富ID /// </summary> public int MasterID = 0; - /// <summary> - /// 鐢ㄦ埛ID - /// </summary> - public int UserID = 0; + public static void ReFresh() { diff --git a/ZigbeeApp/Shared/R.cs b/ZigbeeApp/Shared/R.cs index 23619fa..99875dd 100755 --- a/ZigbeeApp/Shared/R.cs +++ b/ZigbeeApp/Shared/R.cs @@ -161,7 +161,6 @@ public readonly static int ProximithCardUnlock = 86; public readonly static int AllDate = 87; public readonly static int SmartDoorLock = 88; - public readonly static int Current = 89; public readonly static int ClearTempPassword = 90; //闈㈡澘缁戝畾寮�濮� @@ -684,7 +683,7 @@ /// </summary> public const int Cancel = 11023; /// <summary> - /// 娌℃湁鍦烘櫙 \n 璇风偣鍑诲彸涓婅娣诲姞 + /// 娌℃湁鍦烘櫙 {\r\n} 璇风偣鍑诲彸涓婅娣诲姞 /// </summary> public const int NoScene = 11024; /// <summary> @@ -727,8 +726,6 @@ #endregion - - #region 涓婚〉 /// <summary> @@ -752,9 +749,60 @@ /// 娣诲姞鏅鸿兘缃戝叧 /// </summary> public const int AddSmartGW = 13104; + /// <summary> + /// 缂栬緫鎴块棿 + /// </summary> + public const int EditRoom = 13105; + /// <summary> + /// 鎴块棿鍚嶇О + /// </summary> + public const int RoomName = 13106; + /// <summary> + /// 鎵�灞炴ゼ灞� + /// </summary> + public const int BelongFloor = 13107; + /// <summary> + /// 娓╁害 + /// </summary> + public const int Temperature = 13108; + /// <summary> + /// 婀垮害 + /// </summary> + public const int Humidity = 13109; + /// <summary> + /// 褰撳墠 + /// </summary> + public const int Current = 13110; + /// <summary> + /// 寮� + /// </summary> + public const int Open = 13111; + /// <summary> + /// 鍏� + /// </summary> + public const int Close = 13112; + /// <summary> + /// 涓嶅紑鍚� + /// </summary> + public const int NotOpen = 13113; + /// <summary> + /// 绉� + /// </summary> + public static readonly int Second = 13114; + /// <summary> + /// 鍒嗛挓 + /// </summary> + public static readonly int Minute = 13115; + /// <summary> + /// 灏忔椂 + /// </summary> + public static readonly int Hour = 13116; #endregion + + + /// <summary> @@ -826,7 +874,7 @@ public static readonly int Logining = 11024; public static readonly int AddRoom = 11026; - public static readonly int RoomName = 11027; + public static readonly int SettingContent = 11031; @@ -838,7 +886,7 @@ public static readonly int HadSameRoom = 11037; //*****public static readonly int Function = 11038; - public static readonly int EditRoom = 11040; + public static readonly int Delete = 11041; public static readonly int AddFunction = 11042; @@ -856,7 +904,7 @@ public static readonly int DeviceSetting = 11055; public static readonly int AddDeviceSuccess = 11058; - public static readonly int Close = 11059; + public static readonly int Device = 11060; public static readonly int ConfirmDeleteThisRoom = 11062; @@ -871,7 +919,7 @@ public static readonly int NextStep = 11071; public static readonly int SelectRoom = 11072; public static readonly int SelectDevice = 11073; - public static readonly int Open = 11074; + /// <summary> /// 璋冨厜 /// </summary> @@ -923,14 +971,7 @@ public static readonly int TimeSpan = 11093; public static readonly int TheSceneHadExist = 11094; public static readonly int AddSceneFail = 11095; - /// <summary> - /// 绉� - /// </summary> - public static readonly int Second = 11096; - /// <summary> - /// 鍒嗛挓 - /// </summary> - public static readonly int Minute = 11097; + /// <summary> /// 鑷畾涔� /// </summary> diff --git a/ZigbeeApp/Shared/Shared.projitems b/ZigbeeApp/Shared/Shared.projitems index ad7e707..63c4ecc 100755 --- a/ZigbeeApp/Shared/Shared.projitems +++ b/ZigbeeApp/Shared/Shared.projitems @@ -42,6 +42,7 @@ <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\ACLeftIconButtonRowLayout.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\BackButton.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\ButtonLineForm.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\CommonEnum.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\CommonFormResouce.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\CompleteButton.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\CustomAlert.cs" /> @@ -49,14 +50,19 @@ <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\DeviceIconSelectedIMGByLocal.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\DeviceInfoEditRow.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\DeviceInfoRow.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\DeviceInfoWithZoneRow.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\FunctionButton.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\FunctionIconButton.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\FunctionMainView.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\FunctionRow.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\LeftIconButtonRow.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\Line.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\RoomMainView.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\RowLayoutDeleteButton.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\RowLayoutEditButton.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\SceneMainView.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\SelectedStatuButton.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\SelectTime.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\TopFrameLayout.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Light\DimmableLightControl.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\AddLogicPage.cs" /> @@ -84,7 +90,11 @@ <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\TimePage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\TimePoint.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\WeekPage.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Room\EditRoom.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Room\RoomCommon.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Room\RoomHumiditySetting.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Room\RoomShareSetting.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Room\RoomTemperatureSetting.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Abount\AbountForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Controls\CompoundControls\BelongAreaControl.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Controls\CompoundControls\InformationEditorControl.cs" /> -- Gitblit v1.8.0