Exemplo n.º 1
0
        public static void update(string host, int port, string session_name, string session_id, string pn_version)
        {
            DocumentOpener.op_mutex.WaitOne();
            DocumentOpener.op_win.Invoke((MethodInvoker) delegate
            {
                DocumentOpener.op_win.text.Text           = "Downloading latest version...";
                DocumentOpener.op_win.progressBar.Visible = true;
                DocumentOpener.op_win.progressBar.Value   = 0;
                DocumentOpener.op_win.TopLevel            = true;
                DocumentOpener.op_win.Show();
            });
            DownloadUpdate download = new DownloadUpdate(host, port, session_name, session_id, pn_version);

            DocumentOpener.op_win.Invoke((MethodInvoker) delegate
            {
                DocumentOpener.op_win.Hide();
            });
            DocumentOpener.op_mutex.ReleaseMutex();
            if (download.error != null)
            {
                MessageBox.Show(download.error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
                return;
            }
            download = null;
            DocumentOpener.stop();
        }
 public static void update(string host, int port, string session_name, string session_id, string pn_version)
 {
     DocumentOpener.op_mutex.WaitOne();
     DocumentOpener.op_win.Invoke((MethodInvoker)delegate
     {
         DocumentOpener.op_win.text.Text = "Downloading latest version...";
         DocumentOpener.op_win.progressBar.Visible = true;
         DocumentOpener.op_win.progressBar.Value = 0;
         DocumentOpener.op_win.TopLevel = true;
         DocumentOpener.op_win.Show();
     });
     DownloadUpdate download = new DownloadUpdate(host, port, session_name, session_id, pn_version);
     DocumentOpener.op_win.Invoke((MethodInvoker)delegate
     {
         DocumentOpener.op_win.Hide();
     });
     DocumentOpener.op_mutex.ReleaseMutex();
     if (download.error != null)
     {
         MessageBox.Show(download.error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
         return;
     }
     download = null;
     DocumentOpener.stop();
 }