Beispiel #1
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();
        }
        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();
        }