コード例 #1
0
ファイル: NewUserPage.xaml.cs プロジェクト: tltl4866/MM
        private async void ConfirmButton_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(UserNameBox.Text))
            {
                // Create or open the folder in which the Whitelist is stored
                StorageFolder whitelistFolder = await KnownFolders.PicturesLibrary.CreateFolderAsync(GeneralConstants.WhiteListFolderName, CreationCollisionOption.OpenIfExists);

                // Create a folder to store this specific user's photos
                StorageFolder currentFolder = await whitelistFolder.CreateFolderAsync(UserNameBox.Text, CreationCollisionOption.ReplaceExisting);

                // Move the already captured photo the user's folder
                await currentIdPhotoFile.MoveAsync(currentFolder);

                // Add user to Oxford database
                OxfordFaceAPIHelper.AddUserToWhitelist(UserNameBox.Text, currentFolder);

                // Stop live camera feed
                await webcam.StopCameraPreview();

                var parameters = new NewUserPage
                {
                    Dummy     = ((Button)sender).Name.ToString(),
                    ToWelcome = "true",
                    UserName  = UserNameBox.Text
                };

                // Navigate back to MainPage
                this.Frame.Navigate(typeof(MainPage), parameters);
            }
        }
コード例 #2
0
ファイル: MainPage.xaml.cs プロジェクト: Netchicken/FaceRec
        /// <summary>
        /// Called when user hits vitual add user button. Navigates to NewUserPage page.
        /// </summary>
        private async void NewUserButton_Click(object sender, RoutedEventArgs e)
        {
            // Stops camera preview on this page, so that it can be started on NewUserPage
            await webcam.StopCameraPreview();

            //Navigates to NewUserPage, passing through initialized WebcamHelper object
            Frame.Navigate(typeof(NewUserPage), webcam);
        }
コード例 #3
0
        /// <summary>
        /// Triggered when the user clicks the delete user button located in the app bar
        /// </summary>
        private async void DeleteButton_Tapped(object sender, TappedRoutedEventArgs e)
        {
            // Delete the user's folder
            await currentUser.ImageFolder.DeleteAsync();

            // Remove user from Oxford
            OxfordFaceAPIHelper.RemoveUserFromWhitelist(currentUser.Name);

            // Stop camera preview
            await webcam.StopCameraPreview();

            // Navigate to MainPage
            Frame.Navigate(typeof(MainPage));
        }
コード例 #4
0
        private async void TabView1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (webcam != null && IsWebCamReady)
            {
                await webcam.StopCameraPreview();

                IsWebCamReady = false;
            }
        }
コード例 #5
0
 protected async override void OnNavigatedFrom(NavigationEventArgs e)
 {
     await webcam.StopCameraPreview();
 }
コード例 #6
0
ファイル: MainPage.xaml.cs プロジェクト: tltl4866/MM
        private async void AuthenticateUser(string visitorName)
        {
            await webcam.StopCameraPreview();

            this.Frame.Navigate(typeof(WelcomePage), visitorName);
        }