New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <module type="JAVA_MODULE" version="4"> |
| | | <component name="NewModuleRootManager" inherit-compiler-output="true"> |
| | | <exclude-output /> |
| | | <content url="file://$MODULE_DIR$" /> |
| | | <orderEntry type="inheritedJdk" /> |
| | | <orderEntry type="sourceFolder" forTests="false" /> |
| | | </component> |
| | | </module> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project version="4"> |
| | | <component name="ProjectModuleManager"> |
| | | <modules> |
| | | <module fileurl="file://$PROJECT_DIR$/.idea/OnPro.iml" filepath="$PROJECT_DIR$/.idea/OnPro.iml" /> |
| | | </modules> |
| | | </component> |
| | | </project> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project version="4"> |
| | | <component name="VcsDirectoryMappings"> |
| | | <mapping directory="" vcs="Git" /> |
| | | </component> |
| | | </project> |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.5.9" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202206291"> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.5.9" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202206301"> |
| | | <uses-sdk android:minSdkVersion="26" android:targetSdkVersion="29" /> |
| | | <!--友盟--> |
| | | <!--<uses-sdk android:minSdkVersion="8"></uses-sdk>--> |
| | |
| | | <Reference Include="Shared.IOS.LCVideoOnSDK"> |
| | | <HintPath>..\DLL\LC\IOS\Shared.IOS.LCVideoOnSDK.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="Shared.IOS.HDLSceneSiri"> |
| | | <HintPath>..\DLL\IOS\Shared.IOS.HDLSceneSiri.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="Shared.IOS.HDLLinphoneSDK"> |
| | | <HintPath>..\DLL\Linphone\iOS\Shared.IOS.HDLLinphoneSDK.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="Shared.IOS.HDLSceneSiri"> |
| | | <HintPath>..\DLL\IOS\Shared.IOS.HDLSceneSiri.dll</HintPath> |
| | | <Reference Include="Shared.IOS.HDLFVSDK"> |
| | | <HintPath>..\DLL\IOS\Shared.IOS.HDLFVSDK.dll</HintPath> |
| | | </Reference> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | |
| | | EndProject
|
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UMSdk", "UMSdk\UMSdk.csproj", "{5CD1B2DE-1ABD-4B46-8C97-CCB6EA90346A}"
|
| | | EndProject
|
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared.Droid.HDLLinphone", "Shared.Droid.HDLLinphone\Shared.Droid.HDLLinphone.csproj", "{703D29ED-674F-44A8-8AAD-863035899D4B}"
|
| | | EndProject
|
| | | Global
|
| | | GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
| | | HDL_ON\HDL_ON.projitems*{09712674-2a38-407b-b1e2-560b2c352f9a}*SharedItemsImports = 4
|
| | |
| | | {5CD1B2DE-1ABD-4B46-8C97-CCB6EA90346A}.Release|iPhone.Build.0 = Release|Any CPU
|
| | | {5CD1B2DE-1ABD-4B46-8C97-CCB6EA90346A}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
| | | {5CD1B2DE-1ABD-4B46-8C97-CCB6EA90346A}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
| | | {703D29ED-674F-44A8-8AAD-863035899D4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
| | | {703D29ED-674F-44A8-8AAD-863035899D4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
| | | {703D29ED-674F-44A8-8AAD-863035899D4B}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
| | | {703D29ED-674F-44A8-8AAD-863035899D4B}.Debug|iPhone.Build.0 = Debug|Any CPU
|
| | | {703D29ED-674F-44A8-8AAD-863035899D4B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
| | | {703D29ED-674F-44A8-8AAD-863035899D4B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
| | | {703D29ED-674F-44A8-8AAD-863035899D4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
| | | {703D29ED-674F-44A8-8AAD-863035899D4B}.Release|Any CPU.Build.0 = Release|Any CPU
|
| | | {703D29ED-674F-44A8-8AAD-863035899D4B}.Release|iPhone.ActiveCfg = Release|Any CPU
|
| | | {703D29ED-674F-44A8-8AAD-863035899D4B}.Release|iPhone.Build.0 = Release|Any CPU
|
| | | {703D29ED-674F-44A8-8AAD-863035899D4B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
| | | {703D29ED-674F-44A8-8AAD-863035899D4B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
| | | EndGlobalSection
|
| | | GlobalSection(SolutionProperties) = preSolution
|
| | | HideSolutionNode = FALSE
|
| | |
| | | { |
| | | var requestJson = HttpUtil.GetSignRequestJson(uploadImageObj); |
| | | var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_UploadImage, requestJson); |
| | | if(revertObj.Code == StateCode.SUCCESS) |
| | | if (revertObj.Code == StateCode.SUCCESS) |
| | | { |
| | | if(revertObj.Data != null) |
| | | if (revertObj.Data != null) |
| | | { |
| | | return revertObj.Data.ToString(); |
| | | } |
| | |
| | | try |
| | | { |
| | | if (string.IsNullOrEmpty(imageKey)) return null; |
| | | |
| | | |
| | | byte[] imageBytes; |
| | | if (!ignoreCache && Exists(imageKey)) |
| | | { |
| | |
| | | { |
| | | //云端下载 |
| | | imageBytes = GetImageDownloadUrlWithRegionUrl(imageKey, regionUrl); |
| | | if(imageBytes != null) |
| | | if (imageBytes != null) |
| | | { |
| | | //保存到本地 |
| | | WriteFileByBytes(imageKey, imageBytes); |
| | | } |
| | | |
| | | |
| | | } |
| | | return imageBytes; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 下载用户头像 |
| | | /// </summary> |
| | | /// <param name="imageUrl"></param> |
| | | /// <param name="ignoreCache">忽略缓存</param> |
| | | /// <param name="regionUrl">指定服务器域名,传空为使用当前用户地址</param> |
| | | /// <returns></returns> |
| | | public byte[] DownImageByImageUrl(string imageUrl, bool ignoreCache = false) |
| | | { |
| | | try |
| | | { |
| | | if (string.IsNullOrEmpty(imageUrl)) return null; |
| | | |
| | | byte[] imageBytes; |
| | | if (!ignoreCache && Exists(imageUrl)) |
| | | { |
| | | //本地有缓存 |
| | | imageBytes = ReadFile(imageUrl); |
| | | } |
| | | else |
| | | { |
| | | //下载 |
| | | imageBytes = HttpUtil.HttpsDownload(imageUrl); |
| | | if (imageBytes != null) |
| | | { |
| | | //保存到本地 |
| | | WriteFileByBytes(imageUrl, imageBytes); |
| | | } |
| | | |
| | | } |
| | | return imageBytes; |
| | | } |
| | | catch |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | using System.Text; |
| | | using HDL_ON.Entity; |
| | | using Newtonsoft.Json.Linq; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.DAL.Server |
| | | { |
| | |
| | | /// <param name="deviceId">设备ID</param> |
| | | /// <param name="deviceKey">功能查询类型:pm25</param> |
| | | /// <returns></returns> |
| | | public ResponsePackNew GetSensorHistory(string qType, string deviceId, string deviceKey) |
| | | public ResponsePackNew GetSensorHistory(string qType, string deviceId, string deviceKey, string time = "") |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("type", qType); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | | d.Add("deviceId", deviceId); |
| | | d.Add("key", deviceKey); |
| | | if (time != "") |
| | | { |
| | | d.Add("time", time); |
| | | } |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_EnvironmentalSensorHistoricalData, requestJson); |
| | |
| | | #endif |
| | | //是否生产模式 |
| | | bool isProduce = true; |
| | | #if DEBUG |
| | | isProduce = true; |
| | | #endif |
| | | |
| | | if (HttpUtil.GlobalRequestHttpsHost == "https://test-gz.hdlcontrol.com") |
| | | { |
| | | isProduce = false; |
| | | } |
| | | if (string.IsNullOrEmpty(OnAppConfig.Instance.PushDeviceToken)) |
| | | { |
| | | Utlis.WriteLine("PushDeviceToken 为空"); |
| | |
| | | |
| | | //var mAddpushinfoJson = Newtonsoft.Json.JsonConvert.SerializeObject(mAddpushinfoObj); |
| | | var mAddpushinfoJson = HttpUtil.GetSignRequestJson(mAddpushinfoObj); |
| | | |
| | | Utlis.WriteLine("mAddpushinfoJson: " + mAddpushinfoJson); |
| | | |
| | | //new Alert("", , "取消", "确定").Show(); |
| | | var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_AddToken, mAddpushinfoJson); |
| | | if (revertObj.Code == StateCode.SUCCESS) |
| | | { |
| | | //new Alert("", "提交pushToken成功" + OnAppConfig.Instance.PushDeviceToken, "取消", "确定").Show(); |
| | | |
| | | if (revertObj.Data != null) |
| | | { |
| | | var pushId = revertObj.Data.ToString(); |
| | |
| | | OnAppConfig.Instance.PushId = pushId; |
| | | OnAppConfig.Instance.SaveConfig(); |
| | | Utlis.WriteLine("PushId: " + pushId); |
| | | //new Alert("","提交pushToken成功"+ OnAppConfig.Instance.PushDeviceToken, "取消","确定").Show(); |
| | | |
| | | return true; |
| | | } |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | Utlis.WriteLine("AddToken 失败"); |
| | | //Utlis.WriteLine("AddToken 失败"); |
| | | } |
| | | return false; |
| | | } |
| | |
| | | /// 获取设备列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public ResponsePackNew GetDeviceList(string pageSize="",string pageNo ="") |
| | | public ResponsePackNew GetDeviceList(string pageSize = "", string pageNo = "") |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | |
| | | var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_FL_Check, requestJson); |
| | | return pack; |
| | | } |
| | | /// <summary> |
| | | /// 获取门口机徘徊报警数据 |
| | | /// </summary> |
| | | /// <param name="deviceId"></param> |
| | | /// <returns></returns> |
| | | public ResponsePackNew GetAlarmRecords(string deviceId, int pageSize, int pageNo, string alarmType = "PROWLER_ALARM") |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | | d.Add("deviceId", deviceId); |
| | | d.Add("alarmType", alarmType); |
| | | d.Add("pageSize", pageSize); |
| | | d.Add("pageNo", pageNo); |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_ALARM_RECORDS, requestJson); |
| | | return pack; |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 门锁相关____________________________ |
| | |
| | | /// 获取全球区域列表 免登录 |
| | | /// </summary> |
| | | public const string API_POST_GlobalRegionList = "/smart-footstone/region/globalRegionList"; |
| | | #endregion |
| | | |
| | | #region 访客 |
| | | /// <summary> |
| | | /// 生成临时密码 |
| | | /// </summary> |
| | | public const string API_POST_ADD_TEMP_PASSWORD = "/community-wisdom/app/visitor/freeview/add"; |
| | | /// <summary> |
| | | /// 删除临时密码 |
| | | /// </summary> |
| | | public const string API_POST_DEL_TEMP_PASSWORD = "/community-wisdom/app/visitor/freeview/delete"; |
| | | /// <summary> |
| | | /// 获取临时密码 |
| | | /// </summary> |
| | | public const string API_POST_GET_TEMP_PASSWORD_LIST = "/community-wisdom/app/visitor/freeview/page"; |
| | | #endregion |
| | | #endregion |
| | | |
| | | #region ■ AcCluster -- 登录和注册部分___________________________ |
| | | /// <summary> |
| | |
| | | /// 解绑认证(手机/邮箱) |
| | | /// </summary> |
| | | public const string API_POST_Member_UnbindWithAccount = "/smart-footstone/member/memberInfo/unbindWithAccount"; |
| | | #endregion |
| | | |
| | | #region 访客 |
| | | /// <summary> |
| | | /// 生成临时密码 |
| | | /// </summary> |
| | | public const string API_POST_ADD_TEMP_PASSWORD = "/community-wisdom/app/visitor/freeview/add"; |
| | | /// <summary> |
| | | /// 删除临时密码 |
| | | /// </summary> |
| | | public const string API_POST_DEL_TEMP_PASSWORD = "/community-wisdom/app/visitor/freeview/delete"; |
| | | /// <summary> |
| | | /// 获取临时密码 |
| | | /// </summary> |
| | | public const string API_POST_GET_TEMP_PASSWORD_LIST = "/community-wisdom/app/visitor/freeview/page"; |
| | | #endregion |
| | | |
| | | /// <summary> |
| | |
| | | /// 动态密码/二维码开锁 |
| | | /// </summary> |
| | | public const string API_POST_FL_QRcode = "http://112.74.164.111:180/api.php/Device/setdynamicpwd"; |
| | | /// <summary> |
| | | /// 临时密码 |
| | | /// 二维码 |
| | | /// </summary> |
| | | public const string API_Post_Temporary_Password = "/home-wisdom/app/freeview/temppwd/add"; |
| | | /// <summary> |
| | | /// 获取门禁二维码 |
| | | /// </summary> |
| | | public const string API_POST_OwnerQRCode = "/community-wisdom/doorDevice/getOwnerQRCode"; |
| | | /// <summary> |
| | | /// 徘徊报警 |
| | | /// </summary> |
| | | public const string API_POST_ALARM_RECORDS = "/home-wisdom/app/device/alarmRecords/listByPage"; |
| | | |
| | | |
| | | #endregion |
| | | |
| | | |
| | |
| | | }else if (interphoneType == InterphoneType.HDL.ToString()) |
| | | { |
| | | //HDLLinphone 狄耐克 |
| | | HDLLinphone.Current.ShowESVideoMonitor(mESVideoInfo); |
| | | HDLLinphone.Current.ShowESVideoMonitor(mESVideoInfo, interphoneType); |
| | | ////全视通 |
| | | //NSDictionary deviceInfo = new NSDictionary("deviceCode","3-1-11-2", "deviceName", mESVideoInfo.DeviceName); |
| | | //Shared.IOS.HDLFVSDK.Video.Monitor(deviceInfo); |
| | |
| | | /// <summary> |
| | | /// 是否在线 |
| | | /// </summary> |
| | | public bool online = true; |
| | | public bool online { |
| | | get |
| | | { |
| | | return true; |
| | | } |
| | | set { |
| | | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 环境面板 绑定的 设备目标sid列表 |
New file |
| | |
| | | using HDL_ON.Entity;
|
| | | using HDL_ON.UI.CSS;
|
| | | using Shared;
|
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Text;
|
| | |
|
| | | namespace HDL_ON.Stan
|
| | | {
|
| | | /// <summary>
|
| | | /// 设备功能卡片的底层界面
|
| | | /// </summary>
|
| | | public class DeviceFunction4CardCommonForm : EditorCommonForm
|
| | | {
|
| | | #region ■ 变量声明___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 当前回路对象
|
| | | /// </summary>
|
| | | public Function device = null;
|
| | | /// <summary>
|
| | | /// 右上角配置结束的事件
|
| | | /// </summary>
|
| | | public Action SettionFinishEvent = null;
|
| | | /// <summary>
|
| | | /// 左右翻页的控件的事件
|
| | | /// </summary>
|
| | | public Action<int> PageChangeEvent = null;
|
| | | /// <summary>
|
| | | /// 左右整个翻页的控件
|
| | | /// </summary>
|
| | | private PageLayout pageLayout = null;
|
| | | /// <summary>
|
| | | /// 设备名字控件(刷新用到)
|
| | | /// </summary>
|
| | | public NormalViewControl btnDeviceName = null;
|
| | | /// <summary>
|
| | | /// 房间名字控件(刷新用到)
|
| | | /// </summary>
|
| | | public NormalViewControl btnRoomName = null;
|
| | | /// <summary>
|
| | | /// 底部快捷按钮1
|
| | | /// </summary>
|
| | | private NormalViewControl btnBottomOne = null;
|
| | | /// <summary>
|
| | | /// 底部快捷按钮2
|
| | | /// </summary>
|
| | | private NormalViewControl btnBottomTwo = null;
|
| | | private NormalViewControl btnBottom3 = null;
|
| | | private NormalViewControl btnBottom4 = null;
|
| | | /// <summary>
|
| | | /// 第一索引的白色区域的桌布控件
|
| | | /// </summary>
|
| | | public NormalFrameLayout FrameWhiteCentet1 = null;
|
| | | /// <summary>
|
| | | /// 第二索引的白色区域的桌布控件(请先调用AddSecondPage函数完成添加)
|
| | | /// </summary>
|
| | | public NormalFrameLayout FrameWhiteCentet2 = null;
|
| | | public NormalFrameLayout FrameWhiteCentet3 = null;
|
| | | public NormalFrameLayout FrameWhiteCentet4 = null;
|
| | |
|
| | | /// <summary>
|
| | | /// 是否显示收藏按钮
|
| | | /// </summary>
|
| | | public bool ShowColltionButton = true;
|
| | | #endregion
|
| | |
|
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
| | | /// </summary>
|
| | | /// <param name="i_device">设备对象</param>
|
| | | /// <param name="btnHigherCollection">上一级界面的收藏控件(原来on的框架太坑)</param>
|
| | | /// <param name="btnHigherDeviceName">上一级界面的设备名字控件(原来on的框架太坑)</param>
|
| | | /// <param name="btnHigherRoom">上一级界面的房间名字控件(原来on的框架太坑)</param>
|
| | | public void ShowForm(Function i_device, Button btnHigherCollection, Button btnHigherDeviceName, Button btnHigherRoom)
|
| | | {
|
| | | this.device = i_device;
|
| | |
|
| | | //添加头部【设置】图标
|
| | | this.AddTopSettingIcon(btnHigherDeviceName, btnHigherRoom);
|
| | |
|
| | | //初始化中部信息
|
| | | this.InitMiddleFrame(btnHigherCollection);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化中部信息
|
| | | /// </summary>
|
| | | /// <param name="btnHigherCollection">上一级界面的收藏控件</param>
|
| | | private void InitMiddleFrame(Button btnHigherCollection)
|
| | | {
|
| | | //清空bodyFrame
|
| | | this.ClearBodyFrame();
|
| | |
|
| | | //左右整个翻页的控件
|
| | | this.pageLayout = new PageLayout();
|
| | | pageLayout.IsShowPoint = false;
|
| | | pageLayout.ScrollEnabled = false;
|
| | | bodyFrameLayout.AddChidren(pageLayout);
|
| | | pageLayout.PageChange += (sender, index) =>
|
| | | {
|
| | | //设置底部两个按钮的状态
|
| | | this.SetBottomTwoButtonStatu();
|
| | | this.PageChangeEvent?.Invoke(index);
|
| | | };
|
| | |
|
| | | //初始化第一个索引的桌布
|
| | | this.InitFrameWhiteContent1(btnHigherCollection);
|
| | | //初始化白色内容(需要自主实现)
|
| | | this.InitFrameWhiteContent();
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化第一个索引的桌布
|
| | | /// </summary>
|
| | | /// <param name="btnHigherCollection">上一级界面的收藏控件</param>
|
| | | private void InitFrameWhiteContent1(Button btnHigherCollection)
|
| | | {
|
| | | //第一个索引桌布是必定存在的
|
| | | var frameTable1 = new FrameLayout();
|
| | | frameTable1.Width = pageLayout.Width;
|
| | | frameTable1.Height = pageLayout.Height;
|
| | | pageLayout.AddChidren(frameTable1);
|
| | | //第一个索引的白色桌布
|
| | | this.FrameWhiteCentet1 = new NormalFrameLayout();
|
| | | FrameWhiteCentet1.Gravity = Gravity.CenterHorizontal;
|
| | | FrameWhiteCentet1.Y = Application.GetRealHeight(22);
|
| | | FrameWhiteCentet1.Width = Application.GetRealWidth(327);
|
| | | FrameWhiteCentet1.Height = Application.GetRealHeight(526);
|
| | | FrameWhiteCentet1.BackgroundImagePath = "Public/Fragmentbg.png";
|
| | | frameTable1.AddChidren(FrameWhiteCentet1);
|
| | | //设备名字
|
| | | this.btnDeviceName = new NormalViewControl(270, 37, true);
|
| | | btnDeviceName.X = Application.GetRealWidth(16);
|
| | | btnDeviceName.Y = Application.GetRealHeight(18);
|
| | | btnDeviceName.TextColor = CSS_Color.FirstLevelTitleColor;
|
| | | btnDeviceName.TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel;
|
| | | btnDeviceName.Text = device.name;
|
| | | btnDeviceName.Width = btnDeviceName.GetRealWidthByText();
|
| | | FrameWhiteCentet1.AddChidren(btnDeviceName);
|
| | | //房间名字
|
| | | this.btnRoomName = new NormalViewControl(270, 21, true);
|
| | | btnRoomName.X = Application.GetRealWidth(16);
|
| | | btnRoomName.Y = btnDeviceName.Bottom;
|
| | | btnRoomName.TextColor = CSS_Color.PromptingColor1;
|
| | | btnRoomName.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
|
| | | btnRoomName.Text = device.GetRoomListName();
|
| | | btnRoomName.Width = btnRoomName.GetRealWidthByText();
|
| | | FrameWhiteCentet1.AddChidren(btnRoomName);
|
| | | if (ShowColltionButton)
|
| | | {
|
| | | var btnCollection = new IconViewControl(40);
|
| | | btnCollection.X = Application.GetRealWidth(273);
|
| | | btnCollection.Y = Application.GetRealHeight(16);
|
| | | btnCollection.SelectedImagePath = "Collection/CollectionIcon.png";
|
| | | btnCollection.UnSelectedImagePath = "Collection/CollectionGrayIcon.png";
|
| | | btnCollection.IsSelected = device.collect;
|
| | | FrameWhiteCentet1.AddChidren(btnCollection);
|
| | | btnCollection.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | btnCollection.IsSelected = !btnCollection.IsSelected;
|
| | | device.collect = btnCollection.IsSelected;
|
| | | btnHigherCollection.IsSelected = device.collect;
|
| | |
|
| | | device.CollectFunction();
|
| | | };
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化第二个索引的桌布
|
| | | /// </summary>
|
| | | private void InitFrameWhiteContent2()
|
| | | {
|
| | | this.pageLayout.ScrollEnabled = true;
|
| | | //第一个索引桌布是必定存在的
|
| | | var frameTable2 = new FrameLayout();
|
| | | frameTable2.Width = pageLayout.Width;
|
| | | frameTable2.Height = pageLayout.Height;
|
| | | pageLayout.AddChidren(frameTable2);
|
| | | //第一个索引的白色桌布
|
| | | this.FrameWhiteCentet2 = new NormalFrameLayout();
|
| | | FrameWhiteCentet2.Gravity = Gravity.CenterHorizontal;
|
| | | FrameWhiteCentet2.Y = Application.GetRealHeight(22);
|
| | | FrameWhiteCentet2.Width = Application.GetRealWidth(327);
|
| | | FrameWhiteCentet2.Height = Application.GetRealHeight(526);
|
| | | FrameWhiteCentet2.BackgroundImagePath = "Public/Fragmentbg.png";
|
| | | frameTable2.AddChidren(FrameWhiteCentet2);
|
| | | } |
| | | |
| | | /// <summary>
|
| | | /// 初始化第3个索引的桌布
|
| | | /// </summary>
|
| | | private void InitFrameWhiteContent3()
|
| | | {
|
| | | var frameTable3 = new FrameLayout();
|
| | | frameTable3.Width = pageLayout.Width;
|
| | | frameTable3.Height = pageLayout.Height;
|
| | | pageLayout.AddChidren(frameTable3);
|
| | | //第一个索引的白色桌布
|
| | | this.FrameWhiteCentet3 = new NormalFrameLayout();
|
| | | FrameWhiteCentet3.Gravity = Gravity.CenterHorizontal;
|
| | | FrameWhiteCentet3.Y = Application.GetRealHeight(22);
|
| | | FrameWhiteCentet3.Width = Application.GetRealWidth(327);
|
| | | FrameWhiteCentet3.Height = Application.GetRealHeight(526);
|
| | | FrameWhiteCentet3.BackgroundImagePath = "Public/Fragmentbg.png";
|
| | | frameTable3.AddChidren(FrameWhiteCentet3);
|
| | | } |
| | | /// <summary>
|
| | | /// 初始化第4个索引的桌布
|
| | | /// </summary>
|
| | | private void InitFrameWhiteContent4()
|
| | | {
|
| | | var frameTable4 = new FrameLayout();
|
| | | frameTable4.Width = pageLayout.Width;
|
| | | frameTable4.Height = pageLayout.Height;
|
| | | pageLayout.AddChidren(frameTable4);
|
| | | //第一个索引的白色桌布
|
| | | this.FrameWhiteCentet4 = new NormalFrameLayout();
|
| | | FrameWhiteCentet4.Gravity = Gravity.CenterHorizontal;
|
| | | FrameWhiteCentet4.Y = Application.GetRealHeight(22);
|
| | | FrameWhiteCentet4.Width = Application.GetRealWidth(327);
|
| | | FrameWhiteCentet4.Height = Application.GetRealHeight(526);
|
| | | FrameWhiteCentet4.BackgroundImagePath = "Public/Fragmentbg.png";
|
| | | frameTable4.AddChidren(FrameWhiteCentet4);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化白色内容(需要自主实现)
|
| | | /// </summary>
|
| | | public virtual void InitFrameWhiteContent()
|
| | | {
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 添加第二索引页_____________________
|
| | |
|
| | | /// <summary>
|
| | | /// 添加第二索引页
|
| | | /// </summary>
|
| | | public void AddSecondPage()
|
| | | {
|
| | | //初始化第二个索引的桌布
|
| | | this.InitFrameWhiteContent2();
|
| | |
|
| | | //底部添加两个按钮
|
| | | this.btnBottomOne = new NormalViewControl(14, 6, true);
|
| | | btnBottomOne.X = Application.GetRealWidth(170);
|
| | | btnBottomOne.Y = FrameWhiteCentet1.Bottom + Application.GetRealHeight(30);
|
| | | btnBottomOne.BackgroundColor = CSS_Color.MainColor;
|
| | | btnBottomOne.Radius = (uint)Application.GetRealHeight(6) / 2;
|
| | | bodyFrameLayout.AddChidren(btnBottomOne);
|
| | |
|
| | | this.btnBottomTwo = new NormalViewControl(14, 6, true);
|
| | | btnBottomTwo.X = btnBottomOne.Right + Application.GetRealWidth(8);
|
| | | btnBottomTwo.Y = btnBottomOne.Y;
|
| | | btnBottomTwo.BackgroundColor = 0xffadc7f7;
|
| | | btnBottomTwo.Radius = (uint)Application.GetRealHeight(6) / 2;
|
| | | bodyFrameLayout.AddChidren(btnBottomTwo);
|
| | |
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 添加第3索引页
|
| | | /// </summary>
|
| | | public void Add3thPage()
|
| | | {
|
| | | this.InitFrameWhiteContent2();
|
| | | this.InitFrameWhiteContent3();
|
| | |
|
| | | //底部添加两个按钮
|
| | | this.btnBottomOne = new NormalViewControl(14, 6, true);
|
| | | btnBottomOne.X = Application.GetRealWidth(160);
|
| | | btnBottomOne.Y = FrameWhiteCentet1.Bottom + Application.GetRealHeight(30);
|
| | | btnBottomOne.BackgroundColor = CSS_Color.MainColor;
|
| | | btnBottomOne.Radius = (uint)Application.GetRealHeight(6) / 2;
|
| | | bodyFrameLayout.AddChidren(btnBottomOne);
|
| | | this.btnBottomTwo = new NormalViewControl(14, 6, true);
|
| | | btnBottomTwo.X = btnBottomOne.Right + Application.GetRealWidth(8);
|
| | | btnBottomTwo.Y = btnBottomOne.Y;
|
| | | btnBottomTwo.BackgroundColor = 0xffadc7f7;
|
| | | btnBottomTwo.Radius = (uint)Application.GetRealHeight(6) / 2;
|
| | | bodyFrameLayout.AddChidren(btnBottomTwo);
|
| | | this.btnBottom3 = new NormalViewControl(14, 6, true);
|
| | | btnBottom3.X = btnBottomTwo.Right + Application.GetRealWidth(8);
|
| | | btnBottom3.Y = btnBottomTwo.Y;
|
| | | btnBottom3.BackgroundColor = 0xffadc7f7;
|
| | | btnBottom3.Radius = (uint)Application.GetRealHeight(6) / 2;
|
| | | bodyFrameLayout.AddChidren(btnBottom3);
|
| | | }
|
| | | /// <summary>
|
| | | /// 添加第3索引页
|
| | | /// </summary>
|
| | | public void Add4Page()
|
| | | {
|
| | | this.InitFrameWhiteContent2();
|
| | | this.InitFrameWhiteContent3();
|
| | | this.InitFrameWhiteContent4();
|
| | |
|
| | | //底部添加两个按钮
|
| | | this.btnBottomOne = new NormalViewControl(14, 6, true);
|
| | | btnBottomOne.X = Application.GetRealWidth(150);
|
| | | btnBottomOne.Y = FrameWhiteCentet1.Bottom + Application.GetRealHeight(30);
|
| | | btnBottomOne.BackgroundColor = CSS_Color.MainColor;
|
| | | btnBottomOne.Radius = (uint)Application.GetRealHeight(6) / 2;
|
| | | bodyFrameLayout.AddChidren(btnBottomOne);
|
| | | this.btnBottomTwo = new NormalViewControl(14, 6, true);
|
| | | btnBottomTwo.X = btnBottomOne.Right + Application.GetRealWidth(8);
|
| | | btnBottomTwo.Y = btnBottomOne.Y;
|
| | | btnBottomTwo.BackgroundColor = 0xffadc7f7;
|
| | | btnBottomTwo.Radius = (uint)Application.GetRealHeight(6) / 2;
|
| | | bodyFrameLayout.AddChidren(btnBottomTwo);
|
| | | this.btnBottom3 = new NormalViewControl(14, 6, true);
|
| | | btnBottom3.X = btnBottomTwo.Right + Application.GetRealWidth(8);
|
| | | btnBottom3.Y = btnBottomTwo.Y;
|
| | | btnBottom3.BackgroundColor = 0xffadc7f7;
|
| | | btnBottom3.Radius = (uint)Application.GetRealHeight(6) / 2;
|
| | | bodyFrameLayout.AddChidren(btnBottom3);
|
| | | this.btnBottom4 = new NormalViewControl(14, 6, true);
|
| | | btnBottom4.X = btnBottom3.Right + Application.GetRealWidth(8);
|
| | | btnBottom4.Y = btnBottom3.Y;
|
| | | btnBottom4.BackgroundColor = 0xffadc7f7;
|
| | | btnBottom4.Radius = (uint)Application.GetRealHeight(6) / 2;
|
| | | bodyFrameLayout.AddChidren(btnBottom4);
|
| | | }
|
| | |
|
| | |
|
| | | /// <summary>
|
| | | /// 设置底部两个按钮的状态
|
| | | /// </summary>
|
| | | private void SetBottomTwoButtonStatu()
|
| | | {
|
| | | if (this.btnBottomTwo == null) { return; }
|
| | |
|
| | | if (this.pageLayout.PageIndex == 0)
|
| | | {
|
| | | this.btnBottomOne.BackgroundColor = CSS_Color.MainColor;
|
| | | this.btnBottomTwo.BackgroundColor = 0xffadc7f7;
|
| | | this.btnBottom3.BackgroundColor = 0xffadc7f7;
|
| | | this.btnBottom4.BackgroundColor = 0xffadc7f7;
|
| | | }
|
| | | else if (this.pageLayout.PageIndex == 1)
|
| | | {
|
| | | this.btnBottomOne.BackgroundColor = 0xffadc7f7;
|
| | | this.btnBottomTwo.BackgroundColor = CSS_Color.MainColor;
|
| | | this.btnBottom3.BackgroundColor = 0xffadc7f7;
|
| | | this.btnBottom4.BackgroundColor = 0xffadc7f7;
|
| | | }
|
| | | else if (this.pageLayout.PageIndex == 2)
|
| | | {
|
| | | this.btnBottomOne.BackgroundColor = 0xffadc7f7;
|
| | | this.btnBottomTwo.BackgroundColor = 0xffadc7f7;
|
| | | this.btnBottom3.BackgroundColor = CSS_Color.MainColor;
|
| | | this.btnBottom4.BackgroundColor = 0xffadc7f7;
|
| | | }
|
| | | else if (this.pageLayout.PageIndex == 3)
|
| | | {
|
| | | this.btnBottomOne.BackgroundColor = 0xffadc7f7;
|
| | | this.btnBottomTwo.BackgroundColor = 0xffadc7f7;
|
| | | this.btnBottom4.BackgroundColor = CSS_Color.MainColor;
|
| | | this.btnBottom3.BackgroundColor = 0xffadc7f7;
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 界面关闭___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 界面关闭
|
| | | /// </summary>
|
| | | public override void CloseFormBefore()
|
| | | {
|
| | | base.CloseFormBefore();
|
| | |
|
| | | this.SettionFinishEvent = null;
|
| | | this.PageChangeEvent = null;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 一般方法___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 获取头部右边的【设置】图标控件
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | public PicViewControl GetTopSettingIcon()
|
| | | {
|
| | | for (int i = 0; i < topFrameLayout.ChildrenCount; i++)
|
| | | {
|
| | | var myView = topFrameLayout.GetChildren(i);
|
| | | if (myView == null || myView.Name != "btnSetting")
|
| | | {
|
| | | continue;
|
| | | }
|
| | | return myView as PicViewControl;
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 添加头部【设置】的图标
|
| | | /// </summary>
|
| | | /// <param name="btnHigherCollection">上一级界面的收藏控件(原来on的框架太坑)</param>
|
| | | /// <param name="btnHigherDeviceName">上一级界面的设备名字控件(原来on的框架太坑)</param>
|
| | | private void AddTopSettingIcon(Button btnHigherDeviceName, Button btnHigherRoom)
|
| | | {
|
| | | //设置图标(门锁界面需要借用这个图标的X轴和Y轴,所以加进来)
|
| | | var btnSetting = new PicViewControl(28, 28);
|
| | | btnSetting.X = Application.GetRealWidth(337);
|
| | | btnSetting.Y = Application.GetRealHeight(9);
|
| | | btnSetting.UnSelectedImagePath = "Public/FuncInfoSetIcon.png";
|
| | | btnSetting.Name = "btnSetting";
|
| | | topFrameLayout.AddChidren(btnSetting);
|
| | |
|
| | | //如果是成员没有功能
|
| | | if (DB_ResidenceData.Instance.CurrentRegion.isOtherShare == true)
|
| | | {
|
| | | btnSetting.Visible = false;
|
| | | }
|
| | |
|
| | | btnSetting.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | var infoView = new UI.FunctionBaseInfoSetPage(this.device, () =>
|
| | | {
|
| | | //刷新显示
|
| | | btnHigherDeviceName.Text = this.device.name;
|
| | | btnHigherRoom.Text = this.device.GetRoomListName();
|
| | |
|
| | | //从新计算宽度
|
| | | this.btnDeviceName.Text = btnHigherDeviceName.Text;
|
| | | this.btnDeviceName.Width = this.btnDeviceName.GetRealWidthByText();
|
| | |
|
| | | this.btnRoomName.Text = btnHigherRoom.Text;
|
| | | this.btnRoomName.Width = this.btnRoomName.GetRealWidthByText();
|
| | |
|
| | | //回调事件
|
| | | this.SettionFinishEvent?.Invoke();
|
| | | });
|
| | | MainPage.BasePageView.AddChidren(infoView);
|
| | | infoView.LoadPage();
|
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
|
| | | };
|
| | | }
|
| | |
|
| | | #endregion
|
| | | }
|
| | | }
|
| | |
| | | |
| | | btnisitorVManagementText.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | |
| | | |
| | | #if __IOS__ |
| | | //刷新接口请求所需要的参数 |
| | | Foundation.NSDictionary info = new Foundation.NSDictionary("regionUrl", HttpUtil.GlobalRequestHttpsHost, "token", UserInfo.Current.LoginTokenString, "appkey", "HDL-HOME-APP-TEST", "secret", "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss", "refreshToken", UserInfo.Current.RefreshToken); |
| | | Shared.IOS.HDLFVSDK.Video.RefreshInfo(info); |
| | | //跳转访客管理界面 |
| | | Shared.IOS.HDLFVSDK.Video.ShowVisitorManager(); |
| | | #else |
| | | var page = new VisitorQRCodePage(); |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | |
| | | #if __IOS__ |
| | | //刷新接口请求所需要的参数 |
| | | NSDictionary info = new NSDictionary("regionUrl", HttpUtil.GlobalRequestHttpsHost, "token", UserInfo.Current.LoginTokenString, "appkey", "HDL-HOME-APP-TEST", "secret", "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss", "refreshToken", UserInfo.Current.RefreshToken); |
| | | Shared.IOS.HDLFVSDK.Video.RefreshInfo(info); |
| | | //跳转访客管理界面 |
| | | Shared.IOS.HDLFVSDK.Video.ShowVisitorManager(); |
| | | #endif |
| | | }; |
| | | } |
| | |
| | | using System; |
| | | #if __Android__ |
| | | using System; |
| | | using Com.Hdl.Hdllinphonesdk.Dialog; |
| | | using Java.Interop; |
| | | |
| | |
| | | action.Invoke(time); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | #else |
| | | |
| | | namespace HDL_ON.UI.UI2.PersonalCenter.Visitor |
| | | { |
| | | public class LpTimeDialogCallBak |
| | | { |
| | | } |
| | | } |
| | | #endif |
| | |
| | | using System; |
| | | |
| | | #if __Android__ |
| | | using System; |
| | | using Com.Hdl.Hdllinphonesdk.Dialog; |
| | | namespace HDL_ON.UI.UI2.PersonalCenter.Visitor |
| | | { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | #else |
| | | namespace HDL_ON.UI.UI2.PersonalCenter.Visitor |
| | | { |
| | | public class LpTipDialogCallBack |
| | | { |
| | | } |
| | | } |
| | | #endif |
| | |
| | | itemLayout.AddChidren(btn);//+= (sender, e) |
| | | btn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | #if __IOS__ |
| | | #else |
| | | VisitorQRCodePage page = new VisitorQRCodePage(action, temPwd); |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | #endif |
| | | }; |
| | | bodyScrolView.AddChidren(itemLayout); |
| | | } |
| | |
| | | using System; |
| | | #if __Android__ |
| | | |
| | | using System; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | | using HDL_ON.DAL.Server; |
| | |
| | | |
| | | public void LoadPage() |
| | | { |
| | | #region 顶部导航栏 |
| | | #region 顶部导航栏 |
| | | if (tempPassword == null || tempPassword.id == null) |
| | | { |
| | | tempPassword = new VisitorTempPassword(); |
| | |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.VisitorInvitation)).LoadTopView(); |
| | | } |
| | | #endregion |
| | | #endregion |
| | | |
| | | bodyScrolView = new VerticalScrolViewLayout() |
| | | { |
| | |
| | | Height = Application.GetRealHeight(60), |
| | | }); |
| | | |
| | | #region 手机号 |
| | | #region 手机号 |
| | | bodyScrolView.AddChidren(new Button() |
| | | { |
| | | Text = Language.StringByID(StringId.PhoneNumber), |
| | |
| | | Height = Application.GetRealHeight(1), |
| | | BackgroundColor = CSS_Color.DividingLineColor, |
| | | }); |
| | | #endregion |
| | | #endregion |
| | | |
| | | #region 动态密码 |
| | | #region 动态密码 |
| | | bodyScrolView.AddChidren(new Button() { Height = Application.GetRealWidth(10), }); |
| | | bodyScrolView.AddChidren(new Button() |
| | | { |
| | |
| | | Height = Application.GetRealHeight(1), |
| | | BackgroundColor = CSS_Color.DividingLineColor, |
| | | }); |
| | | #endregion |
| | | #endregion |
| | | |
| | | #region 二维码生效时间 |
| | | #region 二维码生效时间 |
| | | FrameLayout startLayout = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(40), |
| | |
| | | BackgroundColor = CSS_Color.DividingLineColor, |
| | | }); |
| | | |
| | | #endregion |
| | | #endregion |
| | | |
| | | #region 二维码失效时间 |
| | | #region 二维码失效时间 |
| | | FrameLayout endLayout = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(40), |
| | |
| | | string error = ex.Message; |
| | | } |
| | | }; |
| | | #endregion |
| | | #endregion |
| | | |
| | | #region 二维码 |
| | | #region 二维码 |
| | | bodyScrolView.AddChidren(new Button() { Height = Application.GetRealWidth(33), }); |
| | | codeLayout = new FrameLayout() |
| | | { |
| | |
| | | Visible = false, |
| | | }; |
| | | bodyScrolView.AddChidren(codeSaveTipBtn); |
| | | #endregion |
| | | #endregion |
| | | |
| | | bodyScrolView.AddChidren(new Button() { Height = Application.GetRealWidth(28), }); |
| | | visitorVoucherBtn = new Button() |
| | |
| | | return pwd; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | #else |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.UI.UI2.PersonalCenter.Visitor |
| | | { |
| | | public class VisitorQRCodePage : FrameLayout |
| | | { } |
| | | } |
| | | #endif |
| | |
| | | //刷新界面状态 |
| | | this.RefreshFormStatu(); |
| | | //读取状态 |
| | | new System.Threading.Thread(() => |
| | | { |
| | | while (true) |
| | | { |
| | | if(controlTime == DateTime.MinValue) |
| | | { |
| | | |
| | | } |
| | | else if (controlTime.AddSeconds(2)<DateTime.Now) |
| | | { |
| | | Control.Ins.SendReadCommand(device); |
| | | controlTime = DateTime.MinValue; |
| | | } |
| | | System.Threading.Thread.Sleep(1000); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | //new System.Threading.Thread(() => |
| | | //{ |
| | | // while (true) |
| | | // { |
| | | // if(controlTime == DateTime.MinValue) |
| | | // { |
| | | |
| | | // } |
| | | // else if (controlTime.AddSeconds(2)<DateTime.Now) |
| | | // { |
| | | // Control.Ins.SendReadCommand(device); |
| | | // controlTime = DateTime.MinValue; |
| | | // } |
| | | // System.Threading.Thread.Sleep(1000); |
| | | // } |
| | | //}) |
| | | //{ IsBackground = true }.Start(); |
| | | } |
| | | |
| | | /// <summary> |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.DAL.Server; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | | public class CacDayHistoryPage : FrameLayout |
| | | { |
| | | CacDayHistoryPage bodyView; |
| | | EchartsOption_BrokenLine brokenLine; |
| | | MyEchartsViewOn myEchartsView_Line; |
| | | string curQueryType = "hour"; |
| | | string queryTime; |
| | | string functionId; |
| | | string time; |
| | | public CacDayHistoryPage(string functionId,string queryType, string time) |
| | | { |
| | | this.time = time; |
| | | this.functionId = functionId; |
| | | curQueryType = queryType; |
| | | bodyView = this; |
| | | queryTime = time; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public void InitView() |
| | | { |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.StatisticalChart24Hour)).LoadTopView(); |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | | |
| | | var contentView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | Height = Application.GetRealHeight(603), |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | | |
| | | var btnTitle = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(60), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | }; |
| | | if(curQueryType == "room_temp") |
| | | { |
| | | btnTitle.Text = queryTime + "室内温度历史数据"; |
| | | } |
| | | else |
| | | { |
| | | btnTitle.Text = queryTime + "室内湿度历史数据"; |
| | | } |
| | | contentView.AddChidren(btnTitle); |
| | | |
| | | |
| | | var historyDataView = new FrameLayout() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealWidth(52), |
| | | Height = Application.GetRealWidth(350), |
| | | }; |
| | | contentView.AddChidren(historyDataView); |
| | | |
| | | |
| | | brokenLine = new EchartsOption_BrokenLine(); |
| | | |
| | | myEchartsView_Line = new MyEchartsViewOn() |
| | | { |
| | | Y = Application.GetRealWidth(10), |
| | | Height = Application.GetRealWidth(338), |
| | | }; |
| | | historyDataView.AddChidren(myEchartsView_Line); |
| | | |
| | | |
| | | #if DEBUG |
| | | |
| | | //List<string> vs = new List<string>() { |
| | | // "1","2","3","4","5","6","7","8","9","10","11","12","13","14" |
| | | // }; |
| | | //brokenLine.InitXdataText(vs); |
| | | //brokenLine.InitYdataText("yData", new List<EnvironmentalSensorHistor>() { |
| | | // new EnvironmentalSensorHistor{ fieldName = "1", fieldValue= "23" }, |
| | | // new EnvironmentalSensorHistor{ fieldName = "2", fieldValue= "22" }, |
| | | // new EnvironmentalSensorHistor{ fieldName = "3", fieldValue= "-11" }, |
| | | // new EnvironmentalSensorHistor{ fieldName = "4", fieldValue= "21" }, |
| | | // new EnvironmentalSensorHistor{ fieldName = "5", fieldValue= "-41" }, |
| | | // new EnvironmentalSensorHistor{ fieldName = "6", fieldValue= "23" }, |
| | | // new EnvironmentalSensorHistor{ fieldName = "7", fieldValue= "-31" }, |
| | | // new EnvironmentalSensorHistor{ fieldName = "8", fieldValue= "-23" }, |
| | | // new EnvironmentalSensorHistor{ fieldName = "9", fieldValue= "-11" }, |
| | | // new EnvironmentalSensorHistor{ fieldName = "10", fieldValue= "-21" }, |
| | | // new EnvironmentalSensorHistor{ fieldName = "11", fieldValue= "24" }, |
| | | // new EnvironmentalSensorHistor{ fieldName = "12", fieldValue= "41" }, |
| | | // new EnvironmentalSensorHistor{ fieldName = "13", fieldValue= "32" }, |
| | | // new EnvironmentalSensorHistor{ fieldName = "14", fieldValue= "23" } |
| | | //}, "#FF9D54"); |
| | | //brokenLine.yTitle = "(℃)"; |
| | | //brokenLine.xTitle = ""; |
| | | ////if (curQueryType != "hour") |
| | | ////{ |
| | | //// brokenLine.xTitle = Language.StringByID(StringId.Date); |
| | | ////} |
| | | //var opString = brokenLine.InitOption(); |
| | | |
| | | // myEchartsView_Line.ShowWithOption(opString); |
| | | |
| | | #endif |
| | | LoadMothed_GetHistoryData(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 读取历史数据 |
| | | /// </summary> |
| | | void LoadMothed_GetHistoryData() |
| | | { |
| | | |
| | | var loadPage = new Loading() |
| | | { |
| | | LodingBackgroundColor = 0x88888888, |
| | | }; |
| | | bodyView.AddChidren(loadPage); |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | loadPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | }); |
| | | |
| | | var revertObj = new HttpServerRequest().GetSensorHistory("day_hour", functionId, curQueryType,time); |
| | | if (revertObj != null) |
| | | { |
| | | if (revertObj.Code == StateCode.SUCCESS) |
| | | { |
| | | var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<EnvironmentalSensorHistor>>(revertObj.Data.ToString()); |
| | | |
| | | List<string> vs = new List<string>(); |
| | | if (brokenLine.YvalueText == "") |
| | | { |
| | | foreach (var data in revertData) |
| | | { |
| | | vs.Add(data.fieldName); |
| | | } |
| | | brokenLine.InitXdataText(vs); |
| | | } |
| | | //if (sr.GetAttribute("ydata") == null) |
| | | //{ |
| | | // sr.attributes.Add(new FunctionAttributes() { key = "ydata" }); |
| | | //} |
| | | //sr.SetAttrState("ydata", |
| | | brokenLine.InitYdataText("", revertData, "#FF9D54");// + ","); |
| | | } |
| | | } |
| | | brokenLine.yTitle = Language.StringByID(StringId.Uint); |
| | | if(curQueryType == "room_temp") |
| | | { |
| | | brokenLine.yTitle += ":°C"; |
| | | } |
| | | else |
| | | { |
| | | brokenLine.yTitle += ":%"; |
| | | } |
| | | brokenLine.xTitle = Language.StringByID(StringId.timeMode); |
| | | //if (curQueryType != "hour") |
| | | //{ |
| | | // brokenLine.xTitle = Language.StringByID(StringId.Date); |
| | | //} |
| | | var opString = brokenLine.InitOption(); |
| | | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | myEchartsView_Line.ShowWithOption(opString); |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"sensor history error : {ex.Message}"); |
| | | } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | loadPage.Hide(); |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | | namespace HDL_ON.UI |
| | | { |
| | | /// <summary> |
| | | /// 温控器历史数据显示选择界面 |
| | | /// </summary> |
| | | public class CacHistoryChoosePage : FrameLayout |
| | | { |
| | | FrameLayout bodyView; |
| | | Function device; |
| | | public CacHistoryChoosePage(Function function) |
| | | { |
| | | device = function; |
| | | bodyView = this; |
| | | } |
| | | |
| | | public void InitView() |
| | | { |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.Data)).LoadTopView(); |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | | |
| | | FrameLayout tempView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | Height = Application.GetRealHeight(50), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | bodyView.AddChidren(tempView); |
| | | |
| | | Button btnTempRight = new Button() |
| | | { |
| | | X = Application.GetRealWidth(339), |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetMinRealAverage(16), |
| | | Height = Application.GetMinRealAverage(16), |
| | | UnSelectedImagePath = "Public/Right.png", |
| | | }; |
| | | tempView.AddChidren(btnTempRight); |
| | | |
| | | Button btnTempLine = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(49), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(1), |
| | | BackgroundColor = CSS_Color.DividingLineColor |
| | | }; |
| | | tempView.AddChidren(btnTempLine); |
| | | |
| | | Button btnTempName = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = StringId.TemperatureStatistics |
| | | }; |
| | | tempView.AddChidren(btnTempName); |
| | | btnTempName.MouseUpEventHandler = (sender, e) => { |
| | | var page = new CacWeekHistoryPage(device, "room_temp"); |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.InitView(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | |
| | | |
| | | |
| | | FrameLayout humidityView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(64 + 50), |
| | | Height = Application.GetRealHeight(50), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | bodyView.AddChidren(humidityView); |
| | | |
| | | Button btnHumidityRight = new Button() |
| | | { |
| | | X = Application.GetRealWidth(339), |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetMinRealAverage(16), |
| | | Height = Application.GetMinRealAverage(16), |
| | | UnSelectedImagePath = "Public/Right.png", |
| | | }; |
| | | humidityView.AddChidren(btnHumidityRight); |
| | | |
| | | Button btnHumidityName = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = StringId.HumidityStatistics |
| | | }; |
| | | humidityView.AddChidren(btnHumidityName); |
| | | btnHumidityName.MouseUpEventHandler = (sender, e) => { |
| | | var page = new CacWeekHistoryPage(device, "room_humidity"); |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.InitView(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.DAL.Server; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.Stan; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | | public class CacWeekHistoryPage : FrameLayout |
| | | { |
| | | |
| | | CacWeekHistoryPage bodyView; |
| | | HorizontalScrolViewLayout dateHorView; |
| | | Function device; |
| | | /// <summary> |
| | | /// 数据显示类型 |
| | | /// room_temp 温度 |
| | | /// room_humidity 湿度 |
| | | /// </summary> |
| | | string showType; |
| | | Dictionary<string, double> dataDic = new Dictionary<string, double>(); |
| | | public CacWeekHistoryPage(Function device,string type) |
| | | { |
| | | bodyView = this; |
| | | this.device = device; |
| | | showType = type; |
| | | BackgroundColor = CSS_Color.BackgroundColor; |
| | | } |
| | | |
| | | public void InitView() |
| | | { |
| | | if (showType == "room_temp") |
| | | { |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.Temp)).LoadTopView(); |
| | | } |
| | | else |
| | | { |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.Humidity)).LoadTopView(); |
| | | } |
| | | |
| | | |
| | | |
| | | InitContentView(); |
| | | } |
| | | |
| | | |
| | | private void InitContentView() |
| | | { |
| | | FrameLayout contentView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(80), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(482), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Radius = (uint)Application.GetRealWidth(5) |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | | |
| | | Button btnTitle = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(60), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextAlignment = TextAlignment.Center, |
| | | }; |
| | | if (showType == "room_temp") |
| | | { |
| | | btnTitle.Text = "最近7天每天平均室内温度统计图"; |
| | | } |
| | | else |
| | | { |
| | | btnTitle.Text = "最近7天每天平均室内湿度统计图"; |
| | | } |
| | | contentView.AddChidren(btnTitle); |
| | | |
| | | FrameLayout dataView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(39), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(293), |
| | | Height = Application.GetRealHeight(345 + 30), |
| | | }; |
| | | contentView.AddChidren(dataView); |
| | | |
| | | Button btnUnit = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(15 + 30), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = 0xFF43425D, |
| | | TextSize = 8, |
| | | }; |
| | | if (showType == "room_temp") |
| | | { |
| | | btnUnit.Text = Language.StringByID(StringId.Uint) + ":℃"; |
| | | } |
| | | else |
| | | { |
| | | btnUnit.Text = Language.StringByID(StringId.Uint) + "%"; |
| | | } |
| | | dataView.AddChidren(btnUnit); |
| | | |
| | | #if DEBUG |
| | | //dataDic.Add("0201", 49); |
| | | //dataDic.Add("0202", 20); |
| | | //dataDic.Add("0203", 10); |
| | | //dataDic.Add("0204", 49); |
| | | //dataDic.Add("0205", 20); |
| | | //dataDic.Add("0206", 20); |
| | | //dataDic.Add("0207", 48); |
| | | |
| | | //dataDic.Add("0201", -20); |
| | | //dataDic.Add("0202", -20); |
| | | //dataDic.Add("0203", -20); |
| | | //dataDic.Add("0204", -48); |
| | | //dataDic.Add("0205", -20); |
| | | //dataDic.Add("0206", -20); |
| | | //dataDic.Add("0207", -20); |
| | | #endif |
| | | |
| | | DataItemView dataShowView = new DataItemView("0",360); |
| | | //dataShowView.Height = Application.GetRealHeight(360); |
| | | dataShowView.Y = Application.GetRealHeight(30); |
| | | |
| | | List<string> items = new List<string>() |
| | | { |
| | | "100","90","80","70","60","50","40","30","20","10","0" |
| | | }; |
| | | if (showType == "room_temp") |
| | | { |
| | | items = new List<string>() |
| | | { |
| | | "50","40","30","20","10","0","-10","-20","-30","-40","-50" |
| | | }; |
| | | } |
| | | int index = 0; |
| | | foreach (var item in items) |
| | | { |
| | | DataItemView dataItemView; |
| | | if (item == "0" ) |
| | | { |
| | | dataItemView = dataShowView; |
| | | index++; |
| | | } |
| | | else |
| | | { |
| | | dataItemView = new DataItemView(item,30); |
| | | dataItemView.Y = ++index * Application.GetRealHeight(30) + Application.GetRealHeight(15); |
| | | } |
| | | dataItemView.InitView(showType == "room_temp"); |
| | | dataView.AddChidren(dataItemView); |
| | | } |
| | | dateHorView = new HorizontalScrolViewLayout() |
| | | { |
| | | X = Application.GetRealWidth(48), |
| | | Y = dataView.Bottom,// - Application.GetRealHeight(19), |
| | | Width = Application.GetRealWidth(267), |
| | | Height = Application.GetRealHeight(26), |
| | | }; |
| | | contentView.AddChidren(dateHorView); |
| | | |
| | | Button btnTip = new Button() |
| | | { |
| | | Y = contentView.Bottom + Application.GetRealHeight(28), |
| | | Height = Application.GetRealHeight(20), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, |
| | | TextAlignment = TextAlignment.Center, |
| | | Text = "*可通过点击柱形图查看当天24小时温度统计" |
| | | }; |
| | | bodyView.AddChidren(btnTip); |
| | | |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | |
| | | var revertObj = new HttpServerRequest().GetSensorHistory("week", device.deviceId, showType); |
| | | if (revertObj.Code == StateCode.SUCCESS) |
| | | { |
| | | var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<EnvironmentalSensorHistor>>(revertObj.Data.ToString()); |
| | | foreach (var reObj in revertData) |
| | | { |
| | | double value = 0; |
| | | try |
| | | { |
| | | value = Convert.ToDouble(reObj.fieldValue); |
| | | } |
| | | catch { } |
| | | dataDic.Add(reObj.time, value); |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | RefrshDataView(dataDic, dataShowView); |
| | | RefreshXtext(); |
| | | }); |
| | | |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | void RefreshXtext() |
| | | { |
| | | dateHorView.RemoveAll(); |
| | | |
| | | foreach (var dic in dataDic) |
| | | { |
| | | FrameLayout dateView = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(39), |
| | | Height = Application.GetRealHeight(26), |
| | | }; |
| | | dateHorView.AddChidren(dateView); |
| | | |
| | | Button btnLineh = new Button() |
| | | { |
| | | Width = 1, |
| | | Height = Application.GetRealHeight(4), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | BackgroundColor = 0xFFDBDBDB |
| | | }; |
| | | dateView.AddChidren(btnLineh); |
| | | |
| | | Button btnDate = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(12), |
| | | Height = Application.GetRealHeight(14), |
| | | TextColor = 0xFF43425D, |
| | | TextSize = 10, |
| | | Text = dic.Key, |
| | | }; |
| | | try |
| | | { |
| | | string[] strs = dic.Key.Split(@"/"); |
| | | btnDate.Text = strs[1] + "/" + strs[2]; |
| | | } |
| | | catch { } |
| | | dateView.AddChidren(btnDate); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | void RefrshDataView(Dictionary<string,double> dataDic, FrameLayout dataShowView) |
| | | { |
| | | int valueIndex = 0; |
| | | foreach (var data in dataDic) |
| | | { |
| | | ColumnarView cv = new ColumnarView(device.deviceId,showType, data.Key, data.Value); |
| | | cv.X = Application.GetRealWidth(valueIndex * 38 + 25); |
| | | cv.InitView(); |
| | | dataShowView.AddChidren(cv); |
| | | cv.Clicker(); |
| | | |
| | | |
| | | valueIndex++; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | class DataItemView : FrameLayout |
| | | { |
| | | string value; |
| | | Button btnLine; |
| | | int height; |
| | | public DataItemView(string value,int height) |
| | | { |
| | | this.value = value; |
| | | Width = Application.GetRealWidth(293); |
| | | this.height = height; |
| | | Height = Application.GetRealHeight(height); |
| | | } |
| | | |
| | | public void InitView(bool isTemp) { |
| | | |
| | | Button btnValue = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(18), |
| | | Height = Application.GetRealHeight(30), |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextColor = 0xFF43425D, |
| | | TextSize = 8, |
| | | Text = value |
| | | }; |
| | | AddChidren(btnValue); |
| | | |
| | | btnLine = new Button() |
| | | { |
| | | X = Application.GetRealWidth(26), |
| | | Width = Application.GetRealWidth(267), |
| | | Height = 1, |
| | | BackgroundColor = CSS_Color.DividingLineColor, |
| | | }; |
| | | if (isTemp) |
| | | { |
| | | btnLine.Gravity = Gravity.CenterVertical; |
| | | btnValue.Gravity = Gravity.CenterVertical; |
| | | } |
| | | else |
| | | { |
| | | if (height == 360) |
| | | { |
| | | btnValue.Y = Application.GetRealHeight(height - 45); |
| | | } |
| | | else |
| | | { |
| | | btnLine.Gravity = Gravity.CenterVertical; |
| | | } |
| | | btnLine.Y = Application.GetRealHeight(height - 30); |
| | | } |
| | | AddChidren(btnLine); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | class ColumnarView : VerticalScrolViewLayout |
| | | { |
| | | string functionId; |
| | | string time; |
| | | string type; |
| | | double value; |
| | | string valueText; |
| | | /// <summary> |
| | | /// 方向:向上、向下 |
| | | /// </summary> |
| | | bool isUpward; |
| | | Button btnValue; |
| | | Button btnValueText; |
| | | |
| | | |
| | | public ColumnarView(string functionId,string type, string key, double value) |
| | | { |
| | | this.functionId = functionId; |
| | | this.type = type; |
| | | time = key; |
| | | this.isUpward = value >= 0; |
| | | valueText = value.ToString(); |
| | | if (isUpward) |
| | | { |
| | | this.value = value; |
| | | } |
| | | else |
| | | { |
| | | this.value = value * -1; |
| | | } |
| | | Width = Application.GetRealWidth(39); |
| | | Height = Application.GetRealHeight((int)(value * 3 + 30)); |
| | | } |
| | | |
| | | public void InitView() |
| | | { |
| | | int yValue = 0; |
| | | btnValue = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Height = Application.GetRealHeight((int)(value * 3)), |
| | | Width = Application.GetRealWidth(16), |
| | | BackgroundColor = 0xFFFF9D54, |
| | | }; |
| | | |
| | | btnValueText = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(30), |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | TextColor = 0xFF43425D, |
| | | Text = valueText, |
| | | }; |
| | | if(type == "room_temp") |
| | | { |
| | | btnValueText.Text += "℃"; |
| | | if (isUpward) |
| | | { |
| | | yValue = (int)(150 - value * 3); |
| | | yValue = yValue > 0 ? yValue : 0; |
| | | Y = Application.GetRealHeight(yValue+1); |
| | | AddChidren(btnValueText); |
| | | AddChidren(btnValue); |
| | | } |
| | | else |
| | | { |
| | | Y = Application.GetRealHeight(180); |
| | | AddChidren(btnValue); |
| | | AddChidren(btnValueText); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | yValue = (int)(360 -30- 30 - value * 3); |
| | | Y = Application.GetRealHeight(yValue+1); |
| | | AddChidren(btnValueText); |
| | | AddChidren(btnValue); |
| | | btnValueText.Text += "%"; |
| | | } |
| | | } |
| | | |
| | | public void Clicker() |
| | | { |
| | | btnValue.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | var page = new CacDayHistoryPage(functionId,type, time); |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.InitView(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | btnValueText.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | var page = new CacDayHistoryPage(functionId,type, time); |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.InitView(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.DriverLayer; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.Stan; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.UI.UI2.FuntionControlView.Panel |
| | | { |
| | | public class AcContentView : FrameLayout |
| | | { |
| | | |
| | | #region ■ 变量声明___________________________ |
| | | /// <summary> |
| | | /// 空调温度控制控件 |
| | | /// </summary> |
| | | DiyArcSeekBar arcBar; |
| | | /// <summary> |
| | | /// 减号按钮 |
| | | /// </summary> |
| | | Button btnMinus; |
| | | /// <summary> |
| | | /// 加号按钮 |
| | | /// </summary> |
| | | Button btnPlus; |
| | | /// <summary> |
| | | /// 温度按钮 |
| | | /// </summary> |
| | | Button btnTemp; |
| | | Button btnTempUint; |
| | | /// <summary> |
| | | /// 室内温度按钮 |
| | | /// </summary> |
| | | Button btnIndoorTemp; |
| | | /// <summary> |
| | | /// 模式按钮 |
| | | /// </summary> |
| | | Button btnMode; |
| | | /// <summary> |
| | | /// 扫风按钮 |
| | | /// </summary> |
| | | Button btnSwing; |
| | | /// <summary> |
| | | /// 风速按钮 |
| | | /// </summary> |
| | | Button btnWindSpeed; |
| | | /// <summary> |
| | | /// 开关按钮 |
| | | /// </summary> |
| | | Button btnSwitch; |
| | | |
| | | AC acFunction = new AC(); |
| | | |
| | | /// <summary> |
| | | /// 控制时间 |
| | | /// </summary> |
| | | DateTime controlTime = DateTime.MinValue.AddDays(10); |
| | | /// <summary> |
| | | /// 控制温度 |
| | | /// </summary> |
| | | int temp = 16; |
| | | |
| | | #endregion |
| | | Function device; |
| | | public AcContentView(Function function) |
| | | { |
| | | device = function; |
| | | |
| | | var sk = device.GetAttribute(FunctionAttributeKey.SetTemp); |
| | | if (sk != null) |
| | | { |
| | | if (sk.min == 0) |
| | | { |
| | | sk.min = 16; |
| | | } |
| | | if (sk.max == 0) |
| | | { |
| | | sk.max = 32; |
| | | } |
| | | } |
| | | |
| | | } |
| | | #region ■ 初始化_____________________________ |
| | | |
| | | /// <summary> |
| | | /// 初始化白色区域的内容 |
| | | /// </summary> |
| | | public void InitContent(bool initStandard = true) |
| | | { |
| | | if (initStandard) |
| | | { |
| | | //设备名字 |
| | | var btnDeviceName = new NormalViewControl(270, 37, true); |
| | | btnDeviceName.X = Application.GetRealWidth(16); |
| | | btnDeviceName.Y = Application.GetRealHeight(18); |
| | | btnDeviceName.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | btnDeviceName.TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel; |
| | | btnDeviceName.Text = device.name; |
| | | btnDeviceName.Width = btnDeviceName.GetRealWidthByText(); |
| | | AddChidren(btnDeviceName); |
| | | //房间名字 |
| | | var btnRoomName = new NormalViewControl(270, 21, true); |
| | | btnRoomName.X = Application.GetRealWidth(16); |
| | | btnRoomName.Y = btnDeviceName.Bottom; |
| | | btnRoomName.TextColor = CSS_Color.PromptingColor1; |
| | | btnRoomName.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; |
| | | btnRoomName.Text = device.GetRoomListName(); |
| | | btnRoomName.Width = btnRoomName.GetRealWidthByText(); |
| | | AddChidren(btnRoomName); |
| | | |
| | | } |
| | | |
| | | //初始化第一个索引页的内容 |
| | | this.InitFrameWhiteContent(); |
| | | |
| | | //刷新界面状态 |
| | | this.RefreshFormStatu(); |
| | | //读取状态 |
| | | new System.Threading.Thread(() => |
| | | { |
| | | while (true) |
| | | { |
| | | if (controlTime == DateTime.MinValue) |
| | | { |
| | | |
| | | } |
| | | else if (controlTime.AddSeconds(2) < DateTime.Now) |
| | | { |
| | | Control.Ins.SendReadCommand(device); |
| | | controlTime = DateTime.MinValue; |
| | | } |
| | | System.Threading.Thread.Sleep(1000); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化第一个索引页的内容 |
| | | /// </summary> |
| | | private void InitFrameWhiteContent() |
| | | { |
| | | temp = (int)Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp).Replace(",", ".")); |
| | | arcBar = new DiyArcSeekBar() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | OpenAngle = 160, |
| | | ThumbImageHeight = Application.GetRealWidth(50), |
| | | ProgressBarColor = CSS_Color.MainColor, |
| | | OfflineProgressBarColor = CSS_Color.PromptingColor2, |
| | | ArcColor = CSS_Color.BackgroundColor, |
| | | #if __IOS__ |
| | | Y = Application.GetRealHeight(120 + 25), |
| | | Width = Application.GetRealWidth(260 - 40), |
| | | Height = Application.GetRealWidth(260 - 40), |
| | | SeekBarPadding = Application.GetRealWidth(8), |
| | | #else |
| | | Y = Application.GetRealHeight(120 + 40), |
| | | Width = Application.GetRealWidth(260 - 40), |
| | | Height = Application.GetRealWidth(260 - 40), |
| | | SeekBarPadding = Application.GetRealWidth(7), |
| | | #endif |
| | | |
| | | }; |
| | | this.AddChidren(arcBar); |
| | | |
| | | |
| | | arcBar.ThumbImagePath = device.GetAttrState(FunctionAttributeKey.OnOff) == "on" ? "FunctionIcon/AC/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png"; |
| | | arcBar.IsOffline = device.GetAttrState(FunctionAttributeKey.OnOff) == "off"; |
| | | arcBar.MinValue = device.GetAttribute(FunctionAttributeKey.SetTemp).min; |
| | | arcBar.MaxValue = device.GetAttribute(FunctionAttributeKey.SetTemp).max; |
| | | arcBar.Progress = (int)Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp).Replace(",", ".")); |
| | | |
| | | btnTemp = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(206), |
| | | Width = Application.GetRealWidth(71), |
| | | Height = Application.GetRealWidth(60), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = 50, |
| | | IsBold = true, |
| | | Text = Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp).Replace(",", ".")).ToString(), |
| | | TextAlignment = TextAlignment.Center, |
| | | }; |
| | | this.AddChidren(btnTemp); |
| | | |
| | | btnTempUint = new Button() |
| | | { |
| | | X = btnTemp.Right, |
| | | Y = btnTemp.Y, |
| | | Width = Application.GetRealWidth(30), |
| | | Height = Application.GetRealHeight(30), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.EmphasisFontSize_Secondary, |
| | | IsBold = true, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = "°C", |
| | | }; |
| | | this.AddChidren(btnTempUint); |
| | | |
| | | btnIndoorTemp = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = btnTemp.Bottom, |
| | | Width = Application.GetRealWidth(120), |
| | | Height = Application.GetRealHeight(20), |
| | | Text = Language.StringByID(StringId.IndoorTemp) + "20°C", |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | }; |
| | | this.AddChidren(btnIndoorTemp); |
| | | |
| | | btnMinus = new Button() |
| | | { |
| | | X = Application.GetRealWidth(21), |
| | | Y = Application.GetRealHeight(263), |
| | | Width = Application.GetRealWidth(32), |
| | | Height = Application.GetRealWidth(32), |
| | | UnSelectedImagePath = "Public/MinusSignIcon.png", |
| | | }; |
| | | this.AddChidren(btnMinus); |
| | | |
| | | btnPlus = new Button() |
| | | { |
| | | X = Application.GetRealWidth(275), |
| | | Y = Application.GetRealHeight(263), |
| | | Width = Application.GetRealWidth(32), |
| | | Height = Application.GetRealWidth(32), |
| | | UnSelectedImagePath = "Public/PlusSignIcon.png", |
| | | }; |
| | | this.AddChidren(btnPlus); |
| | | |
| | | btnMode = new Button() |
| | | { |
| | | X = Application.GetRealWidth(60), |
| | | Y = Application.GetRealHeight(334), |
| | | Width = Application.GetRealWidth(30), |
| | | Height = Application.GetRealWidth(30), |
| | | UnSelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode)), |
| | | }; |
| | | this.AddChidren(btnMode); |
| | | |
| | | |
| | | btnSwing = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(330), |
| | | Width = Application.GetRealWidth(40), |
| | | Height = Application.GetRealWidth(40), |
| | | UnSelectedImagePath = "FunctionIcon/AC/SweepIconNullOn.png", |
| | | }; |
| | | if (device.GetAttribute(FunctionAttributeKey.Swing) != null) |
| | | { |
| | | this.AddChidren(btnSwing); |
| | | } |
| | | |
| | | |
| | | btnWindSpeed = new Button() |
| | | { |
| | | X = Application.GetRealWidth(235), |
| | | Y = Application.GetRealHeight(337), |
| | | Width = Application.GetRealWidth(30), |
| | | Height = Application.GetRealWidth(30), |
| | | UnSelectedImagePath = acFunction.GetFanIconPath(device.GetAttrState(FunctionAttributeKey.FanSpeed)), |
| | | }; |
| | | this.AddChidren(btnWindSpeed); |
| | | |
| | | btnSwitch = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(466), |
| | | Width = Application.GetRealWidth(32), |
| | | Height = Application.GetRealWidth(32), |
| | | UnSelectedImagePath = "Public/PowerClose.png", |
| | | SelectedImagePath = "Public/PowerOpen.png", |
| | | IsSelected = device.GetAttrState(FunctionAttributeKey.OnOff) == "on" |
| | | }; |
| | | this.AddChidren(btnSwitch); |
| | | |
| | | LoadEvent_TempChange(); |
| | | LoadEvent_AcStatesChange(); |
| | | |
| | | LoadDiv_IrView(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载修改模式区域 |
| | | /// </summary> |
| | | void LoadDiv_ChangeModeView() |
| | | { |
| | | Dialog dialog = new Dialog(); |
| | | |
| | | FrameLayout dialogView = new FrameLayout() |
| | | { |
| | | BackgroundColor = CSS_Color.DialogTransparentColor1, |
| | | }; |
| | | dialog.AddChidren(dialogView); |
| | | |
| | | FrameLayout modeChangeView; |
| | | modeChangeView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(30), |
| | | Y = Application.GetRealHeight(128), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealHeight(287), |
| | | BackgroundImagePath = "FunctionIcon/AC/DivBg1.png", |
| | | }; |
| | | dialogView.AddChidren(modeChangeView); |
| | | |
| | | Button btnTitle; |
| | | btnTitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(8 + 16), |
| | | Y = Application.GetRealHeight(8), |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(44), |
| | | TextID = StringId.ChooseMode, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.EmphasisFontSize_Secondary, |
| | | }; |
| | | modeChangeView.AddChidren(btnTitle); |
| | | |
| | | Button btnLine = new Button() |
| | | { |
| | | X = btnTitle.X, |
| | | Y = btnTitle.Bottom, |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(1), |
| | | BackgroundColor = CSS_Color.BackgroundColor, |
| | | }; |
| | | modeChangeView.AddChidren(btnLine); |
| | | |
| | | var modeList = device.GetAttribute(FunctionAttributeKey.Mode).value; |
| | | foreach (var m in modeList) |
| | | { |
| | | Button btnModeIcon = new Button() |
| | | { |
| | | X = btnTitle.X, |
| | | Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 10 + 8), |
| | | Width = Application.GetRealWidth(24), |
| | | Height = Application.GetRealWidth(24), |
| | | IsSelected = device.GetAttrState(FunctionAttributeKey.Mode) == m, |
| | | }; |
| | | modeChangeView.AddChidren(btnModeIcon); |
| | | |
| | | Button btnModeText = new Button() |
| | | { |
| | | X = Application.GetRealWidth(12) + btnModeIcon.Right, |
| | | Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 8), |
| | | Height = Application.GetRealHeight(44), |
| | | Width = Application.GetRealWidth(90), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | IsSelected = device.GetAttrState(FunctionAttributeKey.Mode) == m, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | }; |
| | | modeChangeView.AddChidren(btnModeText); |
| | | |
| | | btnModeIcon.UnSelectedImagePath = acFunction.GetModeIconPath(m, false); |
| | | btnModeIcon.SelectedImagePath = acFunction.GetModeIconPath(m); |
| | | btnModeText.Text = acFunction.GetModeAttrText(m); |
| | | |
| | | if (modeList.IndexOf(m) < modeList.Count - 1) |
| | | { |
| | | modeChangeView.AddChidren(new Button() |
| | | { |
| | | X = btnTitle.X, |
| | | Y = btnModeText.Bottom, |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(1), |
| | | BackgroundColor = CSS_Color.BackgroundColor, |
| | | }); |
| | | } |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | }; |
| | | EventHandler<MouseEventArgs> eventHandler1 = (sender, e) => |
| | | { |
| | | //if (!device.online) |
| | | //{ |
| | | // new Tip() |
| | | // { |
| | | // CloseTime = 1, |
| | | // Text = Language.StringByID(StringId.DeviceOfflineCannotOption), |
| | | // Direction = AMPopTipDirection.None, |
| | | // }.Show(MainPage.BaseView); |
| | | //} |
| | | btnModeIcon.IsSelected = btnModeText.IsSelected = true; |
| | | device.SetAttrState(FunctionAttributeKey.Mode, m); |
| | | btnMode.UnSelectedImagePath = acFunction.GetModeIconPath(m); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.Mode, m); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | dialog.Close(); |
| | | if (device.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | arcBar.IsClickable = false; |
| | | arcBar.IsOffline = true; |
| | | } |
| | | else |
| | | { |
| | | arcBar.IsOffline = false; |
| | | arcBar.IsClickable = true; |
| | | } |
| | | }; |
| | | btnModeIcon.MouseUpEventHandler = eventHandler1; |
| | | btnModeText.MouseUpEventHandler = eventHandler1; |
| | | dialogView.MouseUpEventHandler = eventHandler; |
| | | |
| | | } |
| | | |
| | | dialogView.MouseUpEventHandler = (sender, e) => { |
| | | dialog.Close(); |
| | | }; |
| | | dialog.Show(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载修改扫风模式区域 |
| | | /// </summary> |
| | | void LoadDiv_ChangeSwingView() |
| | | { |
| | | Dialog dialog = new Dialog(); |
| | | |
| | | FrameLayout dialogView = new FrameLayout() |
| | | { |
| | | BackgroundColor = CSS_Color.DialogTransparentColor1, |
| | | }; |
| | | dialog.AddChidren(dialogView); |
| | | |
| | | FrameLayout modeChangeView; |
| | | modeChangeView = new FrameLayout() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(128), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealHeight(287), |
| | | BackgroundImagePath = "FunctionIcon/AC/DivBg2.png", |
| | | }; |
| | | dialogView.AddChidren(modeChangeView); |
| | | |
| | | Button btnTitle; |
| | | btnTitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(8 + 16), |
| | | Y = Application.GetRealHeight(8), |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(44), |
| | | TextID = StringId.Swing, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.EmphasisFontSize_Secondary, |
| | | }; |
| | | modeChangeView.AddChidren(btnTitle); |
| | | |
| | | Button btnLine = new Button() |
| | | { |
| | | X = btnTitle.X, |
| | | Y = btnTitle.Bottom, |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(1), |
| | | BackgroundColor = CSS_Color.BackgroundColor, |
| | | }; |
| | | modeChangeView.AddChidren(btnLine); |
| | | |
| | | var modeList = device.GetAttribute(FunctionAttributeKey.Swing).value; |
| | | foreach (var m in modeList) |
| | | { |
| | | Button btnModeIcon = new Button() |
| | | { |
| | | X = btnTitle.X, |
| | | Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 10 + 8), |
| | | Width = Application.GetRealWidth(24), |
| | | Height = Application.GetRealWidth(24), |
| | | IsSelected = device.GetAttrState(FunctionAttributeKey.Swing) == m, |
| | | }; |
| | | modeChangeView.AddChidren(btnModeIcon); |
| | | |
| | | Button btnModeText = new Button() |
| | | { |
| | | X = Application.GetRealWidth(12) + btnModeIcon.Right, |
| | | Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 8), |
| | | Height = Application.GetRealHeight(44), |
| | | Width = Application.GetRealWidth(90), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | IsSelected = device.GetAttrState(FunctionAttributeKey.Swing) == m, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | }; |
| | | modeChangeView.AddChidren(btnModeText); |
| | | |
| | | if (modeList.IndexOf(m) < modeList.Count - 1) |
| | | { |
| | | modeChangeView.AddChidren(new Button() |
| | | { |
| | | X = btnTitle.X, |
| | | Y = btnModeText.Bottom, |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(1), |
| | | BackgroundColor = CSS_Color.BackgroundColor, |
| | | }); |
| | | } |
| | | |
| | | btnModeIcon.UnSelectedImagePath = acFunction.GetSwingIconPath(m, false); |
| | | btnModeIcon.SelectedImagePath = acFunction.GetSwingIconPath(m); |
| | | btnModeText.Text = acFunction.GetSwingAttrText(m); |
| | | |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | }; |
| | | EventHandler<MouseEventArgs> eventHandler1 = (sender, e) => |
| | | { |
| | | //if (!device.online) |
| | | //{ |
| | | // new Tip() |
| | | // { |
| | | // CloseTime = 1, |
| | | // Text = Language.StringByID(StringId.DeviceOfflineCannotOption), |
| | | // Direction = AMPopTipDirection.None, |
| | | // }.Show(MainPage.BaseView); |
| | | //} |
| | | btnModeIcon.IsSelected = btnModeText.IsSelected = true; |
| | | device.SetAttrState(FunctionAttributeKey.Swing, m); |
| | | btnSwing.UnSelectedImagePath = acFunction.GetSwingIconPath(m); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.Swing, m); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | dialog.Close(); |
| | | }; |
| | | btnModeIcon.MouseUpEventHandler = eventHandler1; |
| | | btnModeText.MouseUpEventHandler = eventHandler1; |
| | | dialogView.MouseUpEventHandler = eventHandler; |
| | | |
| | | } |
| | | |
| | | dialogView.MouseUpEventHandler = (sender, e) => { |
| | | dialog.Close(); |
| | | }; |
| | | dialog.Show(); |
| | | } |
| | | /// <summary> |
| | | /// 加载修改模式区域 |
| | | /// </summary> |
| | | void LoadDiv_ChangeFanView() |
| | | { |
| | | Dialog dialog = new Dialog(); |
| | | |
| | | FrameLayout dialogView = new FrameLayout() |
| | | { |
| | | BackgroundColor = CSS_Color.DialogTransparentColor1, |
| | | }; |
| | | dialog.AddChidren(dialogView); |
| | | |
| | | FrameLayout modeChangeView; |
| | | modeChangeView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(185), |
| | | Y = Application.GetRealHeight(172), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealHeight(243), |
| | | BackgroundImagePath = "FunctionIcon/AC/DivBg2.png", |
| | | }; |
| | | dialogView.AddChidren(modeChangeView); |
| | | |
| | | Button btnTitle; |
| | | btnTitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(8 + 16), |
| | | Y = Application.GetRealHeight(8), |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(44), |
| | | TextID = StringId.ChooseFan, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.EmphasisFontSize_Secondary, |
| | | }; |
| | | modeChangeView.AddChidren(btnTitle); |
| | | |
| | | Button btnLine = new Button() |
| | | { |
| | | X = btnTitle.X, |
| | | Y = btnTitle.Bottom, |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(1), |
| | | BackgroundColor = CSS_Color.BackgroundColor, |
| | | }; |
| | | modeChangeView.AddChidren(btnLine); |
| | | |
| | | var modeList = device.GetAttribute(FunctionAttributeKey.FanSpeed).value; |
| | | foreach (var m in modeList) |
| | | { |
| | | Button btnFanIcon = new Button() |
| | | { |
| | | X = btnTitle.X, |
| | | Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 10 + 8), |
| | | Width = Application.GetRealWidth(24), |
| | | Height = Application.GetRealWidth(24), |
| | | IsSelected = device.GetAttrState(FunctionAttributeKey.FanSpeed) == m, |
| | | }; |
| | | modeChangeView.AddChidren(btnFanIcon); |
| | | |
| | | Button btnFanText = new Button() |
| | | { |
| | | X = Application.GetRealWidth(12) + btnFanIcon.Right, |
| | | Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 8), |
| | | Height = Application.GetRealHeight(44), |
| | | Width = Application.GetRealWidth(70), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | IsSelected = device.GetAttrState(FunctionAttributeKey.FanSpeed) == m, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | }; |
| | | modeChangeView.AddChidren(btnFanText); |
| | | btnFanIcon.UnSelectedImagePath = acFunction.GetFanIconPath(m, false); |
| | | btnFanIcon.SelectedImagePath = acFunction.GetFanIconPath(m); |
| | | btnFanText.Text = acFunction.GetFanAttrText(m); |
| | | |
| | | if (modeList.IndexOf(m) < modeList.Count - 1) |
| | | { |
| | | modeChangeView.AddChidren(new Button() |
| | | { |
| | | X = btnTitle.X, |
| | | Y = btnFanText.Bottom, |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(1), |
| | | BackgroundColor = CSS_Color.BackgroundColor, |
| | | }); |
| | | } |
| | | |
| | | EventHandler<MouseEventArgs> closeDialogEvent = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | }; |
| | | EventHandler<MouseEventArgs> eventHandler1 = (sender, e) => |
| | | { |
| | | //if (!device.online) |
| | | //{ |
| | | // new Tip() |
| | | // { |
| | | // CloseTime = 1, |
| | | // Text = Language.StringByID(StringId.DeviceOfflineCannotOption), |
| | | // Direction = AMPopTipDirection.None, |
| | | // }.Show(MainPage.BaseView); |
| | | //} |
| | | btnFanIcon.IsSelected = btnFanText.IsSelected = true; |
| | | device.SetAttrState(FunctionAttributeKey.FanSpeed, m); |
| | | btnWindSpeed.UnSelectedImagePath = acFunction.GetFanIconPath(m); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.FanSpeed, m); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | //btnWindSpeed.UnSelectedImagePath = btnFanIcon.UnSelectedImagePath; |
| | | dialog.Close(); |
| | | }; |
| | | btnFanIcon.MouseUpEventHandler = eventHandler1; |
| | | btnFanText.MouseUpEventHandler = eventHandler1; |
| | | dialogView.MouseUpEventHandler = closeDialogEvent; |
| | | } |
| | | |
| | | dialog.Show(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载红外遥控器,额外按钮 |
| | | /// </summary> |
| | | void LoadDiv_IrView() |
| | | { |
| | | if (device.spk == SPK.AcIr) |
| | | { |
| | | var btnMore = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(334 + 80), |
| | | Width = Application.GetRealWidth(35), |
| | | Height = Application.GetRealWidth(35), |
| | | UnSelectedImagePath = "FunctionIcon/AC/More.png", |
| | | }; |
| | | this.AddChidren(btnMore); |
| | | |
| | | btnMore.MouseUpEventHandler = (sender, e) => { |
| | | LoadDialog_IrMoreView(); |
| | | }; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载额外对红外按钮界面 |
| | | /// </summary> |
| | | void LoadDialog_IrMoreView() |
| | | { |
| | | Dialog dialog = new Dialog(); |
| | | |
| | | var div = new FrameLayout(); |
| | | dialog.AddChidren(div); |
| | | div.MouseUpEventHandler = (sender, e) => { |
| | | dialog.Close(); |
| | | }; |
| | | |
| | | var bodyView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(427),//667 |
| | | Height = Application.GetRealHeight(240), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | div.AddChidren(bodyView); |
| | | |
| | | var contentView = new VerticalScrolViewLayout() |
| | | { |
| | | Y = Application.GetRealHeight(16), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(296 + 200), |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | | |
| | | |
| | | var row = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(60), |
| | | Width = Application.GetRealWidth(296), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | }; |
| | | contentView.AddChidren(row); |
| | | |
| | | int index = 0; |
| | | List<FunctionAttributes> attrList = new List<FunctionAttributes>(); |
| | | attrList.AddRange(device.attributes); |
| | | attrList.Add(new FunctionAttributes() |
| | | { |
| | | key = "+", |
| | | }); |
| | | |
| | | foreach (var attr in attrList) |
| | | { |
| | | if (attr.key == FunctionAttributeKey.Mode |
| | | || attr.key == FunctionAttributeKey.OnOff |
| | | || attr.key == FunctionAttributeKey.SetTemp |
| | | || attr.key == FunctionAttributeKey.SetTempStep |
| | | || attr.key == FunctionAttributeKey.FanSpeed |
| | | || attr.key == FunctionAttributeKey.FanManual |
| | | || attr.key == FunctionAttributeKey.FanAuto |
| | | ) |
| | | { |
| | | continue; |
| | | } |
| | | if (index != 0 && index % 3 == 0) |
| | | { |
| | | row = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(56), |
| | | Width = Application.GetRealWidth(296), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | }; |
| | | contentView.AddChidren(row); |
| | | } |
| | | if (attr.key == "+") |
| | | { |
| | | var addView = new FrameLayout() |
| | | { |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetRealWidth(88), |
| | | Height = Application.GetRealHeight(40), |
| | | Radius = (uint)Application.GetRealHeight(18), |
| | | BorderColor = CSS_Color.PromptingColor1, |
| | | BorderWidth = (uint)Application.GetRealWidth(2), |
| | | }; |
| | | |
| | | |
| | | if (index % 3 == 1) |
| | | { |
| | | addView.Gravity = Gravity.Center; |
| | | } |
| | | else if (index % 3 == 2) |
| | | { |
| | | addView.X = Application.GetRealWidth(208); |
| | | } |
| | | row.AddChidren(addView); |
| | | |
| | | var btnAdd = new Button() |
| | | { |
| | | Gravity = Gravity.Center, |
| | | UnSelectedImagePath = "Public/PlusSignIcon.png", |
| | | Width = Application.GetRealWidth(32), |
| | | Height = Application.GetRealWidth(32), |
| | | }; |
| | | addView.AddChidren(btnAdd); |
| | | |
| | | btnAdd.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | Action action = () => { |
| | | LoadDialog_IrMoreView(); |
| | | }; |
| | | var addButton = new AcControlPage_AddIrButton(action); |
| | | MainPage.BasePageView.AddChidren(addButton); |
| | | addButton.Show(device); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | |
| | | |
| | | } |
| | | else |
| | | { |
| | | |
| | | var btn = new Button() |
| | | { |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetRealWidth(88), |
| | | Height = Application.GetRealHeight(40), |
| | | Radius = (uint)Application.GetRealHeight(18), |
| | | BorderColor = CSS_Color.PromptingColor1, |
| | | BorderWidth = (uint)Application.GetRealWidth(2), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | SelectedTextColor = CSS_Color.MainBackgroundColor, |
| | | SelectedBackgroundColor = CSS_Color.MainColor, |
| | | }; |
| | | if (attr.value.Count > 0) |
| | | { |
| | | btn.Text = attr.value[0]; |
| | | } |
| | | if (index % 3 == 1) |
| | | { |
| | | btn.Gravity = Gravity.Center; |
| | | } |
| | | else if (index % 3 == 2) |
| | | { |
| | | btn.X = Application.GetRealWidth(208); |
| | | } |
| | | row.AddChidren(btn); |
| | | |
| | | btn.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | //if (!device.online) |
| | | //{ |
| | | // new Tip() |
| | | // { |
| | | // CloseTime = 1, |
| | | // Text = Language.StringByID(StringId.DeviceOfflineCannotOption), |
| | | // Direction = AMPopTipDirection.None, |
| | | // }.Show(MainPage.BaseView); |
| | | //} |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(attr.key, ""); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(2000); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btn.IsSelected = false; |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | }; |
| | | |
| | | } |
| | | |
| | | index++; |
| | | } |
| | | |
| | | dialog.Show(); |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 发送各种命令_______________________ |
| | | |
| | | /// <summary> |
| | | /// 温度改变模式 |
| | | /// </summary> |
| | | void LoadEvent_TempChange() |
| | | { |
| | | btnMinus.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | //if (!device.online) |
| | | //{ |
| | | // new Tip() |
| | | // { |
| | | // CloseTime = 1, |
| | | // Text = Language.StringByID(StringId.DeviceOfflineCannotOption), |
| | | // Direction = AMPopTipDirection.None, |
| | | // }.Show(MainPage.BaseView); |
| | | //} |
| | | if (device.trait_on_off.curValue.ToString() == "off" || device.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | return; |
| | | } |
| | | |
| | | if (temp <= device.GetAttribute(FunctionAttributeKey.SetTemp).min) |
| | | { |
| | | return; |
| | | } |
| | | --temp; |
| | | Console.WriteLine($"temp == {temp}"); |
| | | controlTime = DateTime.Now; |
| | | arcBar.Progress = temp; |
| | | btnTemp.Text = temp.ToString(); |
| | | device.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString()); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.SetTemp, temp.ToString()); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | }; |
| | | btnPlus.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | //if (!device.online) |
| | | //{ |
| | | // new Tip() |
| | | // { |
| | | // CloseTime = 1, |
| | | // Text = Language.StringByID(StringId.DeviceOfflineCannotOption), |
| | | // Direction = AMPopTipDirection.None, |
| | | // }.Show(MainPage.BaseView); |
| | | //} |
| | | if (device.trait_on_off.curValue.ToString() == "off" || device.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | return; |
| | | } |
| | | if (temp >= device.GetAttribute(FunctionAttributeKey.SetTemp).max) |
| | | { |
| | | return; |
| | | } |
| | | ++temp; |
| | | controlTime = DateTime.Now; |
| | | arcBar.Progress = temp; |
| | | btnTemp.Text = temp.ToString(); |
| | | device.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString()); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.SetTemp, temp.ToString()); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | }; |
| | | //if (device.online) |
| | | { |
| | | arcBar.OnStopTrackingTouchEvent = (sender, e) => |
| | | { |
| | | temp = arcBar.Progress; |
| | | device.SetAttrState(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString()); |
| | | btnTemp.Text = arcBar.Progress.ToString(); |
| | | controlTime = DateTime.Now; |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString()); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | }; |
| | | arcBar.OnProgressChangedEvent = (sender, e) => |
| | | { |
| | | device.SetAttrState(FunctionAttributeKey.SetTemp, e.ToString()); |
| | | btnTemp.Text = e.ToString(); |
| | | }; |
| | | //arcBar.MouseDownEventHandler = (sender, e) => { |
| | | // Console.WriteLine("ddd"); |
| | | // MainPage.BasePageView.ScrollEnabled =false; |
| | | //}; |
| | | //arcBar.MouseUpEventHandler = (sender, e) => { |
| | | // Console.WriteLine("ddd2"); |
| | | // MainPage.BasePageView.ScrollEnabled = true; |
| | | //}; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 控制模式事件 |
| | | /// </summary> |
| | | void LoadEvent_AcStatesChange() |
| | | { |
| | | btnMode.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (device.trait_on_off.curValue.ToString() == "off") |
| | | { |
| | | return; |
| | | } |
| | | LoadDiv_ChangeModeView(); |
| | | }; |
| | | //扫风改变模式 |
| | | btnSwing.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (device.trait_on_off.curValue.ToString() == "off") |
| | | { |
| | | return; |
| | | } |
| | | LoadDiv_ChangeSwingView(); |
| | | }; |
| | | btnWindSpeed.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (device.trait_on_off.curValue.ToString() == "off") |
| | | { |
| | | return; |
| | | } |
| | | LoadDiv_ChangeFanView(); |
| | | }; |
| | | |
| | | btnSwitch.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | //if (!device.online) |
| | | //{ |
| | | // new Tip() |
| | | // { |
| | | // CloseTime = 1, |
| | | // Text = Language.StringByID(StringId.DeviceOfflineCannotOption), |
| | | // Direction = AMPopTipDirection.None, |
| | | // }.Show(MainPage.BaseView); |
| | | //} |
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected; |
| | | device.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | if (device.trait_on_off.curValue.ToString() == "on") |
| | | { |
| | | arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIconOn.png"; |
| | | btnSwitch.IsSelected = true; |
| | | arcBar.IsOffline = false; |
| | | } |
| | | else |
| | | { |
| | | arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIcon.png"; |
| | | btnSwitch.IsBold = false; |
| | | arcBar.IsOffline = true; |
| | | } |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, device.trait_on_off.curValue.ToString()); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | }; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 刷新界面状态_______________________ |
| | | |
| | | /// <summary> |
| | | /// 刷新界面状态 |
| | | /// </summary> |
| | | public void RefreshFormStatu() |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | //app自己控制的不用更新,会造成跳动 |
| | | if (controlTime.AddSeconds(2) > DateTime.Now) |
| | | { |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.RoomTemp).Replace(",", "."))) + "°C"; |
| | | btnMode.SelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode)); |
| | | btnSwing.SelectedImagePath = acFunction.GetSwingIconPath(device.GetAttrState(FunctionAttributeKey.Swing)); |
| | | btnWindSpeed.SelectedImagePath = acFunction.GetFanIconPath(device.GetAttrState(FunctionAttributeKey.FanSpeed)); |
| | | btnMode.UnSelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode), false); |
| | | btnSwing.UnSelectedImagePath = acFunction.GetSwingIconPath(device.GetAttrState(FunctionAttributeKey.Swing), false); |
| | | btnWindSpeed.UnSelectedImagePath = acFunction.GetFanIconPath(device.GetAttrState(FunctionAttributeKey.FanSpeed), false); |
| | | temp = Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp).Replace(",", "."))); |
| | | |
| | | |
| | | arcBar.Progress = temp; |
| | | btnTemp.Text = temp.ToString(); |
| | | |
| | | if (device.trait_on_off.curValue.ToString() == "on") |
| | | { |
| | | btnMode.IsSelected = btnSwing.IsSelected = btnWindSpeed.IsSelected = true; |
| | | arcBar.IsOffline = false; |
| | | btnSwitch.IsSelected = true; |
| | | arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIconOn.png"; |
| | | if (device.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | arcBar.IsClickable = false; |
| | | } |
| | | else |
| | | { |
| | | arcBar.IsClickable = true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | btnMode.IsSelected = btnSwing.IsSelected = btnWindSpeed.IsSelected = false; |
| | | arcBar.IsOffline = true; |
| | | btnSwitch.IsSelected = false; |
| | | arcBar.IsClickable = false; |
| | | arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIcon.png"; |
| | | } |
| | | |
| | | if (device.GetAttrState(FunctionAttributeKey.Mode) == "dry") |
| | | { |
| | | arcBar.IsOffline = true; |
| | | arcBar.IsClickable = false; |
| | | |
| | | } |
| | | } |
| | | |
| | | }); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 一般方法___________________________ |
| | | |
| | | /// <summary> |
| | | /// 刷新当前设备的状态缓存 |
| | | /// </summary> |
| | | private void RefreshNowDeviceStatuMemory(Function i_LocalDevice) |
| | | { |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | using HDL_ON.DriverLayer; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.Stan; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | | namespace HDL_ON.UI |
| | | { |
| | | public class FhContentView : FrameLayout |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | /// <summary> |
| | | /// 空调温度控制控件 |
| | | /// </summary> |
| | | DiyArcSeekBar arcBar; |
| | | /// <summary> |
| | | /// 减号按钮 |
| | | /// </summary> |
| | | Button btnMinus; |
| | | /// <summary> |
| | | /// 加号按钮 |
| | | /// </summary> |
| | | Button btnPlus; |
| | | /// <summary> |
| | | /// 温度按钮 |
| | | /// </summary> |
| | | Button btnTemp; |
| | | Button btnTempUint; |
| | | /// <summary> |
| | | /// 室内温度按钮 |
| | | /// </summary> |
| | | Button btnIndoorTemp; |
| | | /// <summary> |
| | | /// 模式按钮 |
| | | /// </summary> |
| | | Button btnMode; |
| | | /// <summary> |
| | | /// 开关按钮 |
| | | /// </summary> |
| | | Button btnSwitch; |
| | | |
| | | FloorHeating fhTemp = new FloorHeating(); |
| | | |
| | | Function device; |
| | | |
| | | #endregion |
| | | |
| | | public FhContentView(Function function) |
| | | { |
| | | device = function; |
| | | } |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | |
| | | /// <summary> |
| | | /// 初始化白色区域的内容 |
| | | /// </summary> |
| | | public void InitContentView(bool initStandard) |
| | | { |
| | | |
| | | if (initStandard) |
| | | { |
| | | //设备名字 |
| | | var btnDeviceName = new NormalViewControl(270, 37, true); |
| | | btnDeviceName.X = Application.GetRealWidth(16); |
| | | btnDeviceName.Y = Application.GetRealHeight(18); |
| | | btnDeviceName.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | btnDeviceName.TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel; |
| | | btnDeviceName.Text = device.name; |
| | | btnDeviceName.Width = btnDeviceName.GetRealWidthByText(); |
| | | AddChidren(btnDeviceName); |
| | | //房间名字 |
| | | var btnRoomName = new NormalViewControl(270, 21, true); |
| | | btnRoomName.X = Application.GetRealWidth(16); |
| | | btnRoomName.Y = btnDeviceName.Bottom; |
| | | btnRoomName.TextColor = CSS_Color.PromptingColor1; |
| | | btnRoomName.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; |
| | | btnRoomName.Text = device.GetRoomListName(); |
| | | btnRoomName.Width = btnRoomName.GetRealWidthByText(); |
| | | AddChidren(btnRoomName); |
| | | |
| | | } |
| | | //初始化第一个索引页的内容 |
| | | this.InitFrameWhiteContent1(); |
| | | |
| | | //刷新界面状态 |
| | | this.RefreshFormStatu(); |
| | | //读取状态 |
| | | new System.Threading.Thread(() => |
| | | { |
| | | Control.Ins.SendReadCommand(device); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化第一个索引页的内容 |
| | | /// </summary> |
| | | private void InitFrameWhiteContent1() |
| | | { |
| | | |
| | | arcBar = new DiyArcSeekBar() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | OpenAngle = 160, |
| | | //ThumbImagePath = device.trait_on_off.curValue.ToString() == "on" ? "FunctionIcon/FloorHeating/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png", |
| | | ThumbImageHeight = Application.GetRealWidth(50), |
| | | ProgressBarColor = CSS_Color.AuxiliaryColor1, // 0xFFFC9C04, |
| | | OfflineProgressBarColor = CSS_Color.PromptingColor2, |
| | | MinValue = device.GetAttribute(FunctionAttributeKey.SetTemp).min, |
| | | MaxValue = device.GetAttribute(FunctionAttributeKey.SetTemp).max, |
| | | ArcColor = CSS_Color.BackgroundColor, |
| | | Progress = Convert.ToInt32(device.GetAttrState(FunctionAttributeKey.SetTemp)), |
| | | #if __IOS__ |
| | | Y = Application.GetRealHeight(120 + 25), |
| | | Width = Application.GetRealWidth(260 - 40), |
| | | Height = Application.GetRealWidth(260 - 40), |
| | | SeekBarPadding = Application.GetRealWidth(8), |
| | | #else |
| | | Y = Application.GetRealHeight(120 + 40), |
| | | Width = Application.GetRealWidth(260 - 40), |
| | | Height = Application.GetRealWidth(260 - 40), |
| | | SeekBarPadding = Application.GetRealWidth(7), |
| | | #endif |
| | | |
| | | }; |
| | | AddChidren(arcBar); |
| | | |
| | | |
| | | arcBar.ThumbImagePath = device.GetAttrState(FunctionAttributeKey.OnOff) == "on" ? "FunctionIcon/AC/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png"; |
| | | arcBar.IsOffline = device.GetAttrState(FunctionAttributeKey.OnOff) == "off"; |
| | | arcBar.MinValue = device.GetAttribute(FunctionAttributeKey.SetTemp).min; |
| | | arcBar.MaxValue = device.GetAttribute(FunctionAttributeKey.SetTemp).max; |
| | | arcBar.Progress = Convert.ToInt32(device.GetAttrState(FunctionAttributeKey.SetTemp)); |
| | | |
| | | |
| | | |
| | | btnTemp = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(200), |
| | | Width = Application.GetRealWidth(80), |
| | | Height = Application.GetRealWidth(60), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = 56, |
| | | IsBold = true, |
| | | Text = device.GetAttrState(FunctionAttributeKey.SetTemp), |
| | | TextAlignment = TextAlignment.Center, |
| | | }; |
| | | AddChidren(btnTemp); |
| | | |
| | | btnTempUint = new Button() |
| | | { |
| | | X = btnTemp.Right, |
| | | Y = btnTemp.Y, |
| | | Width = Application.GetRealWidth(30), |
| | | Height = Application.GetRealWidth(25), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.EmphasisFontSize_Secondary, |
| | | IsBold = true, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = fhTemp.GetTempUnitString(device) |
| | | }; |
| | | AddChidren(btnTempUint); |
| | | |
| | | btnIndoorTemp = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = btnTemp.Bottom + Application.GetRealWidth(10), |
| | | Width = Application.GetRealWidth(100), |
| | | Height = Application.GetRealHeight(20), |
| | | Text = Language.StringByID(StringId.IndoorTemp) + "20°C", |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | }; |
| | | AddChidren(btnIndoorTemp); |
| | | |
| | | btnMinus = new Button() |
| | | { |
| | | X = Application.GetRealWidth(21), |
| | | Y = Application.GetRealHeight(263), |
| | | Width = Application.GetRealWidth(32), |
| | | Height = Application.GetRealWidth(32), |
| | | UnSelectedImagePath = "Public/MinusSignIcon.png", |
| | | }; |
| | | AddChidren(btnMinus); |
| | | |
| | | btnPlus = new Button() |
| | | { |
| | | X = Application.GetRealWidth(275), |
| | | Y = Application.GetRealHeight(263), |
| | | Width = Application.GetRealWidth(32), |
| | | Height = Application.GetRealWidth(32), |
| | | UnSelectedImagePath = "Public/PlusSignIcon.png", |
| | | }; |
| | | AddChidren(btnPlus); |
| | | |
| | | if (device.GetAttribute(FunctionAttributeKey.Mode) != null) |
| | | { |
| | | btnMode = new Button() |
| | | { |
| | | X = Application.GetRealWidth(235), |
| | | Y = Application.GetRealHeight(337), |
| | | Width = Application.GetRealWidth(30), |
| | | Height = Application.GetRealWidth(30), |
| | | UnSelectedImagePath = fhTemp.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode)) |
| | | }; |
| | | AddChidren(btnMode); |
| | | if (device.GetAttribute(FunctionAttributeKey.Mode).value.Count > 1) |
| | | { |
| | | btnMode.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | LoadDiv_ChangeModeView(); |
| | | }; |
| | | } |
| | | } |
| | | |
| | | btnSwitch = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(466), |
| | | Width = Application.GetRealWidth(32), |
| | | Height = Application.GetRealWidth(32), |
| | | UnSelectedImagePath = "Public/PowerClose.png", |
| | | SelectedImagePath = "Public/PowerOpen.png", |
| | | IsSelected = device.trait_on_off.curValue.ToString() == "on" |
| | | }; |
| | | AddChidren(btnSwitch); |
| | | |
| | | LoadEvent_TempChange(); |
| | | LoadEvent_AcStatesChange(); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载修改模式区域 |
| | | /// </summary> |
| | | void LoadDiv_ChangeModeView() |
| | | { |
| | | Dialog dialog = new Dialog(); |
| | | |
| | | FrameLayout dialogView = new FrameLayout() |
| | | { |
| | | BackgroundColor = CSS_Color.DialogTransparentColor1, |
| | | }; |
| | | dialog.AddChidren(dialogView); |
| | | |
| | | FrameLayout modeChangeView; |
| | | modeChangeView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(30), |
| | | Y = Application.GetRealHeight(128), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealHeight(287), |
| | | BackgroundImagePath = "FunctionIcon/AC/DivBg1.png", |
| | | }; |
| | | dialogView.AddChidren(modeChangeView); |
| | | |
| | | Button btnTitle; |
| | | btnTitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(8 + 16), |
| | | Y = Application.GetRealHeight(8), |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(44), |
| | | TextID = StringId.ChooseMode, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.EmphasisFontSize_Secondary, |
| | | }; |
| | | modeChangeView.AddChidren(btnTitle); |
| | | |
| | | Button btnLine = new Button() |
| | | { |
| | | X = btnTitle.X, |
| | | Y = btnTitle.Bottom, |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(1), |
| | | BackgroundColor = CSS_Color.BackgroundColor, |
| | | }; |
| | | modeChangeView.AddChidren(btnLine); |
| | | |
| | | var modeList = device.GetAttribute(FunctionAttributeKey.Mode).value; |
| | | foreach (var m in modeList) |
| | | { |
| | | Button btnModeIcon = new Button() |
| | | { |
| | | X = btnTitle.X, |
| | | Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 10 + 8), |
| | | Width = Application.GetRealWidth(24), |
| | | Height = Application.GetRealWidth(24), |
| | | IsSelected = device.GetAttrState(FunctionAttributeKey.Mode) == m, |
| | | }; |
| | | modeChangeView.AddChidren(btnModeIcon); |
| | | |
| | | Button btnModeText = new Button() |
| | | { |
| | | X = Application.GetRealWidth(12) + btnModeIcon.Right, |
| | | Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 8), |
| | | Height = Application.GetRealHeight(44), |
| | | Width = Application.GetRealWidth(90), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | IsSelected = device.GetAttrState(FunctionAttributeKey.Mode) == m, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | }; |
| | | modeChangeView.AddChidren(btnModeText); |
| | | |
| | | btnModeIcon.UnSelectedImagePath = fhTemp.GetModeIconPath(m, false); |
| | | btnModeIcon.SelectedImagePath = fhTemp.GetModeIconPath(m); |
| | | btnModeText.Text = fhTemp.GetModeAttrText(m); |
| | | |
| | | if (modeList.IndexOf(m) < modeList.Count - 1) |
| | | { |
| | | modeChangeView.AddChidren(new Button() |
| | | { |
| | | X = btnTitle.X, |
| | | Y = btnModeText.Bottom, |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(1), |
| | | BackgroundColor = CSS_Color.BackgroundColor, |
| | | }); |
| | | } |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | }; |
| | | EventHandler<MouseEventArgs> eventHandler1 = (sender, e) => |
| | | { |
| | | //if (!device.online) |
| | | //{ |
| | | // new Tip() |
| | | // { |
| | | // CloseTime = 1, |
| | | // Text = Language.StringByID(StringId.DeviceOfflineCannotOption), |
| | | // Direction = AMPopTipDirection.None, |
| | | // }.Show(MainPage.BaseView); |
| | | //} |
| | | btnModeIcon.IsSelected = btnModeText.IsSelected = true; |
| | | device.SetAttrState(FunctionAttributeKey.Mode, m); |
| | | btnMode.UnSelectedImagePath = fhTemp.GetModeIconPath(m); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | btnMode.UnSelectedImagePath = btnModeIcon.UnSelectedImagePath; |
| | | d.Add(FunctionAttributeKey.Mode, m); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | dialog.Close(); |
| | | if (device.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | arcBar.IsClickable = false; |
| | | } |
| | | else |
| | | { |
| | | arcBar.IsClickable = true; |
| | | } |
| | | }; |
| | | btnModeIcon.MouseUpEventHandler = eventHandler1; |
| | | btnModeText.MouseUpEventHandler = eventHandler1; |
| | | dialogView.MouseUpEventHandler = eventHandler; |
| | | |
| | | } |
| | | |
| | | dialogView.MouseUpEventHandler = (sender, e) => { |
| | | dialog.Close(); |
| | | }; |
| | | dialog.Show(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region ■ 发送各种命令_______________________ |
| | | |
| | | /// <summary> |
| | | /// 温度改变模式 |
| | | /// </summary> |
| | | void LoadEvent_TempChange() |
| | | { |
| | | btnMinus.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | //if (!device.online) |
| | | //{ |
| | | // new Tip() |
| | | // { |
| | | // CloseTime = 1, |
| | | // Text = Language.StringByID(StringId.DeviceOfflineCannotOption), |
| | | // Direction = AMPopTipDirection.None, |
| | | // }.Show(MainPage.BaseView); |
| | | // return; |
| | | //} |
| | | if (device.trait_on_off.curValue.ToString() == "off" || device.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | return; |
| | | } |
| | | var temp = Convert.ToInt32(device.GetAttrState(FunctionAttributeKey.SetTemp)); |
| | | if (temp <= device.GetAttribute(FunctionAttributeKey.Mode).min) |
| | | { |
| | | return; |
| | | } |
| | | temp--; |
| | | arcBar.Progress = temp; |
| | | btnTemp.Text = temp.ToString(); |
| | | device.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString()); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.SetTemp, temp.ToString()); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | }; |
| | | btnPlus.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | //if (!device.online) |
| | | //{ |
| | | // new Tip() |
| | | // { |
| | | // CloseTime = 1, |
| | | // Text = Language.StringByID(StringId.DeviceOfflineCannotOption), |
| | | // Direction = AMPopTipDirection.None, |
| | | // }.Show(MainPage.BaseView); |
| | | // return; |
| | | //} |
| | | if (device.trait_on_off.curValue.ToString() == "off" || device.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | return; |
| | | } |
| | | var temp = Convert.ToInt32(device.GetAttrState(FunctionAttributeKey.SetTemp)); |
| | | if (temp >= device.GetAttribute(FunctionAttributeKey.SetTemp).max) |
| | | { |
| | | return; |
| | | } |
| | | temp++; |
| | | arcBar.Progress = temp; |
| | | btnTemp.Text = temp.ToString(); |
| | | device.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString()); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.SetTemp, temp.ToString()); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | }; |
| | | |
| | | //if (device.online) |
| | | { |
| | | arcBar.OnStopTrackingTouchEvent = (sender, e) => |
| | | { |
| | | device.SetAttrState(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString()); |
| | | btnTemp.Text = arcBar.Progress.ToString(); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString()); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | }; |
| | | arcBar.OnProgressChangedEvent = (sender, e) => |
| | | { |
| | | device.SetAttrState(FunctionAttributeKey.SetTemp, e.ToString()); |
| | | btnTemp.Text = e.ToString(); |
| | | }; |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 控制模式事件 |
| | | /// </summary> |
| | | void LoadEvent_AcStatesChange() |
| | | { |
| | | btnMode.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (device.trait_on_off.curValue.ToString() == "off") |
| | | { |
| | | return; |
| | | } |
| | | LoadDiv_ChangeModeView(); |
| | | }; |
| | | |
| | | btnSwitch.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected; |
| | | device.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | if (device.trait_on_off.curValue.ToString() == "on") |
| | | { |
| | | arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIconOn.png"; |
| | | btnSwitch.IsSelected = true; |
| | | arcBar.IsOffline = false; |
| | | } |
| | | else |
| | | { |
| | | arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIcon.png"; |
| | | btnSwitch.IsBold = false; |
| | | arcBar.IsOffline = true; |
| | | } |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, device.trait_on_off.curValue.ToString()); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | }; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 刷新界面状态_______________________ |
| | | |
| | | /// <summary> |
| | | /// 刷新界面状态 |
| | | /// </summary> |
| | | private void RefreshFormStatu() |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnTemp.Text = device.GetAttrState(FunctionAttributeKey.SetTemp); |
| | | btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.RoomTemp).Replace(",", "."))) + "°C"; |
| | | btnMode.UnSelectedImagePath = fhTemp.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode)); |
| | | arcBar.Progress = Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp).Replace(",", "."))); |
| | | if (device.trait_on_off.curValue.ToString() == "on") |
| | | { |
| | | arcBar.IsOffline = false; |
| | | btnSwitch.IsSelected = true; |
| | | arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIconOn.png"; |
| | | if (device.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | arcBar.IsClickable = false; |
| | | } |
| | | else |
| | | { |
| | | arcBar.IsClickable = true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | arcBar.IsOffline = true; |
| | | btnSwitch.IsSelected = false; |
| | | arcBar.IsClickable = false; |
| | | arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIcon.png"; |
| | | } |
| | | //自动模式不允许调温度 2021-10-27 09:41:35 wxr 陈琳反馈 |
| | | if (device.GetAttrState(FunctionAttributeKey.Mode) == "auto") |
| | | { |
| | | btnPlus.Enable = false; |
| | | btnMinus.Enable = false; |
| | | arcBar.IsClickable = false; |
| | | arcBar.IsOffline = true; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | /// <summary> |
| | | /// </summary> |
| | | public string fieldValue { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 时间 |
| | | /// </summary> |
| | | public string time { get; set; } |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.Stan; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | | public class EnvironmentPanelPage : DeviceFunction4CardCommonForm |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 图标 |
| | | /// </summary> |
| | | private IconViewControl btnIcon = null; |
| | | /// <summary> |
| | | /// 文本控件 |
| | | /// </summary> |
| | | private NormalViewControl btnSuctionView = null; |
| | | |
| | | Function acDevice; |
| | | Function fhDevice; |
| | | Function airFreshDevice; |
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | |
| | | /// <summary> |
| | | /// 初始化白色区域的内容 |
| | | /// </summary> |
| | | public override void InitFrameWhiteContent() |
| | | { |
| | | base.ShowColltionButton = false; |
| | | base.SetTitleText(Language.StringByID(StringId.SmartPanel)); |
| | | foreach (var sid in device.targetSids) |
| | | { |
| | | var targetObj = FunctionList.List.Functions.Find((obj) => sid == obj.sid); |
| | | if (targetObj == null) |
| | | { |
| | | continue; |
| | | } |
| | | if (SPK.AcSpkList().Contains(targetObj.spk)) |
| | | { |
| | | acDevice = targetObj; |
| | | } |
| | | else if (SPK.FhSpkList().Contains(targetObj.spk)) |
| | | { |
| | | fhDevice = targetObj; |
| | | } |
| | | else if (SPK.AirFreshSpkList().Contains(targetObj.spk)) |
| | | { |
| | | airFreshDevice = targetObj; |
| | | } |
| | | } |
| | | |
| | | //添加第二索引页 |
| | | this.Add4Page(); |
| | | //初始化第一个索引页的内容 |
| | | this.InitFrameWhiteContent1(); |
| | | //初始化第二个索引页的内容 |
| | | this.InitFrameWhiteContent2(); |
| | | this.InitFrameWhiteContent3(); |
| | | //刷新界面状态 |
| | | //this.RefreshFormStatu(); |
| | | //读取状态 |
| | | //new System.Threading.Thread(() => |
| | | //{ |
| | | // DriverLayer.Control.Ins.SendReadCommand(device); |
| | | //}) |
| | | //{ IsBackground = true }.Start(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化第一个索引页的内容 |
| | | /// </summary> |
| | | private void InitFrameWhiteContent1() |
| | | { |
| | | btnIcon = new IconViewControl(198) |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealWidth(146), |
| | | UnSelectedImagePath = "FunctionIcon/Panel/PanelHelpNormalBgIcon.png", |
| | | SelectedImagePath = "FunctionIcon/Panel/PanelHelpAlarmBgIcon.png", |
| | | }; |
| | | FrameWhiteCentet1.AddChidren(btnIcon); |
| | | |
| | | btnSuctionView = new NormalViewControl(300, 84, true) |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = btnIcon.Bottom, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextColor = CSS_Color.MainColor, |
| | | SelectedTextColor = CSS_Color.AuxiliaryColor2, |
| | | //BackgroundColor = 0xFFFF0000 |
| | | }; |
| | | FrameWhiteCentet1.AddChidren(btnSuctionView); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化第二个索引页的内容 |
| | | /// </summary> |
| | | private void InitFrameWhiteContent2() |
| | | { |
| | | var acPage = new UI2.FuntionControlView.Panel.AcContentView(acDevice); |
| | | FrameWhiteCentet2.AddChidren(acPage); |
| | | acPage.InitContent(); |
| | | } |
| | | |
| | | private void InitFrameWhiteContent3() |
| | | { |
| | | var fhPage = new FhContentView(fhDevice); |
| | | FrameWhiteCentet3.AddChidren(fhPage); |
| | | fhPage.InitContentView(true); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 设备状态反馈_______________________ |
| | | |
| | | /// <summary> |
| | | /// 设备状态反馈 |
| | | /// </summary> |
| | | /// <param name="i_LocalDevice"></param> |
| | | public override void DeviceStatuPush(Function i_LocalDevice) |
| | | { |
| | | //不是同一个东西 |
| | | if (this.device.sid != i_LocalDevice.sid) { return; } |
| | | |
| | | //刷新界面状态 |
| | | this.RefreshFormStatu(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 发送各种命令_______________________ |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 刷新界面状态_______________________ |
| | | |
| | | /// <summary> |
| | | /// 刷新界面状态 |
| | | /// </summary> |
| | | private void RefreshFormStatu() |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | var temp = device.attributes.Find((sta) => sta.key == "alarm_status"); |
| | | if (temp != null) |
| | | { |
| | | if (temp.state == "alarm") |
| | | { |
| | | btnIcon.IsSelected = true; |
| | | btnSuctionView.TextID = StringId.InAlarm; |
| | | btnSuctionView.IsSelected = true; |
| | | } |
| | | else |
| | | { |
| | | btnIcon.IsSelected = false; |
| | | btnSuctionView.TextID = StringId.SensorNormalState; |
| | | btnSuctionView.IsSelected = false; |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 一般方法___________________________ |
| | | |
| | | #endregion |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.Stan; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.UI.UI2.FuntionControlView.Panel |
| | | { |
| | | public class PanelHelpPage : DeviceFunctionCardCommonForm |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 图标 |
| | | /// </summary> |
| | | private IconViewControl btnIcon = null; |
| | | /// <summary> |
| | | /// 文本控件 |
| | | /// </summary> |
| | | private NormalViewControl btnSuctionView = null; |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | |
| | | /// <summary> |
| | | /// 初始化白色区域的内容 |
| | | /// </summary> |
| | | public override void InitFrameWhiteContent() |
| | | { |
| | | base.ShowColltionButton = false; |
| | | base.SetTitleText(Language.StringByID(StringId.SmartPanel)); |
| | | |
| | | //添加第二索引页 |
| | | this.AddSecondPage(); |
| | | //初始化第一个索引页的内容 |
| | | this.InitFrameWhiteContent1(); |
| | | //初始化第二个索引页的内容 |
| | | this.InitFrameWhiteContent2(); |
| | | //刷新界面状态 |
| | | this.RefreshFormStatu(); |
| | | //读取状态 |
| | | new System.Threading.Thread(() => |
| | | { |
| | | DriverLayer.Control.Ins.SendReadCommand(device); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化第一个索引页的内容 |
| | | /// </summary> |
| | | private void InitFrameWhiteContent1() |
| | | { |
| | | btnIcon = new IconViewControl(198) |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealWidth(146), |
| | | UnSelectedImagePath = "FunctionIcon/Panel/PanelHelpNormalBgIcon.png", |
| | | SelectedImagePath = "FunctionIcon/Panel/PanelHelpAlarmBgIcon.png", |
| | | }; |
| | | FrameWhiteCentet1.AddChidren(btnIcon); |
| | | |
| | | btnSuctionView = new NormalViewControl(300, 84, true) |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = btnIcon.Bottom, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextColor = CSS_Color.MainColor, |
| | | SelectedTextColor = CSS_Color.AuxiliaryColor2, |
| | | //BackgroundColor = 0xFFFF0000 |
| | | }; |
| | | FrameWhiteCentet1.AddChidren(btnSuctionView); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化第二个索引页的内容 |
| | | /// </summary> |
| | | private void InitFrameWhiteContent2() |
| | | { |
| | | var paging = new ArmSensorHistroyPaging(device); |
| | | paging.InitFrame(FrameWhiteCentet2); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 设备状态反馈_______________________ |
| | | |
| | | /// <summary> |
| | | /// 设备状态反馈 |
| | | /// </summary> |
| | | /// <param name="i_LocalDevice"></param> |
| | | public override void DeviceStatuPush(Function i_LocalDevice) |
| | | { |
| | | //不是同一个东西 |
| | | if (this.device.sid != i_LocalDevice.sid) { return; } |
| | | |
| | | //刷新界面状态 |
| | | this.RefreshFormStatu(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 发送各种命令_______________________ |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 刷新界面状态_______________________ |
| | | |
| | | /// <summary> |
| | | /// 刷新界面状态 |
| | | /// </summary> |
| | | private void RefreshFormStatu() |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | var temp = device.attributes.Find((sta) => sta.key == "alarm_status"); |
| | | if (temp != null) |
| | | { |
| | | if (temp.state == "alarm") |
| | | { |
| | | btnIcon.IsSelected = true; |
| | | btnSuctionView.TextID = StringId.InAlarming; |
| | | btnSuctionView.IsSelected = true; |
| | | } |
| | | else |
| | | { |
| | | btnIcon.IsSelected = false; |
| | | btnSuctionView.TextID = StringId.Monitoring; |
| | | btnSuctionView.IsSelected = false; |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 一般方法___________________________ |
| | | |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | <MtouchArch>ARM64</MtouchArch>
|
| | | <MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
|
| | | <MtouchVerbosity></MtouchVerbosity>
|
| | | <CodesignProvision>OnProSiri220307-1-Hoc</CodesignProvision>
|
| | | </PropertyGroup>
|
| | | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
| | | <DebugType>pdbonly</DebugType>
|