Пример #1
0
 static public void ActivateConsole(string text)
 {
     if (form == null)
     {
         hideTimer          = new Timer();
         hideTimer.Interval = 3000;
         hideTimer.Tick    += new EventHandler(hideTimer_Tick);
         form          = new RotateWait();
         form.WaitText = text;
         form.Show();
         // form.SendToBack();
     }
     else
     {
         hideTimer.Start();
     }
 }
Пример #2
0
        public DownloadRotateWait(string url, string destinationFile, string description)
        {
            this.DownloadUrl     = url;
            this.Description     = description;
            this.destinationFile = destinationFile;
            this.DownloadName    = Path.GetFileNameWithoutExtension(this.destinationFile);
            this.tempFile        = System.IO.Path.GetTempPath() + this.DownloadName + ".downloading";

            if (File.Exists(this.tempFile))
            {
                File.Delete(this.tempFile);
            }

            // To receive notification when the file is available, add an event handler to the DownloadFileCompleted event.
            rw = new RotateWait();
            rw.ShowProgress = true;

            rw.Progress.Value   = 0;
            rw.Progress.Maximum = 100;
            rw.Progress.Step    = 1;

            // Create a new WebClient instance.
            WebClient myWebClient = new WebClient();

            myWebClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(myWebClient_DownloadProgressChanged);
            myWebClient.DownloadFileCompleted   += new AsyncCompletedEventHandler(myWebClient_DownloadFileCompleted);

            // Concatenate the domain with the Web resource filename.
            rw.WaitText = String.Format("Downloading \"{0}\"", this.Description);
            // Download the Web resource and save it into the current filesystem folder.

            rw.Hold = true;
            rw.Show();

            myWebClient.DownloadFileAsync(new Uri(this.DownloadUrl), tempFile);
            // myWebClient_DownloadFileCompleted(null, null);
        }