Ejemplo n.º 1
0
        private void ShowGeneralInfo()
        {
            piePieceHeaderTextBlock.Text = "General info";

            DiagramInfo.Clear();
            DiagramInfo.Note   = "Here are the most expensive items";
            DiagramInfo.Header = Scopes.TotalSum.ToString("C2");
            Scopes.OutputData((col1, col2) => DiagramInfo.Add(col1, col2));
        }
Ejemplo n.º 2
0
        private void PiePiece_MouseIn(PiePiece sender)
        {
            Panel.SetZIndex(sender, ElementToForegroundIndex);
            int ind      = sender.Ind;
            var curScope = Scopes[ind];

            piePieceHeaderTextBlock.Text = $"{curScope.EnumMember}";

            DiagramInfo.Clear();
            DiagramInfo.Header = $"{curScope.Sum:C2} ({curScope.Ratio: #0.##%})";
            curScope.OutputData((col1, col2) => DiagramInfo.Add(col1, col2));
        }
Ejemplo n.º 3
0
        private void ShowGeneralInfo()
        {
            DiagramInfo.Clear();
            DiagramInfo.Header = "General info";
            foreach (var item in Scopes)
            {
                DiagramInfo.Add(item.EnumMember.ToString(), DiagramStatInfo.ColumnType.Data);
                DiagramInfo.Add(item.Sum.ToString("f2"), item.Ratio.ToString("p2"));
            }

            DiagramInfo.Add($"Total: {Scopes.TotalSum:f2}", DiagramStatInfo.ColumnType.Data);
            DiagramInfo.Add($"Average: {Scopes.Average(x => x.Sum):f2}", DiagramStatInfo.ColumnType.Data);
        }
Ejemplo n.º 4
0
        private void PiePiece_MouseIn(PiePiece sender)
        {
            Panel.SetZIndex(sender, ElementToForegroundIndex);
            var curScope = Scopes[sender.EnumType];

            DiagramInfo.Clear();
            DiagramInfo.Header = curScope.EnumMember.ToString();

            foreach (var item in curScope)
            {
                DiagramInfo.Add(item.GetTotal.ToString("f2"), (item.GetTotal / curScope.Sum).ToString("p2"));
            }

            DiagramInfo.Add($"Total: {curScope.Sum:f2}", DiagramStatInfo.ColumnType.Data);
            DiagramInfo.Add($"Average: {curScope.Average(x => x.GetTotal):f2}", (curScope.Sum / Scopes.TotalSum).ToString("p2"));
        }
Ejemplo n.º 5
0
 private void ClearPie()
 {
     piePieces.Clear();
     PiecesGrid.Children.Clear();
     DiagramInfo.Clear();
 }
Ejemplo n.º 6
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);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 构造分类树
        /// </summary>
        /// <param name="tree">分类树</param>
        /// <param name="chartClass">分类</param>
        public void ConstructTree(TreeView tree, string chartClass)
        {
            DataTable treeTable = dataBaseManager.GetDiagramInformation(chartClass);
            TreeNodeCollection currentNodes;
            TreeNode newNode;

            tree.Nodes.Clear(); // 清空树结点
            treeMode = EditMode.Normal; // 重设树的状态

            TreeNode classNode = tree.Nodes.Add("地图分类");
            classNode.ImageIndex = 0;
            classNode.SelectedImageIndex = 0;
            classNode.Tag = chartClass;
            diagramInfoTable[chartClass] = new DiagramInfo(chartClass, DateTime.Now, "0", 0);

            foreach (DataRow row in treeTable.Rows)
            {
                string fullPath = row["FullPath"] as string;
                string id = row["ID"].ToString();
                bool isFolder = (bool)row["IsFolder"];
                DateTime editTime = (DateTime)row["EditTime"];
                string hostName = row["Host"].ToString();
                string currentVersion = row["Version"].ToString();

                if (currentVersion == "")
                {
                    currentVersion = "0";
                }

                string[] data = fullPath.Split(new char[] { '\\' });
                currentNodes = classNode.Nodes;

                for (int i = 0; i < data.Length; i++)
                {
                    string classification = data[i];

                    if ((i == data.Length - 1) && !isFolder) // 绘图结点
                    {
                        newNode = currentNodes.Add(classification);
                        newNode.Name = classification;
                        newNode.Tag = id;
                        newNode.ImageIndex = 1;
                        newNode.SelectedImageIndex = 1;
                        diagramInfoTable[id] = new DiagramInfo(hostName, editTime, currentVersion, 0);
                    }
                    else // 绘图分类结点
                    {
                        bool find = false;

                        foreach (TreeNode node in currentNodes)
                        {
                            if (node.Text == classification)
                            {
                                find = true;
                                currentNodes = node.Nodes;
                                break;
                            }
                        }

                        if (!find) // 当前分类不存在
                        {
                            StringBuilder path = new StringBuilder();

                            for (int j = 0; j <= i; j++)
                            {
                                path.Append(string.Format("{0}\\", data[j]));                                
                            }

                            path.Remove(path.Length - 1, 1);                            
                            DataRow[] rows = treeTable.Select(string.Format("FullPath = '{0}'", path.ToString()));

                            if (rows.Length > 0)
                            {
                                newNode = currentNodes.Add(classification);
                                newNode.Name = classification;
                                newNode.Tag = rows[0]["ID"];
                                newNode.ImageIndex = 0;
                                newNode.SelectedImageIndex = 0;
                                diagramInfoTable[newNode.Tag.ToString()] = new DiagramInfo(hostName, editTime, currentVersion, 0);

                                currentNodes = newNode.Nodes;
                                diagramInfoTable[id] = new DiagramInfo(hostName, editTime, currentVersion, 0);
                            }
                            else
                            {
                                MessageBox.Show(string.Format("绘图分类信息不完整,没有找到路径为{0}的绘图!", path),
                                                "分类树构建", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                    }
                }
                               
            }

            // 刷新树节点子结点个数信息
            RefreshNodeCount(tree);            
        }
Ejemplo n.º 8
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);
            }
        }