private void OpenSignpadDraw() { FormCollection formCollection = Application.OpenForms; if (Application.OpenForms["SignpadDrawForm"] == null) { new Thread(() => { signpadDrawForm = new SignpadDrawForm(); User32.SetForegroundWindow(signpadDrawForm.Handle); signpadDrawForm.Focus(); signpadDrawForm.TopMost = true; signpadDrawForm.ShowDialog(); if (signpadDrawForm.IsDisposed && responseData.SignatureBase64 != "") { ReturnMessageToClient("SignpadDrawForm"); } } ).Start(); } else { Application.OpenForms["SignpadDrawForm"].BringToFront(); } }
protected override void OnMessage(MessageEventArgs e) { string getEventDataFormClient = e.Data; if (getEventDataFormClient == "{Who:Customer,Why:Purchase}") { signpadDrawForm = new SignpadDrawForm(); User32.SetForegroundWindow(signpadDrawForm.Handle); signpadDrawForm.Focus(); signpadDrawForm.TopMost = true; signpadDrawForm.ShowDialog(); if (signpadDrawForm.IsDisposed) { dataSignaturePad.Event = responseData.EventStatus; // "OnSigPadCompleted"; dataSignaturePad.SigImage = responseData.SignatureBase64; dataSignaturePad.Message = "Success"; var jsondata = Newtonsoft.Json.JsonConvert.SerializeObject(dataSignaturePad); Send(jsondata); } } else { onscreenDrawForm = new OnscreenDrawForm(); User32.SetForegroundWindow(onscreenDrawForm.Handle); onscreenDrawForm.Focus(); onscreenDrawForm.TopMost = true; onscreenDrawForm.ShowDialog(); if (onscreenDrawForm.IsDisposed) { dataOnscreenPad.Event = responseData.EventStatus; // "OnSignCompleted"; dataOnscreenPad.Base64Image = responseData.SignatureBase64; dataOnscreenPad.Message = "Success"; var jsondata = Newtonsoft.Json.JsonConvert.SerializeObject(dataOnscreenPad); Send(jsondata); } } //Sessions.Broadcast(e.Data); }