示例#1
0
        public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
        {
            if (!callback.IsDisposed) {
                using (callback) {
                    string directory = Properties.Settings.Default.StorageLocation + (GlobalVariables.CurrentUnitCode != "" ? GlobalVariables.CurrentUnitCode + "/" : "");
                    Directory.CreateDirectory(directory);

                    string filename = directory + downloadItem.SuggestedFileName;
                    if (!File.Exists(filename)) {
                        callback.Continue(filename, showDialog: false);
                        ++GlobalVariables.FilesDownloaded;

                        BlackboardFile f = new BlackboardFile(downloadItem.SuggestedFileName, downloadItem.Url);
                        f.RawURL = GlobalVariables.CurrentUrl;
                        f.FirstDownloaded = DateTime.Now;
                        f.LastDownloaded = DateTime.Now;
                        f.TimesDownloaded = 1;
                        f.LocalPath = filename;

                        //We know the unit we want exists in GlobalVariables.Units because it was created before the download started, back in Crawler.cs
                        GlobalVariables.Units.First(u => u.Name == GlobalVariables.CurrentUnitCode).Files.Add(f);
                    }
                    else {
                        //FUTURE FEATURE: Allow files to be marked for redownloading.
                        ++GlobalVariables.FilesSkipped;
                    }

                    if (DownloadHandled != null)
                        DownloadHandled(new object(), new EventArgs());
                }
            }
        }
 public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
 {
     if (!callback.IsDisposed)
     {
         callback.Continue(downloadItem.SuggestedFileName, showDialog: true);
         callback.Dispose();
     }
 }
示例#3
0
        public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
        {
            if (callback.IsDisposed)
            {
                return;
            }

            using (callback)
            {
                callback.Continue(downloadItem.SuggestedFileName, showDialog: true);
            }
        }
示例#4
0
        public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
        {
            var handler = OnBeforeDownloadFired;

            handler?.Invoke(this, downloadItem);

            if (!callback.IsDisposed)
            {
                using (callback) {
                    callback.Continue(downloadItem.SuggestedFileName, true);
                }
            }
        }
 public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
 {
     if (!callback.IsDisposed)
     {
         using (callback)
         {
             callback.Continue(@"C:\Users\" +
                               System.Security.Principal.WindowsIdentity.GetCurrent().Name +
                               @"\Downloads\" +
                               downloadItem.SuggestedFileName,
                               showDialog: true);
         }
     }
 }
示例#6
0
        public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
        {
            if (!callback.IsDisposed)
            {
                using (callback)
                {
                    destination = Path.Combine(MyPath.PathLocalAppData, downloadItem.SuggestedFileName);
                    callback.Continue(destination, showDialog: false);

                    Globals.log.Debug("DownloadHandler:> CefsharpDummy start download file to " + destination);
                    Configuration.myState = Configuration.State.downloading;
                }
            }
        }
示例#7
0
 public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
 {
     //System.Diagnostics.Debug.WriteLine(System.Security.Principal.WindowsIdentity.GetCurrent().Name);
     if (!callback.IsDisposed)
     {
         using (callback)
         {
             callback.Continue(@"c:\Users\" +
                               System.Security.Principal.WindowsIdentity.GetCurrent().Name +
                               @"\download\"
                               + downloadItem.SuggestedFileName, true);
         }
     }
 }
示例#8
0
        public void OnBeforeDownload(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem,
                                     IBeforeDownloadCallback callback)
        {
            if (callback.IsDisposed)
            {
                return;
            }
            _downloadCallBackEvent?.Invoke(false, downloadItem);
            downloadItem.IsInProgress = true;
            var      path = GetDownloadFullPath(downloadItem);
            Download d    = new Download(downloadItem, path);

            d.Show();
            //callback.Continue(path, false);
        }
示例#9
0
        public void OnBeforeDownload(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem,
                                     IBeforeDownloadCallback callback)
        {
            Log.Information("Download triggered for item '{name}'", downloadItem.SuggestedFileName);

            OnBeforeDownloadFired?.Invoke(this, downloadItem);

            if (callback.IsDisposed)
            {
                return;
            }

            using (callback)
                callback.Continue(downloadItem.SuggestedFileName, true);
        }
        public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
        {
            if (!callback.IsDisposed)
            {
                using (callback)
                {
                                     //downloadPath, show default download dialog
                    //callback.Continue(downloadItem.SuggestedFileName, showDialog: true);

                    WebDownload manager = new WebDownload();
                    manager.FileToDownload = downloadItem.Url;
                    manager.Show();

                }
            }
        }
示例#11
0
        public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
        {
            var handler = OnBeforeDownloadFired;
            if (handler != null)
            {
                handler(this, downloadItem);
            }

            if (!callback.IsDisposed)
            {
                using (callback)
                {
                    callback.Continue(downloadItem.SuggestedFileName, showDialog: true);
                }
            }
        }
示例#12
0
        public void OnBeforeDownload(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem,
                                     IBeforeDownloadCallback callback)
        {
            OnBeforeDownloadFired?.Invoke(this, downloadItem);

            if (callback.IsDisposed)
            {
                return;
            }
            var downloadPath = string.IsNullOrEmpty(_saveToDirectory)
                ? downloadItem.SuggestedFileName
                : _saveToDirectory + "\\" + downloadItem.SuggestedFileName;
            var showDialog = string.IsNullOrEmpty(_saveToDirectory);

            callback.Continue(downloadPath, showDialog);
        }
示例#13
0
        public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
        {
            var handler = OnBeforeDownloadFired;
            if (handler != null)
            {
                handler(this, downloadItem);
            }

            if (!callback.IsDisposed)
            {
                using (callback)
                {
                    callback.Continue(_path + "\\" + downloadItem.SuggestedFileName, showDialog: false);
                }
            }
        }
        public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
        {
            if (RuntimeSettings.EnableWebDownloadMode)
            {
                MessageBox.Show("Web downloads are disabled in this mode.", "Downloads Disabled", MessageBoxButton.OK, MessageBoxImage.Information);
                callback.Dispose();
                return;
            }

            if (!callback.IsDisposed)
            {
                using (callback)
                {
                    callback.Continue(downloadItem.SuggestedFileName, showDialog: true);
                }
            }
        }
示例#15
0
        public void OnBeforeDownload(IWebBrowser chromiumWebBrowser,
                                     IBrowser browser,
                                     DownloadItem downloadItem,
                                     IBeforeDownloadCallback callback)
        {
            OnBeforeDownloadFired?.Invoke(this, downloadItem);

            if (callback.IsDisposed)
            {
                return;
            }

            using (callback)
            {
                //Log.Print("Before Download: " + downloadItem.SuggestedFileName);
                callback.Continue(downloadItem.SuggestedFileName, showDialog: false);
            }
        }
示例#16
0
        public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
        {
            var handler = OnBeforeDownloadFired;

            if (handler != null)
            {
                handler(this, downloadItem);
            }

            if (!callback.IsDisposed)
            {
                String thisPath = _defaultPath;
                IEnumerable <Invoice> thisInvoice = MainWindow.invoiceIpc.invoices.Where(x => !String.IsNullOrWhiteSpace(x.norm_szamlaszam) && downloadItem.SuggestedFileName.Contains(x.norm_szamlaszam));
                if (thisInvoice != null && thisInvoice.Count() > 0 && thisInvoice.First() != null)
                {
                    thisPath = legalisePath(_defaultPath.Replace(MainWindow.mask_ev, thisInvoice.First().kibocsatas.Substring(0, 4)).Replace(MainWindow.mask_szolgaltato, thisInvoice.First().szolgaltato).Replace(MainWindow.mask_issuer, thisInvoice.First().kibocsato));
                    System.IO.Directory.CreateDirectory(thisPath);
                }
                else
                {
                    thisPath = legalisePath(_defaultPath.Replace(MainWindow.mask_ev, "").Replace(MainWindow.mask_szolgaltato, "").Replace(MainWindow.mask_issuer, "").Replace(@"\\", @"\"));
                    System.IO.Directory.CreateDirectory(thisPath);
                }
                using (callback)
                {
                    String fullpath = System.IO.Path.Combine(thisPath, legaliseFileName(downloadItem.SuggestedFileName));
                    if (_overwriteFiles || System.IO.File.Exists(fullpath))
                    {
                        callback.Continue(fullpath, showDialog: false);
                    }
                    else
                    {
                        //skip download but notify browser, we are done
                        callback.Dispose();
                        if (browser != null)
                        {
                            CefSharp.LoadingStateChangedEventArgs e = new LoadingStateChangedEventArgs(browser, true, false, false);
                            OnLoadingStateChanged(e);
                        }
                    }
                }
            }
        }
示例#17
0
        public void OnBeforeDownload(IBrowser browser, DownloadItem item, IBeforeDownloadCallback callback)
        {
            if (!callback.IsDisposed)
            {
                using (callback)
                {
                    myForm.UpdateDownloadItem(item);

                    // ask browser what path it wants to save the file into
                    string path = myForm.CalcDownloadPath(item);

                    // if file should not be saved, path will be null, so skip file
                    if (path != null)
                    {
                        // skip file
                        callback.Continue(path, false);
                    }
                }
            }
        }
示例#18
0
        public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
        {
            Console.WriteLine("Bhai please kaam krja");
            var handler = OnBeforeDownloadFired;

            if (handler != null)
            {
                handler(this, downloadItem);
            }

            if (!callback.IsDisposed)
            {
                using (callback)
                {
                    callback.Continue(@"C:\Users\Akhand\Documents\Visual Studio 2015\Projects\ExchangeRecon\ExchangeRecon\AppFiles\Download Data\" + evalPath(downloadItem), showDialog: false);
                    Console.WriteLine("Suggested Download Path : " + downloadItem.SuggestedFileName);
                    Console.WriteLine("Download URL : " + downloadItem.Url);
                }
            }
        }
        public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
        {
            if (!callback.IsDisposed)
            {
                using (callback)
                {
                    //showDialog 下载弹窗是否显示
                    //callback.Continue(@"D:\downloadCef\" + downloadItem.SuggestedFileName,showDialog: false);

                    XJHTTP xj       = new XJHTTP();
                    string filepath = System.Windows.Forms.Application.StartupPath + "\\download";//当前项目目录
                    if (!Directory.Exists(filepath))
                    {
                        Directory.CreateDirectory(filepath);
                    }
                    filepath = filepath + "\\" + xj.EncryptMD5String(DateTime.Now.ToString()) + "_" + downloadItem.SuggestedFileName;
                    callback.Continue(filepath, showDialog: false);
                }
            }
        }
        private void RequestConfigurationFileDownload(DownloadItem downloadItem, IBeforeDownloadCallback callback)
        {
            var args = new DownloadEventArgs();

            logger.Debug($"Detected download request for configuration file '{downloadItem.Url}'.");
            ConfigurationDownloadRequested?.Invoke(downloadItem.SuggestedFileName, args);
            logger.Debug($"Download of configuration file '{downloadItem.Url}' was {(args.AllowDownload ? "granted" : "denied")}.");

            if (args.AllowDownload)
            {
                if (args.Callback != null)
                {
                    callbacks[downloadItem.Id] = args.Callback;
                }

                using (callback)
                {
                    callback.Continue(args.DownloadPath, false);
                }
            }
        }
        public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
        {
            var handler = OnBeforeDownloadFired;

            if (handler != null)
            {
                handler(this, downloadItem);
            }

            if (!callback.IsDisposed)
            {
                using (callback)
                {
                    string filePath = TeescapeInstance.CurrentFolderPath + "\\" + downloadItem.SuggestedFileName;
                    if (!File.Exists(filePath))
                    {
                        if (filePath.Length > 255)
                        {
                            filePath = TeescapeInstance.CurrentFolderPath + "\\vncud_long_" + DateTime.Now + ".png";
                        }
                        callback.Continue(filePath, showDialog: false);
                    }
                    else
                    {
                        TeescapeInstance.TotalDownloadingFile = TeescapeInstance.TotalDownloadingFile - 1;
                        //downloadItem.IsCancelled = true;
                        //downloadItem.IsComplete = true;
                        //downloadItem.IsValid = false;

                        ///callback.Dispose();
                    }
                }
            }
            else
            {
                TeescapeInstance.TotalDownloadingFile = TeescapeInstance.TotalDownloadingFile - 1;
            }
        }
示例#22
0
        public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
        {
            if (!callback.IsDisposed)
            {
                using (callback) {
                    string directory = Properties.Settings.Default.StorageLocation + (GlobalVariables.CurrentUnitCode != "" ? GlobalVariables.CurrentUnitCode + "/" : "");
                    Directory.CreateDirectory(directory);

                    string filename = directory + downloadItem.SuggestedFileName;
                    if (!File.Exists(filename))
                    {
                        callback.Continue(filename, showDialog: false);
                        ++GlobalVariables.FilesDownloaded;

                        BlackboardFile f = new BlackboardFile(downloadItem.SuggestedFileName, downloadItem.Url);
                        f.RawURL          = GlobalVariables.CurrentUrl;
                        f.FirstDownloaded = DateTime.Now;
                        f.LastDownloaded  = DateTime.Now;
                        f.TimesDownloaded = 1;
                        f.LocalPath       = filename;

                        //We know the unit we want exists in GlobalVariables.Units because it was created before the download started, back in Crawler.cs
                        GlobalVariables.Units.First(u => u.Name == GlobalVariables.CurrentUnitCode).Files.Add(f);
                    }
                    else
                    {
                        //FUTURE FEATURE: Allow files to be marked for redownloading.
                        ++GlobalVariables.FilesSkipped;
                    }

                    if (DownloadHandled != null)
                    {
                        DownloadHandled(new object(), new EventArgs());
                    }
                }
            }
        }
示例#23
0
        // 下载之前(单个下载任务 只会执行一次,从这里获取 downloadItem.SuggestedFileName)
        public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
        {
            var handler = OnBeforeDownloadFired;

            if (handler != null)
            {
                var eventArgs = new BeforeDownloadUpdatedEventArgs();
                eventArgs.downloadItem = downloadItem; // DownloadItem 用来获取下载任务信息至关重要
                eventArgs.callback     = callback;

                // 调用事件
                handler(this, eventArgs);
            }

            string downloadPath = @"";

            if (!callback.IsDisposed)
            {
                using (callback)
                {
                    callback.Continue(downloadPath + downloadItem.SuggestedFileName, showDialog: true);
                }
            }
        }
示例#24
0
        public void OnBeforeDownload(IWebBrowser webBrowser, IBrowser browser, DownloadItem item, IBeforeDownloadCallback callback)
        {
            if (!callback.IsDisposed)
            {
                using (callback) {
                    myForm.UpdateDownloadItem(item);

                    // ask browser what path it wants to save the file into
                    string path = myForm.CalcDownloadPath(item);

                    // if file should not be saved, path will be null, so skip file
                    if (path == null)
                    {
                        // skip file
                        callback.Continue(path, false);
                    }
                    else
                    {
                        // open the downloads tab
                        myForm.OpenDownloadsTab();
                        Thread th = new Thread(() => ContinueDownload(path, callback));
                        myForm.threads.Add(th);
                    }
                }
            }
        }
示例#25
0
文件: Form1.cs 项目: mabeyu/CEF
 public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
 {
     if (!callback.IsDisposed)
     {
         using (callback)
         {
             callback.Continue(@"D:\dps下载文件\" + downloadItem.SuggestedFileName,
                               showDialog: false);
         }
     }
 }
示例#26
0
 /// <inheritdoc/>
 protected override void OnBeforeDownload(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
 {
     onBeforeDownload?.Invoke(chromiumWebBrowser, browser, downloadItem, callback);
 }
        public void OnBeforeDownload(IWebBrowser webBrowser, IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
        {
            var uri                 = new Uri(downloadItem.Url);
            var uriExtension        = Path.GetExtension(uri.AbsolutePath);
            var fileExtension       = Path.GetExtension(downloadItem.SuggestedFileName);
            var isConfigurationFile = false;

            isConfigurationFile |= string.Equals(appConfig.ConfigurationFileExtension, fileExtension, StringComparison.OrdinalIgnoreCase);
            isConfigurationFile |= string.Equals(appConfig.ConfigurationFileExtension, uriExtension, StringComparison.OrdinalIgnoreCase);
            isConfigurationFile |= string.Equals(appConfig.ConfigurationFileMimeType, downloadItem.MimeType, StringComparison.OrdinalIgnoreCase);

            logger.Debug($"Detected download request for '{uri}'.");

            if (isConfigurationFile)
            {
                Task.Run(() => RequestConfigurationFileDownload(downloadItem, callback));
            }
            else if (settings.AllowDownloads)
            {
                Task.Run(() => HandleFileDownload(downloadItem, callback));
            }
            else
            {
                logger.Info($"Aborted download request for '{uri}', as downloading is not allowed.");
            }
        }
示例#28
0
 void IDownloadHandler.OnBeforeDownload(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
 {
     if (Listener == null)
     {
         return;
     }
     try {
         if (!callback.IsDisposed)
         {
             using (callback) {
                 var loader = new WebDownloader();
                 Listener.OnDownload(downloadItem.Url, downloadItem.SuggestedFileName, downloadItem.TotalBytes, loader);
                 if (loader.Data != null)
                 {
                     callback.Continue(loader.Data.Destination, false);
                     _downloads[downloadItem.Id] = loader.Data;
                     UpdateIsAnyDownloadActive();
                 }
             }
         }
     } catch (Exception e) {
         Logging.Error(e);
     }
 }
示例#29
0
 public void OnBeforeDownload(IBrowser browser, CefSharp.DownloadItem downloadItem, IBeforeDownloadCallback callback)
 {
     Dispatcher.BeginInvoke((Action)(() =>
     {
         mainWindow.Downloads1.AddDownload(downloadItem.Url, Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), downloadItem.SuggestedFileName);
         mainWindow.Downloads1.Visibility = Visibility.Visible;
     }));
 }
示例#30
0
文件: UnoHostView.cs 项目: zzyzy/uno
 public void OnBeforeDownload(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
 {
     Debug.WriteLine("Downlading: " + downloadItem.FullPath);
 }
示例#31
0
 public void OnBeforeDownload(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
 {
     //if (downloadItem.SuggestedFileName.EndsWith(".hdtpkg4") == false) return;
     if (!callback.IsDisposed)
     {
         using (callback)
         {
             string file = ApplicationInfo.RelativePath("packages", downloadItem.SuggestedFileName);
             if (System.IO.File.Exists(file))
             {
                 if (System.IO.Directory.Exists(ApplicationInfo.RelativePath("backupPackages")) == false)
                 {
                     System.IO.Directory.CreateDirectory(ApplicationInfo.RelativePath("backupPackages"));
                 }
                 System.IO.File.Move(file, ApplicationInfo.RelativePath("backupPackages", Guid.NewGuid().ToString() + downloadItem.SuggestedFileName));
             }
             downloads[downloadItem.Id] = new DownloadStatus(file, downloadItem.TotalBytes);
             downloads[downloadItem.Id].Show();
             callback.Continue(file, false);
         }
     }
 }
示例#32
0
        public void OnBeforeDownload(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
        {
            Preferences pref = new Preferences();

            if (pref.DownloadFolder != null)
            {
                downloadItem.SuggestedFileName = Path.Combine(pref.DownloadFolder, downloadItem.SuggestedFileName);
            }

            OnBeforeDownloadFired?.Invoke(this, downloadItem);

            if (!callback.IsDisposed)
            {
                using (callback)
                {
                    callback.Continue(downloadItem.SuggestedFileName, showDialog: true);
                }
            }
        }
示例#33
0
 void IDownloadHandler.OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
 {
     if (!callback.IsDisposed)
     {
         using (callback) {
             callback.Continue(downloadItem.SuggestedFileName, showDialog: true);
         }
     }
 }
        public void OnBeforeDownload(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
        {
            OnBeforeDownloadFired?.Invoke(this, downloadItem);

            if (!callback.IsDisposed)
            {
                using (callback)
                {
                    callback.Continue(downloadItem.SuggestedFileName, showDialog: true);
                }
            }
        }
示例#35
0
        public void OnBeforeDownload(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
        {
            if (callback.IsDisposed)
            {
                return;
            }

            if (_rejectDownloads)
            {
                Logger.Log("Rejected download due to set reject_download to true; URL was: " + downloadItem.OriginalUrl, Logger.LogLevel.debug);
                return;
            }


            bool showDialog = true;

            foreach (var kv in _beforeDownloadScripts)
            {
                if (kv.Key.Match(downloadItem.OriginalUrl))
                {
                    if (executeBeforeDownloadScript(kv.Value, kv.Key.AddressPattern, ref showDialog, downloadItem))
                    {
                        Logger.Log("Rejected download due to result of the on-download handler; URL was: " + downloadItem.OriginalUrl, Logger.LogLevel.debug);
                        return;
                    }
                    ;
                    break;
                }
            }

            if (!callback.IsDisposed)
            {
                using (callback) {
                    callback.Continue(downloadItem.SuggestedFileName, showDialog: showDialog);
                }
            }
        }
示例#36
0
 public void OnBeforeDownload(IBrowser browser, CefSharp.DownloadItem downloadItem,
     IBeforeDownloadCallback callback)
 {
     Dispatcher.BeginInvoke((Action) (() =>
     {
         mainWindow.Downloads1.AddDownload(downloadItem.Url,
             Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory),
             downloadItem.SuggestedFileName);
         if (mainWindow.Downloads1.ActualHeight.Equals(0))
         {
             double height = 0;
             if (!mainWindow.Downloads1.ItemsCount.Equals(0))
             {
                 height = mainWindow.Downloads1.MarginTop + 50 +
                          mainWindow.Downloads1.Items.Count*mainWindow.Downloads1.ItemHeight;
             }
             else
             {
                 height = mainWindow.Downloads1.MarginTop + 50;
             }
             mainWindow.Downloads1.Visibility = Visibility.Visible;
             StaticFunctions.AnimateScale(0, 0, 250, height, mainWindow.Downloads1, 0.2);
             StaticFunctions.AnimateFade(0, 1, mainWindow.Downloads1, 0.2, mainWindow.Downloads1.RefreshDownloads);
         }
     }));
 }