| | |
| | | /// </summary>
|
| | | private FrameLayout frameTable = null;
|
| | | /// <summary>
|
| | | /// 列表控件
|
| | | /// 列表控件(白色背景)
|
| | | /// </summary>
|
| | | private VerticalListControl listView = null;
|
| | | private FrameListControl listView = null;
|
| | | /// <summary>
|
| | | /// 整个界面的上下滑动控件
|
| | | /// </summary>
|
| | | private VerticalFrameControl listBackContr = null;
|
| | | /// <summary>
|
| | | /// 楼层顺序
|
| | | /// </summary>
|
| | |
| | | //清空bodyFrame
|
| | | this.ClearBodyFrame();
|
| | |
|
| | | //整个界面的上下滑动控件
|
| | | this.listBackContr = new VerticalFrameControl();
|
| | | listBackContr.Height = bodyFrameLayout.Height;
|
| | | bodyFrameLayout.AddChidren(listBackContr);
|
| | |
|
| | | //住宅行
|
| | | var rowHome = new RowLayoutControl();
|
| | | rowHome.Height = Application.GetRealHeight(173);
|
| | | rowHome.BackgroundColor = UserCenterColor.Current.White;
|
| | | bodyFrameLayout.AddChidren(rowHome);
|
| | | listBackContr.frameTable.AddChidren(rowHome);
|
| | | rowHome.frameTable.UseClickStatu = false;
|
| | |
|
| | | var btnAdreeIcon = rowHome.frameTable.AddLeftIcon(81);
|
| | |
| | | }
|
| | | //经纬度
|
| | | var btnLocation = rowHome.frameTable.AddMostRightView(string.Empty, 500);
|
| | | btnLocation.Text = this.GetLatitudeAndLongitudeText(Common.Config.Instance.Home.Longitude, Common.Config.Instance.Home.Latitude);
|
| | | btnLocation.Text = Common.Config.Instance.Home.ResidenceAddressName;
|
| | |
|
| | | //主人或者管理员才会出现这个菜单
|
| | | if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
|
| | |
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //保存住宅地址
|
| | | this.SaveResidenceAdrress(btnLocation, mLatitude, mLongitude);
|
| | | this.SaveResidenceAdrress(btnLocation, mLatitude, mLongitude, name);
|
| | | });
|
| | | }, Language.StringByID(R.MyInternationalizationString.uSelectAdrress), true, latitude, longitude, 100);
|
| | | }, |
| | | Language.StringByID(R.MyInternationalizationString.uSelectAdrress),
|
| | | Language.StringByID(R.MyInternationalizationString.uSave),
|
| | | true, latitude, longitude, 100);
|
| | | };
|
| | | }
|
| | |
|
| | |
| | | //初始化桌布
|
| | | this.frameTable = new FrameLayout();
|
| | | frameTable.Y = rowHome.Bottom + Application.GetRealHeight(23);
|
| | | frameTable.Height = bodyFrameLayout.Height - rowHome.Bottom - Application.GetRealHeight(23);
|
| | | bodyFrameLayout.AddChidren(frameTable);
|
| | | frameTable.Height = listBackContr.frameTable.Height - rowHome.Bottom - Application.GetRealHeight(23);
|
| | | listBackContr.frameTable.AddChidren(frameTable);
|
| | |
|
| | | //根据指定模式,初始化桌布控件
|
| | | this.InitFrameTableByMode();
|
| | |
| | | frameFloor.UseClickStatu = false;
|
| | | frameFloor.Height = Application.GetRealHeight(115);
|
| | | frameFloor.BackgroundColor = UserCenterColor.Current.White;
|
| | | frameTable.AddChidren(frameFloor);
|
| | | this.frameTable.AddChidren(frameFloor);
|
| | |
|
| | | //楼层
|
| | | var btnFloor = frameFloor.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uFloor), 200, 60);
|
| | |
| | | btnFloor.TextSize = 15;
|
| | | frameFloor.AddChidren(btnFloor, ChidrenBindMode.NotBind);
|
| | |
|
| | | listView = new VerticalListControl(29);
|
| | | listView = new FrameListControl(29);
|
| | | listView.BackgroundColor = UserCenterColor.Current.White;
|
| | | listView.Y = frameFloor.Bottom;
|
| | | listView.Height = frameTable.Height - frameFloor.Bottom;
|
| | | frameTable.AddChidren(listView);
|
| | | this.frameTable.AddChidren(listView);
|
| | |
|
| | | //初始化楼层行
|
| | | this.InitFloorRow();
|
| | |
| | | this.AddFloorRow(keys, dicFloor[keys], i != count);
|
| | | }
|
| | | //调整控件高度
|
| | | listView.AdjustRealHeight(Application.GetRealHeight(23));
|
| | | this.AdjustContrlTableHeight();
|
| | | });
|
| | | }
|
| | |
|
| | |
| | | private void AddFloorRow(string keys, string floorName, bool addLine)
|
| | | {
|
| | | var frameRow = new RowLayoutControl(listView.rowSpace / 2);
|
| | | frameRow.MainKeys = keys;
|
| | | this.listView.AddChidren(frameRow);
|
| | | //图标
|
| | | var btnIcon = frameRow.frameTable.AddLeftIcon(81);
|
| | |
| | | if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
|
| | | {
|
| | | //更改
|
| | | var btnChanged = new NormalViewControl(Application.GetRealWidth(184), frameRow.Height, false);
|
| | | btnChanged.BackgroundColor = 0xff4a4a4a;
|
| | | btnChanged.TextSize = 12;
|
| | | btnChanged.TextColor = UserCenterColor.Current.White;
|
| | | btnChanged.TextAlignment = TextAlignment.Center;
|
| | | var btnChanged = frameRow.AddEditorControl();
|
| | | btnChanged.TextID = R.MyInternationalizationString.uChanged1;
|
| | | frameRow.AddRightView(btnChanged);
|
| | | btnChanged.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //创建或者编辑楼层
|
| | |
| | | Common.Config.Instance.Home.CurrentFloorId = floorId;
|
| | | break;
|
| | | }
|
| | | //删除当前楼层的话,需要去刷新主页左边的房间列表
|
| | | HdlRoomLogic.Current.RefreshRoomListView();
|
| | | }
|
| | | var listDeleteId = new List<string>();
|
| | | var listAllRoom = HdlRoomLogic.Current.GetAllListRooms();
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | bool canMove = false;
|
| | | for (int i = 0; i < listView.ChildrenCount; i++)
|
| | | {
|
| | | var myRow = listView.GetChildren(i) as RowLayoutControl;
|
| | | if (myRow != null && myRow.MainKeys == keys)
|
| | | {
|
| | | canMove = true;
|
| | | continue;
|
| | | }
|
| | | if (canMove == true)
|
| | | {
|
| | | //它之后的行,全部往上移
|
| | | myRow.Y -= frameRow.Height;
|
| | | }
|
| | | }
|
| | | frameRow.RemoveFromParent();
|
| | | listView.AdjustRealHeight(Application.GetRealHeight(23));
|
| | | //调整桌布高度
|
| | | this.AdjustContrlTableHeight();
|
| | | }
|
| | | });
|
| | | };
|
| | |
| | | //按下确认按钮
|
| | | dialogForm.ComfirmClickEvent += ((textValue) =>
|
| | | {
|
| | | //还原左右菜单
|
| | | frameRow?.HideMenu();
|
| | |
|
| | | if (this.CheckFloorName(keys, textValue) == false)
|
| | | {
|
| | | //楼层名称检测
|
| | |
| | | }
|
| | | //画面关闭
|
| | | dialogForm.CloseDialog();
|
| | | //还原左右菜单
|
| | | frameRow?.HideMenu();
|
| | | if (floorName != textValue)
|
| | | {
|
| | | //编辑或者创建楼层名称
|
| | |
| | | if (Common.Config.Instance.Home.CurrentFloorId == string.Empty)
|
| | | {
|
| | | Common.Config.Instance.Home.CurrentFloorId = keys;
|
| | | //创建第一个新的楼层的话,需要去刷新主页左边的房间列表
|
| | | HdlRoomLogic.Current.RefreshRoomListView();
|
| | | }
|
| | | if (btnFloor != null)
|
| | | {
|
| | |
| | | btnRoomList.TextSize = 15;
|
| | | frameRoom.AddChidren(btnRoomList, ChidrenBindMode.NotBind);
|
| | |
|
| | | listView = new VerticalListControl(29);
|
| | | listView = new FrameListControl(29);
|
| | | listView.BackgroundColor = UserCenterColor.Current.White;
|
| | | listView.Y = frameRoom.Bottom;
|
| | | listView.Height = frameTable.Height - frameRoom.Bottom;
|
| | |
| | | //添加房间行
|
| | | this.AddRoomRow(listRoom[i], i != listRoom.Count - 1);
|
| | | }
|
| | | //调整控件真实高度
|
| | | listView.AdjustRealHeight(Application.GetRealHeight(23));
|
| | | //调整桌布高度
|
| | | this.AdjustContrlTableHeight();
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | private void AddRoomRow(Common.Room room, bool addLine)
|
| | | {
|
| | | var frameRow = new RowLayoutControl(listView.rowSpace / 2);
|
| | | frameRow.MainKeys = room.Id;
|
| | | listView.AddChidren(frameRow);
|
| | | //图标
|
| | | var btnIcon = frameRow.frameTable.AddLeftIcon(81);
|
| | |
| | | var btnEditor = frameRow.AddEditorControl();
|
| | | btnEditor.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //关闭左右菜单
|
| | | frameRow.HideMenu();
|
| | | var form = new EditorRoomInforForm();
|
| | | form.AddForm(room);
|
| | | form.FinishEditorEvent += (roomName) =>
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | bool canMove = false;
|
| | | for (int i = 0; i < listView.ChildrenCount; i++)
|
| | | {
|
| | | var myRow = listView.GetChildren(i) as RowLayoutControl;
|
| | | if (myRow != null && myRow.MainKeys == room.Id)
|
| | | {
|
| | | canMove = true;
|
| | | continue;
|
| | | }
|
| | | if (canMove == true)
|
| | | {
|
| | | //它之后的行,全部往上移
|
| | | myRow.Y -= frameRow.Height;
|
| | | }
|
| | | }
|
| | | frameRow.RemoveFromParent();
|
| | | listView.AdjustRealHeight(Application.GetRealHeight(23));
|
| | | //调整桌布高度
|
| | | this.AdjustContrlTableHeight();
|
| | | }
|
| | | });
|
| | | };
|
| | |
| | | //开启进度条
|
| | | this.ShowProgressBar();
|
| | |
|
| | | var Pra = new DeleteResidencePra();
|
| | | Pra.HomeId = Common.Config.Instance.Home.Id;
|
| | | Pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
|
| | |
|
| | | bool result = await UserCenterLogic.GetResultStatuByRequestHttps("App/DelHome", true, Pra);
|
| | | if (result == false)
|
| | | if (Common.Config.Instance.Home.IsOthreShare == false)
|
| | | {
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | | return;
|
| | | //删除主人自己的住宅
|
| | | var Pra = new DeleteResidencePra();
|
| | | Pra.HomeId = Common.Config.Instance.Home.Id;
|
| | | Pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
|
| | |
|
| | | bool result = await UserCenterLogic.GetResultStatuByRequestHttps("App/DelHome", true, Pra);
|
| | | if (result == false)
|
| | | {
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | | return;
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | //删除分享的住宅
|
| | | var Pra2 = new
|
| | | {
|
| | | HomeId = Common.Config.Instance.Home.Id,
|
| | | PrimaryUserId = Common.Config.Instance.Home.MainUserDistributedMark
|
| | | };
|
| | | bool result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/SubAccountDelShareHome", false, Pra2);
|
| | | if (result == false)
|
| | | {
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | | return;
|
| | | }
|
| | | }
|
| | |
|
| | | //因为删除的是当前的住宅,所以需要先切换到别的住宅
|
| | |
| | | /// <param name="btnLocation">显示控件</param>
|
| | | /// <param name="latitude">纬度</param>
|
| | | /// <param name="longitude">经度</param>
|
| | | private async void SaveResidenceAdrress(NormalViewControl btnLocation, double latitude, double longitude)
|
| | | /// <param name="addresName">位置名称</param>
|
| | | private async void SaveResidenceAdrress(NormalViewControl btnLocation, double latitude, double longitude, string addresName)
|
| | | {
|
| | | //开启进度条
|
| | | this.ShowProgressBar();
|
| | |
| | | //保存缓存
|
| | | Common.Config.Instance.Home.Longitude = longitude;
|
| | | Common.Config.Instance.Home.Latitude = latitude;
|
| | | Common.Config.Instance.Home.ResidenceAddressName = addresName;
|
| | | Common.Config.Instance.Home.Save();
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | btnLocation.Text = this.GetLatitudeAndLongitudeText(longitude, latitude);
|
| | | btnLocation.Text = addresName;
|
| | | });
|
| | | }
|
| | |
|
| | |
| | | {
|
| | | //请输入住宅名称
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uPleaseInputFloorName);
|
| | | this.ShowMassage(ShowMsgType.Error, msg);
|
| | | this.ShowMassage(ShowMsgType.Tip, msg);
|
| | | return false;
|
| | | }
|
| | | foreach (string floorKeys in Common.Config.Instance.Home.FloorDics.Keys)
|
| | |
| | | {
|
| | | //楼层名称已经存在
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uFloorNameIsExist);
|
| | | this.ShowMassage(ShowMsgType.Error, msg);
|
| | | this.ShowMassage(ShowMsgType.Tip, msg);
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 获取经纬度的翻译名字
|
| | | /// 调整控件桌布高度
|
| | | /// </summary>
|
| | | /// <param name="Longitude">经度</param>
|
| | | /// <param name="Latitude">纬度</param>
|
| | | /// <returns></returns>
|
| | | private string GetLatitudeAndLongitudeText(double Longitude, double Latitude)
|
| | | private void AdjustContrlTableHeight()
|
| | | {
|
| | | string value1 = string.Empty;
|
| | | string value2 = string.Empty;
|
| | | if (Longitude == 0)
|
| | | {
|
| | | //默认东经
|
| | | value1 = "0°00'E";
|
| | | }
|
| | | else if (Longitude > 0)
|
| | | {
|
| | | //东经
|
| | | value1 = Math.Round(Longitude, 2).ToString().Replace(".", "°") + "'E";
|
| | | }
|
| | | else if (Longitude < 0)
|
| | | {
|
| | | //西经
|
| | | value1 = Math.Round(-Longitude, 2).ToString().Replace(".", "°") + "'W";
|
| | | }
|
| | |
|
| | | if (Latitude == 0)
|
| | | {
|
| | | //默认北纬
|
| | | value2 = "0°00'N";
|
| | | }
|
| | | else if (Latitude > 0)
|
| | | {
|
| | | //北纬
|
| | | value2 = Math.Round(Latitude, 2).ToString().Replace(".", "°") + "'N";
|
| | | }
|
| | | else if (Latitude < 0)
|
| | | {
|
| | | //南纬
|
| | | value2 = Math.Round(-Latitude, 2).ToString().Replace(".", "°") + "'S";
|
| | | }
|
| | | return value1 + " " + value2;
|
| | | //调整桌布高度
|
| | | listView.AdjustRealHeight(Application.GetRealHeight(23));
|
| | | this.frameTable.Height = listView.Bottom;
|
| | | this.listBackContr.AdjustTableHeight();
|
| | | }
|
| | |
|
| | | #endregion
|