Exemplo n.º 1
0
        private void DisableWLB(bool deconfigure)
        {
            DisableWLBAction action = new DisableWLBAction(_pool, deconfigure);

            action.Completed += Program.MainWindow.action_Completed;
            action.Completed += this.action_Completed;
            action.RunAsync();
        }
Exemplo n.º 2
0
 protected override AsyncAction CreateAction(out bool cancelled)
 {
     cancelled = false;
     return(new DelegatedAsyncAction(Pool.Connection, Messages.HELP_MESSAGE_DISABLE_WLB, "", "",
                                     ss =>
     {
         var action = new DisableWLBAction(Pool, false);
         action.RunExternal(ss);
         int count = 0;
         while (Helpers.WlbEnabled(Pool.Connection) && count < 10)
         {
             Thread.Sleep(500);
             count++;
         }
     }, true));
 }
Exemplo n.º 3
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);
        }