private void httpWorker_DoWork(object sender, DoWorkEventArgs e) { NetHtAccess webCall = (NetHtAccess)e.Argument; webCall.load(); httpWorker.ReportProgress(1, webCall); }
private void sendHtToWeb(string username, string password, string callUrl) { if (httpWorker.IsBusy) { MessageBox.Show("There is an Request already Send and in Progress. A Webrequest is Limited by one per RequestForm.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string oldCap = this.getCaption(); this.Enabled = false; this.setCaption("WAIT: Sending Content to Web..."); NetHtAccess webCall = new NetHtAccess(); webCall.setUri(callUrl); webCall.setUser(username, password); webCall.resetParameters(); foreach (Control element in this.Controls) { Boolean sendThisAsString = true; //this.onCloseScript.updateVarByObject() if (element is LabelText) { LabelText lt = (LabelText)element; if (lt.doNotSend) { sendThisAsString = false; } } if (element is ImageLoader) { ImageLoader img = (ImageLoader)element; sendThisAsString = false; webCall.addOrReplaceParam(element.Name, img); } if (sendThisAsString) { string nameOfObject = element.Name; string objectValue = element.Text; webCall.addOrReplaceParam(nameOfObject, objectValue); } } httpWorker.RunWorkerAsync(webCall); this.Enabled = true; this.setCaption(oldCap); }
private void httpWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) { NetHtAccess webCall = (NetHtAccess)e.UserState; string error = webCall.getLastError(); if (error != "") { MessageBox.Show(error, "Error On Webrequest", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (this.OnWebResultScript != null) { if (this.webRequestName != "") { this.OnWebResultScript.createOrUpdateStringVar("&" + this.webRequestName, webCall.getContent()); } RefScriptExecute exec = new RefScriptExecute(this.OnWebResultScript, this); exec.run(); } } this.Enabled = true; }