コード例 #1
0
 public void SetWithRestaurant(RestaurantMO restaurantMO)
 {
     _restaurantMO            = restaurantMO;
     ThumbnailImageView.Image = _restaurantMO.GetImage();
     NameLabel.Text           = _restaurantMO.Name;
     NameLabel.Lines          = 0;
     TypeLabel.Text           = _restaurantMO.Type;
     TypeLabel.Lines          = 0;
     LocationLabel.Text       = _restaurantMO.Location;
     LocationLabel.Lines      = 0;
 }
コード例 #2
0
        private void CustomizeBackgroundImage()
        {
            BackgroundImageView.Image = RestaurantMO.GetImage();
            var blurEffect     = UIBlurEffect.FromStyle(UIBlurEffectStyle.Light);
            var blurEffectView = new UIVisualEffectView(blurEffect);

            blurEffectView.Frame = View.Bounds;
            BackgroundImageView.AddSubview(blurEffectView);

            blurEffectView.TranslatesAutoresizingMaskIntoConstraints = false;
            blurEffectView.TopAnchor.ConstraintEqualTo(BackgroundImageView.TopAnchor).Active       = true;
            blurEffectView.BottomAnchor.ConstraintEqualTo(BackgroundImageView.BottomAnchor).Active = true;
            blurEffectView.LeftAnchor.ConstraintEqualTo(BackgroundImageView.LeftAnchor).Active     = true;
            blurEffectView.RightAnchor.ConstraintEqualTo(BackgroundImageView.RightAnchor).Active   = true;
        }
コード例 #3
0
        public static NSObject[] GetActivityItems(this RestaurantMO restaurantMO)
        {
            var defaultText   = AppResources.CheckInWarning + restaurantMO.Name;
            var activityItems = new NSObject[] { };
            var imageToLoad   = restaurantMO.GetImage();

            if (imageToLoad != null)
            {
                activityItems = new NSObject[] { (new NSString(defaultText)), imageToLoad };
            }
            else
            {
                activityItems = new NSObject[] { (new NSString(defaultText)) };
            }

            return(activityItems);
        }
コード例 #4
0
        private void AddingPhotoToNotification(RestaurantMO restaurantMO, UNMutableNotificationContent content)
        {
            var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            var suggestedRestaurantImage = Path.Combine(documents, "suggested-restaurant.jpg");

            var image = restaurantMO.GetImage();

            if (image != null)
            {
                try
                {
                    NSError err = null;
                    image.AsJPEG(1)?.Save(suggestedRestaurantImage, false, out err);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }

                try
                {
                    NSError error;
                    UNNotificationAttachmentOptions attachmentOptions = new UNNotificationAttachmentOptions();
                    var finalImage      = "file:///" + suggestedRestaurantImage;
                    var restaurantImage = UNNotificationAttachment.FromIdentifier("restaurantImage", new NSUrl(finalImage), attachmentOptions, out error);
                    if (restaurantImage != null)
                    {
                        content.Attachments = new[] { restaurantImage };
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
        }