Esempio 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();
        }
 private void failure(string message, Exception e)
 {
     error = message + (e != null ? ": " + e.Message : "");
     if (request != null)
     {
         request.cancel();
     }
     if (file != null)
     {
         try { file.Close(); }
         catch (Exception) { }
     }
     try { DocumentOpener.RemoveDirectory(DocumentOpener.app_path + "/" + doc.storage_id); }
     catch (Exception) { }
 }
Esempio n. 3
0
 public void app_closed(object sender, System.EventArgs e)
 {
     if (!readOnly)
     {
         monitor.Changed            -= docChanged;
         monitor.EnableRaisingEvents = false;
         monitor.Dispose();
         monitor  = null;
         readOnly = true;
         long time = System.IO.File.GetLastWriteTime(file_path).Ticks;
         if (time > last_change)
         {
             saveFile();
         }
     }
     DocumentOpener.RemoveDirectory(DocumentOpener.app_path + "/" + this.storage_id);
     closed = true;
 }