New file |
| | |
| | | using System; |
| | | namespace Shared.Phone.MainPage.ControlForm |
| | | { |
| | | /// <summary>
|
| | | /// 郭雪城的空调深度卡片的各种方法
|
| | | /// </summary> |
| | | public class DeviceAcDetailCardMethord |
| | | { |
| | | #region ◆ 变量_____________________________ |
| | | /// <summary> |
| | | /// 最低温度 16 |
| | | /// </summary> |
| | | public const int Temperature_Low=16; |
| | | /// <summary> |
| | | /// 最高温度 32å |
| | | /// </summary> |
| | | public const int Temperature_High = 32; |
| | | /// <summary> |
| | | /// 默认温度 |
| | | /// </summary> |
| | | public const int Temperature_Default = 26; |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 获取模式名称_______________________ |
| | | /// <summary> |
| | | /// 通过模式获取模式名称 |
| | | /// </summary> |
| | | /// <returns>The mode name by mode.</returns> |
| | | /// <param name="acMode">Ac mode.</param> |
| | | public static string GetModeNameByMode(ZigBee.Device.AC.AcMode acMode) |
| | | { |
| | | if (acMode == ZigBee.Device.AC.AcMode.Auto) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.Mode_Auto); |
| | | } |
| | | else if (acMode == ZigBee.Device.AC.AcMode.Cool) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.Mode_Cool); |
| | | } |
| | | else if (acMode == ZigBee.Device.AC.AcMode.Heat) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.Mode_Heat); |
| | | } |
| | | else if (acMode == ZigBee.Device.AC.AcMode.Dry) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.Mode_Dry); |
| | | } |
| | | else if (acMode == ZigBee.Device.AC.AcMode.FanOnly) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.Mode_FanOnly); |
| | | } |
| | | return Language.StringByID(R.MyInternationalizationString.Mode_Auto); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过模式id获取模式名称 |
| | | /// |
| | | /// <para>0:Off </para> |
| | | /// <para>1:Auto </para> |
| | | /// <para>3:Cool </para> |
| | | /// <para>4:Heat </para> |
| | | /// <para>5:Emergency heating </para> |
| | | /// <para>6:Precooling</para> |
| | | /// <para>7:Fan only </para> |
| | | /// <para>8:Dry </para> |
| | | /// <para>9:Sleep</para> |
| | | /// </summary> |
| | | /// <returns>The mode name by mode.</returns> |
| | | /// <param name="acMode">Ac mode.</param> |
| | | public static string GetModeNameByModeId(int acMode) |
| | | { |
| | | if (acMode == 1) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.Mode_Auto); |
| | | } |
| | | else if (acMode == 3) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.Mode_Cool); |
| | | } |
| | | else if (acMode == 4) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.Mode_Heat); |
| | | } |
| | | else if (acMode == 8) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.Mode_Dry); |
| | | } |
| | | else if (acMode == 7) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.Mode_FanOnly); |
| | | } |
| | | // |
| | | return Language.StringByID(R.MyInternationalizationString.Mode_Auto); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 获取风速名称_______________________ |
| | | /// <summary> |
| | | /// 通过风速模式获取风速名称 |
| | | /// </summary> |
| | | /// <returns>The fan mode name by fan mode.</returns> |
| | | /// <param name="fanMode">Fan mode.</param> |
| | | public static string GetFanModeNameByFanMode(ZigBee.Device.AC.FanMode fanMode) |
| | | { |
| | | if(fanMode==ZigBee.Device.AC.FanMode.Low) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.Fan_Low); |
| | | } |
| | | else if(fanMode == ZigBee.Device.AC.FanMode.Medium) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.Fan_Middle); |
| | | } |
| | | else |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.Fan_Height); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 获取模式图片名称_____________________ |
| | | /// <summary> |
| | | /// 通过模式id获取选中的图片路径 |
| | | /// </summary> |
| | | /// <returns>The mode selected image path by mode identifier.</returns> |
| | | /// <param name="acMode">Ac mode.</param> |
| | | public static string GetModeSelectedImagePathByModeId(int acMode) |
| | | { |
| | | if (acMode == 1) |
| | | { |
| | | return "AC/Mode_AutoSelected.png"; |
| | | } |
| | | else if (acMode == 3) |
| | | { |
| | | return "AC/Mode_CoolSelected.png"; |
| | | } |
| | | else if (acMode == 4) |
| | | { |
| | | return "AC/Mode_HeatSelected.png"; |
| | | } |
| | | else if (acMode == 7) |
| | | { |
| | | return "AC/Mode_FanSelected.png"; |
| | | } |
| | | else if (acMode == 8) |
| | | { |
| | | return "AC/Mode_DrySelected.png"; |
| | | } |
| | | return "AC/Mode_AutoSelected.png"; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过模式id获取图片路径 |
| | | /// </summary> |
| | | /// <returns>The mode selected image path by mode identifier.</returns> |
| | | /// <param name="acMode">Ac mode.</param> |
| | | public static string GetModeUnSelectedImagePathByModeId(int acMode) |
| | | { |
| | | if (acMode == 1) |
| | | { |
| | | return "AC/Mode_Auto.png"; |
| | | } |
| | | else if (acMode == 3) |
| | | { |
| | | return "AC/Mode_Cool.png"; |
| | | } |
| | | else if (acMode == 4) |
| | | { |
| | | return "AC/Mode_Heat.png"; |
| | | } |
| | | else if (acMode == 7) |
| | | { |
| | | return "AC/Mode_Fan.png"; |
| | | } |
| | | else if (acMode == 8) |
| | | { |
| | | return "AC/Mode_Dry.png"; |
| | | } |
| | | return "AC/Mode_Auto.png"; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过模式id获取选中的图片路径 |
| | | /// </summary> |
| | | /// <returns>The mode selected image path by mode identifier.</returns> |
| | | /// <param name="acMode">Ac mode.</param> |
| | | public static string GetModeSelectedImagePathByMode(ZigBee.Device.AC.AcMode acMode) |
| | | { |
| | | if (acMode == ZigBee.Device.AC.AcMode.Auto) |
| | | { |
| | | return GetModeSelectedImagePathByModeId(1); |
| | | } |
| | | else if (acMode == ZigBee.Device.AC.AcMode.Cool) |
| | | { |
| | | return GetModeSelectedImagePathByModeId(3); |
| | | } |
| | | else if (acMode == ZigBee.Device.AC.AcMode.Heat) |
| | | { |
| | | return GetModeSelectedImagePathByModeId(4); |
| | | } |
| | | else if (acMode == ZigBee.Device.AC.AcMode.FanOnly) |
| | | { |
| | | return GetModeSelectedImagePathByModeId(7); |
| | | } |
| | | else if (acMode == ZigBee.Device.AC.AcMode.Dry) |
| | | { |
| | | return GetModeSelectedImagePathByModeId(8); |
| | | } |
| | | return GetModeSelectedImagePathByModeId(1); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过模式id获取选中的图片路径 |
| | | /// </summary> |
| | | /// <returns>The mode selected image path by mode identifier.</returns> |
| | | /// <param name="acMode">Ac mode.</param> |
| | | public static string GetModeUnSelectedImagePathByMode(ZigBee.Device.AC.AcMode acMode) |
| | | { |
| | | if (acMode == ZigBee.Device.AC.AcMode.Auto) |
| | | { |
| | | return GetModeUnSelectedImagePathByModeId(1); |
| | | } |
| | | else if (acMode == ZigBee.Device.AC.AcMode.Cool) |
| | | { |
| | | return GetModeUnSelectedImagePathByModeId(3); |
| | | } |
| | | else if (acMode == ZigBee.Device.AC.AcMode.Heat) |
| | | { |
| | | return GetModeUnSelectedImagePathByModeId(4); |
| | | } |
| | | else if (acMode == ZigBee.Device.AC.AcMode.FanOnly) |
| | | { |
| | | return GetModeUnSelectedImagePathByModeId(7); |
| | | } |
| | | else if (acMode == ZigBee.Device.AC.AcMode.Dry) |
| | | { |
| | | return GetModeUnSelectedImagePathByModeId(8); |
| | | } |
| | | return GetModeUnSelectedImagePathByModeId(1); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 获取扫风模式图片名称_____________________ |
| | | /// <summary> |
| | | /// 通过扫风模式获取选中图片 |
| | | /// </summary> |
| | | /// <returns>The fan mode selected image path by fan mode identifier.</returns> |
| | | /// <param name="swingMode">Fan mode.</param> |
| | | public static string GetFanSwingModeSelectedImagePathByFanSwingModeId(int swingMode) |
| | | { |
| | | if (swingMode == 0) |
| | | { |
| | | return "AC/Swing_1Selected.png"; |
| | | } |
| | | else if (swingMode == 1) |
| | | { |
| | | return "AC/Swing_2Selected.png"; |
| | | } |
| | | else if (swingMode == 2) |
| | | { |
| | | return "AC/Swing_3Selected.png"; |
| | | } |
| | | else if (swingMode == 3) |
| | | { |
| | | return "AC/Swing_4Selected.png"; |
| | | } |
| | | else if (swingMode == 4) |
| | | { |
| | | return "AC/Swing_5Selected.png"; |
| | | } |
| | | return "AC/Swing_AutoSelected.png"; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过扫风模式获取图片 |
| | | /// </summary> |
| | | /// <returns>The fan mode selected image path by fan mode identifier.</returns> |
| | | /// <param name="swingMode">Fan mode.</param> |
| | | public static string GetFanSwingModeUnSelectedImagePathByFanSwingModeId(int swingMode) |
| | | { |
| | | if (swingMode == 0) |
| | | { |
| | | return "AC/Swing_1.png"; |
| | | } |
| | | else if (swingMode == 1) |
| | | { |
| | | return "AC/Swing_2.png"; |
| | | } |
| | | else if (swingMode == 2) |
| | | { |
| | | return "AC/Swing_3.png"; |
| | | } |
| | | else if (swingMode == 3) |
| | | { |
| | | return "AC/Swing_4.png"; |
| | | } |
| | | else if (swingMode == 4) |
| | | { |
| | | return "AC/Swing_5.png"; |
| | | } |
| | | return "AC/Swing_Auto.png"; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过扫风模式获取选中图片 |
| | | /// </summary> |
| | | /// <returns>The fan mode selected image path by fan mode identifier.</returns> |
| | | /// <param name="swingMode">Fan mode.</param> |
| | | public static string GetFanSwingModeSelectedImagePathByFanSwingMode(ZigBee.Device.AC.FanSwingMode swingMode) |
| | | { |
| | | return GetFanSwingModeSelectedImagePathByFanSwingModeId((int)swingMode); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过扫风模式获取图片 |
| | | /// </summary> |
| | | /// <returns>The fan mode selected image path by fan mode identifier.</returns> |
| | | /// <param name="swingMode">Fan mode.</param> |
| | | public static string GetFanSwingModeUnSelectedImagePathByFanSwingMode(ZigBee.Device.AC.FanSwingMode swingMode) |
| | | { |
| | | return GetFanSwingModeUnSelectedImagePathByFanSwingModeId((int)swingMode); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region ◆ 获取风速图片名称_____________________ |
| | | |
| | | /// <summary> |
| | | /// 通过风速模式获取风速选中图片 |
| | | /// </summary> |
| | | /// <returns>The fan mode selected image path by fan mode identifier.</returns> |
| | | /// <param name="fanMode">Fan mode.</param> |
| | | public static string GetFanModeSelectedImagePathByFanModeId(int fanMode) |
| | | { |
| | | if(fanMode == 1) |
| | | { |
| | | return "AC/Fan_LowSelected.png"; |
| | | } |
| | | else if(fanMode == 2) |
| | | { |
| | | return "AC/Fan_MiddleSelected.png"; |
| | | } |
| | | else if(fanMode == 3) |
| | | { |
| | | return "AC/Fan_HeightSelected.png"; |
| | | } |
| | | return "AC/Fan_LowSelected.png"; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过风速模式获取风速图片 |
| | | /// </summary> |
| | | /// <returns>The fan mode selected image path by fan mode identifier.</returns> |
| | | /// <param name="fanMode">Fan mode.</param> |
| | | public static string GetFanModeUnSelectedImagePathByFanModeId(int fanMode) |
| | | { |
| | | if (fanMode == 1) |
| | | { |
| | | return "AC/Fan_Low.png"; |
| | | } |
| | | else if (fanMode == 2) |
| | | { |
| | | return "AC/Fan_Middle.png"; |
| | | } |
| | | else if (fanMode == 3) |
| | | { |
| | | return "AC/Fan_Height.png"; |
| | | } |
| | | return "AC/Fan_Low.png"; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过风速模式获取风速选中图片 |
| | | /// </summary> |
| | | /// <returns>The fan mode selected image path by fan mode identifier.</returns> |
| | | /// <param name="fanMode">Fan mode.</param> |
| | | public static string GetFanModeSelectedImagePathByFanMode(ZigBee.Device.AC.FanMode fanMode) |
| | | { |
| | | return GetFanModeSelectedImagePathByFanModeId((int)fanMode); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过风速模式获取风速图片 |
| | | /// </summary> |
| | | /// <returns>The fan mode selected image path by fan mode identifier.</returns> |
| | | /// <param name="swingMode">Fan mode.</param> |
| | | public static string GetFanModeUnSelectedImagePathByFanMode(ZigBee.Device.AC.FanMode fanMode) |
| | | { |
| | | return GetFanModeUnSelectedImagePathByFanModeId((int)fanMode); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 获取模式__________________________ |
| | | |
| | | //public static ZigBee.Device.AC.AcMode GetModeByModeId(int modeId) |
| | | //{ |
| | | //if(modeId==) |
| | | //} |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 获取温度__________________________ |
| | | |
| | | public static int GetCurrentModeTemperature(ZigBee.Device.AC ac) |
| | | { |
| | | |
| | | if (ac.currentSystemMode == 3 || ac.currentSystemMode == 8) |
| | | { |
| | | return ac.currentCoolingSetpoint; |
| | | } |
| | | else if (ac.currentSystemMode == 4) |
| | | { |
| | | return ac.currentHeatingSetpoint; |
| | | } |
| | | else if (ac.currentSystemMode == 1) |
| | | { |
| | | return ac.currentAutoSetpoint; |
| | | } |
| | | return ac.currentLocalTemperature; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 设置温度__________________________ |
| | | /// <summary> |
| | | /// 设置当前模式下的温度 |
| | | /// </summary> |
| | | /// <param name="ac">Ac.</param> |
| | | /// <param name="temperature">Temperature.</param> |
| | | public static void SetCurrentModeTemperature(ZigBee.Device.AC ac ,int temperature) |
| | | { |
| | | if (ac.currentSystemMode == 3) |
| | | { |
| | | ac.currentCoolingSetpoint+=temperature; |
| | | } |
| | | else if (ac.currentSystemMode == 4) |
| | | { |
| | | ac.currentHeatingSetpoint+=temperature; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region ◆ 当前空调开关状态____________________ |
| | | |
| | | /// <summary> |
| | | /// 当前空调开关状态 |
| | | /// </summary> |
| | | /// <returns><c>true</c>, if open was ised, <c>false</c> otherwise.</returns> |
| | | /// <param name="ac">Ac.</param> |
| | | public static bool IsOpen(ZigBee.Device.AC ac) |
| | | { |
| | | if (ac.currentSystemMode == 0) |
| | | { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 提示空调已关________________________ |
| | | /// <summary> |
| | | /// 提示空调已关 |
| | | /// </summary> |
| | | public static void ShowACIsCloseTip() |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | string msg = Language.StringByID(R.MyInternationalizationString.TheACIsClose); |
| | | //var tip = new Phone.UserCenter.TipViewControl(msg, 1000, 1); |
| | | //tip.ShowView(); |
| | | }); |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |