コード例 #1
0
        private void PostData(ObservableCollection <Dish> basketList)
        {
            List <int?> id = new List <int?>();

            basketList.ToList().ForEach(dish => id.Add(dish.Id));
            WebCamConnect.CheckId(id);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public WebCamWindowViewModel()
 {
     WebCamConnect.GetDevices().ToList().ForEach(item => ListOfWebCamDevice.Add(item));
     WebCamConnect.NewFrame       += WebCamConnect_NewFrame;
     WebCamConnect.NewObjectImage += WebCamConnect_NewObjectImage;
     //WebCamConnect.NewObject += WebCamConnect_NewObject;
 }
コード例 #4
0
 private void Window_Closed(object sender, EventArgs e)
 {
     WebCamConnect.Stop();
 }