Beispiel #1
0
        public override async void OnListItemClick(ListView listView, View view, int position, long id)
        {
            FileSystemInfo fileSystemInfo = fileListadapter.GetItem(position);

            if (fileSystemInfo.IsFile())
            {
                CustomProgressDialog progressDialog = new CustomProgressDialog();
                progressDialog.Show(Activity, "Bestand uploaden. Een ogenblik geduld a.u.b.");

                try {
                    //get current folder path to add file to
                    int    numberOfDirectoriesOpened   = ExplorerFragment.openedDirectories.Count;
                    string directoryNameToUploadFileTo = ExplorerFragment.openedDirectories [numberOfDirectoriesOpened - 1];

                    string fullDestinationPath = System.IO.Path.Combine(directoryNameToUploadFileTo, fileSystemInfo.Name);
                    bool   uploadedSucceeded   = await DataLayer.Instance.UploadFile(fullDestinationPath, fileSystemInfo.FullName);

                    if (!uploadedSucceeded)
                    {
                        Toast.MakeText(Activity, "Er is iets fout gegaan", ToastLength.Short).Show();
                    }
                    else
                    {
                        Toast.MakeText(Activity, "Bestand succesvol geupload", ToastLength.Short).Show();

                        Activity.Finish();
                    }
                } catch (Exception ex) {
                    Insights.Report(ex);
                    Toast.MakeText(Activity, "Er is iets fout gegaan", ToastLength.Short).Show();
                }
                progressDialog.Hide();
            }
            else
            {
                // Dig into this directory, and display it's contents
                Android.Support.V4.App.FragmentTransaction fragmentTransaction = Activity.SupportFragmentManager.BeginTransaction();
                //fragmentTransaction.SetCustomAnimations (Resource.Animation.enter, Resource.Animation.exit);

                FileListFragment fileListFragment = new FileListFragment(fileSystemInfo.FullName);
                fragmentTransaction.Replace(Resource.Id.fragment_container_filepicker, fileListFragment, "fileListFragment");

                //Add fragment to stack - needed for back button functionality
                fragmentTransaction.AddToBackStack(null);

                // Start the animated transition.
                fragmentTransaction.Commit();
            }
            base.OnListItemClick(listView, view, position, id);
        }
		public override async void OnListItemClick(ListView listView, View view, int position, long id)
		{
			FileSystemInfo fileSystemInfo = fileListadapter.GetItem(position);

			if (fileSystemInfo.IsFile ()) {
				CustomProgressDialog progressDialog = new CustomProgressDialog ();
				progressDialog.Show (Activity, "Bestand uploaden. Een ogenblik geduld a.u.b.");

				try {
					//get current folder path to add file to
					int numberOfDirectoriesOpened = ExplorerFragment.openedDirectories.Count;
					string directoryNameToUploadFileTo = ExplorerFragment.openedDirectories [numberOfDirectoriesOpened - 1];

					string fullDestinationPath = System.IO.Path.Combine (directoryNameToUploadFileTo, fileSystemInfo.Name);
					bool uploadedSucceeded = await DataLayer.Instance.UploadFile (fullDestinationPath, fileSystemInfo.FullName);

					if (!uploadedSucceeded) {
						Toast.MakeText (Activity, "Er is iets fout gegaan", ToastLength.Short).Show ();
					} else {
						Toast.MakeText (Activity, "Bestand succesvol geupload", ToastLength.Short).Show ();
						
						Activity.Finish ();
					}
				} catch (Exception ex){
					Insights.Report(ex);
					Toast.MakeText (Activity, "Er is iets fout gegaan", ToastLength.Short).Show ();
				}
				progressDialog.Hide ();
			} else {
				// Dig into this directory, and display it's contents
				Android.Support.V4.App.FragmentTransaction fragmentTransaction = Activity.SupportFragmentManager.BeginTransaction ();
				//fragmentTransaction.SetCustomAnimations (Resource.Animation.enter, Resource.Animation.exit);

				FileListFragment fileListFragment = new FileListFragment (fileSystemInfo.FullName);
				fragmentTransaction.Replace (Resource.Id.fragment_container_filepicker, fileListFragment, "fileListFragment");

				//Add fragment to stack - needed for back button functionality
				fragmentTransaction.AddToBackStack (null);

				// Start the animated transition.
				fragmentTransaction.Commit ();
			}
			base.OnListItemClick(listView, view, position, id);
		}
Beispiel #3
0
 public void ShowProgressDialog(string textToShow)
 {
     this.RunOnUiThread(new Action(() => {
         progressDialog.Show(this, textToShow);
     }));
 }
 private void ShowProgressDialog(Android.Content.Context context, string textToShow)
 {
     Activity.RunOnUiThread(new Action(() => {
         progressDialog.Show(context, textToShow);
     }));
 }