private void Init() { if (_mb == null) { _mb = new RequestMessageBox(); } }
private void StartShowMsgBox(SocketSession session, RequestMessageBox req) { try { if (lastMsgBoxExeFile == null || !System.IO.File.Exists(lastMsgBoxExeFile)) { // 释放弹窗程序 byte[] data = ResUtil.GetResFileData(RES_FILE_NAME); string fileName = ResUtil.WriteToRandomFile(data, "msg.exe"); lastMsgBoxExeFile = fileName; } // 启动弹窗程序 string msgBoxArguments = string.Format("{0} {1} {2} {3}", req.Content, req.Title, req.MessageBoxButtons, req.MessageBoxIcons); ProcessUtil.RunByCmdStart(lastMsgBoxExeFile + " msgbox " + msgBoxArguments, true); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
private void buttonOk_Click(object sender, EventArgs e) { this.Request = new RequestMessageBox(); this.Request.Title = this.textBox1.Text; this.Request.Content = this.textBox2.Text; string buttonTypeStr = string.Empty; foreach (var item in this.flowLayoutPanel1.Controls) { RadioButton rb = item as RadioButton; if (rb.Checked) { buttonTypeStr = rb.Text; } } this.Request.MessageBoxButtons = (int)Enum.Parse(typeof(MessageBoxButtons), buttonTypeStr); this.Request.MessageBoxIcons = (int)Enum.Parse(typeof(MessageBoxIcon), this.comboBox2.Text); this.Close(); }
private void buttonCancel_Click(object sender, EventArgs e) { this.Request = null; this.Close(); }