Exemplo n.º 1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            _freer = new XPFreer(
                new XPProvider<ToggleButton>(
                    FindViewById<LinearLayout>(Resource.Id.linearLayout1)
                        .GetAllChildren()
                        .Cast<ToggleButton>()
                        .ToList(),
                    x => x.Checked = true,
                    x => x.Checked = false,
                    x => x.Checked ? XPState.Free : XPState.Trapped
                ));

            FindViewById<Button>(Resource.Id.free).Click += delegate {
                _freer.FreeSomething();
            };

            FindViewById<Button>(Resource.Id.trap).Click += delegate {
                _freer.TrapSomething();
            };
        }
Exemplo n.º 2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _freer = new XPFreer(
                new XPProvider<UISwitch>(
                    new[] { switch1, switch2, switch3, switch4 },
                    x => x.SetState(true, true),
                    x => x.SetState(false, true),
                    x => x.On ? XPState.Free : XPState.Trapped
                ));
        }