예제 #1
0
        /// <summary>
        /// 按钮点击事件(导航到假条保存界面)
        /// </summary>
        private async void button_ok_Click(object sender, RoutedEventArgs e)
        {
            SetArg();
            if (CheckArg() == true)
            {
                if (IsFinished())
                {
                    await isLongTimeDialong.ShowAsync();
                }
                else
                {
                    checkDataDialong = new CheckDataDialog(arg);
                    checkDataDialong.PrimaryButtonClick += new TypedEventHandler <ContentDialog, ContentDialogButtonClickEventArgs>(CheckDate_PrimaryButton);
                    await checkDataDialong.ShowAsync();

                    await isLongTimeDialong.ShowAsync();
                }
            }
            else
            {
                //重置参数
                arg = new Arg();

                //显示ContentDialog
                var warningDialog = new WarningDialog();
                await warningDialog.ShowAsync();
            }
        }
        //Used to show a dialog
        private async Task validationDialog(String message)
        {
            var dialog = new WarningDialog();

            dialog.Title = "Warning";
            dialog.Text  = message;
            dialog.SecondaryButtonText = "";
            var result = await dialog.ShowAsync();
        }
예제 #3
0
 //Since process is async if a user signs in and then exits the dialog, a post may still be created
 //So this is just a warning explaining that
 private async void ContentDialog_Closed(ContentDialog sender, ContentDialogClosedEventArgs args)
 {
     if (shareCancelled)
     {
         var dialog = new WarningDialog();
         dialog.Title             = "Share";
         dialog.Text              = "Share Cancelled. If you signed into your social media account, a post may have still been created";
         dialog.PrimaryButtonText = "";
         await dialog.ShowAsync();
     }
 }
        private async void FaceDetectionButton_Tapped(object sender, TappedRoutedEventArgs e)
        {
            // Inform the user if we do not have a Microsoft face service key and then exit without doing anything
            if (AppSettings.FaceApiKey == "")
            {
                var messageDialog = new Windows.UI.Popups.MessageDialog("You need a Microsoft Face API service key, which you define in settings, to use facial recognition.");
                await messageDialog.ShowAsync();

                return;
            }

            if (SetCameraButton.IsEnabled)
            {
                // Make sure the user accepts privacy implications.
                var dialog = new WarningDialog();
                await dialog.ShowAsync();

                if (dialog.WarningAccept == false)
                {
                    return;
                }
            }

            bool result = await _presence.EnableFaceDetection();

            if (result)
            {
                _presence.FilterOnFace += UserFilterFromDetection;
                CountBox.Visibility     = Visibility.Visible;
                if (!_currentlyFiltered)
                {
                    ImageWarningBox.Visibility = Visibility.Visible;
                }
            }
            else
            {
                _presence.FilterOnFace    -= UserFilterFromDetection;
                CountBox.Visibility        = Visibility.Collapsed;
                ImageWarningBox.Visibility = Visibility.Collapsed;
            }

            // Update the face detection icon depending on whether the effect exists or not
            FaceDetectionDisabledIcon.Visibility = (result != true) ? Visibility.Visible : Visibility.Collapsed;
            FaceDetectionEnabledIcon.Visibility  = (result == true) ? Visibility.Visible : Visibility.Collapsed;
            SetCameraButton.IsEnabled            = (result != true);
        }
        private async Task EnableFaceDetection()
        {
            // Inform the user if we do not have a Azure Face service key and then exit without doing anything.
            if (AppSettings.FaceApiKey == "")
            {
                ContentDialog noFaceKeyDialog = new ContentDialog
                {
                    Title           = "No Azure Face key",
                    Content         = "You need an Azure Face service key, which you define in settings, to use facial recognition.",
                    CloseButtonText = "Ok"
                };
                await noFaceKeyDialog.ShowAsync();

                FaceDetectionButton.IsChecked = false;
                return;
            }

            if (SetCameraButton.IsEnabled)
            {
                // Make sure the user accepts privacy implications.
                var dialog = new WarningDialog();
                await dialog.ShowAsync();

                if (dialog.WarningAccept == false)
                {
                    FaceDetectionButton.IsChecked = false;
                    return;
                }
            }

            bool result = await _presence.EnableFaceDetection();

            if (result)
            {
                _presence.FilterOnFace += UserFilterFromDetection;
            }
            else
            {
                _presence.FilterOnFace -= UserFilterFromDetection;
            }

            ImageWarningBar.IsOpen = result;
            // Update the face detection icon depending on whether the effect exists or not.
            (FaceDetectionButton.Icon as SymbolIcon).Symbol = (result) ? Symbol.View : Symbol.WebCam;
            SetCameraButton.IsEnabled = result != true;
        }
예제 #6
0
        //Used to exit facepicker early
        public async void quitFacePicker()
        {
            var dialog = new WarningDialog();

            dialog.Title               = "Warning";
            dialog.Text                = "You are leaving the frame picker, all of you data will be lost are you sure you want to continue?";
            dialog.PrimaryButtonText   = "Yes";
            dialog.SecondaryButtonText = "No";
            ContentDialogResult result = await dialog.ShowAsync();

            if (result == ContentDialogResult.Primary)
            {
                mode = Mode.Browse;
                destroyPatient();
                navigateMain(typeof(NavPage));
            }
        }
        //Shows dialog asking if user wants to opt out of photo, returns result
        private async Task <bool> disclaimerDialog()
        {
            var dialog = new WarningDialog();

            dialog.Title               = "Photo Recognition";
            dialog.Text                = "This app will use this image to get your age and gender. Your image will be uploaded to the Microsoft Face API service. Microsoft reserves the right to store your image for analysis to improve their FaceAPI serivce. If you do not want agree to these terms you can click skip to enter your details manually. Do you want to use the facial recognition feature?";
            dialog.PrimaryButtonText   = "Yes";
            dialog.SecondaryButtonText = "Skip";
            var result = await dialog.ShowAsync();

            if (result == ContentDialogResult.Primary)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        private async void FaceDetectionButton_Tapped(object sender, TappedRoutedEventArgs e)
        {
            // Inform the user if we do not have a Microsoft face service key and then exit without doing anything
            if (AppSettings.FaceApiKey == "")
            {
                var messageDialog = new Windows.UI.Popups.MessageDialog("You need a Microsoft Face API service key, which you define in settings, to use facial recognition.");
                await messageDialog.ShowAsync();
                return;
            }
       
            if (SetCameraButton.IsEnabled)
            {
                // Make sure the user accepts privacy implications.
                var dialog = new WarningDialog();
                await dialog.ShowAsync();
                if (dialog.WarningAccept == false)
                {
                    return;
                }
            }

            bool result = await _presence.EnableFaceDetection();
            if (result)
            {
                _presence.FilterOnFace += UserFilterFromDetection;
                CountBox.Visibility = Visibility.Visible;
                if (!_currentlyFiltered)
                {
                    ImageWarningBox.Visibility = Visibility.Visible;
                }
            }
            else
            {
                _presence.FilterOnFace -= UserFilterFromDetection;
                CountBox.Visibility = Visibility.Collapsed;
                ImageWarningBox.Visibility = Visibility.Collapsed;
            }

            // Update the face detection icon depending on whether the effect exists or not
            FaceDetectionDisabledIcon.Visibility = (result != true) ? Visibility.Visible : Visibility.Collapsed;
            FaceDetectionEnabledIcon.Visibility = (result == true) ? Visibility.Visible : Visibility.Collapsed;
            SetCameraButton.IsEnabled = (result != true);
        }