Ejemplo n.º 1
0
        private static bool OpenContextualMenu(SearchSelection selection, Rect contextRect)
        {
            var old = Selection.instanceIDs;

            SearchUtils.SelectMultipleItems(selection);
            EditorUtility.DisplayPopupMenu(contextRect, "Assets/", null);
            EditorApplication.delayCall += () => EditorApplication.delayCall += () => Selection.instanceIDs = old;
            return(true);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            searchButton.Enabled = false;
            // Perform any additional setup after loading the view, typically from a nib.
            segmentControl.ValueChanged += (sender, e) => {
                var selectedSegmentId = (sender as UISegmentedControl).SelectedSegment;
                switch (selectedSegmentId)
                {
                case 0:
                    selectedItem = SearchSelection.Topic;
                    searchResultViewController = null;
                    break;

                case 1:
                    selectedItem = SearchSelection.Date;
                    searchResultViewController = null;
                    break;

                case 2:
                    selectedItem = SearchSelection.Location;
                    break;

                case 3:
                    selectedItem = SearchSelection.Tutor;
                    break;
                }

                searchBar.Text       = "";
                searchButton.Enabled = false;

                resultTableView.Source = null;
                resultTableView.ReloadData();
            };

            searchBar.TextChanged += (s, e) => {
                if (searchBar.Text.Equals(""))
                {
                    searchButton.Enabled = false;
                }

                if (selectedItem == SearchSelection.Date)
                {
                    //this.NavigationController.PushViewController (pinkViewController, true);
                    if (dateVC == null)
                    {
                        dateVC = (DateViewController)AppDelegate.Storyboard.InstantiateViewController("DateViewController");
                    }
                    //AppDelegate.mainTabbarController.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;
                    this.PresentViewController(dateVC, true, null);
                }

                if (!searchBar.Text.Equals(""))
                {
                    searchButton.Enabled = true;
                }
            };

//			searchBar.Sho += (s, e) => {
//				if(!searchBar.Text.Equals(""))
//				searchButton.Enabled = true;
//			};


            searchButton.Clicked += (o, e) => {
                Console.WriteLine("searchBar: " + searchBar.Text);

                if (selectedItem == SearchSelection.Topic)
                {
                    this.searchByTopic();
                }
                else if (selectedItem == SearchSelection.Date)
                {
                    this.searchByDate();
                }
                else if (selectedItem == SearchSelection.Location)
                {
                    this.searchByLocation();
                }
                else if (selectedItem == SearchSelection.Tutor)
                {
                    this.searchByLecturer();
                }
            };
        }