private void PostData(ObservableCollection <Dish> basketList) { List <int?> id = new List <int?>(); basketList.ToList().ForEach(dish => id.Add(dish.Id)); WebCamConnect.CheckId(id); }
private BitmapImage ImageFromStruct(ObjectStruct obj) { int size = (int)Math.Sqrt(obj.Tone.Length); Bitmap img = new Bitmap(size, size); int index = 0; for (int x = 0; x < img.Height; x++) { for (int y = 0; y < img.Width; y++) { double hue = obj.Tone[index].Hue; double sat = obj.Tone[index].Saturation; double val = obj.Tone[index].Value; Color color = WebCamConnect.ColorFromHSV(hue, sat, val); img.SetPixel(x, y, color); index++; } } BitmapImage btm = new BitmapImage(); using (MemoryStream memStream2 = new MemoryStream()) { (img).Save(memStream2, System.Drawing.Imaging.ImageFormat.Png); memStream2.Position = 0; btm.BeginInit(); btm.CacheOption = BitmapCacheOption.OnLoad; btm.UriSource = null; btm.StreamSource = memStream2; btm.EndInit(); } return(btm); }
public WebCamWindowViewModel() { WebCamConnect.GetDevices().ToList().ForEach(item => ListOfWebCamDevice.Add(item)); WebCamConnect.NewFrame += WebCamConnect_NewFrame; WebCamConnect.NewObjectImage += WebCamConnect_NewObjectImage; //WebCamConnect.NewObject += WebCamConnect_NewObject; }
private void Window_Closed(object sender, EventArgs e) { WebCamConnect.Stop(); }