Background info:
I have a windows application (in c#) that handles a custom file type which is just a wrapper for .pdf and .doc files. The user has to download and install this program from the website in order to view and edit their custom file types and save them back to the server.
Question:
Is there any way to make sure when a file is downloaded the application starts and opens the file by altering the install files of the application? I have been looking through the MSDN documentation on file types and it is registered but I couldn't find a handler for On Download. Any guidance is useful, I'm new to stackoverflow and c#.
You will need to register a mime type on the computer during your install process. Then you will need to send the corresponding mime type with the download.
Here is some basic info.
http://msdn.microsoft.com/en-us/library/ms775148(v=vs.85).aspx
Related
I am trying to make a custom protocol to open my c# windows application through a web application following the first comment's steps here: How do I register a custom URL protocol in Windows?
After setting everything up, I got to the last part where I have to type the link. Internet Explorer knows that I have to open some sort of a file but it requires a different reader.
Here is the protocol I made.
And this is the path, I have copied it, so it should be correct!
This is the folder of the program that I want to open.
Here is what happens when I go to that website. As you can see, I need to allow the browser to open the app.
And here is the problem. Any solutions to that? Of course, I can open normally the .exe file without getting any errors.
I am having a WPF-MVVM desktop application. I want to play a media file in this application.
The media file is stored at some remote server (actually hosted on IIS). It requires credentials to access it. I am using MediaElement to play the audio file.
The problem is how to specify the credentials with mediaElement?
One workaround is using HttpWebRequest & download the file in some temp folder. Onces downloaded then I can play the local file. But I don't want to create any file locally. Is there any way I can specify the Stream as input to MediaElement.
Atul Sureka
It should be possible to use the syntax username:password#host for setting the source.
If not, please provide further information how you are trying to do it and what kind of error you get..
While reflecting my answer, I just found this LINK, saying that my answer might be deprecated.
If you are not successful, you might have a look at the link.
I have a WinRT app that, in part, does file downloads from an online service and manages the local copy of the files. When stored locally, the files need to be encrypted, but during editing/viewing, as that happens in external editors (office, pdf, etc) they need to be decrypted.
Is there a way within the WinRT API set to launch an external browser (ie. Windows.System.Launcher.LaunchFileAsync) and somehow get notification when that app has been closed?
Right now, I can download and encrypt the file fine, but when I want to view it, I have to decrypt it and launch the external editor with no way of knowing (or even necessarily running again) when it's finished so I can re-encrypt the file.
Ideally I would like to somehow bind the external application to mine so that my app is unavailable until the external editor is closed, but would settle for notification when the app is closed or any other creative solutions.
Your app scenario looks something like skydrive app from Microsoft. It downloads files from the skydrive service, integrates with file open and file save pickers.
Try integrating with file picker contracts.
you can start here. There are sample code also available to implement file picker contracts.
I currently have a url that looks like this: protocol://folder/file.js
I can open this same file from my local disk using a url like file://C:\folder\file.js
When the application is run inside its own provided environment, this protocol is available and it loads the file just fine from my local disk.
I'd like to also be able to access these files for times when I run this application inside a regular browser like firefox or chrome.
I've managed to register this protocol on my windows machine and forward the url to a custom c# program that can then open the proper file in browser again. However, it opens the file in a new tab and doesn't seem to work properly when attempting to open the file from a tag on the page.
Is there an easy way to get firefox (or any other browser) to open a file from a custom protocol directly in the tab that requested it?
To do this in FireFox, you must implement a XPCOM object. There are instructions on how to do this in C++. For C#, you follow the same instructions, but use GeckoFX to get wrappers for .NET.
Is there any way to create a virtual drive in "(My) Computer" and manipulate it, somewhat like JungleDisk does it?
It probably does something like:
override OnRead(object sender, Event e) {
ShowFilesFromAmazon();
}
Are there any API:s for this? Maybe to write to an XML-file or a database, instead of a real drive.
The Dokan Library seems to be the answer that mostly corresponds with my question, even though System.IO.IsolatedStorage seems to be the most standardized and most Microsoft-environment adapted.
Depending on what type of virtual drive you wish to build, here are some new OS API recently introduced in Windows, macOS and iOS.
Some of the below API is available as managed .NET code on Windows but many are a native Windows / macOS / iOS API. Even though, I was able to consume many of the below API in .NET and Xamarin applications and build entire Virtual Drive in C# for Windows, macOS and iOS.
For Remote Cloud Storage
On Windows. Windows 10 provides Cloud Sync Engine API for creating virtual drives that publish data from a remote location. It is also known under the “Cloud Filter API” name or “Windows Cloud Provider”. Here are its major features:
On-demand folders listing. Folder listing is made only when the first requested by the client application to the file system is made. File content is not downloaded, but all file properties including file size are available on the client via regular files API.
On-demand file content loading. File content can be downloaded in several modes (progressive, streaming mode, allow background download, etc) and made available to OS when application makes first file content reading request.
Offline files support. Files can be edited in the offline mode, pinned/unpinned and synched to/from the server.
Windows shell integration. Windows File Manager shows file status (modified, in-sync, conflict) and file download progress.
Metadata and properties support. Custom columns can be displayed in Windows File Manager as well as some binary metadata can be associated with each file and folder.
On macOS and iOS. MacOS Big Sur and iOS 11+ provides similar API called File Provider API. Its features are similar to what Windows API provides:
On-demand folders listing.
On-demand files content loading.
Offline files support.
File Manager Integration. In macOS Finder and iOS Files application you can can show file status (in the cloud, local).
I am not sure currently if files/folders and can show custom columns in macOS Finder and store any metadata.
For High-Speed Local Storage
On Windows. Windows provides ProjFS API. Its main difference from the Cloud Sync Engine API and macOS/iOS File Provider API is that it hides the fact that it is a remote storage. It does not provide any indication of the file status, download progress, ets. The documentation says it is intended for “projecting” hierarchical data in the form of file system.
You can use the Dokan library to create a virtual drive. There is a .Net wrapper for interfacing with C#.
Yes, use the classes in System.IO.IsolatedStorage
The contents of My Computer can include Shell Namespace Extensions. These COM objects run inside the main Explorer process, as do many other shell extensions. Using C# for such extensions is a bad idea, since your extension cannot control which CLR version Explorer.exe can use. And Microsoft allows only one CLR per process.