Ejemplo n.º 1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            devicesAdapter         = new DevicesListAdapter(this, Common.ListManager);
            listView               = FindViewById <ListView>(Resource.Id.listView1);
            listView.Adapter       = devicesAdapter;
            listView.ItemClick    += ListView_ItemClick;
            listView.ItemSelected += ListView_ItemSelected;

            mainActions = FindViewById <RelativeLayout>(Resource.Id.main_actions);
            mainShare   = FindViewById <RelativeLayout>(Resource.Id.main_share);

            devicesListLayout = FindViewById <LinearLayout>(Resource.Id.main_devicesListLayout);
            bannerLayout      = FindViewById <RelativeLayout>(Resource.Id.main_banner);

            startSessionListener = new CallbackStartSessionListener(this);
            showBannerAdListener = new CallbackShowBanner(this);
            RevMob.StartWithListener(this, startSessionListener, Droid.Config.Secrets.RevMobId);
            UserTrialStatusUpdated();
            TrialHelper.UserTrialStatusChanged += UserTrialStatusUpdated;
            RefreshUserTrialStatus();

            if ((Intent.Action == Intent.ActionSend) || (Intent.Action == Intent.ActionSendMultiple))
            {
                OnCreate_Share();
            }
            else
            {
                OnCreate_Main();
            }

            SetButtonsEnableStatus(false);

            UpdateSelectedRemoteSystem();

            if (IsInitialized)
            {
                return;
            }
            IsInitialized = true;

            Common.PackageManager = new RomePackageManager(this);
            Common.PackageManager.Initialize("com.roamit.service");

            Common.MessageCarrierPackageManager = new RomePackageManager(this);
            Common.MessageCarrierPackageManager.Initialize("com.roamit.messagecarrierservice");

            Common.PackageManager.RemoteSystems.CollectionChanged += RemoteSystems_CollectionChanged;

            InitDiscovery();
        }
Ejemplo n.º 2
0
        private void UpdateSelectedRemoteSystem()
        {
            if (Common.ListManager.SelectedRemoteSystem == null)
            {
                SetButtonsEnableStatus(false);
                return;
            }

            RunOnUiThread(() =>
            {
                FindViewById <TextView>(Resource.Id.selectedDeviceName).Text = Common.ListManager.SelectedRemoteSystem?.DisplayName ?? "";

                var imageView        = FindViewById <ImageView>(Resource.Id.selectedDeviceIcon);
                imageView.Visibility = ViewStates.Visible;
                imageView.SetImageResource(DevicesListAdapter.GetDeviceIconResource(Common.ListManager.SelectedRemoteSystem?.Kind ?? ""));

                System.Diagnostics.Debug.WriteLine(Common.ListManager.SelectedRemoteSystem?.DisplayName ?? "NULL" + " is selected.");

                SetButtonsEnableStatus(true);
                CheckRemoteDeviceSupport();
            });
        }