Example #1
0
        private void miExit_Click(object sender, RoutedEventArgs e)
        {
            if (m_downloader != null)
            {
                m_downloader.Abort();
            }

            Application.Current.Shutdown();
        }
Example #2
0
 private void Main_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (!isClose)
     {
         e.Cancel = true;
         Hide();
         this.ShowInTaskbar = false;
     }
     else
     {
         if (downloader != null)
         {
             downloader.Abort();
         }
         Application.Exit();
     }
 }
Example #3
0
    /// <summary>
    /// starts \ stop button pressed
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private void button1_Click(object sender, EventArgs e)
    {
        //if downloader is not null then abort it
        if (downloader != null)
        {
            downloader.Abort();
            return;
        }

        //setup and start the downloader
        this.progressBar1.Value    = 0;
        this.progressBar1.Minimum  = 0;
        this.progressBar1.Enabled  = true;
        this.progressBar1.Visible  = true;
        this.downloader            = new Downloader();
        this.downloader.Progress  += downloader_Progress;
        this.downloader.Completed += downloader_Completed;
        this.downloader.Cancelled += downloader_Cancelled;
        this.downloader.Start();
    }