Beispiel #1
0
        public override Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            Dialog dialog = new Dialog(Activity);

            dialog.SetContentView(Resource.Layout.layout_dialog_device_scan);

            rvMain = dialog.FindViewById <RecyclerView>(Resource.Id.rvMain);
            vfMain = dialog.FindViewById <ViewFlipper>(Resource.Id.vfMain);
            srMain = dialog.FindViewById <SwipeRefreshLayout>(Resource.Id.srMain);

            rvAdapter = new DeviceScanAdapter(rvMain);
            rvAdapter.OnItemClicked += OnItemSelected;
            rvManager = new LinearLayoutManager(Application.Context);
            rvMain.SetLayoutManager(rvManager);
            rvMain.SetAdapter(rvAdapter);

            srMain.Refresh += OnRefresh;

            deviceDiscoverHelper = new Discover();
            deviceDiscoverHelper.OnStatusChanged += OnScanStatusChanged;
            deviceDiscoverHelper.OnDeviceFound   += OnScanDeviceFound;
            deviceDiscoverHelper.Open();

            vfMain.PostDelayed(() =>
            {
                if (vfMain.DisplayedChild == 0)
                {
                    vfMain.DisplayedChild = 1;
                }
            }, 5000);

            return(dialog);
        }