コード例 #1
0
        /*
         * public override string ToString()
         * {
         *  string s=" ";
         *  for (int j = 0; j < V; j++)
         *  {
         *      foreach (int i in this.list[j])
         *          s = s + " " + i;
         *      s = s + "\n";
         *  }
         *  return s;
         * }*/
        public void buildGraph()
        {
            databaseConnectivity db = new databaseConnectivity();

            db.connectToDatabase();
            // db.readEdgeTable(this);
        }
コード例 #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            this.Location = new Point(0, 0);
            this.Size     = Screen.PrimaryScreen.WorkingArea.Size;
            sourceImg     = Image.FromFile("SrcImage.jpg");
            destImg       = Image.FromFile("DestImage.jpg");
            dummyImg      = Image.FromFile("DummyImage.jpg");
            db            = new databaseConnectivity();
            db.connectToDatabase();
            allpathvertices = new LinkedList <int>();
            locCount        = db.getLocationCount();
            locationArray   = new Location[locCount];
            if (locationArray == null)
            {
                MessageBox.Show("Memory not allocated");
            }
            db.readLocation(locationArray);
            pathArray = new int[locCount];
            graph     = new LocationNode(locCount);
            db.readEdgeTable(graph, locationArray);
            //string str = " ";
            serviceArray = new Services[locCount];
            db.readService(serviceArray);
            var servicestring = new AutoCompleteStringCollection();

            for (int i = 0; i < serviceArray.Length; i++)
            {
                if (!(serviceArray[i] == null || serviceArray[i].service.CompareTo("nil") == 0))
                {
                    servicestring.Add(serviceArray[i].service);
                    comboBox3.Items.Add(serviceArray[i].service);
                }
            }
            var autostring = new AutoCompleteStringCollection();

            for (int i = 0; i < locCount; i++)
            {
                comboBox1.Items.Add(locationArray[i].locName);
                comboBox2.Items.Add(locationArray[i].locName);

                autostring.Add(locationArray[i].locName);
            }
            comboBox1.AutoCompleteCustomSource = autostring;
            comboBox1.AutoCompleteMode         = AutoCompleteMode.SuggestAppend;
            comboBox1.AutoCompleteSource       = AutoCompleteSource.CustomSource;
            panel1.SetAutoScrollMargin(2, 3);

            comboBox2.AutoCompleteCustomSource = autostring;
            comboBox2.AutoCompleteMode         = AutoCompleteMode.SuggestAppend;
            comboBox2.AutoCompleteSource       = AutoCompleteSource.CustomSource;

            comboBox3.AutoCompleteCustomSource = servicestring;
            comboBox3.AutoCompleteMode         = AutoCompleteMode.SuggestAppend;
            comboBox3.AutoCompleteSource       = AutoCompleteSource.CustomSource;

            //Tool tip to help how to use the form
            ToolTip toolTip1 = new ToolTip();

            toolTip1.ShowAlways = true;
            toolTip1.SetToolTip(comboBox1, "Insert source to use showpath button.");
            ToolTip toolTip2 = new ToolTip();

            toolTip2.ShowAlways = true;
            toolTip2.SetToolTip(comboBox2, "Insert destination to use showpath button.");
            ToolTip toolTip3 = new ToolTip();

            toolTip3.ShowAlways = true;
            toolTip3.SetToolTip(comboBox3, "Insert destination type to use showallpath button.");
            ToolTip toolTip4 = new ToolTip();

            toolTip4.ShowAlways = true;
            toolTip4.SetToolTip(button3, "Select source and destination to get the path.");
            ToolTip toolTip5 = new ToolTip();

            toolTip5.ShowAlways = true;
            toolTip5.SetToolTip(button20, "Select source and destination type to get all paths.");
        }