Пример #1
0
            //            private void SelectedElement (nint index)
            public void SelectedElement(nint index)
            {
                this.selectedIndex = (int)index;
                string selectedElement = this.matchedElements [(int)this.selectedIndex];
                this.textField.Text = selectedElement;
                this.autoCompleteTableView.Hidden = true;
                runAsyncMethod = true;

                // check and see if elementsCopy has been used, if not copy the elements to it
                if (elementsCopy == null)
                {
                    elementsCopy = new List<string> (elements);
                }

                if (elementsCopy.Count == elements.Count)
                {
                    // hold removed element in placeholder
                    tempElementCopy = selectedElement;
                    // remove element so user can't select in other option
                    this.elements.Remove (selectedElement);
                    // set bool equal to true
                    runAsyncMethod = false;
                }

                if (selectedElement == "Your Location")
                {
                    CLLocationManager lm = new CLLocationManager();
                    string getLongitude = lm.Location.Coordinate.Longitude.ToString();
                    string getLatitude = lm.Location.Coordinate.Latitude.ToString();

                    // TODO send coordinate into the async method and call the bart API to find the nearest train station
                }

                // this fires off the search event if both an origin and destination are selected
                if (elements.Count < elementsCopy.Count && runAsyncMethod == true)
                {
                    getXMLViewController getXml = new getXMLViewController ();
                    string determineIfOriginOrDest = this.textField.Placeholder;
                    getXml.getResultAsync (this.textField.Text, tempElementCopy, determineIfOriginOrDest, elements, stationAbbrs);
                    this.elements.Add (tempElementCopy);
                }
            }
Пример #2
0
		partial void xmlButtonPress (NSObject sender)
		{
			getXMLViewController vc = new getXMLViewController();
			NavigationController.PushViewController(vc, false);
		}
Пример #3
0
 public TableSource(string[] items, getXMLViewController owner)
 {
     tableItems = items;
     this.owner = owner;
 }