private void UpdateTreeviewWithTypes( IRestResponse <SourceTypeResponseObject> resp, VectorIndexGeometryNode geometryNode) { var sourceNode = (VectorIndexSourceNode)geometryNode.Parent; if (resp.Data == null || resp.StatusCode != HttpStatusCode.OK) { // Remove the node from the list of checked nodes because an error occurred. this.checkedNodes.Remove(this.treeView1.Nodes[sourceNode.Index].Nodes[geometryNode.Index]); this.treeView1.Nodes[sourceNode.Index].Nodes[geometryNode.Index].Checked = false; this.treeView1.Nodes[sourceNode.Index].Nodes[geometryNode.Index].Text = this.treeView1.Nodes[sourceNode.Index].Nodes[geometryNode.Index].Text.Replace( GbdxResources.SearchingText, GbdxResources.Source_ErrorMessage); // Don't allow it to process further. return; } // if not using a query if (string.IsNullOrEmpty(this.query)) { this.treeView1.Nodes[sourceNode.Index].Nodes[geometryNode.Index].Text = this.treeView1.Nodes[sourceNode.Index].Nodes[geometryNode.Index].Text.Replace( GbdxResources.SearchingText, string.Empty); } else // if using a query { this.treeView1.Nodes[geometryNode.Index].Text = this.treeView1.Nodes[geometryNode.Index].Text.Replace(GbdxResources.SearchingText, string.Empty); } foreach (var type in resp.Data.Data) { if (string.IsNullOrEmpty(type.Name)) { continue; } var newItem = new VectorIndexTypeNode { Geometry = geometryNode.GeometryType, Type = type, Text = string.Format("{0} ({1})", type.Name, type.Count), Name = Guid.NewGuid().ToString() }; if (string.IsNullOrEmpty(this.query)) { // non query newItem.Source = sourceNode.Source; this.treeView1.Nodes[sourceNode.Index].Nodes[geometryNode.Index].ContextMenuStrip = this.CreateContextMenuStrip(this.treeView1.Nodes[sourceNode.Index].Nodes[geometryNode.Index]); this.treeView1.Nodes[sourceNode.Index].Nodes[geometryNode.Index].Nodes.Add(newItem); } else { // query newItem.Source = null; this.treeView1.Nodes[geometryNode.Index].ContextMenuStrip = this.CreateContextMenuStrip(this.treeView1.Nodes[geometryNode.Index]); this.treeView1.Nodes[geometryNode.Index].Nodes.Add(newItem); } } this.treeView1.Sort(); }
private void UpdateTreeviewWithTypes( IRestResponse<SourceTypeResponseObject> resp, VectorIndexGeometryNode geometryNode) { var sourceNode = (VectorIndexSourceNode)geometryNode.Parent; if (resp.Data == null || resp.StatusCode != HttpStatusCode.OK) { // Remove the node from the list of checked nodes because an error occurred. this.checkedNodes.Remove(this.treeView1.Nodes[sourceNode.Index].Nodes[geometryNode.Index]); this.treeView1.Nodes[sourceNode.Index].Nodes[geometryNode.Index].Checked = false; this.treeView1.Nodes[sourceNode.Index].Nodes[geometryNode.Index].Text = this.treeView1.Nodes[sourceNode.Index].Nodes[geometryNode.Index].Text.Replace( GbdxResources.SearchingText, GbdxResources.Source_ErrorMessage); // Don't allow it to process further. return; } // if not using a query if (string.IsNullOrEmpty(this.query)) { this.treeView1.Nodes[sourceNode.Index].Nodes[geometryNode.Index].Text = this.treeView1.Nodes[sourceNode.Index].Nodes[geometryNode.Index].Text.Replace( GbdxResources.SearchingText, string.Empty); } else // if using a query { this.treeView1.Nodes[geometryNode.Index].Text = this.treeView1.Nodes[geometryNode.Index].Text.Replace(GbdxResources.SearchingText, string.Empty); } foreach (var type in resp.Data.Data) { if (string.IsNullOrEmpty(type.Name)) { continue; } var newItem = new VectorIndexTypeNode { Geometry = geometryNode.GeometryType, Type = type, Text = string.Format("{0} ({1})", type.Name, type.Count), Name = Guid.NewGuid().ToString() }; if (string.IsNullOrEmpty(this.query)) { // non query newItem.Source = sourceNode.Source; this.treeView1.Nodes[sourceNode.Index].Nodes[geometryNode.Index].ContextMenuStrip = this.CreateContextMenuStrip(this.treeView1.Nodes[sourceNode.Index].Nodes[geometryNode.Index]); this.treeView1.Nodes[sourceNode.Index].Nodes[geometryNode.Index].Nodes.Add(newItem); } else { // query newItem.Source = null; this.treeView1.Nodes[geometryNode.Index].ContextMenuStrip = this.CreateContextMenuStrip(this.treeView1.Nodes[geometryNode.Index]); this.treeView1.Nodes[geometryNode.Index].Nodes.Add(newItem); } } this.treeView1.Sort(); }
private void UpdateTreeviewWithGeometry( IRestResponse <SourceTypeResponseObject> resp, VectorIndexSourceNode source) { if (resp.Data == null || resp.StatusCode != HttpStatusCode.OK) { // Remove the node from the list of checked nodes because an error occurred. this.checkedNodes.Remove(this.treeView1.Nodes[source.Index]); this.treeView1.Nodes[source.Index].Checked = false; this.treeView1.Nodes[source.Index].Text = this.treeView1.Nodes[source.Index].Text.Replace( GbdxResources.SearchingText, GbdxResources.Source_ErrorMessage); // Don't allow it to process further. return; } // do this for normal tree traversal with a source - geometry - type if (string.IsNullOrEmpty(this.query)) { // Results were found so lets get rid of the searching text. this.treeView1.Nodes[source.Index].Text = this.treeView1.Nodes[source.Index].Text.Replace(GbdxResources.SearchingText, string.Empty); foreach (var geoType in resp.Data.Data) { var newItem = new VectorIndexGeometryNode { Source = source.Source, GeometryType = geoType, Text = string.Format( "{0} ({1})", geoType.Name, geoType.Count) }; this.treeView1.Nodes[source.Index].Nodes.Add(newItem); } } else // do this when there is a query whose tree structure goes geoemtry - type { // Results were found so lets get rid of the searching text. this.treeView1.Nodes.Remove(source); this.treeView1.CheckBoxes = true; foreach (var geoType in resp.Data.Data) { var newItem = new VectorIndexGeometryNode { Source = null, GeometryType = geoType, Text = string.Format( "{0} ({1})", geoType.Name, geoType.Count) }; this.treeView1.Nodes.Add(newItem); } } this.treeView1.Sort(); }
private void UpdateTreeviewWithGeometry( IRestResponse<SourceTypeResponseObject> resp, VectorIndexSourceNode source) { if (resp.Data == null || resp.StatusCode != HttpStatusCode.OK) { // Remove the node from the list of checked nodes because an error occurred. this.checkedNodes.Remove(this.treeView1.Nodes[source.Index]); this.treeView1.Nodes[source.Index].Checked = false; this.treeView1.Nodes[source.Index].Text = this.treeView1.Nodes[source.Index].Text.Replace( GbdxResources.SearchingText, GbdxResources.Source_ErrorMessage); // Don't allow it to process further. return; } // do this for normal tree traversal with a source - geometry - type if (string.IsNullOrEmpty(this.query)) { // Results were found so lets get rid of the searching text. this.treeView1.Nodes[source.Index].Text = this.treeView1.Nodes[source.Index].Text.Replace(GbdxResources.SearchingText, string.Empty); foreach (var geoType in resp.Data.Data) { var newItem = new VectorIndexGeometryNode { Source = source.Source, GeometryType = geoType, Text = string.Format( "{0} ({1})", geoType.Name, geoType.Count) }; this.treeView1.Nodes[source.Index].Nodes.Add(newItem); } } else // do this when there is a query whose tree structure goes geoemtry - type { // Results were found so lets get rid of the searching text. this.treeView1.Nodes.Remove(source); this.treeView1.CheckBoxes = true; foreach (var geoType in resp.Data.Data) { var newItem = new VectorIndexGeometryNode { Source = null, GeometryType = geoType, Text = string.Format( "{0} ({1})", geoType.Name, geoType.Count) }; this.treeView1.Nodes.Add(newItem); } } this.treeView1.Sort(); }