예제 #1
0
        public void executeOperation(Button btn, Label lbl, String url, IDownloadObserver observer)
        {
            mIDownloadObserver = observer;
            //
            if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
            {
                if (mIDownloadObserver != null)
                {
                    mIDownloadObserver.onMessage(new DownloadArgument("NetworkFailed"));
                }
                return;
            }

            if (btn.Text == "Cancel")
            {
                btn.Text = "Download";
                cancel(url);
                return;
            }

            FileDownloader fd = create(lbl, url, observer, btn);

            if (fd.DownloadStatus == "Continue")
            {
                return;
            }

            if (fd.DownloadStatus != "Completed")
            {
                fd.DownloadAsync(url, this);
                btn.Text    = "Cancel";
                btn.Enabled = true;
            }
        }
예제 #2
0
        public FileDownloader exeute(Label lblProgress, String url, IDownloadObserver IDownloadObserver)
        {
            mIDownloadObserver = IDownloadObserver;
            //
            FileDownloader fd = new FileDownloader(lblProgress);

            this.Add(fd);
            fd.DownloadAsync(url, this);
            return(fd);
        }