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

            Button button = FindViewById <Button>(Resource.Id.leave_feedback);

            button.Click += delegate
            {
                Apptentive.ShowMessageCenter(this);
            };
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            // Controls
            var eventNameEditText = FindViewById <EditText>(Resource.Id.eventEditText);

            var messageCenterButton = FindViewById <Button>(Resource.Id.messageCenterButton);

            messageCenterButton.Click += delegate
            {
                Apptentive.ShowMessageCenter(this, (shown) => Console.WriteLine("Message Center shown: " + shown));
            };

            var engageButton = FindViewById <Button>(Resource.Id.engageButton);

            engageButton.Click += delegate
            {
                var eventName = eventNameEditText.Text;
                Apptentive.Engage(this, eventName, (engaged) => Console.WriteLine("Interaction engaged: " + engaged));
            };

            var canShowInteractionButton = FindViewById <Button>(Resource.Id.canShowInteractionButton);

            canShowInteractionButton.Click += delegate
            {
                var eventName = eventNameEditText.Text;
                Apptentive.QueryCanShowInteraction(eventName, (canShowInteraction) => Toast.MakeText(this, canShowInteraction ? "Yes" : "No", ToastLength.Long).Show());
            };

            var userDataButton = FindViewById <Button>(Resource.Id.userDataButton);

            userDataButton.Click += delegate
            {
                var intent = new Intent(this, typeof(UserDataActivity));
                StartActivity(intent);
            };

            var customDataButton = FindViewById <Button>(Resource.Id.customDataButton);

            customDataButton.Click += delegate
            {
                var intent = new Intent(this, typeof(CustomDataActivity));
                StartActivity(intent);
            };

            var authenticationButton = FindViewById <Button>(Resource.Id.authenticationButton);

            authenticationButton.Click += delegate
            {
                var intent = new Intent(this, typeof(LoginActivity));
                StartActivity(intent);
            };

            unreadMessagesTextView = FindViewById <TextView>(Resource.Id.unreadMessagesText);
            UpdateUnreadMessagesCount();

            Apptentive.AddUnreadMessagesListener(this);
        }