/// <summary>
        /// 查找引用
        /// </summary>
        /// <param name="sender">事件发送者</param>
        /// <param name="e">事件参数</param>
        private void bSearchReference_Click(object sender, EventArgs e)
        {
            Node currentNode = innerChartTree.SelectedNode;

            if (currentNode != null)
            {
                diagramInfoView.Rows.Clear();

                string innerChartName = currentNode.Text;                
                DataTable infoTable = dataBaseManager.GetDiagramInformation(diagramClass);

                DataRow[] rows = infoTable.Select("IsFolder = 0");
                ProgressForm progressForm = new ProgressForm(0, rows.Length);
                progressForm.Show();

                for (int i = 0; i < rows.Length; i++)
                {   
                    DataRow dataRow = rows[i];
                    string id = dataRow["ID"].ToString();
                    string path = dataRow["FullPath"].ToString();
                    string version = dataRow["Version"].ToString();
                    int diagramID = int.Parse(id);

                    progressForm.ShowProgress(i + 1, string.Format("检索绘图 {0} ...", path));

                    List<SlotContainer> nodeList = new List<SlotContainer>();

                    if (diagramInfoDictionary.ContainsKey(diagramID))
                    {
                        DiagramInfo diagramInfo = diagramInfoDictionary[diagramID];

                        if (diagramInfo.Version == int.Parse(version))
                        {
                            nodeList = diagramInfo.NodeList;
                        }
                        else
                        {
                            Hashtable diagramData = dataBaseManager.GetDiagramData(id) as Hashtable;

                            if (diagramData != null)
                            {
                                Hashtable graphData = diagramData["graphData"] as Hashtable;
                                nodeList = graphData["slotContainerList"] as List<SlotContainer>;
                                diagramInfo.Version = int.Parse(version);
                                diagramInfo.NodeList = nodeList;
                            }
                        }
                    }
                    else
                    {
                        Hashtable diagramData = dataBaseManager.GetDiagramData(id) as Hashtable;

                        if (diagramData != null && !string.IsNullOrEmpty(version))
                        {
                            Hashtable graphData = diagramData["graphData"] as Hashtable;
                            nodeList = graphData["slotContainerList"] as List<SlotContainer>;
                            DiagramInfo diagramInfo = new DiagramInfo(int.Parse(version), nodeList);
                            diagramInfoDictionary[diagramID] = diagramInfo;
                        }
                    }

                    foreach (SlotContainer node in nodeList)
                    {
                        if (node is InnerChart && node.Text == innerChartName)
                        {
                            diagramInfoView.Rows.Add(1);
                            DataGridViewRow newRow = diagramInfoView.Rows[diagramInfoView.Rows.Count - 1];
                            newRow.Cells["Path"].Value = path;
                            newRow.Cells["NodeID"].Value = node.ID.ToString();
                            newRow.Tag = id;
                        }
                    }                   
                }
            }
            else
            {
                MessageBox.Show("请先选择要查找引用的子绘图", "查找引用",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemple #2
0
        /// <summary>
        /// 查找引用
        /// </summary>
        /// <param name="sender">事件发送者</param>
        /// <param name="e">事件参数</param>
        private void bSearchReference_Click(object sender, EventArgs e)
        {
            Node currentNode = innerChartTree.SelectedNode;

            if (currentNode != null)
            {
                diagramInfoView.Rows.Clear();

                string    innerChartName = currentNode.Text;
                DataTable infoTable      = dataBaseManager.GetDiagramInformation(diagramClass);

                DataRow[]    rows         = infoTable.Select("IsFolder = 0");
                ProgressForm progressForm = new ProgressForm(0, rows.Length);
                progressForm.Show();

                for (int i = 0; i < rows.Length; i++)
                {
                    DataRow dataRow   = rows[i];
                    string  id        = dataRow["ID"].ToString();
                    string  path      = dataRow["FullPath"].ToString();
                    string  version   = dataRow["Version"].ToString();
                    int     diagramID = int.Parse(id);

                    progressForm.ShowProgress(i + 1, string.Format("检索绘图 {0} ...", path));

                    List <SlotContainer> nodeList = new List <SlotContainer>();

                    if (diagramInfoDictionary.ContainsKey(diagramID))
                    {
                        DiagramInfo diagramInfo = diagramInfoDictionary[diagramID];

                        if (diagramInfo.Version == int.Parse(version))
                        {
                            nodeList = diagramInfo.NodeList;
                        }
                        else
                        {
                            Hashtable diagramData = dataBaseManager.GetDiagramData(id) as Hashtable;

                            if (diagramData != null)
                            {
                                Hashtable graphData = diagramData["graphData"] as Hashtable;
                                nodeList             = graphData["slotContainerList"] as List <SlotContainer>;
                                diagramInfo.Version  = int.Parse(version);
                                diagramInfo.NodeList = nodeList;
                            }
                        }
                    }
                    else
                    {
                        Hashtable diagramData = dataBaseManager.GetDiagramData(id) as Hashtable;

                        if (diagramData != null && !string.IsNullOrEmpty(version))
                        {
                            Hashtable graphData = diagramData["graphData"] as Hashtable;
                            nodeList = graphData["slotContainerList"] as List <SlotContainer>;
                            DiagramInfo diagramInfo = new DiagramInfo(int.Parse(version), nodeList);
                            diagramInfoDictionary[diagramID] = diagramInfo;
                        }
                    }

                    foreach (SlotContainer node in nodeList)
                    {
                        if (node is InnerChart && node.Text == innerChartName)
                        {
                            diagramInfoView.Rows.Add(1);
                            DataGridViewRow newRow = diagramInfoView.Rows[diagramInfoView.Rows.Count - 1];
                            newRow.Cells["Path"].Value   = path;
                            newRow.Cells["NodeID"].Value = node.ID.ToString();
                            newRow.Tag = id;
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("请先选择要查找引用的子绘图", "查找引用",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }