Exemplo n.º 1
0
        public Photobooth()
        {
            InitializeComponent();

            Sessions      = (PhotoCollection)(App.Current.Resources["Photos"] as ObjectDataProvider).Data;
            Sessions.Path = Environment.CurrentDirectory + "\\images";

            var videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);

            if (videoDevices.Count != 0)
            {
                cbDevices.Items.Clear();

                var devItr = videoDevices.GetEnumerator();
                while (devItr.MoveNext())
                {
                    var current = (FilterInfo)devItr.Current;
                    var item    = new ComboBoxItem();
                    item.Content = current.Name;
                    item.Resources.Add("moniker", current.MonikerString);
                    cbDevices.Items.Add(item);
                }

                ((ComboBoxItem)cbDevices.Items[0]).IsSelected = true;
            }
        }