Beispiel #1
0
        private void TakePicture_Click(object sender, RoutedEventArgs e)
        {
            if (cam != null)
            {
                try
                {
                    // Start image capture.
                    cam.CaptureImage();
                }
                catch (Exception ex)
                {
                    this.Dispatcher.BeginInvoke(delegate()
                    {
                        // Cannot capture an image until the previous capture has completed.
                        // txtDebug.Text = ex.Message;
                    });
                }
            }

            string fileName = "isostore:" + savedCounter + "_th.jpg";

            // Create a new picture caption item based on the text box.
            PhotoItem newPhoto = new PhotoItem { PhotoCaption = newCaptionTextBox.Text, PhotoFileName = fileName };

            // Add a to-do item to the observable collection.
            App.ViewModel.AddNewPhoto(newPhoto);

        }
Beispiel #2
0
        internal void AddNewPhoto(PhotoItem newPhoto)
        {
            // Add a to-do item to the data context.
            PhotoDB.PhotoItems.InsertOnSubmit(newPhoto);

            // Save changes to the database.
            PhotoDB.SubmitChanges();

            // Add a to-do item to the "all" observable collection.
            PhotoItems.Add(newPhoto);
        }