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

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

            SlpManager = new SlpDeviceManager();


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

            listView        = FindViewById <ListView>(Resource.Id.listView1);
            scopeText       = FindViewById <EditText>(Resource.Id.editTextScope);
            serviceTypeText = FindViewById <EditText>(Resource.Id.editTextServiceType);


            adapter = new ArrayAdapter <string>(this,
                                                Android.Resource.Layout.SimpleListItem1,
                                                devices);

            listView.Adapter = adapter;

            button.Click += delegate
            {
                if (SlpManager.Running)
                {
                    SlpManager.Stop();
                    button.Text = "Start";
                }
                else
                {
                    SlpManager.Scope       = scopeText.Text;
                    SlpManager.ServiceType = serviceTypeText.Text;
                    SlpManager.Start();
                    button.Text = "Stop";
                }
            };
        }