1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using CefSharp;
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Text;
- namespace UAS_Web.tool
- {
- class DownLoadFile : IDownloadHandler
- {
- public static bool downloading = false;
- public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
- {
- if (!callback.IsDisposed)
- {
- using (callback)
- {
- if (downloadItem.SuggestedFileName.EndsWith("frx"))
- {
- callback.Continue(System.AppDomain.CurrentDomain.BaseDirectory + downloadItem.SuggestedFileName,
- showDialog: false);
- }else
- callback.Continue(System.AppDomain.CurrentDomain.BaseDirectory + downloadItem.SuggestedFileName,
- showDialog: true);
- }
- }
- }
- public void OnDownloadUpdated(IBrowser browser, DownloadItem downloadItem, IDownloadItemCallback callback)
- {
- if (downloadItem.IsComplete)
- {
- downloading = false;
- }
- else {
- downloading = true;
- }
- }
-
- }
- }
|