Example #1
0
 private void html_DownloadAsyncCompleted(DownloadClient<XDocument> sender, DownloadCompletedEventArgs<XDocument> e)
 {
     sender.AsyncDownloadCompleted -= this.html_DownloadAsyncCompleted;
     AsyncArgs args = (AsyncArgs)e.UserArgs;
     this.ConvertHtml(e.Response.Result, args);
     this.UploadAsync2(args);
 }
Example #2
0
        private void BeatSaverApi_DownloadCompleted(object sender, DownloadCompletedEventArgs e)
        {
            if (OnlineBeatmaps is null)
            {
                return;
            }

            if (!OnlineBeatmaps.Maps.Contains(e.Beatmap))
            {
                OnlineBeatmap onlineBeatmap = OnlineBeatmaps.Maps.FirstOrDefault(x => x.Key == e.Beatmap.Key);
                if (onlineBeatmap != null)
                {
                    onlineBeatmap.IsDownloading = e.Beatmap.IsDownloading;
                    onlineBeatmap.IsDownloaded  = e.Beatmap.IsDownloaded;
                }
            }

            if (!OnlineBeatmaps.Maps.Any(x => x.IsDownloading) && !App.BeatSaverApi.Downloading.Any())
            {
                MainWindow.radioButtonSettings.IsEnabled = true;
            }

            BeatmapChanged = true;
            UpdatePageButtons();
        }
Example #3
0
        public override async Task Refresh()
        {
            var client   = CreateClient();
            var torrents = await client.GetListAsync();

            var completeds = torrents.Result.Torrents.Where(t => t.Downloaded > 0 && t.Remaining == 0);

            foreach (var completed in completeds)
            {
                var hash       = completed.Hash;
                var files      = (await client.GetFilesAsync(hash)).Result.Files;
                var fileNames  = files.SelectMany(fc => fc.Value.Select(f => f.Name));
                var sourcePath = completed.Path;

                var args = new DownloadCompletedEventArgs(hash, sourcePath, fileNames);
                OnDownloadCompleted(args);
                if (args.Found && Settings.DeleteCompletedTorrents)
                {
                    await client.DeleteTorrentAsync(hash);

                    await Task.Delay(1618);

                    if (args.Moved)
                    {
                        Helper.DeleteDirectory(sourcePath);
                    }
                }
            }
        }
        public override Task Refresh()
        {
            return(Task.Run(() => {
                var client = CreateClient();
                var torrents = client.GetTorrents(new[] { Fields.ID, Fields.HASH_STRING, Fields.PERCENT_DONE, Fields.DOWNLOAD_DIR, Fields.FILES });

                var completeds = torrents.Torrents.Where(t => t.PercentDone >= 1);
                foreach (var completedTmp in completeds)
                {
                    var completed = completedTmp;
                    var sourcePath = completed.DownloadDir;

                    var files = completed.Files.Select(f => Path.GetFileName(Path.Combine(completed.DownloadDir, f.Name)));
                    var args = new DownloadCompletedEventArgs(completed.HashString, sourcePath, files);
                    OnDownloadCompleted(args);

                    if (args.Found && Settings.DeleteCompletedTorrents)
                    {
                        client.RemoveTorrents(new[] { completed.ID }, args.Moved);
                        if (args.Moved)
                        {
                            Helper.DeleteDirectory(sourcePath);
                        }
                    }
                }
            }));
        }
Example #5
0
 private void Downloader_DownloadCompleted(object sender, DownloadCompletedEventArgs e)
 {
     if (downloader.Status != DownloadStatus.Canceled)
     {
         this.Invoke(new Action(() => DlNext()));
     }
 }
Example #6
0
        /*==Event-xử-lý-khi-hoàn-tất-download==*/
        protected static void DownloadCompleted(object sender, DownloadCompletedEventArgs e)
        {
            var lbSummary = string.Empty;

            if (e.Error == null)
            {
                lbSummary = String.Format("Received: {0}KB, Total: {1}KB, Time: {2}:{3}:{4}",
                                          e.DownloadedSize / 1024, e.TotalSize / 1024, e.TotalTime.Hours,
                                          e.TotalTime.Minutes, e.TotalTime.Seconds);

                File.Move(DestPath.Trim() + ".downloading", DestPath.Trim());//Đổi tên tệp tin
            }
            else
            {
                lbSummary = e.Error.Message;
                if (File.Exists(DestPath.Trim() + ".downloading"))
                {
                    File.Delete(DestPath.Trim() + ".downloading");
                }

                if (File.Exists(DestPath.Trim()))
                {
                    File.Delete(DestPath.Trim());
                }
            }
        }
Example #7
0
        private DownloadCompletedEventArgs OnFileDownloadCompleted(object sender)
        {
            var e = new DownloadCompletedEventArgs();

            FileDownloadCompleted?.Invoke(sender, e);
            return(e);
        }
Example #8
0
        private void ActiveDownloadCompleted(object sender, DownloadCompletedEventArgs e)
        {
            ActiveDownloads.TryRemove(e.Info.Id, out _);
            ProcessQueue();

            Logger.Debug("Download of " + e.Info.File + " is completed");
        }
        internal void HandlerOnDownloadItemDownloadCompleted(object sender, DownloadCompletedEventArgs args)
        {
            if (args.Error != null)
            {
                _downloadErrors++;
            }

            var downloadManagerItem = (DownloadManagerItem)sender;

            downloadManagerItem.DownloadItemDownloadCompleted -= HandlerOnDownloadItemDownloadCompleted;

            if (DownloadingAllSongs && (--DownloadItemsRemaining <= 0))
            {
                Workspace.Settings.LastSync = DateTime.Now;
                RaisePropertyChanged(nameof(LastSync));

                DownloadingAllSongs = false;
                if (_downloadErrors > 0)
                {
                    Messenger.Default.Send(new ShowMessageDialogMessage("Errors during sync", "The sync is completed but some downloads failed during the syncing process.\nThis usually happens if you have no internet connection, the song is not available in your country, was removed or is not accessible at all."));
                }

                _downloadErrors = 0;
            }

            if (args.Cancelled)
            {
                return;
            }

            DownloadedTracks++;

            SearchTextChanged();
        }
Example #10
0
        void _downloader_DownloadCompleted(object sender, DownloadCompletedEventArgs e)
        {
            if (e.Cancelled)
            {
                CurrentActionText = "Download was cancelled.";
                State             = DownloadState.Cancelled;
            }
            else if (e.Error != null)
            {
                CurrentActionText = "Unable to download/save requested chaper";
                State             = DownloadState.Error;
                _log.Error("Unable to download/save requested chapter.", e.Error);
            }
            else
            {
                State = DownloadState.Ok;
                _openDownloadCommand.Disabled = false;
                _downloadInfo.Path            = e.DownloadedPath;
            }

            _downloadInfo.Downloaded = DateTime.UtcNow;
            Completed = true;
            _cancelDownloadCommand.Disabled = true;
            _downloadExists = null; // reset the download exists flag

            OnDownloadCompleted();
        }
Example #11
0
 private void Session_DownloadCompleted(VideoDownloadSession sender, DownloadCompletedEventArgs e)
 {
     currentDownloadSession = null;
     sender.Dispose();
     if (!e.Cancelled)
     {
         if (e.Error != null)
         {
             this.Dispatcher.BeginInvoke(new Session_ProgressChangedA(() =>
             {
                 this.SetValue(IsYoutubeDownloadingProperty, false);
                 MessageBox.Show(this, e.Error.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
             }));
         }
         else
         {
             this.Dispatcher.BeginInvoke(new Session_ProgressChangedA(() =>
             {
                 this.SetValue(IsYoutubeDownloadingProperty, false);
                 if (MessageBox.Show(this, $"Do you want to open output folder?", "Prompt", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                 {
                     Process.Start("explorer.exe", $"/select,\"{e.DownloadDestination}\"");
                 }
             }));
         }
     }
     else
     {
         this.Dispatcher.BeginInvoke(new Session_ProgressChangedA(() => this.SetValue(IsYoutubeDownloadingProperty, false)));
     }
 }
Example #12
0
 protected virtual void OnDownloadCompleted(DownloadCompletedEventArgs e)
 {
     OnPropertyChanged("Progress");
     OnPropertyChanged("Status");
     OnPropertyChanged("SpeedString");
     OnPropertyChanged("DownloadedSize");
 }
        private void ModelSaberApi_DownloadCompleted(object sender, DownloadCompletedEventArgs e)
        {
            if (OnlineModels is null || e.Model.ModelType != ModelType)
            {
                return;
            }

            if (!OnlineModels.Models.Contains(e.Model))
            {
                OnlineModel onlineModel = OnlineModels.Models.FirstOrDefault(x => x.Id == e.Model.Id);
                if (onlineModel != null)
                {
                    onlineModel.IsDownloading = e.Model.IsDownloading;
                    onlineModel.IsDownloaded  = e.Model.IsDownloaded;
                }
            }

            if (!OnlineModels.Models.Any(x => x.IsDownloading) && !App.ModelSaberApi.Downloading.Any())
            {
                MainWindow.radioButtonSettings.IsEnabled = true;
            }

            ModelChanged = true;
            UpdatePageButtons();
        }
Example #14
0
        protected void DownloadCompletedHandler(object sender, DownloadCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                lbSummary.Text =
                    String.Format("Received: {0}KB, Total: {1}KB, Time: {2}:{3}:{4}",
                                  e.DownloadedSize / 1024, e.TotalSize / 1024, e.TotalTime.Hours,
                                  e.TotalTime.Minutes, e.TotalTime.Seconds);

                File.Move(tbPath.Text.Trim() + ".tmp", tbPath.Text.Trim());

                prgDownload.Value = 100;
            }
            else
            {
                lbSummary.Text = e.Error.Message;
                if (File.Exists(tbPath.Text.Trim() + ".tmp"))
                {
                    File.Delete(tbPath.Text.Trim() + ".tmp");
                }

                if (File.Exists(tbPath.Text.Trim()))
                {
                    File.Delete(tbPath.Text.Trim());
                }

                prgDownload.Value = 0;
            }
        }
Example #15
0
        public void DownloadCompleted(object sender, DownloadCompletedEventArgs e)
        {
            FileDownloadEventArgs ev = new FileDownloadEventArgs();

            ev.byFile = e.Result;
            Event_Download(this, ev);
        }
        protected override void OnMuxing(object sender, DownloadCompletedEventArgs e)
        {
            // Separate file extension.
            DownloadItemData IData = e.DownloadInfo.Data as DownloadItemData;

            FileProgress     VideoFile = e.DownloadInfo.Files.FirstOrDefault(f => f.Type == StreamType.Video);
            FileProgress     AudioFile = e.DownloadInfo.Files.FirstOrDefault(f => f.Type == StreamType.Audio);
            string           SrcFile   = IData.Media.FileName != null ? Settings.NaturalGroundingFolder + IData.Media.FileName : null;
            CompletionStatus Result    = CompletionStatus.Success;

            if (IData.Media.FileName != null && File.Exists(SrcFile) && (VideoFile == null || AudioFile == null))
            {
                // Upgrade audio or video
                FFmpegProcess MInfo       = MediaInfo.GetFileInfo(SrcFile);
                string        VideoFormat = VideoFile != null?Path.GetExtension(VideoFile.Destination).TrimStart('.') : MInfo.VideoStream?.Format;

                string AudioFormat = AudioFile != null?Path.GetExtension(AudioFile.Destination).TrimStart('.') : MInfo.AudioStream?.Format;

                string VideoDestExt = GetFinalExtension(VideoFormat, AudioFormat);
                e.DownloadInfo.Destination = e.DownloadInfo.DestinationNoExt + VideoDestExt;
                Result = MediaMuxer.Muxe(VideoFile?.Destination ?? SrcFile, AudioFile?.Destination ?? SrcFile, e.DownloadInfo.Destination);
            }
            if (Result == CompletionStatus.Success && File.Exists(SrcFile))
            {
                FileOperationAPIWrapper.MoveToRecycleBin(SrcFile);
            }

            e.DownloadInfo.Status = Result == CompletionStatus.Success ? DownloadStatus.Done : DownloadStatus.Failed;
        }
        private void DownloadItemOnDownloadItemDownloadCompleted(object sender, DownloadCompletedEventArgs args)
        {
            DownloadPending = false;
            Downloading     = false;

            CheckForTrack();
            if (args.Error != null)
            {
                DownloadState = DownloadState.Error;
            }
            else if (!args.Cancelled)
            {
                Item.DownloadDate = DateTime.Now;
                RaisePropertyChanged(nameof(DownloadDate));
            }

            var managerItem = (DownloadManagerItem)sender;

            managerItem.DownloadItemDownloadProgressChanged -= DownloadItemOnDownloadItemDownloadProgressChanged;
            managerItem.DownloadItemDownloadCompleted       -= DownloadItemOnDownloadItemDownloadCompleted;
            managerItem.DownloadItemDownloadStarted         -= DownloadItemOnDownloadItemDownloadStarted;

            managerItem.Dispose();
            _downloadItem = null;

            _workspaceViewModel.HandlerOnDownloadItemDownloadCompleted(sender, args);
        }
 protected virtual void OnDownloadCompleted(DownloadCompletedEventArgs e)
 {
     var handler = DownloadCompleted;
     if (handler != null)
     {
         handler(this, e);
     }
 }
Example #19
0
 void client_DownloadCompleted(object sender, DownloadCompletedEventArgs e)
 {
     if (e.Error != null && Status != DownloadStatus.Canceled)
     {
         Cancel();
         OnDownloadCompleted(new DownloadCompletedEventArgs(null, DownloadedSize, TotalSize, TotalUsedTime, e.Error));
     }
 }
Example #20
0
        private void html_DownloadAsyncCompleted(DownloadClient <XDocument> sender, DownloadCompletedEventArgs <XDocument> e)
        {
            sender.AsyncDownloadCompleted -= this.html_DownloadAsyncCompleted;
            AsyncArgs args = (AsyncArgs)e.UserArgs;

            this.ConvertHtml(e.Response.Result, args);
            this.UploadAsync2(args);
        }
Example #21
0
        protected void OnDownloadCompleted(DownloadCompletedEventArgs eventArgs)
        {
            var dcEvent = DownloadCompleted;

            if (dcEvent != null)
            {
                dcEvent(this, eventArgs);
            }
        }
Example #22
0
            /// <summary>
            /// The method will be called by the OnStatusChanged method.
            /// </summary>
            /// <param name="e"></param>
            protected virtual void OnDownloadCompleted(DownloadCompletedEventArgs e)
            {
                if (e.Error != null && this.status != DownloadStatus.Canceled)
                {
                    this.Status = DownloadStatus.Completed;
                }

                DownloadCompleted?.Invoke(this, e);
            }
Example #23
0
        protected virtual void OnDownloadCompleted(DownloadCompletedEventArgs e)
        {
            var handler = DownloadCompleted;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Example #24
0
 private async void DownloadBusiness_DownloadCompleted(object sender, DownloadCompletedEventArgs e)
 {
     if (e.DownloadInfo.IsCompleted)
     {
         DownloadItemData IData = e.DownloadInfo.Data as DownloadItemData;
         MediaList.business.RefreshPlaylist(IData.Media, null);
         await MediaList.LoadDataAsync();
     }
 }
Example #25
0
        } // OnDownloadStarted

        protected virtual void OnDownloadCompleted(object sender, DownloadCompletedEventArgs e)
        {
            if (DownloadCompleted == null)
            {
                return;
            }

            DownloadCompleted(sender, e);
        } // OnDownloadCompleted
Example #26
0
        private async void DownloadBusiness_DownloadCompleted(object sender, DownloadCompletedEventArgs e)
        {
            DownloadItemData IData = e.DownloadInfo.Data as DownloadItemData;

            if (e.DownloadInfo.IsCompleted && this.IsVisible && currentPage == downloadPage)
            {
                await PlayVideo(PlayerAccess.GetVideoById(IData.Media.MediaId));
            }
        }
        private void AddPortfolioItem_Completed(DownloadClient <XDocument> sender, DownloadCompletedEventArgs <XDocument> e)
        {
            AddPfItemAsyncArgs args = (AddPfItemAsyncArgs)e.UserArgs;
            Portfolio          pf   = new PortfolioDownload().ConvertHtmlDoc(e.Response.Result);

            if (this.AsyncAddPortfolioItemCompleted != null)
            {
                this.AsyncAddPortfolioItemCompleted(this, ((DefaultDownloadCompletedEventArgs <XDocument>)e).CreateNew(pf));
            }
        }
Example #28
0
 private void dl_DownloadAsyncCompleted(DownloadClient<System.IO.Stream> sender, DownloadCompletedEventArgs<System.IO.Stream> e)
 {
     sender.AsyncDownloadCompleted -= this.dl_DownloadAsyncCompleted;
     XDocument doc = null;
     if (e.Response.Result != null)
     {
         doc = MyHelper.ParseXmlDocument(e.Response.Result);
     }
     if (this.AsyncUploadCompleted != null) this.AsyncUploadCompleted(this, ((DefaultDownloadCompletedEventArgs<System.IO.Stream>)e).CreateNew(doc));
 }
Example #29
0
        private void DownloadManager_DownloadCompleted(object sender, DownloadCompletedEventArgs e)
        {
            lock (_streams)
            {
                var stream = _streams.FirstOrDefault(s => s.Magnet.TTH == e.DownloadItem.Magnet.TTH);

                stream?.ReplaceDownloadItemWithFile(e.DownloadItem.SaveTargets[0]);
            }

            Share?.AddFile(new ContentItem(e.DownloadItem));
        }
Example #30
0
 /// <summary>Updates the UI when the downloading of updates has completed.</summary>
 /// <param name="sender">The object that called the event.</param>
 /// <param name="e">The <c>SevenUpdate.DownloadCompletedEventArgs</c> instance containing the event data.</param>
 void DownloadCompleted(object sender, DownloadCompletedEventArgs e)
 {
     if (!this.Dispatcher.CheckAccess())
     {
         this.Dispatcher.BeginInvoke(DownloadCompleted, e);
     }
     else
     {
         DownloadCompleted(e);
     }
 }
        protected override void OnCompleted(object sender, DownloadCompletedEventArgs e)
        {
            DownloadItemData IData          = e.DownloadInfo.Data as DownloadItemData;
            Media            Video          = IData.Media;
            string           Destination    = e.DownloadInfo.Destination;
            string           DestinationExt = Path.GetExtension(Destination);

            Destination = Destination.Substring(0, Destination.Length - Path.GetExtension(Destination).Length);

            // Ensure download and merge succeeded.
            if (!FileHasContent(e.DownloadInfo.Destination))
            {
                e.DownloadInfo.Status = DownloadStatus.Failed;
                return;
            }

            // Get final file name.
            DefaultMediaPath PathCalc    = new DefaultMediaPath();
            string           NewFileName = PathCalc.GetDefaultFileName(Video.Artist, Video.Title, Video.MediaCategoryId, (MediaType)Video.MediaTypeId);

            Directory.CreateDirectory(Path.GetDirectoryName(Settings.NaturalGroundingFolder + NewFileName));
            Video.FileName = NewFileName + DestinationExt;

            // Move file and overwrite.
            string DstFile = Settings.NaturalGroundingFolder + Video.FileName;

            if (File.Exists(DstFile))
            {
                FileOperationAPIWrapper.MoveToRecycleBin(DstFile);
            }
            File.Move(Destination + DestinationExt, DstFile);

            // Add to database
            EditVideoBusiness Business     = new EditVideoBusiness();
            Media             ExistingData = Business.GetVideoById(Video.MediaId);

            if (ExistingData != null)
            {
                // Edit video info.
                ExistingData.FileName = Video.FileName;
                ExistingData.Length   = null;
                ExistingData.Height   = null;
                Business.Save();
            }
            else
            {
                // Add new video info.
                Business.AddVideo(Video);
                Business.Save();
            }

            base.OnCompleted(sender, e);
        }
Example #32
0
        } // FireDownloadStarted

        protected virtual void FireDownloadCompleted()
        {
            if (DownloadCompleted == null)
            {
                return;
            }

            var e = new DownloadCompletedEventArgs()
            {
                Payloads = this.Payloads
            };

            OnDownloadCompleted(this, e);
        } // FireDownloadCompleted
        /// <summary>
        /// Occurs when download is completed.
        /// </summary>
        private async void Download_Complete(object sender, DownloadCompletedEventArgs args)
        {
            DownloadItemData IData = args.DownloadInfo.Data as DownloadItemData;

            if (args.DownloadInfo.IsCompleted && (IData.QueuePos == 0 || player.CurrentVideo == null) && !player.AllowClose)
            {
                nextVideo = IData.Media;
                player_PlayNext(null, null);
            }
            else if (args.DownloadInfo.IsCanceled && IData.QueuePos > -1 && playMode != PlayerMode.Manual)
            {
                nextVideo = null;
                await SelectNextVideoAsync(IData.QueuePos, false).ConfigureAwait(false);
            }
        }
Example #34
0
        private void displayBoard(object sender, DownloadCompletedEventArgs args)
        {
            var list = new List<ListViewItem>();

            _currentBoard.Threads.Sort((x, y) => y.Speed.CompareTo(x.Speed));
            foreach (var thread in _currentBoard.Threads) {
                var item =
                    new ListViewItem(new[] { thread.Name, thread.Speed.ToString(), thread.ResNum.ToString() });
                if (thread.ResNum == 1001) {
                    item.BackColor = Color.Red;
                }
                list.Add(item);
            }

            Invoke(new Action(lvwBoard.Items.Clear));
            Invoke(new Action(() => lvwBoard.Items.AddRange(list.ToArray())));
        }
Example #35
0
 /// <summary>
 /// An event handler called when the download of a new Skitter file has completed.
 /// </summary>
 /// <param name="sender">The sender object.</param>
 /// <param name="eventArgs">The download completed event arguments.</param>
 void OnSkitterDownloadCompleted(object sender, DownloadCompletedEventArgs eventArgs)
 {
     if (this.SkitterDownloadCompleted != null) this.SkitterDownloadCompleted(sender, eventArgs);
 }
 private void LogOutAsync_Completed(DownloadClient<XDocument> sender, DownloadCompletedEventArgs<XDocument> e)
 {
     if (e.Response.Connection.State == ConnectionState.Success)
     {
         mCookies = null;
         this.SetCrumb(string.Empty);
         if (this.PropertyChanged != null) this.PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs("IsLoggedIn"));
         if (this.LoggedStatusChanged != null) this.LoggedStatusChanged(this, new LoginStateEventArgs(this.IsLoggedIn, e.UserArgs));
     }
 }
 private void logInDl_Completed(WebFormUpload sender, DownloadCompletedEventArgs<XDocument> e)
 {
     sender.AsyncUploadCompleted -= this.logInDl_Completed;
     if (this.IsLoggedInFunc(mCookies)) { if (this.LoggedStatusChanged != null) this.LoggedStatusChanged(this, new LoginStateEventArgs(this.IsLoggedIn, e.UserArgs)); }
     else { mCookies = null; }
     if (this.PropertyChanged != null) this.PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs("IsLoggedIn"));
 }
Example #38
0
 /// <summary>Updates the UI when the downloading of updates completes.</summary>
 /// <param name="e">The <c>SevenUpdate.DownloadCompletedEventArgs</c> instance containing the event data.</param>
 static void DownloadCompleted(DownloadCompletedEventArgs e)
 {
     Core.Instance.UpdateAction = e.ErrorOccurred ? UpdateAction.ErrorOccurred : UpdateAction.Installing;
 }
Example #39
0
 /// <summary>Updates the UI when the downloading of updates has completed.</summary>
 /// <param name="sender">The object that called the event.</param>
 /// <param name="e">The <c>SevenUpdate.DownloadCompletedEventArgs</c> instance containing the event data.</param>
 void DownloadCompleted(object sender, DownloadCompletedEventArgs e)
 {
     if (!this.Dispatcher.CheckAccess())
     {
         this.Dispatcher.BeginInvoke(DownloadCompleted, e);
     }
     else
     {
         DownloadCompleted(e);
     }
 }
Example #40
0
 void fileclient_DownloadCompleted(object sender, DownloadCompletedEventArgs e)
 {
     //throw new NotImplementedException();
 }
Example #41
0
 protected virtual void On_DownloadCompletedEventArgs(DownloadCompletedEventArgs e)
 {
     if (this.DownloadCompleted != null)
     {
         this.DownloadCompleted(this, e);
     }
 }
Example #42
0
 protected virtual void OnDownLoadCompleted(DownloadCompletedEventArgs args)
 {
     if (DownloadCompleted != null)
     {
         DownloadCompleted(this, args);
     }
 }
Example #43
0
 public void DownloadCompleted(object sender, DownloadCompletedEventArgs e)
 {
     FileDownloadEventArgs ev = new FileDownloadEventArgs();
     ev.byFile = e.Result;
     Event_Download(this, ev);
 }
Example #44
0
 private void displayThread(object sender, DownloadCompletedEventArgs args)
 {
     Invoke(new Action(() => wbThread.DocumentText = _currentBoard.Threads[_selectedThreadIndex].ToXml().ToString()));
     Invoke(new Action(() => wbThread.DocumentCompleted += wbScroll));
 }
Example #45
0
        /// <summary>Reports that the download has completed and starts update installation if necessary.</summary>
        /// <param name="sender">The object that called the event.</param>
        /// <param name="e">The <c>DownloadCompletedEventArgs</c> instance containing the event data.</param>
        static void DownloadCompleted(object sender, DownloadCompletedEventArgs e)
        {
            if ((Settings.AutoOption == AutoUpdateOption.Install && isAutoInstall) || !isAutoInstall)
            {
                if (isClientConnected)
                {
                    client.OnDownloadCompleted(sender, e);
                }

                Application.Current.Dispatcher.BeginInvoke(UpdateNotifyIcon, NotifyType.InstallStarted);
                IsInstalling = true;
                File.Delete(Path.Combine(AllUserStore, "updates.sui"));
                Task.Factory.StartNew(
                    () => Install.InstallUpdates(Applications, Path.Combine(AllUserStore, "downloads")));
            }
            else
            {
                IsInstalling = false;
                Application.Current.Dispatcher.BeginInvoke(UpdateNotifyIcon, NotifyType.DownloadComplete);
            }
        }
 private void AddPortfolioItem_Completed(DownloadClient<XDocument> sender, DownloadCompletedEventArgs<XDocument> e)
 {
     AddPfItemAsyncArgs args = (AddPfItemAsyncArgs)e.UserArgs;
     Portfolio pf = new PortfolioDownload().ConvertHtmlDoc(e.Response.Result);
     if (this.AsyncAddPortfolioItemCompleted != null) this.AsyncAddPortfolioItemCompleted(this, ((DefaultDownloadCompletedEventArgs<XDocument>)e).CreateNew(pf));
 }
Example #47
0
 void Manager_DownloadCompleted(object sender, DownloadCompletedEventArgs e)
 {
     // MessageBox.Show("All downloaded");
 }
 private void PortfolioInfoDownload_Completed(DownloadClient<PortfolioInfoResult> sender, DownloadCompletedEventArgs<PortfolioInfoResult> e)
 {
     sender.AsyncDownloadCompleted -= this.PortfolioInfoDownload_Completed;
     if (this.AsyncPortfolioInfoDownloadCompleted != null) this.AsyncPortfolioInfoDownloadCompleted(this, e);
 }
 private void HoldingsDownload_Completed(DownloadClient<HoldingsResult> sender, DownloadCompletedEventArgs<HoldingsResult> e)
 {
     sender.AsyncDownloadCompleted -= this.HoldingsDownload_Completed;
     if (this.AsyncHoldingsDownloadCompleted != null) this.AsyncHoldingsDownloadCompleted(this, e);
 }