Пример #1
0
        private void btn_Browse_Click(object sender, EventArgs e) // Event btn_Browse di klik (Browse files) dan menggambarkan graph setelah berhasil di load file
        {
            var result = new System.Windows.Forms.OpenFileDialog();

            if (result.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string fileToOpen = result.FileName;
                Console.WriteLine(fileToOpen);
                this.GDraw = new Microsoft.Msagl.Drawing.Graph("graph");
                this.OG    = new Classes.Graph(fileToOpen);
                DrawGraph(this.GDraw, OG.getDrawInfo());
                gViewer1.Graph            = this.GDraw;
                gViewer1.OutsideAreaBrush = Brushes.White;
                gViewer1.ToolBarIsVisible = false;
                this.account      = null;
                this.findAccount  = null;
                this.mode         = -1;
                lbl_FileName.Text = "File Name: " + System.IO.Path.GetFileName(fileToOpen);

                // Initialize dropdown menu
                accList  = new List <ItemCombo>();
                findList = new List <ItemCombo>();
                fromList = new List <ItemCombo>();
                toList   = new List <ItemCombo>();
                InitializeComboItems(accList, findList, fromList, toList, OG);
            }
        }
Пример #2
0
 public Form1() // Konstruktor form (Menginisialisasikan tiap atribut dengan null, dan beberapa komponen tidak dapat dilihat terlebih dahulu pada form)
 {
     InitializeComponent();
     this.GDraw                 = null;
     this.OG                    = null;
     this.account               = null;
     this.findAccount           = null;
     this.mode                  = -1;
     this.from                  = null;
     this.to                    = null;
     cmb_Account.Visible        = false;
     pnl_ExploreFriends.Visible = false;
     cmb_ExploreWith.Visible    = false;
     pnl_ExploreFriends.Size    = new Size(200, 181);
     pnl_AddAccount.Visible     = false;
     pnl_AddConnection.Visible  = false;
     gViewer1.ToolBarIsVisible  = false;
 }
Пример #3
0
        void InitializeComboItems(List <ItemCombo> list1, List <ItemCombo> list2, List <ItemCombo> list3, List <ItemCombo> list4, Classes.Graph graph)
        {
            foreach (var name in graph.getNodeNames())
            {
                list1.Add(new ItemCombo()
                {
                    Text = name, Value = name
                });
                list2.Add(new ItemCombo()
                {
                    Text = name, Value = name
                });
                list3.Add(new ItemCombo()
                {
                    Text = name, Value = name
                });
                list4.Add(new ItemCombo()
                {
                    Text = name, Value = name
                });
            }
            cmb_Account.DataSource    = list1;
            cmb_Account.DisplayMember = "Text";
            cmb_Account.ValueMember   = "Value";

            cmb_ExploreWith.DataSource    = list2;
            cmb_ExploreWith.DisplayMember = "Text";
            cmb_ExploreWith.ValueMember   = "Value";

            cmb_From.DataSource    = list3;
            cmb_From.DisplayMember = "Text";
            cmb_From.ValueMember   = "Value";

            cmb_To.DataSource    = list4;
            cmb_To.DisplayMember = "Text";
            cmb_To.ValueMember   = "Value";
        }