Пример #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            SharedPush.Initialize();

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById <Button>(Resource.Id.myButton);

            button.Click += delegate
            {
                button.Text = $"{count++} clicks!";
                System.Diagnostics.Debug.WriteLine("Button clicked");
            };

            Switch consentButton = FindViewById <Switch>(Resource.Id.consentSwitch);

            consentButton.CheckedChange += (o, e) =>
            {
                SharedPush.ConsentStatusChanged(consentButton.Checked);
                System.Diagnostics.Debug.WriteLine("Changing consent state");
            };

            consentButton.Checked = SharedPush.UserDidProvideConsent();

            Button setExternalIdButton = FindViewById <Button>(Resource.Id.setExternalIdButton);

            TextView externalIdField = FindViewById <TextView>(Resource.Id.externalIdField);

            setExternalIdButton.Click += delegate
            {
                SharedPush.SetExternalUserId(externalIdField.Text);
            };

            Button removeExternalIdButton = FindViewById <Button>(Resource.Id.removeExternalIdButton);

            removeExternalIdButton.Click += delegate
            {
                SharedPush.RemoveExternalUserId();
            };
        }
Пример #2
0
        partial void SetExternalUserId(UIButton sender)
        {
            UITextField externalIdField = (UITextField)this.View.ViewWithTag(3);

            SharedPush.SetExternalUserId(externalIdField.Text);
        }