private void button8_Click(object sender, EventArgs e) { int[] input = AlgorithmHelper.ConvertCommaSeparetedStringToInt(this.textBox5.Text); int index = Convert.ToInt32(this.textBox8.Text); int value = Convert.ToInt32(this.textBox9.Text); SegmentationTree tree = new SegmentationTree(input); tree.UpdateValueAtindex(index, value); this.textBox5.Text = AlgorithmHelper.ConvertIntArrayToCommaSeparatedString(tree.InputArray); }
private void button6_Click(object sender, EventArgs e) { int[] input = AlgorithmHelper.ConvertCommaSeparetedStringToInt(this.textBox5.Text); int querystart = Convert.ToInt32(this.textBox7.Text); int queryend = Convert.ToInt32(this.textBox6.Text); SegmentationTree tree = new SegmentationTree(input); int sum = tree.QuerySumBetweenIndex(querystart, queryend); this.textBox2.Text = sum.ToString(); }
protected override void OnInit(EventArgs e) { btnNew.SetWorkflowMethod<NewSegment>(null, null, false, false, true, null); _tree = new SegmentationTree(); _tree.PostOnClick = true; _tree.Click += new EventHandler(segmentationTree_DblClick); _tree.Drop += new EventHandler(segmentationTree_Drop); _tree.Remove += new EventHandler(segmentationTree_Remove); _tree.AllowDropBetweenElements = true; _tree.AllowDropOnElements = true; _tree.AllowRemoveDrag = false; pnlTree.Controls.Add(_tree); if (Request["nid"] != null) { int nid = Utils.GetIntegerOnly(Request["nid"]); if (nid > 0 && WAFContext.Session.ContentExists(nid)) { contentForm.NodeId = nid; contentForm.Refresh(); _tree.SetSelected(nid); CKeyNLR key = new CKeyNLR(nid, WAFContext.Request.LCID, 0); _tree.SetSelected(nid); } } base.OnInit(e); }