Closed peerem closed 3 years ago
@peerem
I do not think this will work straight out of the box for Linux and MacOS. You may have to implement a gtk "Save As" dialog to make it work.
That is exposing the gtk_file_chooser_native_new via C# using DllImport.
Like this example:
There is an example here using CefSharp - https://stackoverflow.com/questions/39148865/cefsharp-onbeforedownload-handler-opening-open-file-window-instead-of-save-windo
So basically you replace the SaveFileDialog with your implementation.
public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
{
if (!callback.IsDisposed)
{
using (callback)
{
if (_allowDownload)
{
SaveFileDialog saveFileDialog = new SaveFileDialog();
if (saveFileDialog.ShowDialog() == DialogResult.OK && saveFileDialog.FileName != "")
{
}
else
}
else
callback.Continue(downloadItem.SuggestedFileName, showDialog: false);
}
An alternative will be to use an HTML SaveFileDialog using JavaScript.
Chromely does not provide any of these options out of the box.
Thanks.
We are thinking about possibly running the application in the external Chrome/Edge "App Mode". CEF only causes problems, such as dialogues or missing codecs. An option to run it externally wouldn't be bad.
The CefDownloadHandler not showing the dialog on Linux. The event was fired, but no "Save to..." dialog was shown.