Ejemplo n.º 1
0
		private void attach_Photos(Photo entity)
		{
			this.SendPropertyChanging();
			entity.Date = this;
		}
Ejemplo n.º 2
0
		private void detach_Photos(Photo entity)
		{
			this.SendPropertyChanging();
			entity.Date = null;
		}
Ejemplo n.º 3
0
 partial void DeletePhoto(Photo instance);
Ejemplo n.º 4
0
 partial void UpdatePhoto(Photo instance);
Ejemplo n.º 5
0
 partial void InsertPhoto(Photo instance);
Ejemplo n.º 6
0
        private void photoChooserTask_Completed(object sender, PhotoResult e)
        {
            if (e.TaskResult == TaskResult.OK)
            {
                byte[] imageBytes = new byte[e.ChosenPhoto.Length];

                Guid guid = Guid.NewGuid();
                string fileName = string.Format("DatePicture\\{0}", guid.ToString());

                Photo p1 = new Photo() { DateId = ((DateViewModel)this.DataContext).Date.Id, Description = "Description", FileName = fileName, CreatedDate = DateTime.Now.ToString() };
                ((DateViewModel)this.DataContext).Ctx.Photos.InsertOnSubmit(p1);

                int ScreenWidth = Int32.Parse(System.Windows.Application.Current.Host.Content.ActualWidth.ToString());
                int ScreenHeight = Int32.Parse(System.Windows.Application.Current.Host.Content.ActualHeight.ToString());

                ImageInfo fullImage = new ImageInfo() { Directory = "DatePicture", FileName = string.Format("{0}.jpg", guid.ToString()), IsSquare = false, Height = ScreenHeight, Width = ScreenWidth };
                ImageInfo thumbnail = new ImageInfo() { Directory = "DatePicture", FileName = string.Format("{0}Small.jpg", guid.ToString()), IsSquare = true, Height = 136, Width = 136 };

                Storage.WriteImageToIsolatedStorage(e.ChosenPhoto, new List<ImageInfo>() { thumbnail, fullImage });

                //Storage.WriteImageToIsolatedStorage(e.ChosenPhoto, new List<ImageInfo>() { new ImageInfo() { Directory = "DatePicture", FileName = string.Format("{0}Small.jpg", guid.ToString()), Height = 136, Width = 136 } });

                ((DateViewModel)this.DataContext).Ctx.SubmitChanges();
            }
        }
Ejemplo n.º 7
0
 public void DeletePhoto(Photo photo)
 {
     Ctx.Photos.DeleteOnSubmit(photo);
     Storage.DeleteFile(string.Format("{0}Small.jpg", photo.FileName));
     SubmitChanges();
 }