protected override void OnFormClosing(FormClosingEventArgs e) { base.OnFormClosing(e); this.selectedObjects = this.resultDataTable.Clone(); TreeViewObjectPickerForm.DataTreeNodeModel dataTreeNodeModel = this.resultTreeView.SelectedObject as TreeViewObjectPickerForm.DataTreeNodeModel; if (dataTreeNodeModel != null) { this.selectedObjects.Rows.Add(dataTreeNodeModel.InnerDataRow.ItemArray); } this.ObjectPicker.DataTableLoader.CancelRefresh(); this.queryResults.Clear(); }
private void OnQueryCompleted(RunWorkerCompletedEventArgs e) { this.resultTreeView.Select(); TreeViewObjectPickerForm.DataTreeNodeModel parent = (this.nodeToExpand != null) ? (this.nodeToExpand.DataSource as TreeViewObjectPickerForm.DataTreeNodeModel) : null; this.CreateTreeNodes(parent); if (this.nodeToExpand != null) { this.nodeToExpand.Expand(); return; } if (this.resultTreeView.Nodes.Count > 0) { this.resultTreeView.SelectedNode = this.resultTreeView.Nodes[0]; this.resultTreeView.SelectedNode.Expand(); } }
private void resultTreeView_BeforeExpand(object sender, TreeViewCancelEventArgs e) { if (this.ObjectPicker.DataTableLoader.Refreshing) { e.Cancel = true; return; } DataTreeNode dataTreeNode = e.Node as DataTreeNode; TreeViewObjectPickerForm.DataTreeNodeModel dataTreeNodeModel = dataTreeNode.DataSource as TreeViewObjectPickerForm.DataTreeNodeModel; if (!dataTreeNodeModel.IsChildrenReady) { e.Cancel = true; this.RetriveChildrenNodes(dataTreeNode); } }
private void CreateTreeNodes(TreeViewObjectPickerForm.DataTreeNodeModel parent) { this.resultDataTable.Merge(this.queryResults); BindingList <TreeViewObjectPickerForm.DataTreeNodeModel> bindingList = (parent == null) ? this.rootNodes : parent.Children; foreach (object obj in this.queryResults.Rows) { DataRow dataRow = (DataRow)obj; DataRow dataRow2 = this.resultDataTable.Rows.Find(dataRow[this.queryResults.PrimaryKey[0]]); if (this.ObjectPicker.ObjectPickerProfile == null || !(this.ObjectPicker.ObjectPickerProfile.Scope is DataRow) || !object.Equals(dataRow2[this.queryResults.PrimaryKey[0].ColumnName] as ADObjectId, (this.ObjectPicker.ObjectPickerProfile.Scope as DataRow)[this.queryResults.PrimaryKey[0].ColumnName])) { bindingList.Add(new TreeViewObjectPickerForm.DataTreeNodeModel(dataRow2, this.ObjectPicker)); } } if (parent != null) { parent.IsChildrenReady = true; } }