Beispiel #1
0
 async void DisplaySearchResults()
 {
     try {
         Task <string> getSearchJson = Utilities.GetSearchJson("event", EventsNavSearchBar.Text);
         var           searchItems   = JsonConvert.DeserializeObject <List <Game> >(await getSearchJson);
         parsedEventsJson = new Dictionary <string, List <Game> >();
         parsedEventsJson.Add("Found " + searchItems.Count() + " Result(s)", searchItems);
         TableView.Source = new EventTableSource(parsedEventsJson);
         TableView.Hidden = false;
         if (IsViewLoaded && View.Window != null && EventsNavSearchBar.Alpha.Equals(1))
         {
             TableView.ReloadData();
             UIView.AnimateNotify(0.4, 0, 0.65f, 0f, UIViewAnimationOptions.CurveEaseIn, delegate {
                 EventsNavCloseBtn.Transform             = Utilities.Show;
                 EventsNavSearchLoadingSpinner.Transform = Utilities.Hide;
                 TableView.Alpha = 1;
             }, delegate { EventsNavSearchLoadingSpinner.StopAnimating(); });
         }
     }
     catch {
         UIAlertView alert = new UIAlertView("Error", "Problem connecting.\n" +
                                             "Please check your connection and try again.", null, "OK", null);
         alert.Show();
         EventsNavCloseBtn.Transform = Utilities.Show;
         EventsNavSearchLoadingSpinner.StopAnimating();
     }
 }
Beispiel #2
0
 public override void ViewDidDisappear(bool animated)
 {
     base.ViewDidDisappear(animated);
     TableView.Alpha = 1;
     EventsNavSearchBtn.Transform = Utilities.Show;
     EventsTitleLbl.Transform     = Utilities.Show;
     EventsNavCloseBtn.Hidden     = true;
     EventsNavSearchBar.Hidden    = true;
     EventsNavSearchLoadingSpinner.StopAnimating();
 }
Beispiel #3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            EventsNavSearchBtn.TouchUpInside += delegate {
                EventsNavCloseBtn.Transform  = Utilities.Hide;
                EventsNavSearchBar.Transform = Utilities.Hide;
                EventsNavCloseBtn.Hidden     = false;
                EventsNavSearchBar.Hidden    = false;
                EventsNavSearchBar.BecomeFirstResponder();
                UIView.AnimateNotify(0.4, 0, 0.65f, 0.0f, UIViewAnimationOptions.CurveEaseIn, delegate {
                    EventsNavSearchBtn.Transform = Utilities.Hide;
                    EventsTitleLbl.Transform     = Utilities.Hide;

                    TableView.Alpha = 0;

                    EventsNavCloseBtn.Transform  = Utilities.Show;
                    EventsNavSearchBar.Transform = Utilities.Show;
                }, null);
            };

            EventsNavSearchBar.SearchButtonClicked += delegate {
                EventsNavSearchBar.ResignFirstResponder();
                EventsNavSearchLoadingSpinner.Transform = Utilities.Hide;
                UIView.AnimateNotify(0.4, 0, 0.65f, 0f, UIViewAnimationOptions.CurveEaseIn, delegate {
                    EventsNavSearchLoadingSpinner.StartAnimating();
                    EventsNavCloseBtn.Transform             = Utilities.Hide;
                    EventsNavSearchLoadingSpinner.Transform = Utilities.Show;
                }, null);

                DisplaySearchResults();
            };

            EventsNavCloseBtn.TouchUpInside += delegate {
                UIView.AnimateNotify(0.4, 0, 0.65f, 0f, UIViewAnimationOptions.CurveEaseIn, delegate {
                    EventsNavSearchBtn.Transform = Utilities.Show;
                    EventsTitleLbl.Transform     = Utilities.Show;
                    TableView.Alpha = 1;

                    EventsNavCloseBtn.Transform  = Utilities.Hide;
                    EventsNavSearchBar.Transform = Utilities.Hide;
                    EventsNavSearchBar.ResignFirstResponder();
                }, delegate {
                    EventsNavCloseBtn.Hidden  = true;
                    EventsNavSearchBar.Hidden = true;
                    RefreshTable();
                });
            };

            RefreshControl               = new UIRefreshControl();
            RefreshControl.TintColor     = UIColor.FromRGB(144, 199, 62);
            RefreshControl.ValueChanged += delegate {
                GetJson(true);
            };

            foreach (var subView in EventsNavSearchBar.Subviews)
            {
                foreach (var subView2nd in subView.Subviews)
                {
                    if (subView2nd.GetType() == typeof(UITextField))
                    {
                        UITextField searchField = (UITextField)subView2nd;
                        searchField.Font = UIFont.FromName("GillSans", 13);
                    }
                }
            }
        }
Beispiel #4
0
        void ReleaseDesignerOutlets()
        {
            if (LoadingErrorImg != null)
            {
                LoadingErrorImg.Dispose();
                LoadingErrorImg = null;
            }

            if (EventsNavSearchLoadingSpinner != null)
            {
                EventsNavSearchLoadingSpinner.Dispose();
                EventsNavSearchLoadingSpinner = null;
            }

            if (EventsTitleLbl != null)
            {
                EventsTitleLbl.Dispose();
                EventsTitleLbl = null;
            }

            if (EventsNavSearchBar != null)
            {
                EventsNavSearchBar.Dispose();
                EventsNavSearchBar = null;
            }

            if (HomeNavSearchBtn != null)
            {
                HomeNavSearchBtn.Dispose();
                HomeNavSearchBtn = null;
            }

            if (EventsNavSearchBtn != null)
            {
                EventsNavSearchBtn.Dispose();
                EventsNavSearchBtn = null;
            }

            if (EventsNavCloseBtn != null)
            {
                EventsNavCloseBtn.Dispose();
                EventsNavCloseBtn = null;
            }

            if (LoadingView != null)
            {
                LoadingView.Dispose();
                LoadingView = null;
            }

            if (LoadingText != null)
            {
                LoadingText.Dispose();
                LoadingText = null;
            }

            if (LoadingSpinner != null)
            {
                LoadingSpinner.Dispose();
                LoadingSpinner = null;
            }
        }