| | |
| | | using Shared; |
| | | namespace HDL_ON.UI |
| | | { |
| | | public class CatchSceneAddPage : FrameLayout |
| | | public partial class CatchSceneAddPage : FrameLayout |
| | | { |
| | | FrameLayout bodyView; |
| | | private ImageView addSceneImageView; |
| | |
| | | private Button btnChooseZoneViewTitle; |
| | | private VerticalScrolViewLayout functionListView; |
| | | private Button btnComplete; |
| | | /// <summary> |
| | | /// 捕捉的区域列表 |
| | | /// </summary> |
| | | private List<Room> catchRooms = new List<Room>(); |
| | | |
| | | Button btnAddFunctionTitle; |
| | | |
| | | |
| | | #region 图标选择部分图标 |
| | | /// <summary> |
| | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 捕捉的区域列表 |
| | | /// </summary> |
| | | private List<Room> catchRooms = new List<Room>(); |
| | | |
| | | /// <summary> |
| | | /// 回调更新 |
| | | /// </summary> |
| | |
| | | RemoveFromParent(); |
| | | }; |
| | | } |
| | | |
| | | |
| | | public void LoadPage() |
| | | { |
| | |
| | | |
| | | //2020-12-03 修改图片加载方法 |
| | | ImageUtlis.Current.LoadLocalOrNetworkImages(scene.ImagePath, addSceneImageView); |
| | | |
| | | /// <summary> |
| | | /// 修改场景背景事件 |
| | | /// </summary> |
| | | addSceneImageView.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | LoadPictureOptionView(); |
| | | }; |
| | | |
| | | #region 场景名称row |
| | | sceneNameView = new FrameLayout() |
| | |
| | | BackgroundColor = CSS_Color.BackgroundColor, |
| | | }); |
| | | #endregion |
| | | #region 场景延时row |
| | | /* |
| | | if (DB_ResidenceData.Instance.GatewayType == 1) |
| | | { |
| | | FrameLayout sceneDelayRow = new FrameLayout() |
| | | { |
| | | Y = sceneNameView.Bottom, |
| | | Height = Application.GetRealWidth(50), |
| | | }; |
| | | contentView.AddChidren(sceneDelayRow); |
| | | |
| | | Button btnSceneDelayRight = new Button() |
| | | { |
| | | X = Application.GetRealWidth(339), |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetMinRealAverage(16), |
| | | Height = Application.GetMinRealAverage(16), |
| | | UnSelectedImagePath = "Public/Right.png", |
| | | }; |
| | | sceneDelayRow.AddChidren(btnSceneDelayRight); |
| | | |
| | | var btnSceneDelayInfo = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(327), |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = scene.GetDelayText() |
| | | }; |
| | | sceneDelayRow.AddChidren(btnSceneDelayInfo); |
| | | |
| | | Button btnSceneDelayTitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | //Width = Application.GetRealWidth(90), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextID = StringId.SceneDelay, |
| | | }; |
| | | sceneDelayRow.AddChidren(btnSceneDelayTitle); |
| | | |
| | | btnSceneDelayTitle.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | Action<string> action = (obj) => { |
| | | scene.delay = obj; |
| | | btnSceneDelayInfo.Text = scene.GetDelayText(); |
| | | }; |
| | | Dictionary<string, string> items = new Dictionary<string, string>(); |
| | | items.Add("30", "30s"); |
| | | items.Add("60", "1min"); |
| | | items.Add("120", "2min"); |
| | | items.Add("300", "5min"); |
| | | new PublicAssmebly().SetSceneDelayDialog(items, action, scene.delay); |
| | | }; |
| | | |
| | | contentView.AddChidren(new Button() |
| | | { |
| | | Y = sceneDelayRow.Bottom, |
| | | Height = Application.GetRealHeight(8), |
| | | BackgroundColor = CSS_Color.BackgroundColor, |
| | | }); |
| | | } |
| | | */ |
| | | #endregion |
| | | |
| | | #region 选择区域 |
| | | FrameLayout chooseZoneView = new FrameLayout() |
| | |
| | | BackgroundColor = CSS_Color.BackgroundColor, |
| | | }; |
| | | contentView.AddChidren(btnLine1); |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | }; |
| | | |
| | | |
| | | LoadEventList(); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 加载功能列表 |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 加载图标选择选项 |
| | | /// </summary> |
| | |
| | | LoadEvent_PictureOptionViewEventList(pView); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | //-------------------------------------- |
| | | public partial class CatchSceneAddPage |
| | | { |
| | | void LoadEventList() |
| | | { |
| | | LoadEvent_ChangeSceneImage(); |
| | | LoadEvent_ChangeSceneZone(); |
| | | LoadEvent_EditRoomName(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 修改场景所属区域 |
| | | /// </summary> |
| | | void LoadEvent_ChangeSceneZone() |
| | | { |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | Action backAction = () => { |
| | | btnZoneName.Text = scene.GetRoomListName(); |
| | | }; |
| | | var ssl = new SetSceneLocationPage(scene, backAction); |
| | | MainPage.BasePageView.AddChidren(ssl); |
| | | ssl.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | btnZoneName.MouseUpEventHandler = eventHandler; |
| | | belongToZoneRow.MouseUpEventHandler = eventHandler; |
| | | btnBelongToZoneRight.MouseUpEventHandler = eventHandler; |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 修改场景背景事件 |
| | | /// </summary> |
| | | void LoadEvent_ChangeSceneImage() |
| | | { |
| | | addSceneImageView.MouseUpEventHandler = (sender, e) => { |
| | | LoadPictureOptionView(); |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载背景图选择区域事件列表 |
| | | /// </summary> |
| | |
| | | { |
| | | btnTakePicture.IsSelected = false; |
| | | |
| | | //var pid = Guid.NewGuid(); |
| | | //CropImage.TakePicture((imagePath) => |
| | | //{ |
| | | // if (imagePath != null) |
| | | // { |
| | | // addSceneImageView.ImagePath = imagePath.ToString(); |
| | | // scene.ImagePath = addSceneImageView.ImagePath; |
| | | // MainPage.Log("SelectPicture 裁剪图片返回路径: " + imagePath); |
| | | // } |
| | | //}, pid.ToString(), 4, 3); |
| | | |
| | | |
| | | var imageName = Guid.NewGuid().ToString(); |
| | | //var imageName = scene.sid; |
| | | CropImage.TakePicture((imagePath) => |
| | | { |
| | | CropImageCallBack(imagePath); |
| | | |
| | | }, imageName, 4, 3); |
| | | |
| | | //if (pageTitleId == StringId.EditScene) |
| | | //{ |
| | | // scene.SaveFunctionData(); |
| | | //} |
| | | pictureOptionView.Parent.RemoveFromParent(); |
| | | }; |
| | | btnAlbum.MouseDownEventHandler = (sender, e) => { |
| | |
| | | btnAlbum.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnAlbum.IsSelected = false; |
| | | //var pid = Guid.NewGuid(); |
| | | //CropImage.SelectPicture((imagePath) => |
| | | //{ |
| | | // if (imagePath != null) |
| | | // { |
| | | // addSceneImageView.ImagePath = imagePath.ToString(); |
| | | // scene.ImagePath = addSceneImageView.ImagePath; |
| | | // MainPage.Log("SelectPicture 裁剪图片返回路径: " + imagePath); |
| | | // } |
| | | //}, pid.ToString(), 4, 3); |
| | | |
| | | //从相册选择图片裁剪 |
| | | var imageName = Guid.NewGuid().ToString(); |
| | |
| | | }; |
| | | //上传图片到云端 |
| | | UploadImage(selectImagePath, addSceneImageView, scene, uploadSuccessAction); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载修改场景名称窗口事件 |
| | | /// </summary> |
| | | void LoadEvent_EditRoomName() |
| | | { |
| | | Action<string> callBack = (str) => |
| | | { |
| | | //名称不能为空 |
| | | if (string.IsNullOrEmpty(str)) |
| | | { |
| | | new Tip() |
| | | { |
| | | CloseTime = 1, |
| | | Text = Language.StringByID(StringId.SceneNameCannotBeEmpty), |
| | | Direction = AMPopTipDirection.None, |
| | | }.Show(bodyView); |
| | | return; |
| | | } |
| | | btnSceneName.Text = str; |
| | | scene.name = str; |
| | | }; |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | List<string> sceneNameList = new List<string>(); |
| | | foreach (var tempScene in FunctionList.List.scenes) |
| | | { |
| | | sceneNameList.Add(tempScene.name); |
| | | } |
| | | new PublicAssmebly().LoadDialog_EditParater(StringId.SceneName, scene.name, callBack, StringId.SceneNameCannotBeEmpty, StringId.SceneNameAlreadyExists, sceneNameList); |
| | | }; |
| | | sceneNameView.MouseUpEventHandler = eventHandler; |
| | | btnSceneName.MouseUpEventHandler = eventHandler; |
| | | btnEditSceneNameIcon.MouseUpEventHandler = eventHandler; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | } |
| | | catch { } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |