Exemplo n.º 1
0
        protected async override void OnStart()
        {
            // Handle when your app starts
            AzureRepo ar = new AzureRepo();
            await ar.getPictureBlob(pp);

            await ar.getCommentBlob(pp);
        }
Exemplo n.º 2
0
        public PhotosPage()
        {
            InitializeComponent();

            ar = new AzureRepo();


            UserPicture p = new UserPicture();

            pic     = new ObservableCollection <UserPicture>();
            comment = new ObservableCollection <PictureComment>();
            comment.Where((comment) => comment.PictureId.Contains("0"));
            CarouselPics.ItemsSource = pic;
            lstView.ItemsSource      = comment;
            layout_editor.IsVisible  = false;


            Debug.WriteLine("Counter Settings: " + pic.Count.ToString());

            /*
             * Image img = new Image
             * {
             *  Source = "photo_begin"
             * };
             */

            //    pic.Add(new UserPicture(img.Source, "0",null));


            // Getting data back from native system
            MessagingCenter.Subscribe <byte[]>(this, "ImageSelected", (args) =>
            {
                // async lambda expression because of blob storage
                Device.BeginInvokeOnMainThread(async() =>
                {
                    //Set the source of the image view with the byte array
                    counter++;

                    p.Picture     = ImageSource.FromStream(() => new MemoryStream((byte[])args));
                    p.BytePicture = (byte[])args;
                    up            = new UserPicture(p.Picture, counter.ToString(), p.BytePicture);


                    pic.Add(up);
                    await ar.AddPicture(up);
                    Debug.WriteLine("Added Picture" + pic.Count.ToString());

                    CarouselPics.Position = counter;

                    Debug.WriteLine("I am the Message Center" + counter.ToString());
                });
            });
        }