public static SbmqSystem Create() { _instance = new SbmqSystem(); _instance.Initialize(); return(_instance); }
public ConfigWindow(SbmqSystem system, bool showSendCommand = false) { InitializeComponent(); Topmost = SbmqSystem.UIState.AlwaysOnTop; _sys = system; _config = system.Config; _managerTypes = ServiceBusFactory.AvailableServiceBusManagers(); cbContentFormat.ItemsSource = _managerTypes[0].MessageContentTypes; cbContentFormat.SelectedItem = _config.CurrentServer.CommandContentType; cShowOnNewMessages.IsChecked = _config.ShowOnNewMessages; cCheckForNewVer.IsChecked = _config.VersionCheck.Enabled; cStartOnWinStartup.IsChecked = GetStartOnWinStartupState(); BindServers(_config.Servers); SelectServer(_config.MonitorServerName, false); //tbServer.Init(string.Empty, typeof(string), false); //tbServer.Visibility = System.Windows.Visibility.Hidden; BindSendCommandView(_config.CurrentServer); UpdateSendCommandInfo(false); UpdateQueueuInfo(false); if( showSendCommand ) scroller.ScrollToBottom(); }
public SendCommandWindow(SbmqSystem system) { InitializeComponent(); _sys = system; _asmPath = system.Config.CurrentServer.CommandsAssemblyPaths; Topmost = SbmqSystem.UIState.AlwaysOnTop; BindCommands(); savedCommands.Init(system.SavedCommands); BindServer(); cmdAttrib.SendCommandManager = _sys.Manager as ISendCommand; // TEMP: Service Bus Specific Logic, TODO: Refactor var srv = _sys.Config.CurrentServer; if( srv.ServiceBus == "MassTransit" ) { if( srv.ConnectionSettings.HasValidValue("subscriptionQueueService")) { cbQueue.Visibility = Visibility.Hidden; lblServer.Visibility = Visibility.Hidden; lblRouterQueue.Content = "Subscription service: {0}".With(srv.ConnectionSettings["subscriptionQueueService"]); lblRouterQueue.Visibility = Visibility.Visible; } } }
public SelectQueueDialog(SbmqSystem system, string server, string[] queueNames) { InitializeComponent(); _sys = system; _server = server; Topmost = SbmqSystem.UIState.AlwaysOnTop; lbQueues.ItemsSource = queueNames; }
public ViewSubscriptionsWindow(SbmqSystem system) { InitializeComponent(); _sys = system; lbInfo.Opacity = 0; lbInfo.Visibility = System.Windows.Visibility.Hidden; Topmost = SbmqSystem.UIState.AlwaysOnTop; }
public ViewSubscriptionsWindow(SbmqSystem system) { InitializeComponent(); _sys = system; Topmost = SbmqSystem.UIState.AlwaysOnTop; BindServers(); lvTypes.ItemsSource = _items; WindowTools.SetSortColumn(lvTypes, "Name"); }
public SelectDataTypeDialog(SbmqSystem system, string[] asmPaths) { InitializeComponent(); _asmPaths = asmPaths; Topmost = SbmqSystem.UIState.AlwaysOnTop; LoadTypes(); lvTypes.ItemsSource = _types; WindowTools.SetSortColumn(lvTypes, "Name", ListSortDirection.Ascending); tbFilter.Focus(); }
public ManageServerDialog(SbmqSystem system, ServerConfig3 server, bool copy = false) { InitializeComponent(); Topmost = SbmqSystem.UIState.AlwaysOnTop; _sys = system; _config = system.Config; _server = server; _managerTypes = ServiceBusFactory.AvailableServiceBusManagers(); Result = new ConfigWindow.AddServerResult(); Result.Server = new ServerConfig3(); if( server != null ) { server.CopyTo(Result.Server); if( copy ) { Result.Server.Name = string.Empty; Result.Server.ConnectionSettings = new Dictionary<string, object>(); } } DialogActionType = server == null ? ActionType.Add : ( copy ? ActionType.Copy : ActionType.Edit ); string verb = ( DialogActionType == ActionType.Edit ) ? "Edit" : "Add"; lbTitle.Content = Title = "{0} Server".With(verb); lbInfo.Content = string.Empty; cbServiceBus.ItemsSource = _managerTypes.GroupBy(g => g.DisplayName).Select(x => x.Key).ToArray(); //cbServiceBus.DisplayMemberPath = "DisplayName"; //cbServiceBus.SelectedValuePath = "Name"; tbName.Init(Result.Server.Name, typeof(string), false); //var s = cbServiceBus.SelectedValue as string; //cbTransport.ItemsSource = _managerTypes.GroupBy(g => g.Name).Single(x => x.Key == s).Select(x => x.QueueType); //tbInterval.Init(750, typeof(int), false); if( DialogActionType == ActionType.Edit ) { _nameEdited = GetDefaultServerName(_server.ConnectionSettings.First().Value as string, _server.ServiceBus, _server.ServiceBusVersion, _server.ServiceBusQueueType) != _server.Name; } BindServerInfo(); }
public ConfigWindow(SbmqSystem system, bool showSendCommand = false) { InitializeComponent(); Topmost = SbmqSystem.UIState.AlwaysOnTop; _sys = system; _config = system.Config; _managerTypes = ServiceBusFactory.AvailableServiceBusManagers(); cbServiceBus.ItemsSource = _managerTypes; cbServiceBus.DisplayMemberPath = "Name"; cbServiceBus.SelectedValuePath = "Name"; cbServiceBus.SelectedIndex = 0; cbTransport.ItemsSource = _managerTypes[0].QueueTypes; cbContentFormat.ItemsSource = _managerTypes[0].MessageContentTypes; cbContentFormat.SelectedItem = _config.CommandContentType; cShowOnNewMessages.IsChecked = _config.ShowOnNewMessages; cCheckForNewVer.IsChecked = _config.VersionCheck.Enabled; asmPaths.BindItems(_config.CommandsAssemblyPaths); BindServers(_config.Servers); tbInterval.Init(750, typeof(int), false); SelectServer(_config.MonitorServer); tbServer.Init(string.Empty, typeof(string), false); tbServer.Visibility = System.Windows.Visibility.Hidden; tbNamespace.Init(_config.CommandDefinition.NamespaceContains, typeof(string), true); tbCmdInherits.Text = _config.CommandDefinition.InheritsType; UpdateSendCommandInfo(false); UpdateQueueuInfo(false); if( showSendCommand ) scroller.ScrollToBottom(); }
public SendCommandWindow(SbmqSystem system) { InitializeComponent(); _sys = system; _asmPath = system.Config.CommandsAssemblyPaths; Topmost = SbmqSystem.UIState.AlwaysOnTop; BindCommands(); savedCommands.Init(system.SavedCommands); BindServers(); cmdAttrib.SendCommandManager = _sys.Manager as ISendCommand; }
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(); }
public static SbmqSystem Create() { _instance = new SbmqSystem(); _instance.Initialize(); return _instance; }
private void RestartSystem() { _timer.Stop(); if( _sys != null ) _sys.Manager.Dispose(); this.IsEnabled = false; lbItems.ItemsSource = null; BackgroundWorker w = new BackgroundWorker(); w.DoWork += (s,e) => { _sys = SbmqSystem.Create(); _sys.ItemsChanged += MessageMgr_ItemsChanged; _mgr = _sys.Manager; }; w.RunWorkerCompleted += (s,e) => { this.IsEnabled = true; RestoreMonitorQueueState(); btnSendCommand.IsEnabled = _sys.CanSendCommand; btnViewSubscriptions.IsEnabled = _sys.CanViewSubscriptions; lbItems.ItemsSource = _mgr.Items; timer_Tick(this, EventArgs.Empty); _timer.Interval = TimeSpan.FromMilliseconds(_sys.Config.MonitorInterval); _timer.Start(); }; w.RunWorkerAsync(); }
private void InitSystem() { this.Icon = BitmapFrame.Create(this.GetImageResourceStream("main.ico")); _dlg = new ContentWindow(); _uiState = SbmqSystem.UIState; RestoreWindowState(); this.IsEnabled = false; BackgroundWorker w = new BackgroundWorker(); w.DoWork += (s,e) => { _sys = SbmqSystem.Create(); _sys.ItemsChanged += MessageMgr_ItemsChanged; _mgr = _sys.Manager; }; w.RunWorkerCompleted += (s,e) => { RestoreQueueButtonsState(); this.IsEnabled = true; btnSendCommand.IsEnabled = _sys.CanSendCommand; btnViewSubscriptions.IsEnabled = _sys.CanViewSubscriptions; lbItems.ItemsSource = _mgr.Items; SetupContextMenu(); SetupQueueMonitorTimer(_sys.Config.MonitorInterval); if( _sys.Config.StartCount == 1 ) { ShowConfigDialog(); } else if( _sys.Config.VersionCheck.Enabled ) { if( _sys.Config.VersionCheck.LastCheck < DateTime.Now.AddDays(-14) ) CheckIfLatestVersion(false); } }; w.RunWorkerAsync(); }
private void RestartSystem() { StopMonitoring(); if( _sys != null ) _sys.Manager.Terminate(); this.IsEnabled = false; lbItems.ItemsSource = null; BackgroundWorker w = new BackgroundWorker(); w.DoWork += (s, e) => { _sys = SbmqSystem.Create(); _sys.ItemsChanged += MessageMgr_ItemsChanged; _mgr = _sys.Manager; }; w.RunWorkerCompleted += (s, e) => { this.IsEnabled = true; RestoreMonitorQueueState(); btnSendCommand.IsEnabled = _sys.CanSendCommand; btnViewSubscriptions.IsEnabled = _sys.CanViewSubscriptions; lbItems.ItemsSource = _sys.Items; SetupContextMenu(); RestartMonitoring(); }; w.RunWorkerAsync(); }