예제 #1
0
        private void BuildList()
        {
            ListView v = FindViewById <ListView>(Resource.Id.fileList);

            FileViewAdapter ad = new FileViewAdapter(this, _Context, Folder);

            adapter = ad;

            v.SetAdapter(ad);
            v.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>
            {
                EditText       t    = FindViewById <EditText>(Resource.Id.fileName);
                FileSystemInfo item = ad.GetFile(e.Position);
                if (item is FileInfo)
                {
                    t.Text = item.Name;
                }
                else
                {
                    if (CanAccessFolder(item.FullName))
                    {
                        _Folder = item.FullName;
                        UpdateFolderDisplay();
                    }
                    else
                    {
                        //maybe do a popup?
                    }
                }
            };
        }
예제 #2
0
        private async void UpdateFiles()
        {
            FileController fc    = new FileController();
            var            files = await fc.GetFiles();

            if (files != null)
            {
                FileViewAdapter adapter = new FileViewAdapter(Context, files);
                adapter.FileChange += (e, args) =>
                {
                    UpdateFiles();
                };
                if (fileList != null)
                {
                    fileList.Adapter = adapter;
                }
            }
            else
            {
                FileViewAdapter adapter = new FileViewAdapter(Context, new List <FileModel>());
                fileList.Adapter    = adapter;
                adapter.FileChange += (e, args) =>
                {
                    UpdateFiles();
                };
            }
        }