Merge branch 'CJL' into NewFilePath
| | |
| | | 231=其他区域 |
| | | 232=成员管理 |
| | | 233=昵称 |
| | | 234=使用权限 |
| | | 234=成员权限管理 |
| | | 235=创建场景 |
| | | 236=昵称不能为空 |
| | | 237=编辑昵称 |
| | |
| | | 251=添加失败,权限不足。 |
| | | 252=保存成功 |
| | | 253=保存中,请稍后 |
| | | 254=修改成员昵称 |
| | | 254=昵称编辑 |
| | | 255=移除该成员 |
| | | 256=暂无已收藏的功能 |
| | | 257=请输入内容 |
| | |
| | | 9053=推送注册异常 |
| | | 9054=数字密码验证 |
| | | 9055=绘制手势验证 |
| | | 9056=年 |
| | | 9057=无区域功能 |
| | | 9058=是否需要保存 |
| | | 9059=暂无分享 |
| | | 9060=使用权限 |
| | | |
| | | 10000=无效登录密钥,请重新登录! |
| | | 10001=请求服务器失败,请稍后再试! |
| | |
| | | Content = notificationMessage.NotificationContent, |
| | | Extras = notificationMessage.NotificationExtras |
| | | }; |
| | | |
| | | var jpushExpandData = GetJPushExpandData(pushMes); |
| | | if (jpushExpandData != null && jpushExpandData.messageType != null) |
| | | { |
| | | pushMes.messageType = jpushExpandData.messageType; |
| | | System.Console.WriteLine("PushMes messageType : " + pushMes.messageType); |
| | | } |
| | | |
| | | System.Console.WriteLine("PushMes title : " + pushMes.Title); |
| | | System.Console.WriteLine("PushMes message : " + pushMes.Content); |
| | | System.Console.WriteLine("PushMes extras : " + pushMes.Extras); |
| | | |
| | | HDLCommon.Current.AdjustPushMessage(pushMes); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="pushMes"></param> |
| | | /// <returns></returns> |
| | | ExpandData GetJPushExpandData(JPushMessageInfo pushMes) |
| | | { |
| | | try |
| | | { |
| | | if (pushMes.Extras != null) |
| | | { |
| | | var jpushExpandData = Newtonsoft.Json.JsonConvert.DeserializeObject<JPushExpandData>(pushMes.Extras.ToString()); |
| | | return Newtonsoft.Json.JsonConvert.DeserializeObject<ExpandData>(jpushExpandData.expandData); |
| | | } |
| | | return null; |
| | | } |
| | | catch |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 注册成功回调 |
| | |
| | | Content = notificationMessage.NotificationContent, |
| | | Extras = notificationMessage.NotificationExtras |
| | | }; |
| | | |
| | | var jpushExpandData = GetJPushExpandData(pushMes); |
| | | if (jpushExpandData != null && jpushExpandData.messageType != null) |
| | | { |
| | | pushMes.messageType = jpushExpandData.messageType; |
| | | System.Console.WriteLine("PushMes messageType : " + pushMes.messageType); |
| | | } |
| | | |
| | | System.Console.WriteLine("PushMes title : " + pushMes.Title); |
| | | System.Console.WriteLine("PushMes message : " + pushMes.Content); |
| | | System.Console.WriteLine("PushMes extras : " + pushMes.Extras); |
| | |
| | | var body = alert["body"] as NSString; |
| | | var title = alert["title"] as NSString; |
| | | var expandData = ""; |
| | | var messageType = ""; |
| | | if (userInfo.ContainsKey(new NSString("expandData"))) |
| | | { |
| | | var expandDataStr = userInfo["expandData"] as NSString; |
| | |
| | | if (expandDataNSD != null) |
| | | { |
| | | expandData = expandDataNSD.ToString(); |
| | | if(expandDataNSD.ContainsKey(new NSString("messageType"))){ |
| | | messageType = expandDataNSD["messageType"] as NSString; |
| | | Utlis.WriteLine("messageType: "+ messageType); |
| | | } |
| | | |
| | | } |
| | | } |
| | | else |
| | |
| | | expandData = expandDataStr; |
| | | } |
| | | |
| | | //var expandDataNSD = userInfo["expandData"] as NSDictionary; |
| | | //if (expandDataNSD != null && expandDataNSD is NSDictionary) |
| | | //{ |
| | | // if (expandDataNSD.ContainsKey(new NSString("messageType"))) |
| | | // { |
| | | // expandData = expandDataNSD["messageType"] as NSString; |
| | | // } |
| | | //} |
| | | } |
| | | var pushMes = new JPushMessageInfo() |
| | | { |
| | | Title = title, |
| | | Content = body, |
| | | Extras = expandData, |
| | | messageType = messageType |
| | | }; |
| | | System.Console.WriteLine("PushMes title : " + pushMes.Title); |
| | | System.Console.WriteLine("PushMes message : " + pushMes.Content); |
| | |
| | | 231=其他区域 |
| | | 232=成员管理 |
| | | 233=昵称 |
| | | 234=使用权限 |
| | | 234=成员权限管理 |
| | | 235=创建场景 |
| | | 236=昵称不能为空 |
| | | 237=编辑昵称 |
| | |
| | | 251=添加失败,权限不足。 |
| | | 252=保存成功 |
| | | 253=保存中,请稍后 |
| | | 254=修改成员昵称 |
| | | 254=昵称编辑 |
| | | 255=移除该成员 |
| | | 256=暂无已收藏的功能 |
| | | 257=请输入内容 |
| | |
| | | 9053=推送注册异常 |
| | | 9054=数字密码验证 |
| | | 9055=绘制手势验证 |
| | | 9056=年 |
| | | 9057=无区域功能 |
| | | 9058=是否需要保存 |
| | | 9059=暂无分享 |
| | | 9060=使用权限 |
| | | |
| | | 10000=无效登录密钥,请重新登录! |
| | | 10001=请求服务器失败,请稍后再试! |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 推送消息MessageType |
| | | /// </summary> |
| | | public enum PushMessageType |
| | | { |
| | | /// <summary> |
| | | /// Prompt |
| | | /// </summary> |
| | | Prompt = 0, |
| | | /// <summary> |
| | | /// 报警类 |
| | | /// </summary> |
| | | Alarm, |
| | | /// <summary> |
| | | /// 丰林可视对讲呼叫 |
| | | /// </summary> |
| | | FLCall, |
| | | /// <summary> |
| | | /// 挤下线推送 |
| | | /// </summary> |
| | | OffLine, |
| | | /// <summary> |
| | | /// 自动化执行 |
| | | /// </summary> |
| | | LogicExecute, |
| | | /// <summary> |
| | | /// 安防报警 |
| | | /// </summary> |
| | | SecurityAlarm, |
| | | } |
| | | |
| | | /// <summary> |
| | | /// BottomLine 类型 |
| | | /// </summary> |
| | | public enum BottomLineType |
| | |
| | | { |
| | | Shared.Application.RunOnMainThread(() => |
| | | { |
| | | //报警推送才弹窗提示(messageType包含Alarm关键字的) |
| | | if (jpushMessageInfo.messageType != null && jpushMessageInfo.messageType.Contains("Alarm")) |
| | | { |
| | | new Alert(jpushMessageInfo.Title, jpushMessageInfo.Content, Language.StringByID(StringId.Close)).Show(); |
| | | } |
| | | GetPushMessageAction?.Invoke(); |
| | | }); |
| | | return; |
| | |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="userName"></param> |
| | | /// <returns></returns> |
| | | public string GetUserName(string userName) |
| | | { |
| | | return string.IsNullOrEmpty(userName) ? Language.StringByID(StringId.UsersWhoNameIsEmpty) : userName; |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | public const int EditNickname = 237; |
| | | public const int NicknameCannotBeEmpty = 236; |
| | | public const int CreateScene = 235; |
| | | public const int PermissionToUse = 234; |
| | | public const int MemberPermissionManagement = 234; |
| | | public const int Nickname = 233; |
| | | public const int MemberManagement = 232; |
| | | public const int OtherArea = 231; |
| | |
| | | /// 绘制手势验证 |
| | | /// </summary> |
| | | public const int GestureVerification = 9055; |
| | | |
| | | /// <summary> |
| | | /// 年 |
| | | /// </summary> |
| | | public const int Years = 9056; |
| | | /// <summary> |
| | | /// 无区域功能 |
| | | /// </summary> |
| | | public const int NoAreaFunction = 9057; |
| | | /// <summary> |
| | | /// 是否需要保存 |
| | | /// </summary> |
| | | public const int IfNeedToSave = 9058; |
| | | /// <summary> |
| | | /// 暂无分享 |
| | | /// </summary> |
| | | public const int NoShare = 9059; |
| | | /// <summary> |
| | | /// 使用权限 |
| | | /// </summary> |
| | | public const int PermissionToUse = 9060; |
| | | |
| | | |
| | | #region 网络请求响应错误提示信息 |
| | |
| | | private const int Day = 24 * Hour; |
| | | private const int Month = 30 * Day; |
| | | |
| | | ///// <summary> |
| | | ///// 时间转换 |
| | | ///// 少于1天 显示 时分 |
| | | ///// 少于一年 显示 月日 |
| | | ///// 大于一年 显示 年 |
| | | ///// </summary> |
| | | ///// <param name="dateTime"></param> |
| | | ///// <returns></returns> |
| | | //public static string ToFriendlyDisplay(this DateTime dateTime) |
| | | //{ |
| | | // var ts = DateTime.Now - dateTime; |
| | | // var delta = ts.TotalSeconds; |
| | | // if (delta < Day) |
| | | // { |
| | | // //显示 时:分 |
| | | // return dateTime.ToString("HH:mm"); |
| | | // } |
| | | // else if (delta < 12 * Month) |
| | | // { |
| | | // //显示 月:日 |
| | | // return dateTime.ToString("MM/dd"); |
| | | // } |
| | | // else |
| | | // { //显示 年 |
| | | // return dateTime.ToString("yyyy"); |
| | | // } |
| | | //} |
| | | /// <summary> |
| | | /// 时间转换 |
| | | /// 少于1天 显示 时分 |
| | |
| | | /// <returns></returns> |
| | | public static string ToFriendlyDisplay(this DateTime dateTime) |
| | | { |
| | | var ts = DateTime.Now - dateTime; |
| | | var delta = ts.TotalSeconds; |
| | | if (delta < 24 * Hour) |
| | | var nowDateTime = DateTime.Now; |
| | | var subYear = nowDateTime.Year - dateTime.Year; |
| | | var subMonth = nowDateTime.Month - dateTime.Month; |
| | | var subDay = nowDateTime.Day - dateTime.Day; |
| | | |
| | | //年份差值大于0 |
| | | if(subYear > 0) |
| | | { |
| | | //显示 时:分 |
| | | return dateTime.ToString("HH:mm"); |
| | | //显示 年 |
| | | return dateTime.ToString("yyyy"); |
| | | } |
| | | else if (delta < 12 * Month) |
| | | else |
| | | { |
| | | //相同年份,月份差值大于0 |
| | | if (subMonth > 0) |
| | | { |
| | | //显示 月:日 |
| | | return dateTime.ToString("MM/dd"); |
| | | } |
| | | else |
| | | { //显示 年 |
| | | return dateTime.ToString("yyyy"); |
| | | { |
| | | //相同月份,日期差值大于0 |
| | | if (subDay > 0) |
| | | { |
| | | //显示 月:日 |
| | | return dateTime.ToString("MM/dd"); |
| | | } |
| | | else |
| | | { |
| | | //同一天显示 时:分 |
| | | return dateTime.ToString("HH:mm"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 时间转换 |
| | | /// 少于1天 显示 时分 |
| | |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.Entity; |
| | | |
| | | namespace HDL_ON |
| | | { |
| | | public class FloorSelectPopupDialog |
| | | { |
| | | public FloorSelectPopupDialog() |
| | | { |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 一级List |
| | | /// </summary> |
| | | List<RoomCellInfo> mFirstList = new List<RoomCellInfo>(); |
| | | /// <summary> |
| | | /// 二级联动List |
| | | /// </summary> |
| | | List<List<RoomCellInfo>> mSecondList = new List<List<RoomCellInfo>>(); |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public void ShowView(Action<string> selectAction, string selectTag = DiySelectPopupDialog.ALLSELECT) |
| | | { |
| | | |
| | | var floorList = SpatialInfo.CurrentSpatial.FloorList; |
| | | var roomList = SpatialInfo.CurrentSpatial.RoomList; |
| | | |
| | | if (floorList == null || floorList.Count == 0) |
| | | { |
| | | //没有楼层只加载房间 |
| | | if (roomList == null) |
| | | { |
| | | Utlis.WriteLine("roomList null"); |
| | | return; |
| | | } |
| | | |
| | | mFirstList.Clear(); |
| | | foreach (var room in roomList) |
| | | { |
| | | mFirstList.Add(new RoomCellInfo() { Title = room.roomName, TagId = room.roomId }); |
| | | } |
| | | var roomSelectPopupDialog = new DiySelectPopupDialog(); |
| | | roomSelectPopupDialog.ShowView(mFirstList, null, selectAction, selectTag); |
| | | } |
| | | else |
| | | { |
| | | mFirstList.Clear(); |
| | | mSecondList.Clear(); |
| | | //一级数组为楼层 |
| | | foreach (var floor in floorList) |
| | | { |
| | | mFirstList.Add(new RoomCellInfo() { Title = floor.roomName, TagId = floor.roomId }); |
| | | var mList = new List<RoomCellInfo>(); |
| | | var allRoom = roomList.FindAll((room) => room.parentId == floor.roomId); |
| | | foreach (var mRoom in allRoom) |
| | | { |
| | | mList.Add(new RoomCellInfo() { Title = mRoom.roomName, TagId = mRoom.roomId }); |
| | | } |
| | | |
| | | if(mList == null) |
| | | { |
| | | mList = new List<RoomCellInfo>(); |
| | | } |
| | | mSecondList.Add(mList); |
| | | } |
| | | |
| | | var roomSelectPopupDialog = new DiySelectPopupDialog(); |
| | | roomSelectPopupDialog.ShowView(mFirstList, mSecondList, selectAction, selectTag); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | //*********网关********* |
| | | //网关不存在 |
| | | stateCodeDic["10506"] = StringId.GatewayDoesNotExist; |
| | | |
| | | |
| | | //控制失败 |
| | | stateCodeDic["14007"] = StringId.ControlFailure; |
| | | //网关离线 |
| | | stateCodeDic["14005"] = StringId.GatewayOffline; |
| | | //设备离线 |
| | | stateCodeDic["14006"] = StringId.DeviceOffline; |
| | | |
| | | //*********场景/自动化********* |
| | | //场景已存在 |
| | | stateCodeDic["14501"] = StringId.SceneAlreadyExists; |
| | |
| | | public string homeId; |
| | | } |
| | | |
| | | |
| | | |
| | | //获取项目 (住宅)下面的子账号 |
| | | /// <summary> |
| | | /// 获取成员信息的结果 |
| | | /// </summary> |
| | | /// [Serializable] |
| | | public class SubAccountNewRes |
| | | { |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string id; |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string homeId; |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string homeRegionId; |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string childAccountId; |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string childAccountRegionId; |
| | | /// <summary> |
| | | /// 子账户类型 ORDINARY、DEBUG、ADMIN |
| | | /// </summary> |
| | | public string childAccountType; |
| | | /// <summary> |
| | | /// 是否允许远程控制 |
| | | /// </summary> |
| | | public bool isRemoteControl; |
| | | /// <summary> |
| | | /// 昵称1 |
| | | /// </summary> |
| | | public string nickName; |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string createTime; |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更新子账号备注名字 |
| | | /// </summary> |
| | |
| | | /// 推送附加数据 |
| | | /// </summary> |
| | | public string Extras; |
| | | /// <summary> |
| | | /// 信息类型 |
| | | /// </summary> |
| | | public string messageType = ""; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 极光推送消息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class JPushExpandData |
| | | { |
| | | /// <summary> |
| | | /// 附加内容 |
| | | /// </summary> |
| | | public string expandData; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 极光推送消息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class ExpandData |
| | | { |
| | | /// <summary> |
| | | /// 附加内容 |
| | | /// </summary> |
| | | public string expantContent; |
| | | /// <summary> |
| | | /// 信息类型 |
| | | /// </summary> |
| | | public string messageType; |
| | | } |
| | | |
| | | //#region 旧接口 |
| | | ///// <summary> |
| | | ///// |
| | |
| | | ApiAlinkControlActionObj aaao = new ApiAlinkControlActionObj(); |
| | | aaao.deviceId = this.deviceId; |
| | | aaao.spk = this.spk; |
| | | aaao.bus = this.bus; |
| | | foreach (var kv in keyValues) |
| | | { |
| | | aaao.attributes.Add(new AlinkControlAttributes() |
| | |
| | | /// <summary> |
| | | /// 子账号获得的当前住宅的功能数据 |
| | | /// </summary> |
| | | public List<ShareData> CurResidenceShareDate = new List<ShareData>(); |
| | | public List<ShareData> CurResidenceShareData = new List<ShareData>(); |
| | | |
| | | /// <summary> |
| | | /// |
| | |
| | | /// <summary> |
| | | /// 用户名字 |
| | | /// </summary> |
| | | public string UserName = ""; |
| | | public string memberName = ""; |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | |
| | | <Compile Include="$(MSBuildThisFileDirectory)Common\OnAppConfig.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Common\UserInfo.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Scene\SceneAddPage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Public\Widget\SelectPopupDialog.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Common\Utlis\FloorSelectPopupDialog.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Public\Widget\DiySelectPopupDialog.cs" />
|
| | | </ItemGroup>
|
| | | <ItemGroup>
|
| | | <Folder Include="$(MSBuildThisFileDirectory)UI\" />
|
| | |
| | | //btnConfirm.IsSelected = false; |
| | | if (string.IsNullOrEmpty(editText.Text.Trim()) || list.Contains(editText.Text.Trim())) |
| | | { |
| | | if (titleId == StringId.ModifyMemberNickname) |
| | | { |
| | | return; |
| | | } |
| | | //if (titleId == StringId.ModifyMemberNickname) |
| | | //{ |
| | | // return; |
| | | //} |
| | | string tipMsgString = ""; |
| | | if (string.IsNullOrEmpty(editText.Text.Trim())) |
| | | { |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON |
| | | { |
| | | /// <summary> |
| | | /// 楼层DiySelectPopupDialog |
| | | /// </summary> |
| | | public class DiySelectPopupDialog : Dialog |
| | | { |
| | | /// <summary> |
| | | /// ALLSELECT |
| | | /// </summary> |
| | | public const string ALLSELECT = "ALLSELECT"; |
| | | |
| | | /// bodyView |
| | | /// </summary> |
| | | FrameLayout bodyView; |
| | | /// <summary> |
| | | /// 底部View |
| | | /// 自己根据需要调整X、Y坐标 |
| | | /// </summary> |
| | | public FrameLayout BackView; |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | Button leftAllButton; |
| | | /// <summary> |
| | | /// 一级滑动View |
| | | /// </summary> |
| | | VerticalScrolViewLayout leftScrolView; |
| | | /// <summary> |
| | | /// 二级滑动View |
| | | /// </summary> |
| | | VerticalScrolViewLayout rightScrolView; |
| | | /// <summary> |
| | | /// 选中回调事件 |
| | | /// </summary> |
| | | Action<string> SelectAction; |
| | | /// <summary> |
| | | /// 一级List |
| | | /// </summary> |
| | | List<RoomCellInfo> mFirstList = new List<RoomCellInfo>(); |
| | | /// <summary> |
| | | /// 二级联动List |
| | | /// </summary> |
| | | List<List<RoomCellInfo>> mSecondList = new List<List<RoomCellInfo>>(); |
| | | /// <summary> |
| | | /// 二级所有List |
| | | /// </summary> |
| | | List<RoomCellInfo> mSecondAllList = new List<RoomCellInfo>(); |
| | | |
| | | /// <summary> |
| | | /// RoomSelectPopupDialog |
| | | /// </summary> |
| | | /// <param name="SelectAction"></param> |
| | | public DiySelectPopupDialog() |
| | | { |
| | | bodyView = new FrameLayout(); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 显示View |
| | | /// mFirstList、mSecondList不合法都不会显示View |
| | | /// mSecondList 不传为默认一级 |
| | | /// </summary> |
| | | /// <param name="mFirstList"></param> |
| | | /// <param name="mSecondList"></param> |
| | | public void ShowView(List<RoomCellInfo> mFirstList, List<List<RoomCellInfo>> mSecondList, Action<string> SelectAction, string selectTagId = ALLSELECT) |
| | | { |
| | | if (mFirstList == null) |
| | | { |
| | | Utlis.WriteLine("mFirstList null"); |
| | | return; |
| | | } |
| | | //注册回调事件 |
| | | this.SelectAction = SelectAction; |
| | | //二是否需要二级判断 |
| | | if (mSecondList == null || mSecondList.Count == 0) |
| | | { |
| | | //一级 |
| | | this.mFirstList = mFirstList; |
| | | //View显示 |
| | | ShowOneBaseView(); |
| | | //数据内容填充 |
| | | RefreshOneBaseView(selectTagId); |
| | | } |
| | | else |
| | | { |
| | | if (mFirstList.Count != mSecondList.Count) |
| | | { |
| | | Utlis.WriteLine("数据 不联动异常"); |
| | | return; |
| | | } |
| | | //二级联动 |
| | | this.mFirstList = mFirstList; |
| | | this.mSecondList = mSecondList; |
| | | this.mSecondAllList.Clear(); |
| | | foreach(var list in mSecondList) |
| | | { |
| | | foreach (var data in list) |
| | | { |
| | | this.mSecondAllList.Add(data); |
| | | } |
| | | } |
| | | |
| | | //View显示 |
| | | ShowDoubleBaseView(); |
| | | //数据内容填充 |
| | | RefreshDoubleBaseView(); |
| | | // |
| | | SetSelectTagId(selectTagId); |
| | | |
| | | } |
| | | this.Show(); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | void SelectAll() |
| | | { |
| | | RefreshSelectButton(leftScrolView, ALLSELECT); |
| | | var all = new RoomCellInfo() |
| | | { |
| | | TagId = ALLSELECT, |
| | | Title = "ALL", |
| | | }; |
| | | LoadRightScrolView(all, this.mSecondAllList); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据tagID选中 |
| | | /// </summary> |
| | | void SetSelectTagId(string tagId) |
| | | { |
| | | if (string.IsNullOrEmpty(tagId) || tagId == ALLSELECT) |
| | | { |
| | | SelectAll(); |
| | | } |
| | | else |
| | | { |
| | | |
| | | var tagInfo = mFirstList.Find((m) => m.TagId == tagId); |
| | | if (tagInfo != null) |
| | | { |
| | | var index = mFirstList.IndexOf(tagInfo); |
| | | if (index < mSecondList.Count) |
| | | { |
| | | RefreshSelectButton(leftScrolView, tagId); |
| | | LoadRightScrolView(tagInfo, mSecondList[index]); |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | SelectAll(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | SelectAll(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | #region 二级联动选择效果 |
| | | /// <summary> |
| | | /// 显示二级view |
| | | /// </summary> |
| | | void ShowDoubleBaseView() |
| | | { |
| | | bodyView.BackgroundColor = CSS_Color.DialogTransparentColor1; |
| | | this.AddChidren(bodyView); |
| | | bodyView.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | this.Close(); |
| | | }; |
| | | |
| | | BackView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(10), |
| | | Y = Application.GetRealHeight(104), |
| | | Width = Application.GetRealWidth(283), |
| | | Height = Application.GetRealWidth(242), |
| | | }; |
| | | bodyView.AddChidren(BackView); |
| | | |
| | | var backImageView = new ImageView(){ |
| | | Width = BackView.Width, |
| | | Height = BackView.Height, |
| | | ImagePath = "Public/PopupDialog.png" |
| | | }; |
| | | BackView.AddChidren(backImageView); |
| | | |
| | | leftAllButton = new Button() |
| | | { |
| | | Y = Application.GetRealWidth(14), |
| | | X = Application.GetRealWidth(24), |
| | | Height = Application.GetRealWidth(44), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextID = StringId.All, |
| | | IsSelected = true, |
| | | //IsBold = true, |
| | | }; |
| | | BackView.AddChidren(leftAllButton); |
| | | //分割线 |
| | | var lineView1 = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(1), |
| | | Y = leftAllButton.Bottom, |
| | | X = leftAllButton.X, |
| | | BackgroundColor = CSS_Color.DividingLineColor, |
| | | }; |
| | | BackView.AddChidren(lineView1); |
| | | |
| | | leftScrolView = new VerticalScrolViewLayout() |
| | | { |
| | | X = Application.GetRealWidth(8), |
| | | Y = leftAllButton.Bottom, |
| | | Height = Application.GetRealWidth(176), |
| | | Width = Application.GetRealWidth(128), |
| | | VerticalScrollBarEnabled = false, |
| | | }; |
| | | BackView.AddChidren(leftScrolView); |
| | | |
| | | rightScrolView = new VerticalScrolViewLayout() |
| | | { |
| | | X = leftScrolView.Right + Application.GetRealWidth(12), |
| | | Y = Application.GetRealWidth(58), |
| | | Height = Application.GetRealWidth(176), |
| | | Width = Application.GetRealWidth(128), |
| | | VerticalScrollBarEnabled = false, |
| | | }; |
| | | BackView.AddChidren(rightScrolView); |
| | | |
| | | leftAllButton.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | leftAllButton.IsSelected = true; |
| | | |
| | | //加载全部 |
| | | SelectAll(); |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 刷新二级联动的VIEW |
| | | /// </summary> |
| | | void RefreshDoubleBaseView() |
| | | { |
| | | leftScrolView.RemoveAll(); |
| | | for (var i = 0; i < mFirstList.Count; i++) |
| | | { |
| | | AddSelectButton(leftScrolView, mFirstList[i], mSecondList[i]); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// scrolView里面Button 选中效果互斥 |
| | | /// </summary> |
| | | /// <param name="scrolView"></param> |
| | | /// <param name="selectBtnTag"></param> |
| | | void RefreshSelectButton(VerticalScrolViewLayout scrolView, string selectBtnTag) |
| | | { |
| | | try |
| | | { |
| | | if (leftAllButton != null) |
| | | { |
| | | leftAllButton.IsSelected = selectBtnTag == ALLSELECT; |
| | | } |
| | | |
| | | if (scrolView != null) |
| | | { |
| | | for (int i = 0; i < scrolView.ChildrenCount; i++) |
| | | { |
| | | if (scrolView.GetChildren(i).GetType() == typeof(FrameLayout)) |
| | | { |
| | | var cellView = (FrameLayout)scrolView.GetChildren(i); |
| | | for (int j = 0; j < cellView.ChildrenCount; j++) |
| | | { |
| | | if (cellView.GetChildren(j).GetType() == typeof(Button)) |
| | | { |
| | | var titleButton = (Button)cellView.GetChildren(j); |
| | | var o = titleButton.GetTagByKey("BtnKey"); |
| | | if (o != null && o.ToString() == selectBtnTag) |
| | | { |
| | | titleButton.IsSelected = true; |
| | | } |
| | | else |
| | | { |
| | | titleButton.IsSelected = false; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch |
| | | { |
| | | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加一级楼层选择CellView |
| | | /// </summary> |
| | | /// <param name="scrolView"></param> |
| | | /// <param name="firstData"></param> |
| | | /// <param name="rightList"></param> |
| | | void AddSelectButton(VerticalScrolViewLayout scrolView, RoomCellInfo firstData, List<RoomCellInfo> rightList) |
| | | { |
| | | var cellView = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealWidth(44), |
| | | Tag = "cell" |
| | | }; |
| | | scrolView.AddChidren(cellView); |
| | | |
| | | var titleButton = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Height = Application.GetRealWidth(44), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = firstData.Title, |
| | | }; |
| | | cellView.AddChidren(titleButton); |
| | | titleButton.AddTag("BtnKey", firstData.TagId); |
| | | |
| | | //顶部分割线 |
| | | var lineView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Height = Application.GetRealHeight(1), |
| | | Width = Application.GetRealWidth(112), |
| | | BackgroundColor = CSS_Color.DividingLineColor, |
| | | Y = cellView.Height - Application.GetRealHeight(1), |
| | | }; |
| | | cellView.AddChidren(lineView); |
| | | |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | //cellView.BackgroundColor = CSS_Color.viewTranslucence; |
| | | RefreshSelectButton(scrolView, firstData.TagId); |
| | | LoadRightScrolView(firstData, rightList); |
| | | }; |
| | | |
| | | titleButton.MouseUpEventHandler = eventHandler; |
| | | cellView.MouseUpEventHandler = eventHandler; |
| | | |
| | | //EventHandler<MouseEventArgs> mousDownEventHandler = (sender, e) => |
| | | //{ |
| | | // cellView.BackgroundColor = CSS_Color.TopViewColor; |
| | | //}; |
| | | |
| | | //titleButton.MouseDownEventHandler = mousDownEventHandler; |
| | | //cellView.MouseDownEventHandler = mousDownEventHandler; |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 加载二级滑动View |
| | | /// </summary> |
| | | /// <param name="firstData"></param> |
| | | /// <param name="rightList"></param> |
| | | void LoadRightScrolView(RoomCellInfo firstData, List<RoomCellInfo> rightList) |
| | | { |
| | | rightScrolView.RemoveAll(); |
| | | |
| | | //添加顶部分割线 |
| | | var lineView2 = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(1), |
| | | BackgroundColor = CSS_Color.DividingLineColor, |
| | | }; |
| | | rightScrolView.AddChidren(lineView2); |
| | | //添加全部按钮 |
| | | var allInfo = new RoomCellInfo() |
| | | { |
| | | Title = Language.StringByID(StringId.All), |
| | | TagId = firstData.TagId,//上一级楼层ID |
| | | }; |
| | | AddRightSelectButton(rightScrolView, allInfo, true); |
| | | |
| | | for (var i = 0; i < rightList.Count; i++) |
| | | { |
| | | AddRightSelectButton(rightScrolView, rightList[i]); |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加二级选择CellView |
| | | /// </summary> |
| | | /// <param name="scrolView"></param> |
| | | /// <param name="secondData"></param> |
| | | /// <param name="isSelected"></param> |
| | | void AddRightSelectButton(VerticalScrolViewLayout scrolView, RoomCellInfo secondData, bool isSelected = false) |
| | | { |
| | | var cellView = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealWidth(44), |
| | | }; |
| | | scrolView.AddChidren(cellView); |
| | | |
| | | var titleButton = new Button() |
| | | { |
| | | //X = Application.GetRealWidth(16), |
| | | Height = Application.GetRealWidth(44), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = secondData.Title, |
| | | IsSelected = isSelected |
| | | }; |
| | | cellView.AddChidren(titleButton); |
| | | |
| | | var lineView = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(1), |
| | | Y = cellView.Height - Application.GetRealHeight(1), |
| | | BackgroundColor = CSS_Color.DividingLineColor, |
| | | }; |
| | | cellView.AddChidren(lineView); |
| | | |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | this.Close(); |
| | | //回调选中索引 |
| | | SelectAction?.Invoke(secondData.TagId); |
| | | }; |
| | | |
| | | titleButton.MouseUpEventHandler = eventHandler; |
| | | cellView.MouseUpEventHandler = eventHandler; |
| | | |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region 只有一级的联动 |
| | | /// <summary> |
| | | /// 都显示一级的 |
| | | /// </summary> |
| | | void ShowOneBaseView() |
| | | { |
| | | bodyView.BackgroundColor = CSS_Color.DialogTransparentColor1; |
| | | this.AddChidren(bodyView); |
| | | bodyView.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | this.Close(); |
| | | }; |
| | | |
| | | BackView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(10), |
| | | Y = Application.GetRealHeight(104), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealWidth(198), |
| | | }; |
| | | bodyView.AddChidren(BackView); |
| | | |
| | | var backImageView = new ImageView() |
| | | { |
| | | Width = BackView.Width, |
| | | Height = BackView.Height, |
| | | ImagePath = "PersonalCenter/HomeList3bg.png" |
| | | }; |
| | | BackView.AddChidren(backImageView); |
| | | |
| | | leftAllButton = new Button() |
| | | { |
| | | Y = Application.GetRealWidth(14), |
| | | X = Application.GetRealWidth(24), |
| | | Height = Application.GetRealWidth(44), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextID = StringId.All, |
| | | //IsBold = true, |
| | | }; |
| | | BackView.AddChidren(leftAllButton); |
| | | //分割线 |
| | | var lineView1 = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(1), |
| | | Y = leftAllButton.Bottom, |
| | | X = leftAllButton.X, |
| | | BackgroundColor = CSS_Color.DividingLineColor, |
| | | }; |
| | | BackView.AddChidren(lineView1); |
| | | |
| | | leftScrolView = new VerticalScrolViewLayout() |
| | | { |
| | | X = Application.GetRealWidth(8), |
| | | Y = leftAllButton.Bottom, |
| | | Height = Application.GetRealWidth(132), |
| | | Width = Application.GetRealWidth(144), |
| | | VerticalScrollBarEnabled = false, |
| | | }; |
| | | BackView.AddChidren(leftScrolView); |
| | | |
| | | leftAllButton.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | this.Close(); |
| | | SelectAction?.Invoke(ALLSELECT); |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="tagId"></param> |
| | | void RefreshOneBaseView(string tagId) |
| | | { |
| | | if (leftAllButton != null) |
| | | { |
| | | leftAllButton.IsSelected = tagId == ALLSELECT; |
| | | } |
| | | leftScrolView.RemoveAll(); |
| | | for (var i = 0; i < mFirstList.Count; i++) |
| | | { |
| | | AddOneSelectButton(leftScrolView, mFirstList[i], tagId); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加一级楼层选择CellView |
| | | /// </summary> |
| | | /// <param name="scrolView"></param> |
| | | /// <param name="firstIndex"></param> |
| | | /// <param name="firstText"></param> |
| | | void AddOneSelectButton(VerticalScrolViewLayout scrolView, RoomCellInfo firstData, string tagId) |
| | | { |
| | | var cellView = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealWidth(44), |
| | | Tag = "cell" |
| | | }; |
| | | scrolView.AddChidren(cellView); |
| | | |
| | | var titleButton = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Height = Application.GetRealWidth(44), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = firstData.Title, |
| | | }; |
| | | cellView.AddChidren(titleButton); |
| | | titleButton.IsSelected = firstData.TagId == tagId; |
| | | titleButton.AddTag("BtnKey", firstData.TagId); |
| | | |
| | | //顶部分割线 |
| | | var lineView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Height = Application.GetRealHeight(1), |
| | | Width = Application.GetRealWidth(112), |
| | | BackgroundColor = CSS_Color.DividingLineColor, |
| | | Y = cellView.Height - Application.GetRealHeight(1), |
| | | }; |
| | | cellView.AddChidren(lineView); |
| | | |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | this.Close(); |
| | | //回调选中索引 |
| | | SelectAction?.Invoke(firstData.TagId); |
| | | }; |
| | | |
| | | titleButton.MouseUpEventHandler = eventHandler; |
| | | cellView.MouseUpEventHandler = eventHandler; |
| | | |
| | | //EventHandler<MouseEventArgs> mousDownEventHandler = (sender, e) => |
| | | //{ |
| | | // cellView.BackgroundColor = CSS_Color.TopViewColor; |
| | | //}; |
| | | |
| | | //titleButton.MouseDownEventHandler = mousDownEventHandler; |
| | | //cellView.MouseDownEventHandler = mousDownEventHandler; |
| | | } |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region 选择楼层和房间专用 |
| | | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public class RoomCellInfo |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string Title; |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string TagId; |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON |
| | | { |
| | | /// <summary> |
| | | /// 通用PopupDialog 单选效果 |
| | | /// 只回调Index |
| | | /// </summary> |
| | | public class SelectPopupDialog : Dialog |
| | | { |
| | | /// bodyView |
| | | /// </summary> |
| | | FrameLayout bodyView; |
| | | /// <summary> |
| | | /// 底部View |
| | | /// 自己根据需要调整X、Y坐标 |
| | | /// </summary> |
| | | public FrameLayout BackView; |
| | | /// <summary> |
| | | /// 一级滑动View |
| | | /// </summary> |
| | | VerticalScrolViewLayout leftScrolView; |
| | | /// <summary> |
| | | /// 二级滑动View |
| | | /// </summary> |
| | | VerticalScrolViewLayout rightScrolView; |
| | | /// <summary> |
| | | /// 选中回调事件 |
| | | /// </summary> |
| | | Action<int, int> SelectAction; |
| | | /// <summary> |
| | | /// 一级List |
| | | /// </summary> |
| | | List<string> mFirstList = new List<string>(); |
| | | /// <summary> |
| | | /// 二级联动List |
| | | /// </summary> |
| | | List<List<string>> mSecondList = new List<List<string>>(); |
| | | |
| | | /// <summary> |
| | | /// SelectPopupDialog |
| | | /// </summary> |
| | | /// <param name="SelectAction"></param> |
| | | public SelectPopupDialog() |
| | | { |
| | | bodyView = new FrameLayout(); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 显示View |
| | | /// mFirstList、mSecondList不合法都不会显示View |
| | | /// mSecondList 不传为默认一级 |
| | | /// </summary> |
| | | /// <param name="mFirstList"></param> |
| | | /// <param name="mSecondList"></param> |
| | | public void ShowView(List<string> mFirstList, List<List<string>> mSecondList, Action<int, int> SelectAction) |
| | | { |
| | | if (mFirstList == null) |
| | | { |
| | | Utlis.WriteLine("mFirstList null"); |
| | | return; |
| | | } |
| | | //注册回调事件 |
| | | this.SelectAction = SelectAction; |
| | | //二是否需要二级判断 |
| | | if (mSecondList == null || mSecondList.Count == 0) |
| | | { |
| | | //一级 |
| | | this.mFirstList = mFirstList; |
| | | //View显示 |
| | | ShowOneBaseView(); |
| | | //数据内容填充 |
| | | RefreshOneBaseView(); |
| | | } |
| | | else |
| | | { |
| | | if (mFirstList.Count != mSecondList.Count) |
| | | { |
| | | Utlis.WriteLine("数据 不联动异常"); |
| | | return; |
| | | } |
| | | //二级联动 |
| | | this.mFirstList = mFirstList; |
| | | this.mSecondList = mSecondList; |
| | | //View显示 |
| | | ShowDoubleBaseView(); |
| | | //数据内容填充 |
| | | RefreshDoubleBaseView(); |
| | | |
| | | } |
| | | this.Show(); |
| | | } |
| | | |
| | | #region 二级联动选择效果 |
| | | /// <summary> |
| | | /// 显示二级view |
| | | /// </summary> |
| | | void ShowDoubleBaseView() |
| | | { |
| | | bodyView.BackgroundColor = CSS_Color.DialogTransparentColor1; |
| | | this.AddChidren(bodyView); |
| | | bodyView.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | this.Close(); |
| | | }; |
| | | |
| | | BackView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(10), |
| | | Y = Application.GetRealHeight(104), |
| | | Width = Application.GetRealWidth(283), |
| | | Height = Application.GetRealWidth(242), |
| | | }; |
| | | bodyView.AddChidren(BackView); |
| | | |
| | | var backImageView = new ImageView(){ |
| | | Width = BackView.Width, |
| | | Height = BackView.Height, |
| | | ImagePath = "Public/PopupDialog.png" |
| | | }; |
| | | BackView.AddChidren(backImageView); |
| | | |
| | | var leftAllButton = new Button() |
| | | { |
| | | Y = Application.GetRealWidth(14), |
| | | X = Application.GetRealWidth(24), |
| | | Height = Application.GetRealWidth(44), |
| | | TextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextID = StringId.All, |
| | | IsBold = true, |
| | | }; |
| | | BackView.AddChidren(leftAllButton); |
| | | //分割线 |
| | | var lineView1 = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(1), |
| | | Y = leftAllButton.Bottom, |
| | | X = leftAllButton.X, |
| | | BackgroundColor = CSS_Color.DividingLineColor, |
| | | }; |
| | | BackView.AddChidren(lineView1); |
| | | |
| | | leftScrolView = new VerticalScrolViewLayout() |
| | | { |
| | | X = Application.GetRealWidth(8), |
| | | Y = leftAllButton.Bottom, |
| | | Height = Application.GetRealWidth(176), |
| | | Width = Application.GetRealWidth(128), |
| | | VerticalScrollBarEnabled = false, |
| | | }; |
| | | BackView.AddChidren(leftScrolView); |
| | | |
| | | var rightAllButton = new Button() |
| | | { |
| | | Y = Application.GetRealWidth(58), |
| | | X = leftScrolView.Right + Application.GetRealWidth(12), |
| | | Height = Application.GetRealWidth(44), |
| | | TextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextID = StringId.All, |
| | | IsBold = true, |
| | | }; |
| | | BackView.AddChidren(rightAllButton); |
| | | |
| | | var lineView2 = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(1), |
| | | Y = rightAllButton.Y, |
| | | X = rightAllButton.X, |
| | | BackgroundColor = CSS_Color.DividingLineColor, |
| | | }; |
| | | BackView.AddChidren(lineView2); |
| | | |
| | | var lineView3 = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(1), |
| | | Y = rightAllButton.Bottom, |
| | | X = rightAllButton.X, |
| | | BackgroundColor = CSS_Color.DividingLineColor, |
| | | }; |
| | | BackView.AddChidren(lineView3); |
| | | |
| | | rightScrolView = new VerticalScrolViewLayout() |
| | | { |
| | | X = leftScrolView.Right + Application.GetRealWidth(12), |
| | | Y = Application.GetRealWidth(102), |
| | | Height = Application.GetRealWidth(132), |
| | | Width = Application.GetRealWidth(128), |
| | | VerticalScrollBarEnabled = false, |
| | | }; |
| | | BackView.AddChidren(rightScrolView); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 刷新二级联动的VIEW |
| | | /// </summary> |
| | | void RefreshDoubleBaseView() |
| | | { |
| | | leftScrolView.RemoveAll(); |
| | | for (var i = 0; i < mFirstList.Count; i++) |
| | | { |
| | | AddSelectButton(leftScrolView, i, mFirstList[i], mSecondList[i]); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// scrolView里面Button 选中效果互斥 |
| | | /// </summary> |
| | | void RefreshSelectButton(VerticalScrolViewLayout scrolView, string selectBtnTag) |
| | | { |
| | | try |
| | | { |
| | | if (scrolView != null) |
| | | { |
| | | for (int i = 0; i < scrolView.ChildrenCount; i++) |
| | | { |
| | | if (scrolView.GetChildren(i).GetType() == typeof(FrameLayout)) |
| | | { |
| | | var cellView = (FrameLayout)scrolView.GetChildren(i); |
| | | for (int j = 0; j < cellView.ChildrenCount; j++) |
| | | { |
| | | if (cellView.GetChildren(j).GetType() == typeof(Button)) |
| | | { |
| | | var titleButton = (Button)cellView.GetChildren(j); |
| | | var o = titleButton.GetTagByKey("BtnKey"); |
| | | if (o != null && o.ToString() == selectBtnTag) |
| | | { |
| | | titleButton.IsSelected = true; |
| | | } |
| | | else |
| | | { |
| | | titleButton.IsSelected = false; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch |
| | | { |
| | | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加一级楼层选择CellView |
| | | /// </summary> |
| | | /// <param name="scrolView"></param> |
| | | void AddSelectButton(VerticalScrolViewLayout scrolView, int firstIndex, string firstText, List<string> rightList) |
| | | { |
| | | var cellView = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealWidth(44), |
| | | Tag = "cell" |
| | | }; |
| | | scrolView.AddChidren(cellView); |
| | | |
| | | var titleButton = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Height = Application.GetRealWidth(44), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = firstText, |
| | | }; |
| | | cellView.AddChidren(titleButton); |
| | | titleButton.AddTag("BtnKey", firstIndex.ToString()); |
| | | |
| | | //顶部分割线 |
| | | var lineView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Height = Application.GetRealHeight(1), |
| | | Width = Application.GetRealWidth(112), |
| | | BackgroundColor = CSS_Color.DividingLineColor, |
| | | Y = cellView.Height - Application.GetRealHeight(1), |
| | | }; |
| | | cellView.AddChidren(lineView); |
| | | |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | //cellView.BackgroundColor = CSS_Color.viewTranslucence; |
| | | RefreshSelectButton(scrolView, firstIndex.ToString()); |
| | | LoadRightScrolView(firstIndex, rightList); |
| | | }; |
| | | |
| | | titleButton.MouseUpEventHandler = eventHandler; |
| | | cellView.MouseUpEventHandler = eventHandler; |
| | | |
| | | //EventHandler<MouseEventArgs> mousDownEventHandler = (sender, e) => |
| | | //{ |
| | | // cellView.BackgroundColor = CSS_Color.TopViewColor; |
| | | //}; |
| | | |
| | | //titleButton.MouseDownEventHandler = mousDownEventHandler; |
| | | //cellView.MouseDownEventHandler = mousDownEventHandler; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载二级滑动View |
| | | /// </summary> |
| | | /// <param name="firstIndex">一级的索引</param> |
| | | /// <param name="rightList">二级对应一级的List</param> |
| | | void LoadRightScrolView(int firstIndex, List<string> rightList) |
| | | { |
| | | rightScrolView.RemoveAll(); |
| | | for (var i = 0; i < rightList.Count; i++) |
| | | { |
| | | AddRightSelectButton(rightScrolView, firstIndex, rightList[i], i); |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加二级选择CellView |
| | | /// </summary> |
| | | /// <param name="scrolView"></param> |
| | | /// <param name="firstIndex"></param> |
| | | /// <param name="secondText"></param> |
| | | /// <param name="secondIndex"></param> |
| | | void AddRightSelectButton(VerticalScrolViewLayout scrolView, int firstIndex, string secondText, int secondIndex) |
| | | { |
| | | var cellView = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealWidth(44), |
| | | }; |
| | | scrolView.AddChidren(cellView); |
| | | |
| | | var titleButton = new Button() |
| | | { |
| | | //X = Application.GetRealWidth(16), |
| | | Height = Application.GetRealWidth(44), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = secondText, |
| | | }; |
| | | cellView.AddChidren(titleButton); |
| | | |
| | | var lineView = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(1), |
| | | Y = cellView.Height - Application.GetRealHeight(1), |
| | | BackgroundColor = CSS_Color.DividingLineColor, |
| | | }; |
| | | cellView.AddChidren(lineView); |
| | | |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | this.Close(); |
| | | //回调选中索引 |
| | | SelectAction?.Invoke(firstIndex, secondIndex); |
| | | }; |
| | | |
| | | titleButton.MouseUpEventHandler = eventHandler; |
| | | cellView.MouseUpEventHandler = eventHandler; |
| | | |
| | | //EventHandler<MouseEventArgs> mousDownEventHandler = (sender, e) => |
| | | //{ |
| | | // cellView.BackgroundColor = CSS_Color.TopViewColor; |
| | | //}; |
| | | |
| | | //titleButton.MouseDownEventHandler = mousDownEventHandler; |
| | | //cellView.MouseDownEventHandler = mousDownEventHandler; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region 只有一级的联动 |
| | | /// <summary> |
| | | /// 都显示一级的 |
| | | /// </summary> |
| | | void ShowOneBaseView() |
| | | { |
| | | bodyView.BackgroundColor = CSS_Color.DialogTransparentColor1; |
| | | this.AddChidren(bodyView); |
| | | bodyView.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | this.Close(); |
| | | }; |
| | | |
| | | BackView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(10), |
| | | Y = Application.GetRealHeight(104), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealWidth(198), |
| | | }; |
| | | bodyView.AddChidren(BackView); |
| | | |
| | | var backImageView = new ImageView() |
| | | { |
| | | Width = BackView.Width, |
| | | Height = BackView.Height, |
| | | ImagePath = "PersonalCenter/HomeList3bg.png" |
| | | }; |
| | | BackView.AddChidren(backImageView); |
| | | |
| | | var leftAllButton = new Button() |
| | | { |
| | | Y = Application.GetRealWidth(14), |
| | | X = Application.GetRealWidth(24), |
| | | Height = Application.GetRealWidth(44), |
| | | TextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextID = StringId.All, |
| | | IsBold = true, |
| | | }; |
| | | BackView.AddChidren(leftAllButton); |
| | | //分割线 |
| | | var lineView1 = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(1), |
| | | Y = leftAllButton.Bottom, |
| | | X = leftAllButton.X, |
| | | BackgroundColor = CSS_Color.DividingLineColor, |
| | | }; |
| | | BackView.AddChidren(lineView1); |
| | | |
| | | leftScrolView = new VerticalScrolViewLayout() |
| | | { |
| | | X = Application.GetRealWidth(8), |
| | | Y = leftAllButton.Bottom, |
| | | Height = Application.GetRealWidth(132), |
| | | Width = Application.GetRealWidth(144), |
| | | VerticalScrollBarEnabled = false, |
| | | }; |
| | | BackView.AddChidren(leftScrolView); |
| | | } |
| | | |
| | | void RefreshOneBaseView() |
| | | { |
| | | leftScrolView.RemoveAll(); |
| | | for (var i = 0; i < mFirstList.Count; i++) |
| | | { |
| | | AddOneSelectButton(leftScrolView, i, mFirstList[i]); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加一级楼层选择CellView |
| | | /// </summary> |
| | | /// <param name="scrolView"></param> |
| | | /// <param name="firstIndex"></param> |
| | | /// <param name="firstText"></param> |
| | | void AddOneSelectButton(VerticalScrolViewLayout scrolView, int firstIndex, string firstText) |
| | | { |
| | | var cellView = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealWidth(44), |
| | | Tag = "cell" |
| | | }; |
| | | scrolView.AddChidren(cellView); |
| | | |
| | | var titleButton = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Height = Application.GetRealWidth(44), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = firstText, |
| | | }; |
| | | cellView.AddChidren(titleButton); |
| | | titleButton.AddTag("BtnKey", firstIndex.ToString()); |
| | | |
| | | //顶部分割线 |
| | | var lineView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Height = Application.GetRealHeight(1), |
| | | Width = Application.GetRealWidth(112), |
| | | BackgroundColor = CSS_Color.DividingLineColor, |
| | | Y = cellView.Height - Application.GetRealHeight(1), |
| | | }; |
| | | cellView.AddChidren(lineView); |
| | | |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | this.Close(); |
| | | //回调选中索引 |
| | | SelectAction?.Invoke(firstIndex, 0); |
| | | }; |
| | | |
| | | titleButton.MouseUpEventHandler = eventHandler; |
| | | cellView.MouseUpEventHandler = eventHandler; |
| | | |
| | | //EventHandler<MouseEventArgs> mousDownEventHandler = (sender, e) => |
| | | //{ |
| | | // cellView.BackgroundColor = CSS_Color.TopViewColor; |
| | | //}; |
| | | |
| | | //titleButton.MouseDownEventHandler = mousDownEventHandler; |
| | | //cellView.MouseDownEventHandler = mousDownEventHandler; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region 选择楼层和房间专用 |
| | | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | #if __IOS__ |
| | | using UIKit; |
| | | using Foundation; |
| | | #else |
| | | using Android.Graphics; |
| | | #endif |
| | | |
| | | namespace HDL_ON.UI |
| | |
| | | /// <summary> |
| | | /// TextButton |
| | | /// 解决iOS 文本到边框有边距问题 |
| | | /// |
| | | /// 支持根据文本动态计算高度 |
| | | /// </summary> |
| | | public class TextButton : Button |
| | | { |
| | |
| | | (this.uiView as MyButton).ContentEdgeInsets = new UIEdgeInsets(0, 0, 0, 0); |
| | | #endif |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置需要限制的最大行数 |
| | | /// 但是超过行数的话会缺少省略号...,暂时无法解决 |
| | | /// </summary> |
| | | public int MaxLine = 0; |
| | | /// <summary> |
| | | /// 动态计算高度 |
| | | /// 赋值文本后和指定宽度后,通过计算真实的需要宽度和指定宽度算出多行需要的真实高度 |
| | | /// 该方法有误差不能100%准确 |
| | | /// 最正确方法是根据 单行单个字体的高度加上行距来计算 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public int GetMoreLineNeedHeight() |
| | | { |
| | | //计算需要的真实宽度 |
| | | int needWidth = this.GetTextWidth(); |
| | | //计算在指定宽度情况下,需要的真实行数 |
| | | int line = (needWidth / this.Width); |
| | | //求余 |
| | | int modValue = (needWidth % this.Width); |
| | | //余大于0,则多加一行 |
| | | if (modValue > 0) |
| | | { |
| | | line = line + 1; |
| | | } |
| | | if (line > 0) |
| | | { |
| | | if(MaxLine != 0) |
| | | { |
| | | line = Math.Min(line, MaxLine); |
| | | } |
| | | return line * this.Height; |
| | | } |
| | | else |
| | | { |
| | | return this.Height; |
| | | } |
| | | } |
| | | |
| | | int _lineSpacing; |
| | |
| | | /// 显示当前文字需要几行 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | int GetNeedLinesWithWidth() |
| | | public int GetNeedLinesWithWidth() |
| | | { |
| | | return 0; |
| | | return (this.GetTextWidth() / this.Width) * this.Height; |
| | | //return 0; |
| | | } |
| | | /** |
| | | |
| | | |
| | | // @param width 给定一个宽度 |
| | | // @return 返回行数 |
| | | // */ |
| | | //- (NSInteger) needLinesWithWidth:(CGFloat) width |
| | | // { |
| | | // //创建一个labe |
| | | // UILabel * label = [[UILabel alloc] |
| | | // init]; |
| | | // //font和当前label保持一致 |
| | | // label.font = self.font; |
| | | // NSString* text = self.text; |
| | | // NSInteger sum = 0; |
| | | // //总行数受换行符影响,所以这里计算总行数,需要用换行符分隔这段文字,然后计算每段文字的行数,相加即是总行数。 |
| | | // NSArray* splitText = [text componentsSeparatedByString: @"\n"]; |
| | | // for (NSString* sText in splitText) |
| | | // { |
| | | // label.text = sText; |
| | | // //获取这段文字一行需要的size |
| | | // CGSize textSize = [label systemLayoutSizeFittingSize: CGSizeZero]; |
| | | // //size.width/所需要的width 向上取整就是这段文字占的行数 |
| | | // NSInteger lines = ceilf(textSize.width / width); |
| | | // //当是0的时候,说明这是换行,需要按一行算。 |
| | | // lines = lines == 0 ? 1 : lines; |
| | | // sum += lines; |
| | | // } |
| | | // return sum; |
| | | // } |
| | | |
| | | //#elif __Android__ |
| | | #else |
| | | |
| | | /// <summary> |
| | |
| | | (this.AndroidView as Android.Widget.Button).SetLineSpacing(spacing, 1); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | int GetTextHeight() |
| | | { |
| | | string text = "Text"; |
| | | Rect rect = new Rect(); |
| | | (this.AndroidView as Android.Widget.Button).Paint.GetTextBounds(text, 0, text.Length, rect); |
| | | return rect.Height(); |
| | | } |
| | | #endif |
| | | } |
| | | |
| | |
| | | }; |
| | | contentView.AddChidren(mesView); |
| | | |
| | | Button btnMes = new Button() |
| | | TextButton btnMes = new TextButton() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = mesView.Width, |
| | | Height = mesView.Height, |
| | | //Height = mesView.Height, |
| | | Height = Application.GetRealWidth(20), |
| | | TextAlignment = TextAlignment.TopLeft, |
| | | TextColor = CSS_Color.TextualColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | IsMoreLines = true, |
| | | Text = msgStr, |
| | | //BackgroundColor = CSS_Color.AuxiliaryColor2 |
| | | |
| | | }; |
| | | mesView.AddChidren(btnMes); |
| | | //动态计算高度 |
| | | var needHeight = btnMes.GetMoreLineNeedHeight(); |
| | | btnMes.IsMoreLines = true; |
| | | btnMes.Height = needHeight; |
| | | |
| | | Button btnLine = new Button() |
| | | { |
| | |
| | | if (selectId == 0) |
| | | { |
| | | allMenuButton.IsSelected = true; |
| | | shareMenuButton.IsSelected = false; |
| | | alarmMenuButton.IsSelected = false; |
| | | systemMenuButton.IsSelected = false; |
| | | shareMenuButton.IsSelected = true; |
| | | alarmMenuButton.IsSelected = true; |
| | | systemMenuButton.IsSelected = true; |
| | | |
| | | } |
| | | else if (selectId == 1) |
| | |
| | | VerticalScrolViewMiddle.AddChidren(rowView); |
| | | |
| | | //标题 |
| | | var btnTilte = new Button() |
| | | var btnTilte = new TextButton() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Y = Application.GetRealHeight(12), |
| | | Width = Application.GetRealWidth(320), |
| | | Height = Application.GetRealHeight(20), |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealWidth(20), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | Text = pushMessageInfo.messageTitle |
| | | Text = pushMessageInfo.messageContent |
| | | }; |
| | | rowView.AddChidren(btnTilte); |
| | | // |
| | | var needHeight = btnTilte.GetMoreLineNeedHeight(); |
| | | btnTilte.IsMoreLines = true; |
| | | btnTilte.Height = needHeight; |
| | | rowView.Height = Application.GetRealHeight(45) + needHeight; |
| | | |
| | | //副标题 |
| | | var btnSubtitle = new Button() |
| | | var btnSubtitle = new TextButton() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Y = btnTilte.Bottom + Application.GetRealHeight(4), |
| | |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = pushMessageInfo.messageContent |
| | | Text = pushMessageInfo.messageTitle |
| | | }; |
| | | rowView.AddChidren(btnSubtitle); |
| | | |
| | |
| | | rowView.MouseUpEventHandler = eventHandler; |
| | | btnTilte.MouseUpEventHandler = eventHandler; |
| | | btnSubtitle.MouseUpEventHandler = eventHandler; |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | }; |
| | | VerticalScrolViewMiddle.AddChidren(bgView); |
| | | |
| | | var yearBtn = new Button() |
| | | var yearBtn = new TextButton() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Y = Application.GetRealHeight(16), |
| | |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, |
| | | IsBold = true, |
| | | Text = yearStr |
| | | }; |
| | | bgView.AddChidren(yearBtn); |
| | | yearBtn.Text = yearStr + Language.StringByID(StringId.Years); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | bodyView.AddChidren(topView); |
| | | |
| | | //不是A网关或者是成员 只允许添加场景隐藏自动化 |
| | | if (DB_ResidenceData.Instance.GatewayType != 1 || DB_ResidenceData.Instance.CurrentRegion.IsOthreShare) |
| | | var HideAutoPage = DB_ResidenceData.Instance.GatewayType != 1 || DB_ResidenceData.Instance.CurrentRegion.IsOthreShare; |
| | | //判断是否需要隐藏自动化 |
| | | if (HideAutoPage) |
| | | { |
| | | btnSceneTilte = new Button() |
| | | { |
| | |
| | | bodyView.AddChidren(contentPageView); |
| | | |
| | | LoadScenePageView(); |
| | | //判断是否需要隐藏自动化 |
| | | if (!HideAutoPage) |
| | | { |
| | | LoadAutomationPageView(); |
| | | } |
| | | LoadEventList(); |
| | | |
| | | } |
| | |
| | | /// 加载区域选择RowView |
| | | /// </summary> |
| | | /// <param name="VerticalScrolViewMiddle"></param> |
| | | void AddRowView(VerticalScrolViewLayout VerticalScrolViewMiddle, HelpURLInfo functionInfo) |
| | | void AddRowView(VerticalScrolViewLayout VerticalScrolViewMiddle, APPFunctionURLInfo functionInfo) |
| | | { |
| | | var rowView = new FrameLayout() |
| | | { |
| | |
| | | } |
| | | |
| | | #region 测试 |
| | | List<HelpURLInfo> list = new List<HelpURLInfo>(); |
| | | List<APPFunctionURLInfo> list = new List<APPFunctionURLInfo>(); |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | void TestLoad() |
| | | { |
| | | list.Add(new HelpURLInfo() |
| | | list.Add(new APPFunctionURLInfo() |
| | | { |
| | | Title = "HDL ON PRO 1.0.10 主要更新", |
| | | CreateTime = "11月26", |
| | | Url = Constant.URL_PRIVACYPOLICY, |
| | | }); |
| | | |
| | | list.Add(new HelpURLInfo() |
| | | list.Add(new APPFunctionURLInfo() |
| | | { |
| | | Title = "HDL ON PRO 1.0.09 主要更新", |
| | | CreateTime = "10月26", |
| | | Url = Constant.URL_PRIVACYPOLICY, |
| | | }); |
| | | |
| | | list.Add(new HelpURLInfo() |
| | | list.Add(new APPFunctionURLInfo() |
| | | { |
| | | Title = "HDL ON PRO 1.0.08 主要更新", |
| | | CreateTime = "09月26", |
| | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 帮助网页地址 |
| | | /// 功能介绍网页信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class HelpURLInfo |
| | | public class APPFunctionURLInfo |
| | | { |
| | | /// <summary> |
| | | /// |
| | |
| | | |
| | | ResidenceMemberInfo memberInfo; |
| | | |
| | | Room room; |
| | | |
| | | Action<string> refreshFunctionCount; |
| | | /// <summary> |
| | | /// 当前的房间roomId |
| | | /// 如果为空,则代表管理无分配区域的功能分享 |
| | | /// </summary> |
| | | string roomId; |
| | | /// <summary> |
| | | /// 房间所有功能列表 |
| | | /// </summary> |
| | | List<Function> roomFunctionList = new List<Function>(); |
| | | |
| | | /// <summary> |
| | | /// 之前的分享列表 |
| | | /// 刷新回调Action |
| | | /// </summary> |
| | | List<ShareData> funs; |
| | | Action refreshAction; |
| | | /// <summary> |
| | | /// 当前账号的所有分享列表 |
| | | /// </summary> |
| | | List<ShareData> curResidenceShareData; |
| | | /// <summary> |
| | | /// 属于当前房间最终的设备分享列表 |
| | | /// </summary> |
| | | List<ShareData> funs_New; |
| | | List<ShareData> funs_RoomAll; |
| | | //shareDataList = new List<ShareData>(); |
| | | /// <summary> |
| | | /// 删除的分享列表 |
| | | /// </summary> |
| | | List<ShareData> funs_Del; |
| | | |
| | | public MemberFunctionPermissionPage(ResidenceMemberInfo mInfo, Room r, Action<string> action) |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="mInfo"></param> |
| | | /// <param name="roomFunctionList"></param> |
| | | /// <param name="roomId"></param> |
| | | /// <param name="refreshAction"></param> |
| | | public MemberFunctionPermissionPage(ResidenceMemberInfo mInfo, List<Function> roomFunctionList, List<ShareData> funs_RoomAll, string roomId, Action refreshAction) |
| | | { |
| | | bodyView = this; |
| | | memberInfo = mInfo; |
| | | room = r; |
| | | funs = new List<ShareData>(); |
| | | funs = memberInfo.CurResidenceShareDate; |
| | | funs_New = new List<ShareData>(); |
| | | funs_Del = new List<ShareData>(); |
| | | |
| | | refreshFunctionCount = action; |
| | | } |
| | | |
| | | public MemberFunctionPermissionPage(Room r,List<ShareData> sd) |
| | | { |
| | | bodyView = this; |
| | | room = r; |
| | | funs = new List<ShareData>(); |
| | | funs_New = sd; |
| | | funs_Del = new List<ShareData>(); |
| | | memberInfo = new ResidenceMemberInfo(); |
| | | this.memberInfo = mInfo; |
| | | this.roomFunctionList = roomFunctionList; |
| | | this.roomId = roomId; |
| | | //this.curResidenceShareData = new List<ShareData>(); |
| | | this.curResidenceShareData = memberInfo.CurResidenceShareData; |
| | | this.funs_RoomAll = new List<ShareData>(); |
| | | this.funs_RoomAll.AddRange(funs_RoomAll); |
| | | this.funs_Del = new List<ShareData>(); |
| | | this.refreshAction = refreshAction; |
| | | } |
| | | |
| | | public void LoadPage(int tId) |
| | |
| | | BackgroundColor = CSS_Color.MainColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.MainBackgroundColor, |
| | | TextID = titleId == StringId.PermissionToUse ? StringId.Confirm : StringId.Shared, |
| | | TextID = titleId == StringId.MemberPermissionManagement ? StringId.Confirm : StringId.Shared, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | IsBold = true, |
| | | Radius = (uint)Application.GetRealWidth(22), |
| | |
| | | }; |
| | | bodyView.AddChidren(btnOption); |
| | | |
| | | if(titleId == StringId.PermissionToUse) |
| | | { |
| | | LoadFunctionRow(funs); |
| | | } |
| | | else |
| | | { |
| | | LoadFunctionRow(funs_New); |
| | | } |
| | | LoadFunctionRow(funs_RoomAll); |
| | | |
| | | LoadEventList(); |
| | | } |
| | | /// <summary> |
| | |
| | | void LoadFunctionRow(List<ShareData> shareDatas) |
| | | { |
| | | contentView.RemoveAll(); |
| | | foreach (var function in room.GetRoomFunctions(false)) |
| | | foreach (var function in roomFunctionList) |
| | | { |
| | | var roomView = new FrameLayout() |
| | | { |
| | |
| | | { |
| | | btnChoose.IsSelected = true; |
| | | //刷新属于当前房间的分享统计 |
| | | funs_New.Add(shareData); |
| | | //funs_New.Add(shareData); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | btnOption.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (titleId == StringId.PermissionToUse)//从个人中心进入单独分享 |
| | | Action action = () => |
| | | { |
| | | UploadShareDeviceList(); |
| | | } |
| | | else |
| | | { |
| | | //var sharedBytes = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(funs_New)); |
| | | //2020-12-01 屏蔽页面 |
| | | //var page = new ChooseShareMemberTargetListPage(funs_New, memberInfo); |
| | | //MainPage.BasePageView.AddChidren(page); |
| | | //page.LoadPage(); |
| | | //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | }; |
| | | //是否需要保存 |
| | | new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.IfNeedToSave, action); |
| | | |
| | | //if (titleId == StringId.PermissionToUse)//从个人中心进入单独分享 |
| | | //{ |
| | | // Action action = () => |
| | | // { |
| | | // UploadShareDeviceList(); |
| | | // }; |
| | | // //是否需要保存 |
| | | // new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.IfNeedToSave, action); |
| | | //} |
| | | //else |
| | | //{ |
| | | // //var sharedBytes = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(funs_New)); |
| | | // //2020-12-01 屏蔽页面 |
| | | // //var page = new ChooseShareMemberTargetListPage(funs_New, memberInfo); |
| | | // //MainPage.BasePageView.AddChidren(page); |
| | | // //page.LoadPage(); |
| | | // //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | //} |
| | | }; |
| | | } |
| | | |
| | |
| | | act = new PublicAssmebly().TipLoadingMsgDialog(Language.StringByID(StringId.SavingPleaseWait)); |
| | | }); |
| | | |
| | | //1.管理最终属于房间的分享 |
| | | if (funs_New != null && funs_New.Count > 0) |
| | | if (!string.IsNullOrEmpty(roomId)) |
| | | { |
| | | //最终属于房间的分享大于0 |
| | | var success = ShareRoom(); |
| | | if (success) |
| | | { |
| | | Utlis.WriteLine("添加房间分享成功"); |
| | | //如果房间ID不为空,管理房间 |
| | | ManageRoomSharing(); |
| | | } |
| | | else |
| | | { |
| | | Utlis.WriteLine("添加房间分享失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var success = DeleteShareRoom(); |
| | | if (success) |
| | | { |
| | | Utlis.WriteLine("删除房间分享成功"); |
| | | } |
| | | else |
| | | { |
| | | Utlis.WriteLine("删除房间分享失败"); |
| | | } |
| | | } |
| | | |
| | | |
| | | //2.批量删除分享 |
| | | var deleteShareObj = new DeleteShareObj() |
| | |
| | | |
| | | //3.批量上传 |
| | | var funs_NeedAdd = new List<ShareData>(); |
| | | foreach (var f in funs_New) |
| | | foreach (var f in funs_RoomAll) |
| | | { |
| | | var sd = funs.Find((obj) => obj.shareTypeId == f.shareTypeId); |
| | | var sd = curResidenceShareData.Find((obj) => obj.shareTypeId == f.shareTypeId); |
| | | //如果该功能已经分享,不用分享 |
| | | if (null == sd) |
| | | { |
| | |
| | | { |
| | | //4.1管理最终的分享列表 |
| | | var funs_final = new List<ShareData>(); |
| | | funs_final.AddRange(funs); |
| | | funs_final.AddRange(curResidenceShareData); |
| | | //4.2移除删除的 |
| | | foreach (var share_d in funs_Del) |
| | | { |
| | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.FunctionSharingSucceeded), true); |
| | | memberInfo.CurResidenceShareDate = funs_final; |
| | | memberInfo.CurResidenceShareData = funs_final; |
| | | }); |
| | | Thread.Sleep(1600); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | //MainPage.BasePageView.RemoveAt(MainPage.BasePageView.ChildrenCount - 1); |
| | | MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); |
| | | refreshFunctionCount?.Invoke(funs_New.Count.ToString()); |
| | | refreshAction?.Invoke(); |
| | | }); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 管理房间分享操作 |
| | | /// funs_New 大于1分享房间 |
| | | /// </summary> |
| | | bool ManageRoomSharing() |
| | | { |
| | | bool success = false; |
| | | //1.管理最终属于房间的分享 |
| | | if (funs_RoomAll != null && funs_RoomAll.Count > 0) |
| | | { |
| | | //最终属于房间的分享大于0 |
| | | success = ShareRoom(); |
| | | if (success) |
| | | { |
| | | Utlis.WriteLine("添加房间分享成功"); |
| | | } |
| | | else |
| | | { |
| | | Utlis.WriteLine("添加房间分享失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | success = DeleteShareRoom(); |
| | | if (success) |
| | | { |
| | | Utlis.WriteLine("删除房间分享成功"); |
| | | } |
| | | else |
| | | { |
| | | Utlis.WriteLine("删除房间分享失败"); |
| | | } |
| | | } |
| | | return success; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 分享房间 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | |
| | | roomList.Add(new ShareData() |
| | | { |
| | | shareType = ShareType.ROOM.ToString(), |
| | | shareTypeId = room.roomId |
| | | shareTypeId = roomId |
| | | }); |
| | | List<string> childAccountIds = new List<string>(); |
| | | childAccountIds.Add(memberInfo.childAccountId); |
| | |
| | | roomList.Add(new ShareData() |
| | | { |
| | | shareType = ShareType.ROOM.ToString(), |
| | | shareTypeId = room.roomId |
| | | shareTypeId = roomId |
| | | }); |
| | | |
| | | var deleteShareObj = new DeleteShareObj() |
| | |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | btnChoose.IsSelected = !btnChoose.IsSelected; |
| | | var sd = funs.Find((obj) => obj.shareTypeId == function.deviceId); |
| | | var sd = curResidenceShareData.Find((obj) => obj.shareTypeId == function.deviceId); |
| | | if (btnChoose.IsSelected) |
| | | { |
| | | try |
| | | { |
| | | if (null != sd) |
| | | { |
| | | if (!funs_New.Contains(sd)) |
| | | if (!funs_RoomAll.Contains(sd)) |
| | | { |
| | | funs_New.Add(sd); |
| | | funs_RoomAll.Add(sd); |
| | | } |
| | | if (funs_Del.Contains(sd)) |
| | | { |
| | |
| | | var newSd = new ShareData(); |
| | | newSd.shareTypeId = function.deviceId; |
| | | |
| | | funs_New.Add(newSd); |
| | | funs_RoomAll.Add(newSd); |
| | | } |
| | | btnChooseAll.IsSelected = true; |
| | | foreach (var f in room.GetRoomFunctions(false)) |
| | | foreach (var f in roomFunctionList) |
| | | { |
| | | if (funs_New.Find((obj) => obj.shareTypeId == f.deviceId) == null) |
| | | if (funs_RoomAll.Find((obj) => obj.shareTypeId == f.deviceId) == null) |
| | | { |
| | | btnChooseAll.IsSelected = false; |
| | | break; |
| | |
| | | } |
| | | else |
| | | { |
| | | var onFuns = funs_New.Find((obj) => obj.shareTypeId == function.deviceId); |
| | | if (funs_New.Contains(onFuns)) |
| | | var onFuns = funs_RoomAll.Find((obj) => obj.shareTypeId == function.deviceId); |
| | | if (funs_RoomAll.Contains(onFuns)) |
| | | { |
| | | funs_New.Remove(onFuns); |
| | | funs_RoomAll.Remove(onFuns); |
| | | } |
| | | |
| | | if (null != sd) |
| | |
| | | { |
| | | btnChooseAll.IsSelected = !btnChooseAll.IsSelected; |
| | | funs_Del = new List<ShareData>(); |
| | | funs_New = new List<ShareData>(); |
| | | funs_RoomAll = new List<ShareData>(); |
| | | if (btnChooseAll.IsSelected) |
| | | { |
| | | foreach (var f in room.GetRoomFunctions(false)) |
| | | foreach (var f in roomFunctionList) |
| | | { |
| | | var ssdd = new ShareData(); |
| | | ssdd.shareTypeId = f.deviceId; |
| | | funs_New.Add(ssdd); |
| | | funs_RoomAll.Add(ssdd); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | foreach (var f in room.GetRoomFunctions(false)) |
| | | foreach (var f in roomFunctionList) |
| | | { |
| | | var sd = funs.Find((obj) => obj.shareTypeId == f.deviceId); |
| | | var sd = curResidenceShareData.Find((obj) => obj.shareTypeId == f.deviceId); |
| | | if (sd != null) |
| | | { |
| | | funs_Del.Add(sd); |
| | | } |
| | | } |
| | | } |
| | | LoadFunctionRow(funs_New); |
| | | LoadFunctionRow(funs_RoomAll); |
| | | }; |
| | | btnChooseAll.MouseUpEventHandler = eventHandler; |
| | | allRoomView.MouseUpEventHandler = eventHandler; |
| | |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | IsBold = true, |
| | | Text = memberInfo.nickName |
| | | //Text = memberInfo.UserName, |
| | | Text = HDLCommon.Current.GetUserName(memberInfo.memberName) |
| | | }; |
| | | view1.AddChidren(btnMemberName); |
| | | |
| | |
| | | //设置用户昵称 |
| | | if (string.IsNullOrEmpty(mInfo.nickName)) |
| | | { |
| | | mInfo.nickName = mInfo.UserName; |
| | | mInfo.nickName = mInfo.memberName; |
| | | } |
| | | //设置用户头像路径 |
| | | CheckIfDownloadHeadImage(mInfo); |
| | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | }; |
| | | new PublicAssmebly().LoadDialog_EditParater(StringId.ModifyMemberNickname, mInfo.nickName, callBack, StringId.HouseNameCannotBeEmpty, 0, new List<string>()); |
| | | new PublicAssmebly().LoadDialog_EditParater(StringId.ModifyMemberNickname, mInfo.nickName, callBack, StringId.NicknameCannotBeEmpty, 0, new List<string>()); |
| | | }; |
| | | btn1.MouseUpEventHandler = eventHandler; |
| | | btn2.MouseUpEventHandler = eventHandler; |
| | |
| | | using HDL_ON.Entity; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.DAL; |
| | | using HDL_ON.DAL.Server; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | | /// <summary> |
| | | /// 使用权限页面 |
| | | /// 成员权限管理页面 |
| | | /// </summary> |
| | | public partial class MemberPermissionPage : FrameLayout |
| | | { |
| | |
| | | public void LoadPage() |
| | | { |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.PermissionToUse)).LoadTopView(); |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.MemberPermissionManagement)).LoadTopView(); |
| | | |
| | | FrameLayout headPortraitView = new FrameLayout() |
| | | { |
| | |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | Text = memberInfo.nickName + "(" + memberInfo.Account + ")", |
| | | //Text = memberInfo.nickName + "(" + memberInfo.UserName + ")", |
| | | }; |
| | | headPortraitView.AddChidren(btnMemberName); |
| | | string username = HDLCommon.Current.GetUserName(memberInfo.memberName); |
| | | btnMemberName.Text = memberInfo.nickName + "(" + username + ")"; |
| | | |
| | | #region RoomList |
| | | roomListView = new VerticalScrolViewLayout() |
| | |
| | | var btnLine = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Y = btnTitle.Bottom, |
| | | Y = titleView.Height - Application.GetRealHeight(2), |
| | | Width = Application.GetRealWidth(360), |
| | | Height = Application.GetRealHeight(1), |
| | | BackgroundColor = CSS_Color.DividingLineColor, |
| | | }; |
| | | roomListView.AddChidren(btnLine); |
| | | titleView.AddChidren(btnLine); |
| | | |
| | | //--------------------------------------------- |
| | | //var roomListView = new VerticalScrolViewLayout() |
| | | //{ |
| | | // Y = btnLine.Bottom, |
| | | // Height = Application.GetRealHeight(440), |
| | | //}; |
| | | //contentView.AddChidren(roomListView); |
| | | //未分配区域的功能 |
| | | List<Function> allFunctionList = FunctionList.List.GetDeviceFunctionList(); |
| | | //未分配区域的功能 |
| | | List<Function> unallocatedList = new List<Function>(); |
| | | // |
| | | foreach (var function in allFunctionList) |
| | | { |
| | | function.roomIds.Remove(null); |
| | | if (function.roomIds.Count > 0) |
| | | { |
| | | //allocatedList.Add(function); |
| | | } |
| | | else |
| | | { |
| | | unallocatedList.Add(function); |
| | | } |
| | | } |
| | | |
| | | //List<Function> funss = new List<Function>(); |
| | | //if (memberInfo.CurResidenceShareDate.Count > 0) |
| | | //{ |
| | | // foreach (var sd in memberInfo.CurResidenceShareDate) |
| | | // { |
| | | // funss.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<ShareData>(System.Text.Encoding.UTF8.GetString(sd.ShareDataBytes))); |
| | | // } |
| | | //} |
| | | //移除当前住宅已经不存在的功能 |
| | | for (int i = 0; i < memberInfo.CurResidenceShareData.Count;) |
| | | { |
| | | var sd = memberInfo.CurResidenceShareData[i]; |
| | | if (allFunctionList.Find((obj) => obj.deviceId == sd.shareTypeId) == null) |
| | | { |
| | | //new DAL.Server.HttpServerRequest().DeleteShareData(sd); |
| | | //待确认是否同步云端删除分享 |
| | | memberInfo.CurResidenceShareData.Remove(sd); |
| | | } |
| | | else |
| | | { |
| | | i++; |
| | | } |
| | | } |
| | | |
| | | try |
| | | { |
| | | //遍历加载房间分享个数统计状态RowLayout |
| | | foreach (var room in SpatialInfo.CurrentSpatial.RoomList) |
| | | { |
| | | var roomView = new FrameLayout() |
| | | AddRoomFunctionRowLayout(room); |
| | | } |
| | | //2020-12-16 加载未分配区域功能RowLayout |
| | | AddNoAreaFunctionRowLayout(unallocatedList); |
| | | } |
| | | catch |
| | | { |
| | | Utlis.WriteLine("AddRoomFunctionRowLayout error"); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加房间分享个数统计状态的RowLayout |
| | | /// </summary> |
| | | /// <param name="mRoom"></param> |
| | | void AddRoomFunctionRowLayout(Room mRoom) |
| | | { |
| | | ShowBaseRoomFunOrNoAreaFunRowLayout(mRoom, null); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加未分配区域功能 的个数统计状态的RowLayout |
| | | /// </summary> |
| | | /// <param name="unallocatedList">未分配的所有功能列表</param> |
| | | void AddNoAreaFunctionRowLayout(List<Function> unallocatedList) |
| | | { |
| | | ShowBaseRoomFunOrNoAreaFunRowLayout(null, unallocatedList); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 2020-12-17 重新调整 |
| | | /// 添加房间分享或者无区域分配 个数统计状态的RowLayout |
| | | /// </summary> |
| | | /// <param name="room">如果房间为空,代表管理无分配区域</param> |
| | | /// <param name="unallocatedList">管理无分配区域才有效</param> |
| | | void ShowBaseRoomFunOrNoAreaFunRowLayout(Room mRoom, List<Function> unallocatedList) |
| | | { |
| | | /// 当前房间或者无分配区域分享列表 |
| | | List<ShareData> funs_RoomAll = new List<ShareData>(); |
| | | /// <summary> |
| | | /// 房间或者无分配区域所有功能列表 |
| | | /// </summary> |
| | | List<Function> roomFunctionList = new List<Function>(); |
| | | /// 房间ID |
| | | string roomId = ""; |
| | | |
| | | var roomView = new RowLayout() |
| | | { |
| | | Height = Application.GetRealWidth(50), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | LineColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | roomListView.AddChidren(roomView); |
| | | |
| | |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | Text = room.roomName, |
| | | //Text = room.roomName, |
| | | }; |
| | | roomView.AddChidren(btnRoomName); |
| | | |
| | | //计算已经加入房间的设备数量 |
| | | int addCount = 0; |
| | | foreach (var sd in memberInfo.CurResidenceShareDate) |
| | | { |
| | | if (room.GetRoomFunctions(false).Find((obj) => obj.deviceId == sd.shareTypeId) != null) |
| | | { |
| | | addCount++; |
| | | } |
| | | } |
| | | //移除当前住宅已经不存在的功能 |
| | | for (int i = 0; i < memberInfo.CurResidenceShareDate.Count;) |
| | | { |
| | | var sd = memberInfo.CurResidenceShareDate[i]; |
| | | if (FunctionList.List.GetDeviceFunctionList().Find((obj) => obj.deviceId == sd.shareTypeId) == null) |
| | | { |
| | | //new DAL.Server.HttpServerRequest().DeleteShareData(sd); |
| | | memberInfo.CurResidenceShareDate.Remove(sd); |
| | | } |
| | | else |
| | | { |
| | | i++; |
| | | } |
| | | } |
| | | |
| | | |
| | | var btnFunctionCount = new Button() |
| | | { |
| | |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, |
| | | Text = addCount + "/" + room.GetRoomFunctions(false).Count.ToString(), |
| | | //Text = addCount + "/" + room.GetRoomFunctions(false).Count.ToString(), |
| | | }; |
| | | roomView.AddChidren(btnFunctionCount); |
| | | |
| | |
| | | }; |
| | | roomView.AddChidren(btnRight); |
| | | |
| | | //如果房间为空,代表管理无分配区域 |
| | | if (mRoom != null) |
| | | { |
| | | //显示房间名 |
| | | btnRoomName.Text = mRoom.roomName; |
| | | roomFunctionList = mRoom.GetRoomFunctions(false); |
| | | roomId = mRoom.roomId; |
| | | //添加分割线 |
| | | var lineView = new LineView(roomView.Height - Application.GetRealHeight(1)); |
| | | roomView.AddChidren(lineView); |
| | | } |
| | | else |
| | | { |
| | | //显示无区域功能 |
| | | btnRoomName.TextID = StringId.NoAreaFunction; |
| | | roomFunctionList = unallocatedList; |
| | | roomId = null; |
| | | } |
| | | |
| | | //删除按钮 |
| | | var deleteBtn = new Button() |
| | | { |
| | | TextID = StringId.Del, |
| | | BackgroundColor = CSS_Color.AuxiliaryColor2, |
| | | TextColor = CSS_Color.MainBackgroundColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | }; |
| | | roomView.AddRightView(deleteBtn); |
| | | deleteBtn.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | //一键删除所有分享 |
| | | DeleteRoomAllShare(funs_RoomAll, roomFunctionList, roomId, btnFunctionCount, roomView); |
| | | }; |
| | | |
| | | //计算已经加入房间的设备数量的Action事件 |
| | | Action RefreshAction = () => { |
| | | funs_RoomAll = new List<ShareData>(); |
| | | int addCount = 0; |
| | | foreach (var sd in memberInfo.CurResidenceShareData) |
| | | { |
| | | if (roomFunctionList.Find((obj) => obj.deviceId == sd.shareTypeId) != null) |
| | | { |
| | | addCount++; |
| | | funs_RoomAll.Add(sd); |
| | | } |
| | | } |
| | | btnFunctionCount.Text = addCount + "/" + roomFunctionList.Count.ToString(); |
| | | //Utlis.WriteLine("刷新成功"); |
| | | }; |
| | | //点击调整事件 |
| | | EventHandler<MouseEventArgs> eHandler = (sender, e) => |
| | | { |
| | | Action<string> refreshFunctionCount = (newCount) => { |
| | | btnFunctionCount.Text = newCount + "/" + room.GetRoomFunctions(false).Count.ToString(); |
| | | }; |
| | | var mmp = new MemberFunctionPermissionPage(memberInfo, room, refreshFunctionCount); |
| | | var mmp = new MemberFunctionPermissionPage(memberInfo, roomFunctionList, funs_RoomAll, roomId, RefreshAction); |
| | | MainPage.BasePageView.AddChidren(mmp); |
| | | mmp.LoadPage(StringId.PermissionToUse); |
| | | mmp.LoadPage(StringId.MemberPermissionManagement); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | roomView.MouseUpEventHandler = eHandler; |
| | |
| | | btnRight.MouseUpEventHandler = eHandler; |
| | | btnFunctionCount.MouseUpEventHandler = eHandler; |
| | | |
| | | if (SpatialInfo.CurrentSpatial.RoomList.IndexOf(room) < SpatialInfo.CurrentSpatial.RoomList.Count - 2) |
| | | { |
| | | var btnRoomLine = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Y = Application.GetRealWidth(49), |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealWidth(1), |
| | | BackgroundColor = CSS_Color.DividingLineColor, |
| | | }; |
| | | roomView.AddChidren(btnRoomLine); |
| | | } |
| | | RefreshAction?.Invoke(); |
| | | } |
| | | |
| | | //if (DB_ResidenceData.rooms.Count > 10) |
| | | //{ |
| | | // roomListView.ScrollEnabled = true; |
| | | //} |
| | | //else |
| | | //{ |
| | | // roomListView.ScrollEnabled = false; |
| | | |
| | | // roomListView.AddChidren(new Button() |
| | | // { |
| | | // Height = Application.GetRealWidth(441), |
| | | // BackgroundColor = CSS_Color.BackgroundColor, |
| | | // }); |
| | | //} |
| | | } |
| | | } |
| | | } |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Threading; |
| | | using HDL_ON.DAL.Server; |
| | | using HDL_ON.Entity; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.UI |
| | |
| | | { |
| | | Action action = () => |
| | | { |
| | | var responePack = new HttpServerRequest().DeleteResidenceMemberAccount(memberInfo); |
| | | if (responePack.Code == StateCode.SUCCESS) |
| | | { |
| | | this.RemoveFromParent(); |
| | | backAction(); |
| | | } |
| | | RemoveTheMember(); |
| | | }; |
| | | new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.ConfirmToRemoveTheMember, action); |
| | | }; |
| | |
| | | if(responePack.Data != null) |
| | | { |
| | | var responeObj = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ShareData>>(responePack.Data.ToString()); |
| | | memberInfo.CurResidenceShareDate = responeObj; |
| | | memberInfo.CurResidenceShareData = responeObj; |
| | | } |
| | | else |
| | | { |
| | | memberInfo.CurResidenceShareDate = new List<ShareData>(); |
| | | memberInfo.CurResidenceShareData = new List<ShareData>(); |
| | | } |
| | | |
| | | Application.RunOnMainThread(() => |
| | |
| | | } |
| | | else |
| | | { |
| | | memberInfo.CurResidenceShareDate = new List<ShareData>(); |
| | | memberInfo.CurResidenceShareData = new List<ShareData>(); |
| | | IMessageCommon.Current.ShowErrorInfoAlter(responePack.Code); |
| | | } |
| | | } |
| | |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 删除子账号 |
| | | /// </summary> |
| | | void RemoveTheMember() |
| | | { |
| | | var waitPage = new Loading(); |
| | | bodyView.AddChidren(waitPage); |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | var responePack = new HttpServerRequest().DeleteResidenceMemberAccount(memberInfo); |
| | | if (responePack.Code == StateCode.SUCCESS) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | this.RemoveFromParent(); |
| | | backAction(); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | IMessageCommon.Current.ShowErrorInfoAlter(responePack.Code); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (waitPage != null) |
| | | { |
| | | waitPage.RemoveFromParent(); |
| | | waitPage = null; |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 一键删除当前房间所有分享 |
| | | /// </summary> |
| | | /// <param name="funs_Del">需要一键删除的分享数据</param> |
| | | /// <param name="roomFunctionList">当前房间所有功能列表</param> |
| | | /// <param name="roomId">如果房间ID为空,则代表管理无分配区域的功能,不需要删除房间分享</param> |
| | | /// <param name="btnFunctionCount">个数统计数量</param> |
| | | /// <param name="roomView">背景View</param> |
| | | void DeleteRoomAllShare(List<ShareData> funs_Del, List<Function> roomFunctionList, string roomId, Button btnFunctionCount, RowLayout roomView) |
| | | { |
| | | //需要删除的分享为0 |
| | | if (funs_Del == null || funs_Del.Count == 0) |
| | | { |
| | | //关闭右滑菜单 |
| | | roomView.HideMenu(); |
| | | Utlis.ShowTip(Language.StringByID(StringId.NoShare)); |
| | | return; |
| | | } |
| | | |
| | | var waitPage = new Loading(); |
| | | bodyView.AddChidren(waitPage); |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | |
| | | new Thread(() => |
| | | { |
| | | try |
| | | { |
| | | bool result = false; |
| | | //如果房间ID为空,则代表管理无分配区域的功能,不需要删除房间分享 |
| | | if (!string.IsNullOrEmpty(roomId)) |
| | | { |
| | | //删除房间分享 |
| | | var success = DeleteShareRoom(roomId); |
| | | if (success) |
| | | { |
| | | Utlis.WriteLine("删除房间分享成功"); |
| | | } |
| | | else |
| | | { |
| | | Utlis.WriteLine("删除房间分享失败"); |
| | | } |
| | | } |
| | | |
| | | //2.批量删除分享 |
| | | var deleteShareObj = new DeleteShareObj() |
| | | { |
| | | shareDatas = funs_Del, |
| | | homeId = DB_ResidenceData.Instance.CurrentRegion.RegionID, |
| | | }; |
| | | result = LoadMethod_DelSharedData(deleteShareObj); |
| | | |
| | | if (!result) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.delFail), true); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | //删除分享成功 |
| | | //4.1管理最终的分享列表 |
| | | var funs_final = new List<ShareData>(); |
| | | funs_final.AddRange(memberInfo.CurResidenceShareData); |
| | | //4.2移除删除的 |
| | | foreach (var share_d in funs_Del) |
| | | { |
| | | var sd = funs_final.Find((obj) => obj.shareTypeId == share_d.shareTypeId); |
| | | //如果该功能已经分享,不用分享 |
| | | if (null != sd) |
| | | { |
| | | funs_final.Remove(share_d); |
| | | } |
| | | } |
| | | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.SavedSuccessfully), true); |
| | | //清空 |
| | | funs_Del.Clear(); |
| | | memberInfo.CurResidenceShareData = funs_final; |
| | | btnFunctionCount.Text = 0 + "/" + roomFunctionList.Count.ToString(); |
| | | //关闭右滑菜单 |
| | | roomView.HideMenu(); |
| | | }); |
| | | |
| | | } |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (waitPage != null) |
| | | { |
| | | waitPage.RemoveFromParent(); |
| | | waitPage = null; |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 删除房间分享 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | bool DeleteShareRoom(string roomId) |
| | | { |
| | | var roomList = new List<ShareData>(); |
| | | roomList.Add(new ShareData() |
| | | { |
| | | shareType = ShareType.ROOM.ToString(), |
| | | shareTypeId = roomId |
| | | }); |
| | | |
| | | var deleteShareObj = new DeleteShareObj() |
| | | { |
| | | shareDatas = roomList, |
| | | homeId = DB_ResidenceData.Instance.CurrentRegion.RegionID, |
| | | }; |
| | | var responePack = new HttpServerRequest().DeleteShareData(deleteShareObj); |
| | | if (responePack.Code != StateCode.SUCCESS) |
| | | { |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 删除共享数据点击事件 |
| | | /// </summary> |
| | | /// <param name="function"></param> |
| | | bool LoadMethod_DelSharedData(DeleteShareObj sd) |
| | | { |
| | | var responePack = new HttpServerRequest().DeleteShareData(sd); |
| | | if (responePack.Code != StateCode.SUCCESS) |
| | | { |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, |
| | | Text = DB_ResidenceData.Instance.CurrentRegion.Name, |
| | | IsBold = true |
| | | }; |
| | | residenceInfoView.AddChidren(btnCurResidenceName); |
| | | |