Beispiel #1
0
        private void ContextMenu_CreateSchema(object sender, EventArgs e)
        {
            using (FormCreateSchema form = new FormCreateSchema())
            {
                if (form.ShowDialog() == DialogResult.OK)
                {
                    string SchemaName = treeManager.GetFullSchemaNameFromNode(contextNode) + ":" + form.SchemaName;

                    client.Schema.CreateAsync(SchemaName).ContinueWith((t) =>
                    {
                        FormProgress.WaitForVisible();
                        FormProgress.Complete();

                        if (t.Status == TaskStatus.RanToCompletion)
                        {
                            contextNode.Nodes.Clear();
                            treeManager.PopulateSchemas(client, contextNode, true);
                        }
                        else
                        {
                            Program.AsyncExceptionMessage(t, "An error occured while processing your request.");
                        }
                    }, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());

                    FormProgress.Start("Creating Schema [" + SchemaName + "]...");
                }
            }
        }
Beispiel #2
0
        private void ExecuteCurrentDocument()
        {
            var    queryDocument = tabManager.CurrentQueryDocument();
            string queryText     = queryDocument.TextOrSelection?.Trim();

            if (String.IsNullOrWhiteSpace(queryText))
            {
                return;
            }

            client.Query.ExecuteQueryAsync(queryText).ContinueWith((t) =>
            {
                FormProgress.WaitForVisible();
                FormProgress.Complete();

                if (t.Status == TaskStatus.RanToCompletion)
                {
                    PopulateFormFromResults(t.Result);
                }
                else
                {
                    PopulateException(t.Exception);
                }
            }, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());

            //FormProgress.Instance.CanCancel = true;

            if (FormProgress.Start("Executing query...") == DialogResult.Cancel)
            {
                //cancellationToken.Cancel();
            }
        }
Beispiel #3
0
        private void ContextMenu_DeleteIndex(object sender, EventArgs e)
        {
            if (MessageBox.Show("Are you sure you want to delete the index [" + contextNode.Text + "]?",
                                "Delete Index?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
            {
                return;
            }

            string schemaName = treeManager.GetFullSchemaNameFromNode(contextNode);

            client.Schema.Indexes.DeleteByNameAsync(schemaName, contextNode.Value.ToString()).ContinueWith((t) =>
            {
                FormProgress.WaitForVisible();
                FormProgress.Complete();

                if (t.Status == TaskStatus.RanToCompletion)
                {
                    contextNode.Remove();
                }
                else
                {
                    Program.AsyncExceptionMessage(t, "An error occured while processing your request.");
                }
            }, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());

            FormProgress.Start("Deleting index [" + contextNode.Text + "]...");
        }
Beispiel #4
0
        private void ContextMenu_CreateIndex(object sender, EventArgs e)
        {
            string schemaName = treeManager.GetFullSchemaNameFromNode(contextNode);

            using (FormCreateIndex form = new FormCreateIndex())
            {
                if (form.ShowDialog() == DialogResult.OK)
                {
                    client.Schema.Indexes.CreateAsync(schemaName,
                                                      new Index
                    {
                        Name       = form.IndexName,
                        IsUnique   = form.IsUnique,
                        Attributes = form.IndexAttributes
                    }).ContinueWith((t) =>
                    {
                        FormProgress.WaitForVisible();
                        FormProgress.Complete();

                        if (t.Status != TaskStatus.RanToCompletion)
                        {
                            Program.AsyncExceptionMessage(t, "An error occured while processing your request.");
                        }

                        treeManager.PopulateSchemaIndexes(client, contextNode);
                    }, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());

                    FormProgress.Start("Creating index [" + form.IndexName + "]...");
                }
            }
        }
Beispiel #5
0
        private void ContextMenu_SetLoginPassword(object sender, EventArgs e)
        {
            using (FormSetLoginPassword form = new FormSetLoginPassword())
            {
                if (form.ShowDialog() == DialogResult.OK)
                {
                    client.Security.SetLoginPasswordAsync(contextNode.Text, form.PasswordHash).ContinueWith((t) =>
                    {
                        FormProgress.WaitForVisible();
                        FormProgress.Complete();

                        if (t.Status != TaskStatus.RanToCompletion)
                        {
                            Program.AsyncExceptionMessage(t, "An error occured while processing your request.");
                        }
                    }, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());

                    FormProgress.Start("Setting password for [" + contextNode.Text + "]...");
                }
            }
        }
Beispiel #6
0
        private void ContextMenu_DeleteLogin(object sender, EventArgs e)
        {
            if (MessageBox.Show("Are you sure you want to delete the login [" + contextNode.Text + "]?",
                                "Delete Login?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
            {
                return;
            }

            client.Security.DeleteLoginByNameAsync(contextNode.Text).ContinueWith((t) =>
            {
                FormProgress.WaitForVisible();
                FormProgress.Complete();

                if (t.Status != TaskStatus.RanToCompletion)
                {
                    Program.AsyncExceptionMessage(t, "An error occured while processing your request.");
                }

                treeManager.PopulateLogins(client);
            }, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());

            FormProgress.Start("Deleting login [" + contextNode.Text + "]...");
        }
Beispiel #7
0
        private void ContextMenu_CreateLogin(object sender, EventArgs e)
        {
            using (FormCreateLogin form = new FormCreateLogin())
            {
                if (form.ShowDialog() == DialogResult.OK)
                {
                    client.Security.CreateLoginAsync(form.Username, form.PasswordHash).ContinueWith((t) =>
                    {
                        FormProgress.WaitForVisible();
                        FormProgress.Complete();

                        if (t.Status != TaskStatus.RanToCompletion)
                        {
                            Program.AsyncExceptionMessage(t, "An error occured while processing your request.");
                        }

                        treeManager.PopulateLogins(client);
                    }, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());

                    FormProgress.Start("Creating login [" + form.Username + "]...");
                }
            }
        }