private void LoadPage(int index)
        {
            if (index < 0 || index >= this.pageControl.Pages)
            {
                // If it's outside the range of what you have to display, then do nothing
                return;
            }

            UIImageView pageView;

            if (this.pages.ContainsKey(index))
            {
                pageView = this.pages [index];
            }
            else
            {
                var        myFrame = this.scrollView.Frame;
                RectangleF frame   = new RectangleF(myFrame.Width * index, 0, myFrame.Width, myFrame.Height);
                pageView             = new UIImageView(frame);
                pageView.ContentMode = UIViewContentMode.ScaleAspectFit;

                var imageItem = this.viewModel.MyBuddyPictures [index];
                IOSUtilities.SetImageFromStream(PopPicImageCache.GetPhotoAlbumImage(0, imageItem.PhotoID, imageItem.FullUrl),
                                                pageView,
                                                this);

                this.scrollView.AddSubview(pageView);
            }

            this.pages [index] = pageView;
        }
Ejemplo n.º 2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            Debug.Assert(this.viewModel.IsInitialized);

            // Add all of the child items
            var localRoot = new RootElement(this.viewModel.PageTitle);

            localRoot.UnevenRows = true;
            var topSection = new Section();

            localRoot.Add(topSection);

            foreach (var user in this.viewModel.Friends)
            {
                UIImage image   = UIImage.FromBundle("unknownUserImage_50.png");
                var     element = new CreateGamePlayerCell(image, user.Name, "", () => {
                    IOSUtilities.ShowSetupGameScreen(user, this.NavigationController, this);
                });
                element.ImageDownloadTask = PopPicImageCache.GetUserProfileImage(user.UserId, user.ProfilePictureUri.ToString());

                topSection.Add(element);
            }

            this.Root = localRoot;
        }
Ejemplo n.º 3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            UIApplication.SharedApplication.StatusBarHidden = true;

            // this.ControlsOverlay.Frame = this.View.Frame;
            // this.ControlsOverlay.SetNeedsDisplay ();
            InitializeCameraLayer();

            // Next set up our UI
            this.FinishRoundButton.TouchUpInside += (sender, e) => {
            };

            this.PlayerOneViewContainer.Layer.BorderColor  = this.PlayerTwoViewContainer.Layer.BorderColor = new CGColor(0, 0, 0);
            this.PlayerOneViewContainer.Layer.BorderWidth  = this.PlayerTwoViewContainer.Layer.BorderWidth = 3;
            this.PlayerOneViewContainer.Layer.CornerRadius = this.PlayerTwoViewContainer.Layer.CornerRadius = 5;



            this.gameplayView = new GameplayView(this.ControlsOverlay.Frame, this.viewModel);

            // gameplayView.SetImages (backgroundImage, balloonImage);
            gameplayView.BalloonPopped += HandleBalloonPopped;

            this.View.InsertSubview(gameplayView, 0);
            this.View.UserInteractionEnabled = true;

            if (this.viewModel != null)
            {
                // Go through and set up all of the UI!
                this.PlayerOneTimeElapsed.Text     = viewModel.PlayerTime1;
                this.PlayerOnePlayerNameLabel.Text = viewModel.PlayerName1;
                IOSUtilities.SetImageFromStream(PopPicImageCache.GetUserProfileImage(
                                                    this.viewModel.model.GameRequesterId,
                                                    this.viewModel.PlayerProfileImage1),
                                                this.PlayerOneProfilePictureImage,
                                                this);


                this.PlayerTwoTimeElapsed.Text     = viewModel.PlayerTime2;
                this.PlayerTwoPlayerNameLabel.Text = viewModel.PlayerName2;
                IOSUtilities.SetImageFromStream(PopPicImageCache.GetUserProfileImage(
                                                    this.viewModel.model.GameResponderId,
                                                    this.viewModel.PlayerProfileImage2),
                                                this.PlayerTwoProfilePictureImage,
                                                this);

                this.viewModel.Tick += (object sender, bool e) => {
                    InvokeOnMainThread(() => {
                        this.PlayerOneTimeElapsed.Text = viewModel.PlayerTime1;
                        this.PlayerTwoTimeElapsed.Text = viewModel.PlayerTime2;
                    });
                };

                this.timer = NSTimer.CreateRepeatingScheduledTimer(TimeSpan.FromMilliseconds(40), delegate {
                    this.viewModel.TickExternal();
                });
            }
        }
Ejemplo n.º 4
0
        public void SetData(GameViewModel viewModel)
        {
            webClient.CancelAsync();
            this.viewModel             = viewModel;
            this.UserNameLabel.Text    = this.viewModel.OpponentName;
            this.LastMoveLabel.Text    = this.viewModel.PreviousActionTimeStamp;
            this.TimeElapsedLabel.Text = this.viewModel.PreviousActionDescription;

            IOSUtilities.SetImageFromStream(PopPicImageCache.GetUserProfileImage(
                                                this.viewModel.Opponent.ID,
                                                this.viewModel.Opponent.ProfilePicture.ToString(),
                                                TimeSpan.FromMinutes(5)),
                                            this.UserProfileImage,
                                            this);
        }
Ejemplo n.º 5
0
        public void SetCellData(Buddy.PicturePublic imageData)
        {
            taskCancelled = false;

            var downloadTask = PopPicImageCache.GetPhotoAlbumImage(0, imageData.PhotoID, imageData.FullUrl).ContinueWith(t => {
                if (!t.IsFaulted && t.Result != null && !taskCancelled)
                {
                    return(t.Result);
                }
                else
                {
                    return(null);
                }
            });

            IOSUtilities.SetImageFromStream(downloadTask,
                                            this.imageView,
                                            this);
        }