예제 #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            Button            btnLock   = FindViewById <Button>(Resource.Id.buttonLock);
            Button            btnUnlock = FindViewById <Button>(Resource.Id.buttonUnlock);
            RestClientService client    = new RestClientService();

            GetLocationPermissionAsync();

            btnLock.Click += (sender, e) =>
            {
                string response = client.SendLockRequest();
                if (!string.IsNullOrEmpty(response))
                {
                    Toast.MakeText(this, response, ToastLength.Short).Show();
                }
            };

            btnUnlock.Click += (sender, e) =>
            {
                string response = client.SendUnlockRequest();
                if (!string.IsNullOrEmpty(response))
                {
                    Toast.MakeText(this, response, ToastLength.Short).Show();
                }
            };
        }