/// <summary>
        /// <see cref="MyCompany.Visitors.Client.IVisitorPictureService"/>
        /// </summary>
        /// <param name="visitorPicture"><see cref="MyCompany.Visitors.Client.IVisitorPictureService"/></param>
        /// <returns><see cref="MyCompany.Visitors.Client.IVisitorPictureService"/></returns>
        public async Task Update(VisitorPicture visitorPicture)
        {
            string url = String.Format(CultureInfo.InvariantCulture
                                       , "{0}api/visitorpictures", _urlPrefix);

            await base.PutAsync <VisitorPicture>(url, visitorPicture);
        }
예제 #2
0
        /// <summary>
        /// <see cref="MyCompany.Visitors.Client.IVisitorPictureService"/>
        /// </summary>
        /// <param name="visitorPicture"><see cref="MyCompany.Visitors.Client.IVisitorPictureService"/></param>
        /// <returns><see cref="MyCompany.Visitors.Client.IVisitorPictureService"/></returns>
        public async Task Update(VisitorPicture visitorPicture)
        {
            string url = String.Format(CultureInfo.InvariantCulture
              , "{0}api/visitorpictures", _urlPrefix);

            await base.PutAsync<VisitorPicture>(url, visitorPicture);
        }
        /// <summary>
        /// <see cref="MyCompany.Visitors.Client.IVisitorPictureService"/>
        /// </summary>
        /// <param name="visitorPicture"><see cref="MyCompany.Visitors.Client.IVisitorPictureService"/></param>
        /// <returns><see cref="MyCompany.Visitors.Client.IVisitorPictureService"/></returns>
        public async Task <int> Add(VisitorPicture visitorPicture)
        {
            string url = String.Format(CultureInfo.InvariantCulture
                                       , "{0}api/visitorpictures", _urlPrefix);

            return(await base.PostAsync <int, VisitorPicture>(url, visitorPicture));
        }
예제 #4
0
        /// <summary>
        /// <see cref="MyCompany.Visitors.Client.IVisitorPictureService"/>
        /// </summary>
        /// <param name="visitorPicture"><see cref="MyCompany.Visitors.Client.IVisitorPictureService"/></param>
        /// <returns><see cref="MyCompany.Visitors.Client.IVisitorPictureService"/></returns>
        public async Task<int> Add(VisitorPicture visitorPicture)
        {
            string url = String.Format(CultureInfo.InvariantCulture
              , "{0}api/visitorpictures", _urlPrefix);

            return await base.PostAsync<int, VisitorPicture>(url, visitorPicture);
        }
예제 #5
0
 public void AddPicture(VisitorPicture picture)
 {
     if (visitor.VisitorPictures == null)
     {
         visitor.VisitorPictures = new   Collection <VisitorPicture>();
     }
     HasPhotoshanged = true;
     Visitor.VisitorPictures.Add(picture);
     RaisePropertyChanged(() => VisitorPhoto);
 }
            public EditVisitorView(EditVisitorViewController parent)
            {
                BackgroundColor = UIColor.FromRGB(239, 239, 244);

                image = new UIButton
                {
                    Frame     = new RectangleF(0, 0, 150, 150),
                    TintColor = UIColor.White,
                    Layer     =
                    {
                        CornerRadius  =   75,
                        MasksToBounds = true,
                    }
                };
                image.SetTitle("Change photo", UIControlState.Normal);
                image.ImageView.ContentMode = UIViewContentMode.ScaleAspectFill;;
                image.SetImage(Theme.UserImageDefaultLight.Value, UIControlState.Normal);
                image.TouchUpInside += async(sender, args) =>
                {
                    try
                    {
                        var picker     = new MediaPicker();
                        var controller = picker.GetTakePhotoUI(new StoreCameraMediaOptions
                        {
                            Name      = "test.jpg",
                            Directory = "MediaPickerSample"
                        });

                        parent.PresentViewController(controller, true, null);

                        var result = await controller.GetResultAsync();

                        var     i = UIImage.FromFile(result.Path).ResizeImage(380, 380);
                        NSError error;
                        i.AsJPEG().Save(result.Path, NSDataWritingOptions.FileProtectionNone, out error);

                        Console.WriteLine("Result came back");
                        Console.WriteLine(result);
                        Console.WriteLine(result.Path);

                        var picture = new VisitorPicture
                        {
                            Content     = File.ReadAllBytes(result.Path),
                            PictureType = PictureType.Small,
                        };

                        var picture2 = new VisitorPicture
                        {
                            Content     = File.ReadAllBytes(result.Path),
                            PictureType = PictureType.Big,
                        };

                        image.SetImage(UIImage.FromFile(result.Path) ?? Theme.UserImageDefaultLight.Value, UIControlState.Normal);
                        Visitor.ClearPhotos();
                        Visitor.AddPicture(picture);
                        Visitor.AddPicture(picture2);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex);
                    }
                    finally
                    {
                        parent.DismissViewController(true, null);
                    }
                };

                AddSubview(image);

                dvc = new DialogViewController(new RootElement("Visitor")
                {
                    new Section("Visitor")
                    {
                        (firstName = new EntryElement("First name", "John", "")),
                        (lastName = new EntryElement("Last name", "Apleseed", "")),
                        (idNumber = new EntryElement("Id number", "123456", "")),
                        (email = new EntryElement("Email", "*****@*****.**", "")),
                        (company = new EntryElement("Organization/ Company", "MyCompany", "")),
                        (title = new EntryElement("Proffesional Title", "CEO", ""))
                    }
                })
                {
                    TableView =
                    {
                        SectionHeaderHeight =             0,
                        BackgroundColor     = UIColor.White,
                        Layer               =
                        {
                            CornerRadius  =             5,
                            MasksToBounds = true
                        }
                    }
                };

                this.AddSubview(dvc.View);
                parent.AddChildViewController(dvc);
            }
			public EditVisitorView(EditVisitorViewController parent)
			{
				BackgroundColor = UIColor.FromRGB(239, 239, 244);

				image = new UIButton
				{
					Frame = new RectangleF(0, 0, 150, 150),
					TintColor = UIColor.White,
					Layer =
					{
						CornerRadius = 75,
						MasksToBounds = true,
					}
				};
				image.SetTitle("Change photo", UIControlState.Normal);
				image.ImageView.ContentMode = UIViewContentMode.ScaleAspectFill;;
				image.SetImage(Theme.UserImageDefaultLight.Value,UIControlState.Normal);
				image.TouchUpInside += async (sender, args) =>
				{
					try
					{
						var picker = new MediaPicker();
						var controller = picker.GetTakePhotoUI(new StoreCameraMediaOptions
						{
							Name = "test.jpg",
							Directory = "MediaPickerSample"
						});

						//var popupver = new UIPopoverController(controller);
						//popupver.PresentFromRect(image.Frame,this, UIPopoverArrowDirection.Any, true);
						parent.PresentViewController(controller, true, null);

						var result = await controller.GetResultAsync();
						var i = UIImage.FromFile(result.Path).ResizeImage(380,380);
						NSError error;
						i.AsJPEG().Save(result.Path, NSDataWritingOptions.FileProtectionNone, out error);
						
						Console.WriteLine("Result came back");
						Console.WriteLine(result);
						Console.WriteLine(result.Path);
						
						var picture = new VisitorPicture
						{
							Content = File.ReadAllBytes(result.Path),
							PictureType = PictureType.Small,
						};

						var picture2 = new VisitorPicture
						{
							Content = File.ReadAllBytes(result.Path),
							PictureType = PictureType.Big,
						};

						image.SetImage(UIImage.FromFile(result.Path) ?? Theme.UserImageDefaultLight.Value, UIControlState.Normal);
						Visitor.ClearPhotos();
						Visitor.AddPicture(picture);
						Visitor.AddPicture(picture2);
					}
					catch (Exception ex)
					{
						Console.WriteLine(ex);
					}
					finally
					{
						parent.DismissViewController(true,null);
					}
					
					//popupver.Dismiss(true);

				};

				AddSubview(image);

				dvc = new DialogViewController(new RootElement("Visitor")
				{
					new Section("Visitor")
					{
						(firstName = new EntryElement("First name", "John","")),
						(lastName = new EntryElement("Last name","Apleseed","")),
						(idNumber = new EntryElement("Id number","123456","")),
						(email = new EntryElement("Email", "*****@*****.**","")),
						(company = new EntryElement("Organization/ Company","MyCompany","")),
						(title = new EntryElement("Proffesional Title","CEO",""))
					}
				})
				{
					TableView =
					{
						SectionHeaderHeight = 0,
						BackgroundColor = UIColor.White,
						Layer =
						{
							CornerRadius = 5,
							MasksToBounds = true
						}
					}
				};
				
				this.AddSubview(dvc.View);
				parent.AddChildViewController(dvc);
			}
예제 #8
0
		public void AddPicture(VisitorPicture picture)
		{
			if(visitor.VisitorPictures == null)
				visitor.VisitorPictures = new	Collection<VisitorPicture>();
			HasPhotoshanged = true;
			Visitor.VisitorPictures.Add(picture);
			RaisePropertyChanged(() => VisitorPhoto);
		}