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

            ReleasesSearchBtn.Hidden = false;
            SetReleaseTypeButtonDisplay();
            ReleasesInStoresBtn.Hidden       = false;
            ReleasesUpcomingBtn.Hidden       = false;
            TableView.Alpha                  = 1;
            ReleasesNavCloseSearchBtn.Hidden = true;
            ReleasesSearchBar.Hidden         = true;
            ReleasesSearchBtn.Transform      = Utilities.Show;
            ReleasesNavSearchLoadingSpinner.StopAnimating();
        }
Ejemplo n.º 3
0
        void ReleaseDesignerOutlets()
        {
            if (LoadingSpinner != null)
            {
                LoadingSpinner.Dispose();
                LoadingSpinner = null;
            }

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

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

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

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

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

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

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

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

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

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

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

            if (LoadingView != null)
            {
                LoadingView.Dispose();
                LoadingView = null;
            }
        }
Ejemplo n.º 4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            ReleasesSearchBtn.TouchUpInside += delegate {
                ReleasesNavCloseSearchBtn.Transform = Utilities.Hide;
                ReleasesSearchBar.Transform         = Utilities.Hide;
                ReleasesNavCloseSearchBtn.Hidden    = false;
                ReleasesSearchBar.Hidden            = false;
                ReleasesSearchBar.BecomeFirstResponder();
                UIView.AnimateNotify(0.4, 0, 0.65f, 0.0f, UIViewAnimationOptions.CurveEaseIn, delegate {
                    ReleasesSearchBtn.Transform   = Utilities.Hide;
                    ReleasesInStoresBtn.Transform = Utilities.Hide;
                    ReleasesUpcomingBtn.Transform = Utilities.Hide;
                    TableView.Alpha = 0;

                    ReleasesNavCloseSearchBtn.Transform = Utilities.Show;
                    ReleasesSearchBar.Transform         = Utilities.Show;
                }, null);
            };

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

                DisplaySearchResults();
            };

            ReleasesNavCloseSearchBtn.TouchUpInside += delegate {
                UIView.AnimateNotify(0.4, 0, 0.65f, 0.0f, UIViewAnimationOptions.CurveEaseIn, delegate {
                    ReleasesSearchBtn.Transform = Utilities.Show;
                    SetReleaseTypeButtonDisplay();
                    TableView.Alpha = 1;
                    ReleasesNavCloseSearchBtn.Transform = Utilities.Hide;
                    ReleasesSearchBar.Transform         = Utilities.Hide;
                    ReleasesSearchBar.ResignFirstResponder();
                }, delegate {
                    ReleasesNavCloseSearchBtn.Hidden = true;
                    ReleasesSearchBar.Hidden         = true;
                    RefreshTable();
                });
            };

            ReleasesInStoresBtn.TouchUpInside += delegate {
                selectedSegmentBtn = 0;
                TableView.Source   = null;
                TableView.ReloadData();
                GetJson();
                UIView.AnimateNotify(0.2, 0, 0.65f, 0.0f, UIViewAnimationOptions.CurveEaseIn, delegate {
                    SetReleaseTypeButtonDisplay();
                }, null);
            };

            ReleasesUpcomingBtn.TouchUpInside += delegate {
                selectedSegmentBtn = 1;
                TableView.Source   = null;
                TableView.ReloadData();
                GetJson();
                UIView.AnimateNotify(0.2, 0, 0.65f, 0.0f, UIViewAnimationOptions.CurveEaseIn, delegate {
                    SetReleaseTypeButtonDisplay();
                }, null);
            };

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

            foreach (var subView in ReleasesSearchBar.Subviews)
            {
                foreach (var subView2nd in subView.Subviews)
                {
                    if (subView2nd.GetType() == typeof(UITextField))
                    {
                        UITextField searchField = (UITextField)subView2nd;
                        searchField.Font = UIFont.FromName("GillSans", 13);
                    }
                }
            }
        }