Exemple #1
0
        public BrowseGroupView(BrowseGroupViewModel browseGroupViewModel, ImageService imageService, INavigator navigator, ColorService colorService)
            : base(imageService, navigator, "Back")
        {
            _browseGroupViewModel = browseGroupViewModel;

            DataContext = _browseGroupViewModel;
            var label = new Label()
            {
                Text = "Browse Group View"
            };

            var image = new ImageView()
            {
                Image = new Bitmap(_browseGroupViewModel.GroupImage)
            };

            if (image.Size.Width > 64)
            {
                image.Size = new Size(64, 64);
            }

            var joinButton = new Button()
            {
                Text = "Join"
            };

            joinButton.BindDataContext(c => c.Visible, (BrowseGroupViewModel m) => m.CanJoin);
            joinButton.Command = _browseGroupViewModel.Join;

            var leaveButton = new Button()
            {
                Text = "Leave"
            };

            leaveButton.BindDataContext(c => c.Visible, (BrowseGroupViewModel m) => m.CanLeave);
            leaveButton.Command = _browseGroupViewModel.Leave;

            var layout = new DynamicLayout();

            layout.BeginVertical();
            layout.Add(image);
            layout.Add(new Label()
            {
                Text = _browseGroupViewModel.Name, TextAlignment = TextAlignment.Center, Font = new Font(FontFamilies.Sans, 24)
            });
            layout.AddCentered(joinButton);
            layout.AddCentered(leaveButton);
            layout.AddSpace();

            ModalContent = layout;
        }
Exemple #2
0
 public BrowseGroupPage(BrowseGroupViewModel browseGroupViewModel)
 {
     InitializeComponent();
     _browseGroupViewModel = browseGroupViewModel;
     BindingContext        = _browseGroupViewModel;
 }