public DownloadUpdate(string host, int port, string session_name, string session_id, string pn_version) { if (System.IO.File.Exists(DocumentOpener.app_path + "/setup.exe")) { System.IO.File.Delete(DocumentOpener.app_path + "/setup.exe"); } System.IO.File.Create(DocumentOpener.app_path + "/setup.exe").Close(); try { this.file = System.IO.File.OpenWrite(DocumentOpener.app_path + "/setup.exe"); } catch (Exception e) { failure("Error writing in file", e); return; } request = new ServerRequest( host, port, "/dynamic/documents/service/download_document_opener", session_name, session_id, pn_version, "downloading update", download_progress, download_succeed, download_failed ); while (error == null && !launched) { Thread.Sleep(250); } request = null; }
public DownloadUpdate(string host, int port, string session_name, string session_id, string pn_version) { if (System.IO.File.Exists(DocumentOpener.app_path + "/setup.exe")) System.IO.File.Delete(DocumentOpener.app_path + "/setup.exe"); System.IO.File.Create(DocumentOpener.app_path + "/setup.exe").Close(); try { this.file = System.IO.File.OpenWrite(DocumentOpener.app_path + "/setup.exe"); } catch (Exception e) { failure("Error writing in file", e); return; } request = new ServerRequest( host, port, "/dynamic/documents/service/download_document_opener", session_name, session_id, pn_version, "downloading update", download_progress, download_succeed, download_failed ); while (error == null && !launched) Thread.Sleep(250); request = null; }
public DocumentDownload(Document doc) { DocumentOpener.op_win.Invoke((MethodInvoker) delegate { DocumentOpener.op_win.text.Text = "Downloading " + doc.filename; DocumentOpener.op_win.progressBar.Visible = true; DocumentOpener.op_win.progressBar.Value = 0; }); System.IO.Directory.CreateDirectory(DocumentOpener.app_path + "/" + doc.storage_id); doc.file_path = DocumentOpener.app_path + "/" + doc.storage_id + "/" + doc.filename; System.IO.File.Create(doc.file_path).Close(); this.doc = doc; try { this.file = System.IO.File.OpenWrite(doc.file_path); } catch (Exception e) { failure("Error writing in file", e); return; } request = new ServerRequest( doc.host, doc.port, "/dynamic/storage/service/get?id=" + doc.storage_id + (doc.storage_revision != null ? "&revision=" + doc.storage_revision : ""), doc.session_name, doc.session_id, doc.pn_version, "downloading " + doc.filename, download_progress, download_succeed, download_failed ); while (error == null) { if (!doc.opened) { Thread.Sleep(250); } else { Thread.Sleep(250); break; } } request = null; this.doc = null; }
public DocumentDownload(Document doc) { DocumentOpener.op_win.Invoke((MethodInvoker)delegate { DocumentOpener.op_win.text.Text = "Downloading " + doc.filename; DocumentOpener.op_win.progressBar.Visible = true; DocumentOpener.op_win.progressBar.Value = 0; }); System.IO.Directory.CreateDirectory(DocumentOpener.app_path + "/" + doc.storage_id); doc.file_path = DocumentOpener.app_path + "/" + doc.storage_id + "/" + doc.filename; System.IO.File.Create(doc.file_path).Close(); this.doc = doc; try { this.file = System.IO.File.OpenWrite(doc.file_path); } catch (Exception e) { failure("Error writing in file", e); return; } request = new ServerRequest( doc.host, doc.port, "/dynamic/storage/service/get?id=" + doc.storage_id + (doc.storage_revision != null ? "&revision=" + doc.storage_revision : ""), doc.session_name, doc.session_id, doc.pn_version, "downloading " + doc.filename, download_progress, download_succeed, download_failed ); while (error == null) { if (!doc.opened) Thread.Sleep(250); else { Thread.Sleep(250); break; } } request = null; this.doc = null; }