Esempio n. 1
0
        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();
            }
        }
Esempio n. 2
0
        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();
        }
        private void Initialize()
        {
            AppDomain.CurrentDomain.AssemblyResolve += SbmqmDomain_AssemblyResolve;
            _monitorState = new SbmqmMonitorState();

            Config = SystemConfig.Load();

            Config.StartCount += 1;
            Config.Save();

            // Check if we still have the ServiceBus Adapter available
            var availMgrs = ServiceBusFactory.AvailableServiceBusManagers();

            if (!availMgrs.Any(mgr => mgr.Name == Config.ServiceBus && mgr.Version == Config.ServiceBusVersion && mgr.QueueType == Config.ServiceBusQueueType))
            {
                // Check if we have any other versions available
                var m = availMgrs.FirstOrDefault(mgr => mgr.Name == Config.ServiceBus && mgr.QueueType == Config.ServiceBusQueueType);

                if (m != null)
                {
                    Config.CurrentServer.ServiceBusVersion = m.Version;
                }

                else // Check if we have this ServiceBus Type
                {
                    m = availMgrs.FirstOrDefault(mgr => mgr.Name == Config.ServiceBus);

                    if (m != null)
                    {
                        Config.CurrentServer.ServiceBusQueueType = m.QueueType;
                        Config.CurrentServer.ServiceBusVersion   = m.Version;
                    }
                    else
                    {
                        throw new NotSupportedException("Not Supported Service Bus type '{0}', Please re-install Service Bus MQ Manager.".With(Config.ServiceBus));
                    }
                }
            }

            CreateServiceBusManager(Config.ServiceBus, Config.ServiceBusVersion, Config.ServiceBusQueueType);


            _history = new CommandHistoryManager(Config);

            AppInfo = new ApplicationInfo(Config.Id, Assembly.GetEntryAssembly());
        }
        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();
            }
        }