Example #1
0
 void ActivityMonitorTabDisposed(object sender, EventArgs e)
 {
     if (subscription != null)
     {
         subscription.Dispose();
         subscription = null;
     }
 }
Example #2
0
        private void backgroundWorker1_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            backgroundWorker1.ReportProgress(0, "Waiting for subscriber host to be opened...");

            SubscriberInfo subscriberInfo = ApplicationService.GetSubscriberInfo();
            if (subscriberInfo.OpenedSuccessfully)
            {
                backgroundWorker1.ReportProgress(0, "Starting subscription...");
                try
                {
                    subscription = ConnectionInfo.DoWithExceptionTranslation(() => new Subscription(ConnectionInfo.Proxy,
                                                                                                    subscriberInfo.EndpointAddress, "SUBSCRIBE System.QueryExecuted"));
                    backgroundWorker1.ReportProgress(0, "Waiting for notifications");
                }
                catch (ApplicationException ex)
                {
                    e.Result = ex;
                }
            }
            else
            {
                e.Result = new ApplicationException(subscriberInfo.ErrorMessage);
            }
        }
Example #3
0
        private void subscriptionWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            var arg = (QueryArguments)e.Argument;

            subscriptionWorker.ReportProgress(0, "Waiting for subscriber host to be opened...");

            Func<Subscription> action;
            SubscriberInfo subscriberInfo;
            if (arg.Connection.ServerType.Equals("Java over HTTP"))
            {
                subscriberInfo = ApplicationService.GetHttpSubscriberInfo();
                action = () => SubscribeHttp(arg.Connection.Proxy, arg.Query, subscriberInfo);
            }
            else
            {
                if (Settings.Default.UseActiveSubscriber)
                    subscriberInfo = arg.Connection.GetActiveSubscriberInfo();
                else
                    subscriberInfo = ApplicationService.GetSubscriberInfo();

                action = () => SubscribeNetTcp(arg.Connection.Proxy, arg.Query, subscriberInfo);
            }

            if (subscriberInfo.OpenedSuccessfully)
            {
                subscriptionWorker.ReportProgress(0, "Starting subscription...");
                try
                {
                    subscription = ConnectionInfo.DoWithExceptionTranslation(action);
                    subscriptionWorker.ReportProgress(0, "Waiting for notifications");
                }
                catch (ApplicationException ex)
                {
                    e.Result = new QueryErrorResult { ErrorMessage = ex.Message, Log = ex.ToString() };
                }
            }
            else
            {
                e.Result = new QueryErrorResult {ErrorMessage = subscriberInfo.ErrorMessage};
            }
        }
Example #4
0
        public void RunQuery()
        {
            var editor = sciTextEditorControl1;
            if (editor == null)
                return;
            
            string query = editor.GetSelectedOrAllText();
            if (String.IsNullOrEmpty(query) || query.Trim().Length == 0)
                return;

            ConnectionInfo connection = ConnectionInfo;
            if (connection == null)
                return; // should we try to connect?

            if (queryWorker.IsBusy)
                return;

            if (subscription != null)
            {
                subscription.Dispose();
                subscription = null;
            }

            if (query.Trim().StartsWith("SUBSCRIBE", StringComparison.OrdinalIgnoreCase))
            {
                ShowTabs(Tabs.Subscription);
                subscriptionWorker.RunWorkerAsync(new QueryArguments(connection, query));
            }
            else
            {
                queryStatusBar1.UpdateStatusLabel("Running query...");
                queryWorker.RunWorkerAsync(new QueryArguments(connection, query));
            }
        }
Example #5
0
 void QueryTabDisposed(object sender, EventArgs e)
 {
     if (subscription != null)
     {
         subscription.Dispose();
         subscription = null;
     }
 }