Ejemplo n.º 1
0
        /// <summary>
        /// Retrieve subscriptions and set _subscriptionCollection
        /// </summary>
        private void SetSubscriptionCollection()
        {
            _subscriptionCollection = null;

            WlbPoolConfiguration           poolConfiguration;
            RetrieveWlbConfigurationAction action = new RetrieveWlbConfigurationAction(_pool);

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

            if (action.Succeeded)
            {
                poolConfiguration = new WlbPoolConfiguration(action.WlbConfiguration);

                _isCreedenceOrLater = poolConfiguration.IsCreedenceOrLater;

                this.splitContainerLeftPane.Panel2Collapsed = true;
                this.wlbReportView1.btnSubscribe.Visible    = false;
            }
            else
            {
                throw (action.Exception);
            }
        }
Ejemplo n.º 2
0
 private void RetrieveConfiguration()
 {
     // only get the config if there are no other pending wlb actions
     if (null == HelpersGUI.FindActiveWLBAction(_pool.Connection))
     {
         RetrieveWlbConfigurationAction action = new RetrieveWlbConfigurationAction(_pool);
         action.Completed += this.action_Completed;
         action.RunAsync();
     }
 }
        private WlbPoolConfiguration RetrieveWLBConfiguration()
        {
            RetrieveWlbConfigurationAction action = new RetrieveWlbConfigurationAction(_pool);
            ActionProgressDialog           dialog = new ActionProgressDialog(action, ProgressBarStyle.Blocks);

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

            if (!action.Succeeded || null == action.WlbConfiguration || action.WlbConfiguration.Count == 0)
            {
                return(null);
            }
            else
            {
                return(new WlbPoolConfiguration(StripReportSubscriptions(action.WlbConfiguration)));
            }
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
0
        protected void action_Completed(ActionBase sender)
        {
            // This seems to be called off the event thread
            AsyncAction action = (AsyncAction)sender;

            if (action.IsCompleted)
            {
                action.Completed -= action_Completed;
                if (action is EnableWLBAction || action is RetrieveWlbConfigurationAction || action is DisableWLBAction)
                {
                    if (action is EnableWLBAction)
                    {
                        EnableWLBAction thisAction = (EnableWLBAction)action;
                        _wlbPoolConfiguration = new WlbPoolConfiguration(thisAction.WlbConfiguration);
                    }
                    else if (action is RetrieveWlbConfigurationAction)
                    {
                        RetrieveWlbConfigurationAction thisAction = (RetrieveWlbConfigurationAction)action;
                        if (thisAction.Succeeded)
                        {
                            _wlbPoolConfiguration = new WlbPoolConfiguration(thisAction.WlbConfiguration);
                        }
                        else
                        {
                            //_statusError = thisAction.Exception.Message;
                            _wlbPoolConfiguration = null;
                        }
                    }
                    else if (action is DisableWLBAction)
                    {
                    }

                    Program.Invoke(Program.MainWindow, delegate()
                    {
                        if (_pool != null && _pool.Connection == action.Connection)
                        {
                            RefreshControls();
                        }
                    });
                }
            }
        }