Interaction logic for EmotionDetectionUserControl.xaml
상속: System.Windows.Controls.UserControl
예제 #1
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.URLTextBox = ((System.Windows.Controls.TextBox)(target));
                return;

            case 2:

            #line 25 "..\..\DetectEmotionUsingURLPage.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.LoadImageButton_Click);

            #line default
            #line hidden
                return;

            case 3:
                this._detectionStatus = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 4:
                this._emotionDetectionUserControl = ((EmotionAPI_WPF_Samples.EmotionDetectionUserControl)(target));
                return;
            }
            this._contentLoaded = true;
        }
        private static void ImageChangedCallback(DependencyObject obj, DependencyPropertyChangedEventArgs eventArg)
        {
            EmotionDetectionUserControl userControl = obj as EmotionDetectionUserControl;

            if (userControl != null)
            {
                userControl._image.Source = (BitmapImage)eventArg.NewValue;
                // Remove any previous detection result in the list box
                userControl._emotionList._resultListBox.ItemsSource = null;
            }
        }
예제 #3
0
        private static void ImageChangedCallback(DependencyObject obj, DependencyPropertyChangedEventArgs eventArg)
        {
            EmotionDetectionUserControl userControl = obj as EmotionDetectionUserControl;

            if (userControl != null)
            {
                userControl._image.Source = (BitmapImage)eventArg.NewValue;
                // LIMPANDO RESULTADOS
                userControl._emotionList._resultListBox.ItemsSource = null;
            }
        }
        private static void EmotionsChangedCallback(DependencyObject obj, DependencyPropertyChangedEventArgs eventArg)
        {
            MainWindow window = (MainWindow)Application.Current.MainWindow;

            if (window != null)
            {
                EmotionDetectionUserControl userControl = obj as EmotionDetectionUserControl;

                if (userControl != null)
                {
                    //
                    // Draw face rectangles
                    //
                    window.DrawFaceRectangle(userControl._image, userControl.Image, userControl.Emotions);

                    //
                    // List the result of the emotion detections in a list box with face rectangle images and top 3 emotions and scores.
                    //
                    window.ListEmotionResult(userControl.ImageUri, userControl._emotionList._resultListBox, userControl.Emotions);
                }
            }
        }