示例#1
0
        void myMenuItemQueryDocument_Click(object sender, EventArgs e)
        {
            this.currentQueryCommandContext = new CommandContext();
            this.currentQueryCommandContext.IsFeed = true;

            // reset continuation token
            this.currentContinuation = null;

            Program.GetMain().SetCrudContext(this, string.Format(CultureInfo.InvariantCulture, "Query Documents from Collection {0}", (this.Tag as Documents.DocumentCollection).Id),
                false, "select * from c", this.QueryDocuments, this.currentQueryCommandContext);

        }
示例#2
0
 void myMenuItemDeleteDocumentCollection_Click(object sender, EventArgs e)
 {
     string x = this.Tag.ToString();
     CommandContext context = new CommandContext();
     context.IsDelete = true;
     Program.GetMain().SetCrudContext(this, "Delete DocumentCollection", false, x, this.DeleteDocumentCollection, context);
 }
示例#3
0
 void myMenuItemUpdateDocumentCollection_Click(object sender, EventArgs e)
 {
     string x = this.Tag.ToString();
     CommandContext context = new CommandContext();
     Program.GetMain().SetCrudContext(this, "Replace DocumentCollection", false, x, this.UpdateDocumentCollection, context);
 }
示例#4
0
 void myMenuItemQueryDocument_Click(object sender, EventArgs e)
 {
     this.currentQueryCommandContext = new CommandContext();
     this.currentQueryCommandContext.IsFeed = true; 
     Program.GetMain().SetCrudContext(string.Format("Query Documents from Collection {0}", (this.Tag as Documents.DocumentCollection).Id),
         false, "select * from c", this.QueryDocuments, this.currentQueryCommandContext);
     
 }
示例#5
0
 void myMenuItemDelete_Click(object sender, EventArgs e)
 {
     string x = this.Tag.ToString();
     CommandContext context = new CommandContext();
     context.IsDelete = true;
     Program.GetMain().SetCrudContext(this, "Delete " + this.resourceType.ToString(), false, x, this.DeleteNode, context);
 }
示例#6
0
 public void SetNextPageVisibility(CommandContext commandContext)
 {
     this.btnExecuteNext.Enabled = commandContext.HasContinuation || !commandContext.QueryStarted;
 }
示例#7
0
 void myMenuItemDeleteDatabase_Click(object sender, EventArgs e)
 {
     string x = this.Tag.ToString();
     CommandContext context = new CommandContext();
     context.IsDelete = true;
     Program.GetMain().SetCrudContext("Delete database", false, x, this.DeleteDatabase, context);
 }
示例#8
0
        public void SetCrudContext(TreeNode node, string name, bool showId, string bodytext, Action<string, object> func, CommandContext commandContext = null)
        {
            if (commandContext == null)
            {
                commandContext = new CommandContext();
            }

            this.treeView1.SelectedNode = node;

            this.currentCrudName = name;

            this.currentOperation = func;
            this.tabCrudContext.Text = name;
            this.tbCrudContext.Text = bodytext;

            this.toolStripBtnExecute.Enabled = true;
            this.tbCrudContext.ReadOnly = commandContext.IsDelete;

            // the whole left split panel.
            this.splitContainerInner.Panel1Collapsed = false;
            //the split panel inside Tab. Panel1: Id, Panel2: Edit CRUD.
            this.splitContainerIntabPage.Panel1Collapsed = !showId;

            this.tbResponse.Text = "";

            //the split panel at right bottom. Panel1: NextPage, Panel2: Browser.
            if (commandContext.IsFeed)
            {
                this.ButtomSplitContainer.Panel1Collapsed = false;
                this.ButtomSplitContainer.Panel1.Controls.Clear();
                this.ButtomSplitContainer.Panel1.Controls.Add(this.feedToolStrip);
            }
            else if (commandContext.IsCreateTrigger)
            {
                this.ButtomSplitContainer.Panel1Collapsed = false;
                this.ButtomSplitContainer.Panel1.Controls.Clear();
                this.ButtomSplitContainer.Panel1.Controls.Add(this.triggerPanel);
            }
            else
            {
                this.ButtomSplitContainer.Panel1Collapsed = true;
            }

            this.SetNextPageVisibility(commandContext);

            if (string.Compare(name, "Create documentCollection", StringComparison.OrdinalIgnoreCase) == 0 ||
                string.Compare(name, "Replace DocumentCollection", StringComparison.OrdinalIgnoreCase) == 0)
            {
                if (string.Compare(name, "Create documentCollection", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    cbIndexingPolicyDefault.Enabled = true;
                }
                else
                {
                    cbIndexingPolicyDefault.Enabled = false;
                }

                if (this.tabControl.TabPages.Contains(this.tabCrudContext))
                {
                    this.tabControl.TabPages.Insert(0, this.tabDocumentCollectionPolicy);
                    this.tabControl.TabPages.Remove(this.tabCrudContext);
                }
                this.tabControl.SelectedTab = this.tabDocumentCollectionPolicy;
            }
            else
            {
                if (this.tabControl.TabPages.Contains(this.tabDocumentCollectionPolicy))
                {
                    this.tabControl.TabPages.Remove(this.tabDocumentCollectionPolicy);
                    this.tabControl.TabPages.Insert(0, this.tabCrudContext);
                }
                this.tabControl.SelectedTab = this.tabCrudContext;
            }
        }
        void myMenuItemQueryDocument_Click(object sender, EventArgs e)
        {
            this.currentQueryCommandContext = new CommandContext();
            this.currentQueryCommandContext.IsFeed = true;

            // reset continuation token
            this.currentContinuation = null;

            Program.GetMain().SetCrudContext(this, OperationType.Query, ResourceType.Document, "select * from c", this.QueryDocumentsAsync, this.currentQueryCommandContext);

        }
 void myMenuItemReplaceDocumentCollection_Click(object sender, EventArgs e)
 {
     string x = this.Tag.ToString();
     CommandContext context = new CommandContext();
     Program.GetMain().SetCrudContext(this, OperationType.Replace, ResourceType.DocumentCollection, x, this.ReplaceDocumentCollectionAsync, context);
 }
 void myMenuItemDeleteDatabase_Click(object sender, EventArgs e)
 {
     string x = this.Tag.ToString();
     CommandContext context = new CommandContext();
     context.IsDelete = true;
     Program.GetMain().SetCrudContext(this, OperationType.Delete,  ResourceType.Database, x, this.DeleteDatabaseAsync, context);
 }
示例#12
0
        public void SetCrudContext(string name, bool showId, string bodytext, Action<string, string> func, CommandContext commandContext = null)
        {
            if(commandContext == null)
            {
                commandContext = new CommandContext();
            }

            this.currentOperation = func;
            this.tabCrudContext.Text = name;
            this.tbCrudContext.Text = bodytext;

            this.toolStripBtnExecute.Enabled = true;
            this.tbCrudContext.ReadOnly = commandContext.IsDelete;

            this.splitContainerInner.Panel1Collapsed = false;
            this.splitContainerIntabPage.Panel1Collapsed = !showId;

            this.tbResponse.Text = "";

            this.tabControl.SelectedTab = this.tabCrudContext;
            this.ButtomSplitContainer.Panel1Collapsed = !commandContext.IsFeed;
            this.SetNextPageVisibility(commandContext);
        }