コード例 #1
0
 void ActivityMonitorTabDisposed(object sender, EventArgs e)
 {
     if (subscription != null)
     {
         subscription.Dispose();
         subscription = null;
     }
 }
コード例 #2
0
ファイル: QueryTab.cs プロジェクト: cooperdustin12/psproj
        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));
            }
        }