void ReleaseDesignerOutlets()
        {
            if (WebToolBarRefreshBtn != null)
            {
                WebToolBarRefreshBtn.Dispose();
                WebToolBarRefreshBtn = null;
            }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            if (RefreshBtn != null)
            {
                RefreshBtn.Dispose();
                RefreshBtn = null;
            }
        }
예제 #2
0
 void LoadFinished()
 {
     WebLoadingSpinner.StopAnimating();
     WebShowSocialNetworksBtn.Alpha = 1;
     isLoaded = true;
 }
예제 #3
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);
            AVAudioSession audioSession = AVAudioSession.SharedInstance();

            audioSession.Init();
            //audioSession.Category = AVAudioSession.CategoryPlayback;
            audioSession.SetActive(true, new NSError());
            //MonoTouch.AudioToolbox.AudioSession.Initialize ();

            WebLoadingSpinner.StopAnimating();
            NavigationItem.HidesBackButton = true;
            WebTitle.Text = _title;

            WebView.ScalesPageToFit = true;

            switch (_title)
            {
            case "Website":
                _url = _game.game_url;
                LoadWebUrl(_game.game_url);
                break;

            case "Trailer":
                _url = _game.trailer_url;
                LoadWebUrl(_game.trailer_url);
                break;

            case "Order":
                if (_game.order_links.Count == 1)
                {
                    _url = _game.order_links[0].order_url;
                    LoadWebUrl(_url);
                }
                else
                {
                    actionSheet = new UIActionSheet("Choose a platform");
                    foreach (var link in _game.order_links)
                    {
                        actionSheet.AddButton(link.platform);
                    }

                    actionSheet.AddButton("Cancel");
                    actionSheet.CancelButtonIndex = _game.order_links.Count;
                    actionSheet.ShowInView(ParentViewController.View);

                    actionSheet.Clicked += delegate(object a, UIButtonEventArgs b) {
                        if (b.ButtonIndex == actionSheet.CancelButtonIndex)
                        {
                            this.DismissViewController(true, null);
                            this.NavigationController.PopViewControllerAnimated(true);
                        }
                        else
                        {
                            _url = _game.order_links[b.ButtonIndex].order_url;
                            LoadWebUrl(_url);
                        }
                    };
                }
                break;
            }
        }
예제 #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            NavBackBtn.TouchUpInside += delegate {
                this.NavigationController.PopViewControllerAnimated(true);
            };

            WebShowSocialNetworksBtn.TouchUpInside += delegate {
                WebNavCloseBtn.Transform = CGAffineTransform.MakeScale(0f, 0f);
                WebTweetBtn.Transform    = CGAffineTransform.MakeScale(0f, 0f);
                WebPostBtn.Transform     = CGAffineTransform.MakeScale(0f, 0f);
                WebNavCloseBtn.Hidden    = false;
                WebTweetBtn.Hidden       = false;
                WebPostBtn.Hidden        = false;
                UIView.AnimateNotify(0.4, 0, 0.65f, 0.0f, UIViewAnimationOptions.CurveEaseIn, delegate {
                    WebTitle.Transform = CGAffineTransform.MakeScale(0f, 0f);
                    WebShowSocialNetworksBtn.Transform = CGAffineTransform.MakeScale(0f, 0f);
                    NavBackBtn.Transform = CGAffineTransform.MakeScale(0f, 0f);

                    WebNavCloseBtn.Transform = CGAffineTransform.MakeScale(1f, 1f);
                    WebTweetBtn.Transform    = CGAffineTransform.MakeScale(1f, 1f);
                    WebPostBtn.Transform     = CGAffineTransform.MakeScale(1f, 1f);
                }, null);
            };

            WebNavCloseBtn.TouchUpInside += delegate {
                UIView.AnimateNotify(0.4, 0, 0.65f, 0.0f, UIViewAnimationOptions.CurveEaseIn, delegate {
                    WebNavCloseBtn.Transform = CGAffineTransform.MakeScale(0f, 0f);
                    WebTweetBtn.Transform    = CGAffineTransform.MakeScale(0f, 0f);
                    WebPostBtn.Transform     = CGAffineTransform.MakeScale(0f, 0f);

                    WebTitle.Transform = CGAffineTransform.MakeScale(1f, 1f);
                    WebShowSocialNetworksBtn.Transform = CGAffineTransform.MakeScale(1f, 1f);
                    NavBackBtn.Transform = CGAffineTransform.MakeScale(1f, 1f);
                }, null);
            };

            WebTweetBtn.TouchUpInside += delegate {
                slComposer = SLComposeViewController.FromService(SLServiceType.Twitter);
                slComposer.AddUrl(new NSUrl(_url));

                slComposer.CompletionHandler += (result) => {
                    slComposer.DismissViewController(true, null);
                };
                PresentViewController(slComposer, true, null);
            };

            WebPostBtn.TouchUpInside += delegate {
                slComposer = SLComposeViewController.FromService(SLServiceType.Facebook);
                slComposer.AddUrl(new NSUrl(_url));

                slComposer.CompletionHandler += (result) => {
                    slComposer.DismissViewController(true, null);
                };
                PresentViewController(slComposer, true, null);
            };

            WebBackBtn.TouchUpInside += delegate {
                WebView.GoBack();
            };

            WebForwardBtn.TouchUpInside += delegate {
                WebView.GoForward();
            };

            WebToolBarRefreshBtn.TouchUpInside += delegate {
                if (WebTweetBtn.Hidden == false)
                {
                    UIView.AnimateNotify(0.4, 0, 0.65f, 0f, UIViewAnimationOptions.CurveEaseIn, delegate {
                        WebNavCloseBtn.Transform    = CGAffineTransform.MakeScale(0f, 0f);
                        WebTweetBtn.Transform       = CGAffineTransform.MakeScale(0f, 0f);
                        WebPostBtn.Transform        = CGAffineTransform.MakeScale(0f, 0f);
                        WebTitle.Transform          = CGAffineTransform.MakeScale(1f, 1f);
                        NavBackBtn.Transform        = CGAffineTransform.MakeScale(1f, 1f);
                        WebLoadingSpinner.Transform = CGAffineTransform.MakeScale(1f, 1f);
                        WebLoadingSpinner.StartAnimating();
                    }, null);
                }
                else
                {
                    UIView.AnimateNotify(0.4, 0, 0.65f, 0f, UIViewAnimationOptions.CurveEaseIn, delegate {
                        WebShowSocialNetworksBtn.Transform = CGAffineTransform.MakeScale(0f, 0f);
                        WebLoadingSpinner.Transform        = CGAffineTransform.MakeScale(1f, 1f);
                        WebLoadingSpinner.StartAnimating();
                    }, null);
                }

                WebView.Reload();
                if (!isLoaded)
                {
                    LoadWebUrl(_url);
                }
            };

            WebView.LoadStarted += delegate {
                if (WebTweetBtn.Hidden == false)
                {
                    UIView.AnimateNotify(0.4, 0, 0.65f, 0f, UIViewAnimationOptions.CurveEaseIn, delegate {
                        WebNavCloseBtn.Transform    = CGAffineTransform.MakeScale(0f, 0f);
                        WebTweetBtn.Transform       = CGAffineTransform.MakeScale(0f, 0f);
                        WebPostBtn.Transform        = CGAffineTransform.MakeScale(0f, 0f);
                        WebTitle.Transform          = CGAffineTransform.MakeScale(1f, 1f);
                        NavBackBtn.Transform        = CGAffineTransform.MakeScale(1f, 1f);
                        WebLoadingSpinner.Transform = CGAffineTransform.MakeScale(1f, 1f);
                        WebLoadingSpinner.StartAnimating();
                    }, null);
                }
                else
                {
                    UIView.AnimateNotify(0.4, 0, 0.65f, 0f, UIViewAnimationOptions.CurveEaseIn, delegate {
                        WebShowSocialNetworksBtn.Transform = CGAffineTransform.MakeScale(0f, 0f);
                        WebLoadingSpinner.Transform        = CGAffineTransform.MakeScale(1f, 1f);
                        WebLoadingSpinner.StartAnimating();
                    }, null);
                }
            };

            WebView.LoadFinished += delegate {
                WebShowSocialNetworksBtn.Hidden    = false;
                WebShowSocialNetworksBtn.Transform = CGAffineTransform.MakeScale(0f, 0f);
                UIView.AnimateNotify(0.4, 0, 0.65f, 0f, UIViewAnimationOptions.CurveEaseIn, delegate {
                    WebShowSocialNetworksBtn.Transform = CGAffineTransform.MakeScale(1f, 1f);
                    WebLoadingSpinner.Transform        = CGAffineTransform.MakeScale(0f, 0f);
                }, delegate {
                    WebLoadingSpinner.StopAnimating();
                    isLoaded = true;
                });
            };

            WebView.LoadError += delegate(object sender, UIWebErrorArgs e) {
                if (!e.Error.ToString().Contains("NSURLErrorDomain"))
                {
                    WebLoadingSpinner.StopAnimating();
                    WebShowSocialNetworksBtn.Alpha = 1;
                    UIAlertView alert = new UIAlertView("Error", "Problem connecting.\n" +
                                                        "Please check your connection and try again.", null, "OK", null);
                    alert.Show();
                }
            };
        }