Ejemplo n.º 1
0
        // popup constructor for showing user ratings in another listbox
        // after a user double-clicks a user in the output listbox
        public Form2(Pushpin pin, BusinessTier.Business bt)
        {
            InitializeComponent();

            Location loc = pin.Location;

            double latitude  = loc.Latitude;
            double longitude = loc.Longitude;

            // now get the stops at this location
            IReadOnlyList <BusinessTier.Stops> lines  = bt.getAllStopsbyLocation(latitude, longitude);
            IEnumerator <BusinessTier.Stops>   lineEn = lines.GetEnumerator();

            BusinessTier.Stops curLine;

            // format the content
            while (lineEn.MoveNext())
            {
                string stopMsg;
                string coordinates;
                string handicap;

                curLine = lineEn.Current;
                stopMsg = string.Format(" {0}: {1}", curLine.StopID, curLine.Name);

                // get stop info
                BusinessTier.Stops stopInfo = bt.getStopInfo(Convert.ToInt32(curLine.StopID));

                // display coordinates of stop
                coordinates = string.Format("({1},{0})", stopInfo.Longitude, stopInfo.Latitude);

                // handicap accessible ?
                if (stopInfo.ADA == 0)
                {
                    handicap = "No";
                }
                else
                {
                    handicap = "Yes";
                }

                this.pushPin_listBox.Items.Add(stopMsg);
                this.pushPin_listBox.Items.Add("Location: " + coordinates);
                this.pushPin_listBox.Items.Add("Handicap Accessible: " + handicap);
                this.pushPin_listBox.Items.Add("Direction: " + stopInfo.Direction);
                this.pushPin_listBox.Items.Add("Stop Detail: " + bt.getDetail(stopInfo.StopID));
                this.pushPin_listBox.Items.Add("");
            }
        }
Ejemplo n.º 2
0
        private void listBox2_DoubleClick(object sender, EventArgs e)
        {
            //parse the item the user selected
            string[] words = listBox2.SelectedItem.ToString().Split(':');

            // get stop info
            BusinessTier.Stops stopInfo = bt.getStopInfo(Convert.ToInt32(words[0]));

            // display coordinates of stop
            string newMsg = string.Format("({1},{0})", stopInfo.Longitude, stopInfo.Latitude);

            this.textBox1.Text = newMsg;


            //Pushpin pin = new Pushpin();
            //pin.Location = new Location(stopInfo.Longitude, stopInfo.Latitude);
            //theMap.map.Children.Add(pin);
            //theMap.map.Center = new Location(stopInfo.Longitude, stopInfo.Latitude);       //The default is to center on the UIC campus
            //elementHost1.Child = theMap;



            // handicap accessible ?
            if (stopInfo.ADA == 0)
            {
                newMsg = "No";
            }
            else
            {
                newMsg = "Yes";
            }

            this.textBox2.Text = newMsg;
            //direction
            this.textBox3.Text = stopInfo.Direction;

            //detail
            this.textBox7.Text = bt.getDetail(stopInfo.StopID);
        }