Beispiel #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            refreshButton         = FindViewById <Button>(Resource.Id.RefreshButton);
            refreshButton.Enabled = false;
            refreshButton.Click  += (object sender, EventArgs e) =>
            {
                RefreshDevices();
            };

            if (string.IsNullOrEmpty(CLIENT_ID))
            {
                Toast.MakeText(this, "CLIENT_ID not set!", ToastLength.Long).Show();
            }

            // Prompt for location permission if it hasn't been granted
            if (CheckSelfPermission(Manifest.Permission.AccessCoarseLocation) == Permission.Granted)
            {
                this.InitializeAsync();
            }
            else
            {
                Random rand = new Random();
                this.permissionRequestCode = rand.Next(128);
                RequestPermissions(new string[] { Manifest.Permission.AccessCoarseLocation }, this.permissionRequestCode);
            }

            this.adapter     = new RemoteSystemAdapter(this, new List <RemoteSystem>());
            this.ListAdapter = this.adapter;
        }
Beispiel #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            Button callButton = FindViewById <Button>(Resource.Id.RefreshButton);

            callButton.Click += (object sender, EventArgs e) =>
            {
                RefreshDevices();
            };

            if (string.IsNullOrEmpty(CLIENT_ID))
            {
                Toast.MakeText(this, "CLIENT_ID not set!", ToastLength.Long).Show();
            }

            InitializeAsync();

            _adapter         = new RemoteSystemAdapter(this, new List <RemoteSystem>());
            this.ListAdapter = _adapter;
        }