private void SelectFunction(TreeNode functionNode) { if (functionNode == null) { return; } ITrainerNode node = functionNode.Tag as ITrainerNode; if (node == null) { return; } // Show introduction page if (node.NodeType == TrainerNodeType.Introduction) { SetRightGrid(RightFunction.Introduction); } else { // Fill address list FillAddressList(node.NodeIndex); // Show address list if (viewData.Items.Count > 0) { SetRightGrid(RightFunction.EditTable); } else { SetRightGrid(RightFunction.Empty); } } }
private void cmdModify_Click(object sender, EventArgs e) { try { ApplyModify(); // Refresh left TreeNode selectedNode = viewFunctions.SelectedNode; if (selectedNode == null) { return; } ITrainerNode functionNode = selectedNode.Tag as ITrainerNode; if (functionNode != null) { RefreshSelectedObject(functionNode); } // Refresh right SelectFunction(selectedNode); } catch (WindowsApi.BadProcessIdException ex) { ReportProcessIdFailure(ex.ProcessId); } }
// Re-query specific tree-node by FunctionListNode private void RefreshSelectedObject(ITrainerNode currentFunction) { TreeNode[] currentNodes = viewFunctions.Nodes.Find(currentFunction.NodeIndex.ToString(), true); TreeNode currentTree; if (currentNodes.Length < 1) { return; } else { currentTree = currentNodes[0]; } currentTree.Text = currentFunction.NodeTypeName; }