private void UpdateServiceBus(string messageBus = null, string version = null, string queueType = null) { if (messageBus == null) { var sb = _managerTypes.First(x => x.DisplayName == (string)cbServiceBus.SelectedValue); messageBus = sb.Name; version = sb.Version; } if (queueType == null) { queueType = cbTransport.SelectedValue as string; } if (messageBus != null && queueType != null) { _discoverySvc = _sys.GetDiscoveryService(messageBus, version, queueType); parameters.Children.Clear(); foreach (var prm in _discoverySvc.ServerConnectionParameters) { var value = (Result.Server != null ? Result.Server.ConnectionSettings.GetValue(prm.SchemaName, prm.DefaultValue) : null); var ctl = new ServerConnectionParamControl(prm, value); ctl.ValueChanged += ctl_ValueChanged; ctl.LostFocus += ctl_LostFocus; parameters.Children.Add(ctl); } } }
private IServiceBusDiscovery GetDiscoveryService() { if (_disc == null) { _disc = _sys.GetDiscoveryService(); } return(_disc); }
private IServiceBusDiscovery GetDiscoveryService(string messageBus, string version, string queueType) { var disc = _disc.GetValue(messageBus + queueType); if (disc == null) { disc = _sys.GetDiscoveryService(messageBus, version, queueType); _disc.Add(messageBus + queueType, disc); } return(disc); }
private void InitSystem() { this.Icon = BitmapFrame.Create(this.GetImageResourceStream("main.ico")); _uiState = SbmqSystem.UIState; RestoreWindowState(); this.IsEnabled = false; lbLoading.Visibility = System.Windows.Visibility.Visible; BackgroundWorker w = new BackgroundWorker(); w.DoWork += (s, e) => { try { _sys = SbmqSystem.Create(); _sys.ItemsChanged += sys_ItemsChanged; _sys.ErrorOccured += _sys_ErrorOccured; _sys.WarningOccured += _sys_WarningOccured; _sys.StartedLoadingQueues += _sys_StartedLoadingQueues; _sys.FinishedLoadingQueues += _sys_FinishedLoadingQueues; _features = _sys.GetDiscoveryService().Features; _mgr = _sys.Manager; } catch (Exception ex) { Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => { LogError("Failed to initialize System", ex, true); })); } }; w.RunWorkerCompleted += (s, e) => { RestoreQueueButtonsState(); this.IsEnabled = true; btnSendCommand.IsEnabled = _sys.CanSendCommand; btnViewSubscriptions.IsEnabled = _sys.CanViewSubscriptions; lbItems.ItemsSource = _sys.Items; if (!lbItems.IsEnabled) { lbItems.IsEnabled = true; } SetupContextMenu(); UpdateNotifyIconText(); if (_sys.Config.StartCount == 1) { ShowConfigDialog(); } else if (_sys.Config.VersionCheck.Enabled) { if (_sys.Config.VersionCheck.LastCheck < DateTime.Now.AddDays(-14)) { CheckIfLatestVersion(false); } } UpdateTitle(); _sys.StartMonitoring(); lbLoading.Visibility = System.Windows.Visibility.Hidden; }; w.RunWorkerAsync(); }