private void btnOK_Click(object sender, EventArgs e)
        {
            /* TO DO:
             * logic to set GroupsCheckedList and pass it to 
             * 
             * */
            chklist = new GroupsCheckedList();
            if (radDConnectorMotif.Checked)
            {
                chklist.Dconnector_Motif = true;
                chklist.dMaximum = Convert.ToInt32(numericUpDown2.Value);
                chklist.dMininum = Convert.ToInt32(numericUpDown1.Value);
            }
            else if (radFanMotif.Checked) chklist.Fan_Motif = true;
            else chklist.WakitaTsurumi_Cluster = true;

            GroupCalculationProgressDialog gp = new GroupCalculationProgressDialog(m_oGraph, chklist, m_oShowMetricCalculateResult);
            if (gp.ShowDialog() == DialogResult.OK) {
                DialogResult = DialogResult.OK;
                m_oResultDataTableObservableBase = m_oShowMetricCalculateResult.m_oDataTableObservableBase;
                gp.Close();            
            }
        }
 private void button5_Click(object sender, EventArgs e)
 {
     if (m_oShowMetricCalculateResult == null)
         m_oShowMetricCalculateResult = new ShowMetricCalculateResult();
     if (layoutControl1.Graph.Vertices.Count > 0)
     {
         GroupSettingDialog oGroupSettingDialog = new GroupSettingDialog(layoutControl1.Graph, m_oShowMetricCalculateResult);
         if (oGroupSettingDialog.ShowDialog() == DialogResult.OK)
         {
             DialogResult = DialogResult.OK;
             m_oResultDataTableObservableBase = m_oShowMetricCalculateResult.m_oDataTableObservableBase;
         }
     }
     else
     {
         MessageBox.Show("Error: 請先選好讀入的Graph", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        public void refreshwith(DataTableObservableBase source)
        {
            m_oDataTableObservableBase = source;
            List<DataTable> tbs = source.getDataTables;

            foreach (DataTable tb in tbs) {
                if (tb.TableName == "Vertex") {
                    if (m_oVertexTable == null)
                    {
                        m_oVertexTable = tb;
                        continue;
                    }
                    foreach (DataRow dr in tb.Rows)
                    {
                        Debug.Assert(m_oVertexTable.Rows.Contains(dr["Vertex_ID"]));                      
                    }
                    foreach (DataColumn dc in tb.Columns)
                    {
                        if (!m_oVertexTable.Columns.Contains(dc.ColumnName))
                            m_oVertexTable.Columns.Add(dc.ColumnName, dc.DataType);
                        foreach (DataRow dr in tb.Rows) {
                            if (dc.ColumnName != "Vertex_ID")
                                m_oVertexTable.Rows.Find(dr["Vertex_ID"])[dc.ColumnName] = dr[dc.ColumnName]; 
                        }
                    } 
                }
                else if (tb.TableName == "Edge")
                {
                    if (m_oEdgeTable == null)
                    {
                        m_oEdgeTable = tb;
                        continue;
                    }
                    foreach (DataRow dr in tb.Rows)
                    {
                        Debug.Assert(m_oEdgeTable.Rows.Contains(dr["Edge_ID"]));

                    }
                    foreach (DataColumn dc in tb.Columns)
                    {
                        if (!m_oEdgeTable.Columns.Contains(dc.ColumnName))
                            m_oEdgeTable.Columns.Add(dc.ColumnName, dc.DataType);
                        foreach (DataRow dr in tb.Rows)
                        {
                            if (dc.ColumnName != "Edge_ID")
                                m_oEdgeTable.Rows.Find(dr["Edge_ID"])[dc.ColumnName] = dr[dc.ColumnName];
                        }
                    }
                }
                else if (tb.TableName == "Group")
                {
                    m_oGroupTable = tb;
                    /*
                    if (m_oGroupTable == null){
                        m_oGroupTable = tb;
                        continue;
                    }
                    foreach (DataRow dr in tb.Rows)
                    {
                        Debug.Assert(m_oGroupTable.Rows.Contains(dr["Group_ID"]));

                    }
                    foreach (DataColumn dc in tb.Columns)
                    {
                        if (!m_oGroupTable.Columns.Contains(dc.ColumnName))
                            m_oGroupTable.Columns.Add(dc.ColumnName, dc.DataType);
                        foreach (DataRow dr in tb.Rows)
                        {
                            if (dc.ColumnName != "Group_ID")
                            {
                                Debug.Assert(m_oGroupTable != null);
                                Debug.Assert(dr[dc.ColumnName] != null);
                                System.Console.WriteLine("!!!!!!!!!!!!!!!");
                                m_oGroupTable.Rows.Find(dr["Group_ID"])[dc.ColumnName] = dr[dc.ColumnName];
                            }
                        }
                    }*/
                }
            
            }
            refreshDisplay(m_oVertexTable, m_oEdgeTable, m_oGroupTable);
            if (!this.Visible)
                this.Show();
        }
        private void btnCalculate_Click(object sender, EventArgs e)
        {
            //chklist = new MetricsCheckedList();

            //if (checkedListBox1.CheckedItems.Contains("overall graph metrics")) chklist.overall_graph_metrics = true;
            //if (checkedListBox1.CheckedItems.Contains("vertex degree")) chklist.vertex_degree = true;
            //if (checkedListBox1.CheckedItems.Contains("vertex reciprocated pair ratio")) chklist.vertex_reciprocated_pair_ratio = true;
            //if (checkedListBox1.CheckedItems.Contains("vertex clustering coefficient")) chklist.vertex_clustering_coefficient = true;
            //if (checkedListBox1.CheckedItems.Contains("vertex pagerank")) chklist.vertex_pagerank = true;
            //if (checkedListBox1.CheckedItems.Contains("edge reciprocation")) chklist.edge_reciprocation = true;
            //if (checkedListBox1.CheckedItems.Contains("vertex eigen vector centrality")) chklist.vertex_eigenvector_centrality = true;
            //if (checkedListBox1.CheckedItems.Contains("group metrics")) chklist.group_metrics = true;

            MetricsCalculationProgressDialog dg = new MetricsCalculationProgressDialog(m_oGraph, chklist, m_oShowMetricCalculateResult);
            //dg.Show(this);
            if (dg.ShowDialog() == DialogResult.OK)
            {
                DialogResult = DialogResult.OK;
                m_oDataTableObservableBase = m_oShowMetricCalculateResult.m_oDataTableObservableBase;
                this.Close();
            }
        }