Ejemplo n.º 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            _userName   = Intent.GetStringExtra(AppConstants.UserName);
            _ip         = Intent.GetStringExtra(AppConstants.HostIp);
            _portNumber = Intent.GetIntExtra(AppConstants.PortNumber, 8080);
            _client     = new FileSharingClient(_ip, _portNumber);
            CrossCurrentActivity.Current.Init(this, savedInstanceState);
            CrossMedia.Current.Initialize();

            _rvFiles       = FindViewById <RecyclerView>(Resource.Id.recyclerView);
            _uploadFileBtn = FindViewById <ImageView>(Resource.Id.btnUpload);
            _takePhotoBtn  = FindViewById <ImageView>(Resource.Id.btnTakePhoto);

            _files = _client.GetFileNames(_userName);
            if (_files != null)
            {
                _fileAdapter = new FileAdapter(_files, _ip, _portNumber, _userName);
                _rvFiles.SetLayoutManager(new GridLayoutManager(this, 4));
                _rvFiles.SetAdapter(_fileAdapter);
            }

            _uploadFileBtn.Click += UploadFileBtn;
            _takePhotoBtn.Click  += TakePhoto;
        }
Ejemplo n.º 2
0
 private void UpdateListView()
 {
     _files = _client.GetFileNames(_userName);
     if (_files != null)
     {
         _fileAdapter = new FileAdapter(_files, _ip, _portNumber, _userName);
         _rvFiles.SetAdapter(_fileAdapter);
     }
 }