I’m creating a c# winforms desktop program with dropbox support. The problem comes in where the user must select the file (from dropbox) that he would like to open. Is it possible to use the OpenFileDialog to display the content of the person’s dropbox account? I know you can just direct the openFileDialog to the local dropbox folder, but I don’t want to do that. This will mean that the person must have dropbox installed on that computer before they can use this function of my program. If you can’t do this, how will you use tree and list views to create your own openFileDialog? I would like to keep the design the same as the standard openFileDialog. I have read that you can create a rapper class for customising the openFileDialog but don’t know how this will work.
I have looked on google but can’t find what I’m looking for. Any advice or examples will be appreciated.
I’m using dotnet 4.5 and the dropnet library.
Thank you
OpenFileDialog only shows existing files.
Your program can act like drop box client application and load all files to the client in a local folder. Then when you show the OpenFileDialog you can set that folder as InitialDirectory of the file dialog.
Also if you don't want to load all files, you can create dummy (empty) files on the local folder and after the user choose to show the file from OpenFileDialog, then download the file and show it to the user.
Related
There is a feature in OneDrive that you can see a file that is on the OneDrive site on your system without actually having that file in your system. And when you double click on that file, that file starts to download and you can see its contents.
I want to implement such a possibility with C#.
I have a site where files are uploaded.
I download the files from there and put them in a folder on my C drive.
But I want that file not to be downloaded until it is double-clicked, something similar to OneDrive.
What should I do?
I compared the FileInfo of these two files, but I didn't see any difference and I couldn't find a solution for this problem.
This is a virtual filesystem implemented using a file system driver.
There are multiple ways to implement this feature using C/C++.
But in your case, using C# means you should use third-party libraries to create a virtual files system.
There is a library called Dokan, which lets you implement a full-featured virtual file system, and you have complete control over its behaviour in your C# project.
it called "Windows Shell namespace"
https://learn.microsoft.com/en-us/windows/win32/shell/namespace-intro
i used EZNameSpace Wrapper for handling this.
there is another library called "CBFS Shell" (formerly shelboost) that you can use.
You could create a dummy file that appears to be correct but is really just a pointer to some code that downloads the correct file. Then use File.Move or File.Copy to replace the dummy file with the actual file.
I would like users to add files to a program, in a Windows Active Directory Environment. I would then like the program to save the files to a directory. However I would like to have the files saved to a directory where the user only has read access. Once the file is saved it is permanent and cannot be edited by the user, but they can still open it and save it locally with changes if desired.
This would be like saving the file with elevated permissions.
I don't think setting a read only attribute will do the trick as to my knowledge if the user finds the directory and file they could change that status manually. I also don't think System.IO.File has this kind of functionality.
Is there anyway to achieve this?
It seems FileIOPermission library could solve this porblem so use c# sharp libary which is "FileIOPermission", you can go over from this.
I'm working in a very basic C# application, I want to compress a directory that has some files (specifically a dbf database) that are already opened or in use for other software.
I use the class "ZipFile" in this way:
ZipFile.CreateFromDirectory(source, path);
And I get an exception that says that It could not access to the file because it was already in use for other application.
Is there another way to do this?
Thanks!
I'm working on a WPF project which is in charge to display a picture library.
The pictures are stored on folders.
I would like to know if there is a way to encrypt the folders and the pictures to protect the files (the user shouldn't see the files), but I want to keep the possibility to browse these folders by code to build my library.
The best way that I can think of is to store the files and folders in a Zip archive with a password. Zip files are supported natively by Windows. There are plenty of options for supporting zip files, including framework options and outboard libraries.
Note that this doesn't really protect the files from user tampering; it merely hides them from casual observers. Also, there may be a speed penalty; you should use the fastest possible options for compression.
you can use Zip archive and Another way:
you can add another project project(Library)into your main solution,add your image folders into your application and set their build action property to resource,with that,your images will store in an Dll and for can access them from Dll.i tried it before follow this link:
get-folder-address-in-dll
I am saving image in windows mobile application using C#.My code is
SaveFileDialog dialog = new SaveFileDialog();
if (dialog.ShowDialog() == DialogResult.OK)
{
aspectRatioPictureBox1.Photo.Save(dialog.FileName, System.Drawing.Imaging.ImageFormat.Bmp);
}
In the above code i am able to save only in folders of MyDocument But
i am not able to browse to save in other folders..
Please let know the code to save image through browsing the location
Thanks in Advance
The default Open and Save dialogs are just very limited, there's little you can do if you keep using them.
If you browse around though, I'm sure you can find alternative implementations for these dialogs. One of the first that came up in a quick google search is this one. I haven't tested it and I'm sure there are others, but it may give you a start.
The default open and save file dialogs are not very good at all.
Firstly they can only look at My Documents and sub folders. Secondly the user interface is very poor and old fashioned.
We ended up rolling our own file save dialog. And while we where at it we also added gesture based scrolling and file text which was large enough to use with a finger. I would definitely recommend finding an alternative or writing your own which is a good exercise in itself.