Esempio n. 1
0
        private async void button9_Click(object sender, EventArgs e)
        {
            FirebaseResponse response = await client.GetTaskAsync("Image/");

            Image_model image = response.ResultAs <Image_model>();

            byte[]       b  = Convert.FromBase64String(image.Img);
            MemoryStream ms = new MemoryStream();

            ms.Write(b, 0, Convert.ToInt32(b.Length));
            Bitmap bm = new Bitmap(ms, false);

            ms.Dispose();
            imageBox.Image = bm;
        }
Esempio n. 2
0
        private async void button8_Click(object sender, EventArgs e)
        {
            MemoryStream ms = new MemoryStream();

            imageBox.Image.Save(ms, ImageFormat.Jpeg);
            byte[] a      = ms.GetBuffer();
            string output = Convert.ToBase64String(a);
            var    data   = new Image_model
            {
                Img = output
            };
            SetResponse response = await client.SetTaskAsync("Image/", data);

            Image_model result = response.ResultAs <Image_model>();

            imageBox.Image = null;
            MessageBox.Show("Image inserted");
        }