public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); if (ViewModel == null) { ViewModel = new DetailsViewModel(); NavigationItem.RightBarButtonItem = save; } else { this.Title = ViewModel.FirstName; TextEmail.Text = ViewModel.Email; TextFirst.Text = ViewModel.FirstName; TextLast.Text = ViewModel.LastName; TextPhone.Text = ViewModel.Phone; ImagePhoto.SetImage( url: new NSUrl(Gravatar.GetURL(ViewModel.Contact.EmailAddresses[0].Address, 172)), placeholder: UIImage.FromBundle("missing.png") ); NavigationItem.RightBarButtonItem = null; } }
private async void ToDetailPage(ImagePhoto imageToDetail) { var parameter = new NavigationParameters(); parameter.Add("ImageToDetail", imageToDetail); await _navigationService.NavigateAsync(new Uri(NavigationConstants.Detail, UriKind.Relative), parameter); }
public override void ViewDidLoad() { base.ViewDidLoad(); NavigationController.NavigationBar.BarStyle = UIBarStyle.Black; save = new UIBarButtonItem(UIBarButtonSystemItem.Save, async(sender, args) => { ViewModel.FirstName = TextFirst.Text.Trim(); ViewModel.LastName = TextLast.Text.Trim(); ViewModel.Email = TextEmail.Text.Trim(); ViewModel.Phone = TextPhone.Text.Trim(); BigTed.BTProgressHUD.Show("Saving contact..."); await ViewModel.SaveContact(); BigTed.BTProgressHUD.Dismiss(); NavigationController.PopToRootViewController(true); }); TextEmail.ShouldReturn += ShouldReturn; TextFirst.ShouldReturn += ShouldReturn; TextPhone.ShouldReturn += ShouldReturn; TextLast.ShouldReturn += ShouldReturn; TextEmail.ValueChanged += (sender, args) => { ImagePhoto.SetImage( url: new NSUrl(Gravatar.GetURL(TextEmail.Text, 172)), placeholder: UIImage.FromBundle("missing.png") ); }; var color = new CGColor(17.0F / 255.0F, 113.0F / 255.0F, 197.0F / 255F); TextEmail.Layer.BorderColor = color; TextFirst.Layer.BorderColor = color; TextPhone.Layer.BorderColor = color; TextLast.Layer.BorderColor = color; ButtonCall.Clicked += (sender, args) => PlaceCall(); NSNotificationCenter.DefaultCenter.AddObserver (UIKeyboard.DidShowNotification, KeyBoardUpNotification); // Keyboard Down NSNotificationCenter.DefaultCenter.AddObserver (UIKeyboard.WillHideNotification, KeyBoardDownNotification); double min = Math.Min((float)ImagePhoto.Frame.Width, (float)ImagePhoto.Frame.Height); ImagePhoto.Layer.CornerRadius = (float)(min / 2.0); ImagePhoto.Layer.MasksToBounds = false; ImagePhoto.Layer.BorderColor = new CGColor(1, 1, 1); ImagePhoto.Layer.BorderWidth = 3; ImagePhoto.ClipsToBounds = true; }
void ReleaseDesignerOutlets() { if (ImagePhoto != null) { ImagePhoto.Dispose(); ImagePhoto = null; } if (PhotoButton != null) { PhotoButton.Dispose(); PhotoButton = null; } }
private void drawCropRect() { Point startPoint = cropStartPoint; Point endPoint = cropEndPoint; startPoint = ImagePhoto.PointToScreen(startPoint); endPoint = ImagePhoto.PointToScreen(endPoint); startPoint = CanvasCropRect.PointFromScreen(startPoint); endPoint = CanvasCropRect.PointFromScreen(endPoint); Canvas.SetLeft(RectangleCropArea, Math.Min(startPoint.X, endPoint.X)); Canvas.SetTop(RectangleCropArea, Math.Min(startPoint.Y, endPoint.Y)); RectangleCropArea.Width = Math.Abs(endPoint.X - startPoint.X); RectangleCropArea.Height = Math.Abs(endPoint.Y - startPoint.Y); }
void ReleaseDesignerOutlets() { if (ButtonAddEvent != null) { ButtonAddEvent.Dispose(); ButtonAddEvent = null; } if (ButtonCall != null) { ButtonCall.Dispose(); ButtonCall = null; } if (ButtonEmail != null) { ButtonEmail.Dispose(); ButtonEmail = null; } if (ImagePhoto != null) { ImagePhoto.Dispose(); ImagePhoto = null; } if (TextEmail != null) { TextEmail.Dispose(); TextEmail = null; } if (TextFirst != null) { TextFirst.Dispose(); TextFirst = null; } if (TextLast != null) { TextLast.Dispose(); TextLast = null; } if (TextPhone != null) { TextPhone.Dispose(); TextPhone = null; } }
void ReleaseDesignerOutlets() { if (LabelName != null) { LabelName.Dispose(); LabelName = null; } if (ImageCheckedIn != null) { ImageCheckedIn.Dispose(); ImageCheckedIn = null; } if (ImagePhoto != null) { ImagePhoto.Dispose(); ImagePhoto = null; } }