Question

I'm looking for any ideas on how to incorporate FileReference method like Upload into a Cairngorm architecture.

Specifically, I would think to fire an event with the File in it, and that's fine. But how would one then be able to listen for e.g. Progress Events?

One thing I thought is to have the delegate fire off progress events that are listened for in the View.

Any ideas would be greatly appreciated!

Was it helpful?

Solution

You could create an instance of the FileReference class in your view, assign it to a property in the view and listen for ProgressEvent there. Then let your Command or Delegate handle initiating the upload after you've dispatched the Event.

If you don't like the idea of a View instantiating a FileReference, you could write a helper class that has the FileReference as a property, assign the helper object in your View, assign the helper object to your Event, and then repeat the same steps as above, except now the Command or Delegate would also take responsibility for instantiating the FileReference on the helper object.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top