wxr
2021-07-01 43b0d5870d528f23ecd6aeceb6cfd4325188b46f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using System;
using HDL_ON.Entity;
using Shared;
 
namespace HDL_ON.UI
{
    public partial class RoomsManagementPage
    {
        /// <summary>
        /// 进入编辑房间之后的回调
        /// </summary>
        Action editBackAction;
 
        /// <summary>
        /// 跳转到增加房间的界面
        /// </summary>
        void LoadEvent_SkipAddRoomPage()
        {
            skipAddRoomAction = () =>
            {
                Action<Room> addRoomBackAction = (newRoom) =>
                {
                    LoadRoomRow(newRoom);
                };
 
                var addRoomPage = new AddRoomPage(addRoomBackAction);
                MainPage.BasePageView.AddChidren(addRoomPage);
                addRoomPage.LoadPage();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
        }
 
        /// <summary>
        /// 跳转到编辑房间的界面
        /// </summary>
        void LoadEvent_SkipEditRoomPage(Room r, Button btnRoomName, ImageView btnBg, FrameLayout roomRow)
        {
            editBackAction = () =>
            {
                if (string.IsNullOrEmpty(r.roomId))
                {
                    for (int i = 0; i < roomsListView.ChildrenCount; )
                    {
                        if (roomsListView.GetChildren(i).Tag.ToString() == r.roomName + "line" || roomsListView.GetChildren(i).Tag.ToString() == r.roomName + "row")
                        {
                            roomsListView.GetChildren(i).RemoveFromParent();
                        }
                        else
                        {
                            i++;
                        }
                    }
                }
                else
                {
                    btnRoomName.Text = r.floorName + r.roomName;
                    btnBg.ImagePath = r.backgroundImage;
                }
            };
 
            Action deleteAction = () => {
                roomRow.RemoveFromParent();
            };
 
            Action modifyImageAction = () => {
                ImageUtlis.Current.LoadLocalOrNetworkImages(r.backgroundImage, btnBg);
            };
 
            var skipPage = new RoomEditPage(r, editBackAction, deleteAction, modifyImageAction);
            MainPage.BasePageView.AddChidren(skipPage);
            skipPage.LoadPage();
            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
        }
    }
}