Hi everbody;
my web service code is here;
[WebMethod]
public List<byte[]> getPicture()
{
List<byte[]> img = new List<byte[]>();
string impath = @"C:\Users\vehbi\Desktop\pictures";
foreach (string file in Directory.GetFiles(impath))
img.Add(File.ReadAllBytes(file));
return img;
}
my form application code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Xml;
namespace Client
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
ServiceReference1.Service1SoapClient deneme = new ServiceReference1.Service1SoapClient();
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
timer1.Start();
byte[][] img = deneme.getPicture();
flowLayoutPanel1.Controls.Clear();
foreach (byte[] pic in img)
{
MemoryStream ms = new MemoryStream(pic);
PictureBox picbox = new PictureBox();
picbox.Size = new System.Drawing.Size(150, 150);
picbox.Image = Image.FromStream(ms);
picbox.SizeMode = PictureBoxSizeMode.Zoom;
flowLayoutPanel1.Controls.Add(picbox);
}
}
my question is how can i refresh my web service. Server adds a picture per 15 minutes and clients has to see added pictures. without pressing button1