コード例 #1
0
        public ReportParticipantsPage(string reportParticipantsPath)
        {
            Services.ParticipantsManager manager = new Services.ParticipantsManager(reportParticipantsPath);

            StackLayout stack = new StackLayout();

            foreach (Services.Participant item in manager.Participants)
            {
                stack.Children.Add(new BoxView()
                {
                    Opacity = 0.5f, Color = Color.Gray, WidthRequest = 100, HeightRequest = 2
                });
                stack.Children.Add(getParticpantView(manager, item));
            }

            stack.Children.Add(new BoxView()
            {
                Opacity = 0.5f, Color = Color.Gray, WidthRequest = 100, HeightRequest = 2
            });

            Button addPartipant = new Button {
                Text = "New Partipant"
            };

            addPartipant.Clicked += (sender, args) =>
            {
                Services.Participant newP = new Services.Participant();
                manager.AddPartipant(newP);
                stack.Children.Add(getParticpantView(manager, newP));
            };

            Button save = new Button {
                Text = "Save"
            };

            save.Clicked += (sender, args) => manager.SaveParticipants();

            Grid grid = new Grid();

            grid.Children.Add(save, 0, 0);
            grid.Children.Add(addPartipant, 1, 0);


            ScrollView scrollView = new ScrollView
            {
                Content = new StackLayout {
                    Children =
                    {
                        grid,
                        stack
                    }
                }
            };

            Content = scrollView;
        }