コード例 #1
0
        private bool InitializeWLB()
        {
            //combine url and port
            string    wlbHost = textboxWlbUrl.Text;
            string    wlbPort = textboxWLBPort.Text;
            IPAddress address;
            string    wlbUrl = (IPAddress.TryParse(wlbHost, out address) && address.AddressFamily == AddressFamily.InterNetworkV6) ?
                               ("[" + wlbHost + "]:" + wlbPort) : (wlbHost + ":" + wlbPort);

            //handle the wlb creds
            string wlbUserName = textboxWlbUserName.Text;
            string wlbPassword = textboxWlbPassword.Text;

            //handle the xenserver creds
            string xsUserName = textboxXSUserName.Text;
            string xsPassword = textboxXSPassword.Text;

            InitializeWLBAction action = new InitializeWLBAction(_pool, wlbUrl, wlbUserName, wlbPassword, xsUserName, xsPassword);

            using (var dialog = new ActionProgressDialog(action, ProgressBarStyle.Blocks))
            {
                dialog.ShowCancel = true;
                dialog.ShowDialog(this);
            }

            Program.MainWindow.UpdateToolbars();
            return(action.Succeeded);
        }
コード例 #2
0
        /// <summary>
        /// Finds the WLBAction in progress that pertains to the given connection, or null
        /// if there is no such action.
        /// Must be called on the event thread.
        /// </summary>
        /// <param name="connection">May not be null.</param>
        /// <returns></returns>
        internal static AsyncAction FindActiveWLBAction(IXenConnection connection)
        {
            Program.AssertOnEventThread();
            foreach (ActionBase action in ConnectionsManager.History)
            {
                if (action.IsCompleted)
                {
                    continue;
                }

                InitializeWLBAction configureAction = action as InitializeWLBAction;
                if (configureAction != null && !configureAction.Cancelled && configureAction.Connection == connection)
                {
                    return(configureAction);
                }

                EnableWLBAction enableAction = action as EnableWLBAction;
                if (enableAction != null && !enableAction.Cancelled && enableAction.Connection == connection)
                {
                    return(enableAction);
                }

                DisableWLBAction disableAction = action as DisableWLBAction;
                if (disableAction != null && !disableAction.Cancelled && disableAction.Connection == connection)
                {
                    return(disableAction);
                }

                RetrieveWlbConfigurationAction retrieveAction = action as RetrieveWlbConfigurationAction;
                if (retrieveAction != null && !retrieveAction.Cancelled && retrieveAction.Connection == connection)
                {
                    return(retrieveAction);
                }

                SendWlbConfigurationAction sendAction = action as SendWlbConfigurationAction;
                if (sendAction != null && !sendAction.Cancelled && sendAction.Connection == connection)
                {
                    return(sendAction);
                }
            }
            return(null);
        }
コード例 #3
0
        private bool InitializeWLB()
        {
            //combine url and port
            string wlbUrl = textboxWlbUrl.Text + ":" + textboxWLBPort.Text;

            //handle the wlb creds
            string wlbUserName = textboxWlbUserName.Text;
            string wlbPassword = textboxWlbPassword.Text;

            //handle the xenserver creds
            string xsUserName = textboxXSUserName.Text;
            string xsPassword = textboxXSPassword.Text;

            InitializeWLBAction  action = new InitializeWLBAction(_pool, wlbUrl, wlbUserName, wlbPassword, xsUserName, xsPassword);
            ActionProgressDialog dialog = new ActionProgressDialog(action, ProgressBarStyle.Blocks);

            dialog.ShowCancel = true;
            dialog.ShowDialog(this);

            Program.MainWindow.UpdateToolbars();
            return(action.Succeeded);
        }