The document discusses functions from the avicap32.dll library for creating a video capture window and retrieving media properties in C++. It also shows using the CameraCaptureUI class in C# for launching the camera capture UI and getting a bitmap image from a photo or video capture.
8. DllImport "avicap32.dll" "capCreateCaptureWindow"
static extern int
string int
int int int int
int int
DllImport "avicap32.dll"
static extern bool
int
MarshalAs UnmanagedType ref string
int
MarshalAs UnmanagedType ref string
int
// more and more of the same
9. using Windows.Media.Capture;
var new CameraCaptureUI
new Size
var await CameraCaptureUIMode
if
var new BitmapImage
await FileAccessMode
Hinweis der Redaktion
PrepVisual Studio 11 loadedDemoNew Metro project. Discuss templates.Add some content. Talk about design & C shape. Do some in XAML. Set style in property drag on button. <Grid Background="{StaticResourceApplicationPageBackgroundBrush}"> <Grid.ColumnDefinitions> <ColumnDefinition Width="120"/> <ColumnDefinition/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="120"/> <RowDefinition /> <RowDefinition Height="120"/> </Grid.RowDefinitions> <TextBlockGrid.Column="1" Grid.Row="0" Text="Community Night" Style="{StaticResourcePageHeaderTextStyle}" /> <Button Content="Demo 1" Grid.Column="1" HorizontalAlignment="Left" Margin="189,132,0,0" Grid.Row="1" VerticalAlignment="Top" Width="115" Style="{StaticResourceTextButtonStyle}"/> </Grid>Code behind for buttonnew MessageDialog("Welcome to Windows 8!", "Community Night").ShowAsync(); Run, then run in emulatorLook at the code and talk async for a bit.Demo 2Add another buttonCode behind – talk async. Talk pickers. Show picking from photosprivate async void Button_Click_2(object sender, RoutedEventArgs e) {var picker = new Windows.Storage.Pickers.FileOpenPicker();picker.FileTypeFilter.Add(".jpg");picker.FileTypeFilter.Add(".png");picker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.PicturesLibrary;picker.ViewMode = Windows.Storage.Pickers.PickerViewMode.Thumbnail;var result = await picker.PickSingleFileAsync(); await new MessageDialog(string.Format("You picked {0}", result.DisplayName)).ShowAsync(); }Demo 3 – new button again. Add following, break, show manifest talk about settings and permissions. Fix run show settings. private async void Button_Click_3(object sender, RoutedEventArgs e) {vargps = new Windows.Devices.Geolocation.Geolocator();var location = await gps.GetGeopositionAsync(); await new MessageDialog(string.Format("You picked at {0}-{1}", location.Coordinate.Latitude, location.Coordinate.Longitude)).ShowAsync(); }Demo 4 needs a textbox and a buttonprivate void Button_Click_4(object sender, RoutedEventArgs e) {var text = blah.Text;var manager = DataTransferManager.GetForCurrentView();manager.DataRequested += (s, args) => {args.Request.Data.Properties.Title = "From Community Night";args.Request.Data.SetText(text); };DataTransferManager.ShowShareUI(); }Demo 5 – Add search contract demo page and show the tie in