private void button_Click(object sender, RoutedEventArgs e) { if (mqSrv == null) { mqSrv = new MQService(); } mqSrv.Hostname = this.tbxHostName.Text; mqSrv.Port = int.Parse(this.tbxPort.Text); mqSrv.MQCCSID = this.tbxCCSID.Text; mqSrv.Channel = this.tbxChannel.Text; mqSrv.UserId = this.tbxUserId.Text; mqSrv.QmgrName = this.tbxQmgrName.Text; mqSrv.QueueName = this.tbxQueueName.Text; try { mqSrv.Init(); MessageBox.Show("连接成功!"); } catch (Exception ex) { MessageBox.Show("连接失败!" + ex.Message); return; } }
private void button_Copy_Click(object sender, RoutedEventArgs e) { this.mqSrv = null; }
private void LoadResource() { try { ResourceReader rr = new ResourceReader("Resources.resx"); string type; byte[] byteTmp; rr.GetResourceData("HostName", out type, out byteTmp); this.tbxHostName.Text = new BinaryReader(new MemoryStream(byteTmp)).ReadString(); rr.GetResourceData("Port", out type, out byteTmp); this.tbxPort.Text = new BinaryReader(new MemoryStream(byteTmp)).ReadString(); rr.GetResourceData("CCSID", out type, out byteTmp); this.tbxCCSID.Text = new BinaryReader(new MemoryStream(byteTmp)).ReadString(); rr.GetResourceData("Channel", out type, out byteTmp); this.tbxChannel.Text = new BinaryReader(new MemoryStream(byteTmp)).ReadString(); rr.GetResourceData("UserId", out type, out byteTmp); this.tbxUserId.Text = new BinaryReader(new MemoryStream(byteTmp)).ReadString(); rr.GetResourceData("QmgrName", out type, out byteTmp); this.tbxQmgrName.Text = new BinaryReader(new MemoryStream(byteTmp)).ReadString(); rr.GetResourceData("QueueName", out type, out byteTmp); this.tbxQueueName.Text = new BinaryReader(new MemoryStream(byteTmp)).ReadString(); rr.GetResourceData("KeyPath", out type, out byteTmp); this.tbxKeyPath.Text = new BinaryReader(new MemoryStream(byteTmp)).ReadString(); rr.GetResourceData("CertPath", out type, out byteTmp); this.tbxCrtPath.Text = new BinaryReader(new MemoryStream(byteTmp)).ReadString(); rr.GetResourceData("Password", out type, out byteTmp); this.tbxPwd.Text = new BinaryReader(new MemoryStream(byteTmp)).ReadString(); rr.GetResourceData("SignOffset", out type, out byteTmp); this.tbxSignOffset.Text = new BinaryReader(new MemoryStream(byteTmp)).ReadString(); rr.GetResourceData("SignLength", out type, out byteTmp); this.tbxSignLength.Text = new BinaryReader(new MemoryStream(byteTmp)).ReadString(); rr.GetResourceData("VerifyOffset", out type, out byteTmp); this.tbxVerifyOffset.Text = new BinaryReader(new MemoryStream(byteTmp)).ReadString(); rr.GetResourceData("SendCount", out type, out byteTmp); this.tbxSendCount.Text = new BinaryReader(new MemoryStream(byteTmp)).ReadString(); rr.GetResourceData("NumString", out type, out byteTmp); this.tbxNumString.Text = new BinaryReader(new MemoryStream(byteTmp)).ReadString(); rr.GetResourceData("StartNum", out type, out byteTmp); this.tbxStartNum.Text = new BinaryReader(new MemoryStream(byteTmp)).ReadString(); rr.GetResourceData("FileName", out type, out byteTmp); this.tbxFileName.Text = new BinaryReader(new MemoryStream(byteTmp)).ReadString(); rr.Close(); if (mqSrv == null) { mqSrv = new MQService(); } mqSrv.Hostname = this.tbxHostName.Text; mqSrv.Port = int.Parse(this.tbxPort.Text); mqSrv.MQCCSID = this.tbxCCSID.Text; mqSrv.Channel = this.tbxChannel.Text; mqSrv.UserId = this.tbxUserId.Text; mqSrv.QmgrName = this.tbxQmgrName.Text; mqSrv.QueueName = this.tbxQueueName.Text; } catch (Exception) { return; } }