Frage

I'd like to select and use a file on a folder from a remoting server (inherits MarshalByRefObject) with my wpf application. I'm using remoting, so I can't use the OpenFileDialog method.

Does anyone have any idea about a way to do it? To use my file I thing that I'd better use a filestream, but I don't know how I can select one of the files on my server

War es hilfreich?

Lösung 2

Ok, so what I did to achieve this task was quite easy. I made a list of my folder content, then I displayed it in a listbox

public static List<string> getFiles()
{
  List<string> listReturn = new List<string>();
  string[] filePaths = Directory.GetFiles(backupFolder);
  return filePaths.ToList();
}

Here, you can find info about GetFiles method. You can specify if you want your displayed files to have a certain extension, and if you want a search option such as going through all subdirectories

Andere Tipps

On codeplex there is this .NET Remoting: Handling Remote Events Using Delegates – A Real World Example of 'Chat and File Send' Application that you could look at. I think that the example code for send file etc should be possible to copy and revert to your needs. In any solution I can think of you are going to need a service and a client to get the job done anyhow.

This code also uses relevant design patterns that can be interesting to look at for remoting development

http://www.codeproject.com/Articles/14100/Dot-Net-Remoting-Handling-Remote-Events-using-Dele

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top