private void OpenLocalQueue(RecentQueueConnection rqc = null) { if (rqc != null) { bool automaticOpenOk = false; ShellService.WithGlobalBusy(() => { var q = MqController.TryOpenQueue(rqc); if (q != null) { OpenQueueView(q); UserSettings.AddRecentConnection(rqc); automaticOpenOk = true; } }); if (automaticOpenOk) { return; } } SelectQueueInternal(null, rqc, q => { if (q != null) { AddRecentConnection(q, rqc); OpenQueueView(q); } }); }
private void OpenRemoteQueueManager(RecentRemoteQueueManagerConnection rrqmc = null) { if (rrqmc != null) { bool automaticOpenOk = false; ShellService.WithGlobalBusy(() => { var qm = MqController.TryOpenRemoteQueueManager(rrqmc); if (qm != null) { IObjectNameFilter filter = null; if (rrqmc.QueueList != null && rrqmc.QueueList.Count > 0) { filter = new StaticQueueList(rrqmc.QueueList.ToArray()); } else { filter = qm.NewObjectNameFilter(rrqmc.ObjectNamePrefix); } var provider = qm.NewObjectProvider(filter); OpenQueueManagerView(qm, provider); UserSettings.AddRecentConnection(rrqmc); automaticOpenOk = true; } }); if (automaticOpenOk) { return; } } SelectQueueManagerInternal(true, true, rrqmc, (qm, qpfx) => { if (qm != null) { AddRecentConnection(qm, qpfx, rrqmc); var provider = qm.NewObjectProvider(qpfx); OpenQueueManagerView(qm, provider); } }); }
private void OpenRemoteQueue(RecentRemoteQueueConnection rrqc = null) { if (rrqc != null) { bool automaticOpenOk = false; ShellService.WithGlobalBusy(() => { var q = MqController.TryOpenRemoteQueue(rrqc); if (q != null) { OpenQueueView(q); UserSettings.AddRecentConnection(rrqc); automaticOpenOk = true; } }); if (automaticOpenOk) { return; } } SelectQueueManagerInternal(true, false, rrqc, (qm, qpfx) => { if (qm != null) { SelectQueueInternal(qm, rrqc, q => { if (q != null) { AddRecentConnection(q, rrqc); OpenQueueView(q); } }); } }); }
private void AddRecentConnection(IQueue q, IRecentQueueConnection previous) { RecentConnection data = null; if (previous != null) { if (q.QueueManager.ConnectionProperties.IsLocal) { var temp = previous as RecentQueueConnection; if (temp != null) { if (temp.QueueManagerName == q.QueueManager.Name && temp.QueueName == q.Name) { data = temp; } } } else { var temp = previous as RecentRemoteQueueConnection; if (temp != null) { if (temp.QueueManagerName == q.QueueManager.Name && temp.QueueName == q.Name && temp.HostName == q.QueueManager.ConnectionProperties.HostName && temp.Port == q.QueueManager.ConnectionProperties.Port && temp.Channel == q.QueueManager.ConnectionProperties.Channel && (temp.UserId ?? "") == (q.QueueManager.ConnectionProperties.UserId ?? "")) { data = temp; } } } } if (data == null) { if (q.QueueManager.ConnectionProperties.IsLocal) { data = new RecentQueueConnection { QueueManagerName = q.QueueManager.Name, QueueName = q.Name }; } else { data = new RecentRemoteQueueConnection { QueueManagerName = q.QueueManager.Name, QueueName = q.Name, HostName = q.QueueManager.ConnectionProperties.HostName, Port = q.QueueManager.ConnectionProperties.Port, Channel = q.QueueManager.ConnectionProperties.Channel }; if (!string.IsNullOrEmpty(q.QueueManager.ConnectionProperties.UserId)) { ((RecentRemoteQueueConnection)data).UserId = q.QueueManager.ConnectionProperties.UserId; } } } UserSettings.AddRecentConnection(data); }
private void AddRecentConnection(IQueueManager qm, IObjectNameFilter filter, IRecentConnection previous) { RecentConnection data = null; if (previous != null) { if (qm.ConnectionProperties.IsLocal) { var temp = previous as RecentQueueManagerConnection; if (temp != null) { if (temp.QueueManagerName == qm.Name && FilterEquals(temp, filter)) { data = temp; } } } else { var temp = previous as RecentRemoteQueueManagerConnection; if (temp != null) { if (temp.QueueManagerName == qm.Name && FilterEquals(temp, filter) && temp.HostName == qm.ConnectionProperties.HostName && temp.Port == qm.ConnectionProperties.Port && temp.Channel == qm.ConnectionProperties.Channel && (temp.UserId ?? "") == (qm.ConnectionProperties.UserId ?? "")) { data = temp; } } } } if (data == null) { if (qm.ConnectionProperties.IsLocal) { data = new RecentQueueManagerConnection { QueueManagerName = qm.Name }; if (filter is StaticQueueList) { ((RecentQueueManagerConnection)data).QueueList = new List <string>(((StaticQueueList)filter).Names); } else { ((RecentQueueManagerConnection)data).ObjectNamePrefix = filter?.NamePrefix?[0]; } } else { data = new RecentRemoteQueueManagerConnection { QueueManagerName = qm.Name, HostName = qm.ConnectionProperties.HostName, Port = qm.ConnectionProperties.Port, Channel = qm.ConnectionProperties.Channel, UserId = qm.ConnectionProperties.UserId }; if (filter is StaticQueueList) { ((RecentRemoteQueueManagerConnection)data).QueueList = new List <string>(((StaticQueueList)filter).Names); } else { ((RecentRemoteQueueManagerConnection)data).ObjectNamePrefix = filter?.NamePrefix?[0]; } if (!string.IsNullOrWhiteSpace(qm.ConnectionProperties.UserId)) { ((RecentRemoteQueueManagerConnection)data).UserId = qm.ConnectionProperties.UserId; } } } UserSettings.AddRecentConnection(data); }