private static void EmitDownloadEvent(DownloadEventHandler handler, DownloadEventArgs args)
 {
     if (handler != null)
     {
         handler(null, args);
     }
 }
Пример #2
0
        protected virtual void OnFinished()
        {
            DownloadEventHandler handler = Finished;

            if (handler != null)
            {
                handler(this, new DownloadEventArgs(dif));
            }
        }
Пример #3
0
        protected virtual void OnStart()
        {
            DownloadEventHandler handler = Started;

            if (handler != null)
            {
                handler(this, new DownloadEventArgs(dif));
            }
        }
Пример #4
0
        protected virtual void OnDownloadStateChanged(DownloadEventHandler handler,
                                                      DownloadEventArgs args)
        {
            DownloadEventHandler local_handler = handler;

            if (local_handler != null)
            {
                local_handler(this, args);
            }
        }
Пример #5
0
 public Updater(MainViewModel mainView, DownloadEventHandler onDownloadStart, DownloadEventHandler onDownloading,
                DownloadEventHandler onDownloadCompleted, DownloadErrorEventHandler onError)
 {
     _mainView = mainView;
     _dlClient = new DownloaderClient();
     _dlClient.OnDownloadStart     += onDownloadStart;
     _dlClient.OnDownloading       += onDownloading;
     _dlClient.OnDownloadCompleted += onDownloadCompleted;
     _dlClient.OnError             += onError;
 }
Пример #6
0
        protected virtual void OnStop()
        {
            if (dif.State == DownloadState.CancelRequested)
            {
                dif.State = DownloadState.Canceled;

                try
                {
                    if (File.Exists(TempFilePath))
                    {
                        File.Delete(TempFilePath);
                        DeleteTempDirectory();
                        DeleteDirectory();
                    }
                }
                catch {}
            }

            else if (dif.State == DownloadState.Completed)
            {
                try
                {
                    if (File.Exists(TempFilePath))
                    {
                        CreateDirectory();
                        HandleExistingFile();
                        File.Move(TempFilePath, FilePath);
                        DeleteTempDirectory();
                    }
                }
                catch {}
            }
            else if (dif.State == DownloadState.Queued)
            {
                dif.State = DownloadState.Ready;
            }

            DownloadEventHandler handler = Stopped;

            if (handler != null)
            {
                handler(this, new DownloadEventArgs(dif));
            }

            if (!dif.Active)
            {
                OnFinished();
            }
        }
Пример #7
0
        public void RegisterForDownloadNotification(DownloadEventHandler eventHandler, DownloadEventProgressHandler progressHandler, EventHandler allPendingHandler)
        {
            return;

            throw new NotImplementedException();
        }
Пример #8
0
 public void Download(IList items, EDownloadFlags eDownloadFlags, string deviceEndpointId, EDownloadContextEvent clientContextEvent, string clientContextEventData, DownloadEventHandler eventHandler, DownloadEventProgressHandler progressHandler, EventHandler allPendingHandler)
 {
     throw new NotImplementedException();
 }
 private static void EmitDownloadEvent(DownloadEventHandler handler, DownloadEventArgs args)
 {
     if (handler != null)
     {
         handler (null, args);
     }
 }
        protected virtual void OnDownloadStateChanged(DownloadEventHandler handler,
                DownloadEventArgs args)
        {
            DownloadEventHandler local_handler = handler;

            if (local_handler != null)
            {
                local_handler (this, args);
            }
        }