示例#1
0
        /// <summary>
        /// Called in the 'connect new server and add to pool' action after the server has connected
        /// and its cache has been populated. Adds the new server to the pool.
        /// </summary>
        private void dialog_CachePopulated(object sender, CachePopulatedEventArgs e)
        {
            IXenConnection newConnection = e.Connection;

            // A new connection was successfully made: add the new server to its destination pool.
            Host hostToAdd = Helpers.GetMaster(newConnection);

            if (hostToAdd == null)
            {
                log.Debug("hostToAdd is null while joining host to pool in AddNewHostToPoolCommand: this should never happen!");
                return;
            }

            // Check newly-connected host is not in pool
            Pool hostPool = Helpers.GetPool(newConnection);

            MainWindowCommandInterface.Invoke(delegate
            {
                if (hostPool != null)
                {
                    string text    = String.Format(Messages.HOST_ALREADY_IN_POOL, hostToAdd.Name, _pool.Name, hostPool.Name);
                    string caption = Messages.POOL_JOIN_IMPOSSIBLE;

                    new ThreeButtonDialog(new ThreeButtonDialog.Details(SystemIcons.Exclamation, text, caption)).ShowDialog(Program.MainWindow);
                }
                else
                {
                    new AddHostToPoolCommand(MainWindowCommandInterface, new Host[] { hostToAdd }, _pool, false).Execute();
                }
            });
        }
示例#2
0
        private void dialog_CachePopulated(object sender, CachePopulatedEventArgs e)
        {
            _dialog.CachePopulated -= dialog_CachePopulated;

            // first select the disconnected host in the tree
            // before the tree is populated, the opaque_ref of the disconnected host is the hostname
            // so use this to select the object.
            MainWindowCommandInterface.Invoke(() => MainWindowCommandInterface.SelectObjectInTree(new Host {
                opaque_ref = e.Connection.Hostname
            }, false));
            MainWindowCommandInterface.TrySelectNewObjectInTree(e.Connection, true, true, true);
        }