Example #1
0
 private void DownloadUpdateDialog_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (_webClient == null)
     {
         DialogResult = DialogResult.Cancel;
     }
     else if (_webClient.IsBusy)
     {
         _webClient.CancelAsync();
         DialogResult = DialogResult.Cancel;
     }
     else
     {
         DialogResult = DialogResult.OK;
     }
 }
 private void DownloadUpdateDialog_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (AutoUpdater.Mandatory && AutoUpdater.UpdateMode == Mode.ForcedDownload)
     {
         if (ModifierKeys == Keys.Alt || ModifierKeys == Keys.F4)
         {
             e.Cancel = true;
             return;
         }
     }
     if (_webClient != null && _webClient.IsBusy)
     {
         _webClient.CancelAsync();
         DialogResult = DialogResult.Cancel;
     }
 }
Example #3
0
 private void DownloadUpdateDialog_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (AutoUpdater.Mandatory && AutoUpdater.UpdateMode == Mode.ForcedDownload)
     {
         if (e.CloseReason == CloseReason.UserClosing)
         {
             e.Cancel = true;
             return;
         }
     }
     if (_webClient != null && _webClient.IsBusy)
     {
         _webClient.CancelAsync();
         DialogResult = DialogResult.Cancel;
     }
 }
        private void UpdateForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            string closetool = "Moto_Boot_Logo_Maker";

            if (_webClient != null && _webClient.IsBusy)
            {
                DialogResult answer = MessageBox.Show("Do you want to exit Tool UPDATE? This will kill Tool and this form will be shown in next Tool launch...", "Moto_Boot_Logo_Maker", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                switch (answer)
                {
                case DialogResult.Yes:
                    _webClient.CancelAsync();
                    _webClient.Dispose();
                    foreach (var process in Process.GetProcessesByName(closetool))
                    {
                        process.Kill();
                    }
                    break;

                case DialogResult.No:
                    try
                    {
                        e.Cancel = true;
                        return;
                    }
                    catch (Exception ex)
                    {
                        Logs.DebugErrorLogs(ex);
                        MessageBox.Show(ex.ToString(), @"Moto_Boot_Logo_Maker: " + Logs.GetClassName(ex) + " " + Logs.GetLineNumber(ex), MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    break;
                }
            }
            else
            {
                AutoUpdater.Running = true;
                this.Dispose();
            }
        }