Пример #1
0
        private void enableTSQLToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var con = GetService(treeView.SelectedNode);

            try
            {
                TSqlEndpoint.Enable(con.ServiceClient);
                treeView.SelectedNode.Text = "T-SQL Endpoint";

                if (!String.IsNullOrEmpty(con.ServiceClient.CurrentAccessToken))
                {
                    treeView.SelectedNode.ImageIndex         = 21;
                    treeView.SelectedNode.SelectedImageIndex = 21;
                }
                else
                {
                    treeView.SelectedNode.ImageIndex         = 21;
                    treeView.SelectedNode.SelectedImageIndex = 21;
                    treeView.SelectedNode.Text += " (Unavailable - OAuth authentication required)";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error enabling T-SQL Endpoint:\r\n\r\n" + ex.Message);
            }
        }
Пример #2
0
        private void enableTSQLToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var con  = GetService(treeView.SelectedNode);
            var node = treeView.SelectedNode;

            WorkAsync(new WorkAsyncInfo
            {
                Message = "Enabling...",
                Work    = (worker, args) =>
                {
                    TSqlEndpoint.Enable(con.ServiceClient);
                },
                PostWorkCallBack = (args) =>
                {
                    if (args.Error != null)
                    {
                        MessageBox.Show("Error enabling TDS Endpoint:\r\n\r\n" + args.Error.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    node.Text = "TDS Endpoint";

                    if (!String.IsNullOrEmpty(con.ServiceClient.CurrentAccessToken))
                    {
                        node.ImageIndex         = 21;
                        node.SelectedImageIndex = 21;
                    }
                    else
                    {
                        node.ImageIndex         = 21;
                        node.SelectedImageIndex = 21;
                        node.Text += " (Unavailable - OAuth authentication required)";
                    }
                }
            });
        }