Esempio n. 1
0
        private void PauseShowAnnotation(VideoAnnotationItem sci)
        {
            if (sci == null)
            {
                return;
            }

            Application.Current.Windows[1].Height = _ANNOTATE_HEIGHT;
            ToggleButton1.IsChecked = true;
            ToggleButton1.Content   = "Save";
            myInkCanvas.Strokes     = sci.Strokes.Clone();
            TextBox1.Text           = sci.Description;
            Button1.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); // forward click event to pause button
        }
Esempio n. 2
0
        private void OnAnnotationToggle(object sender, RoutedEventArgs e)
        {
            ToggleButton tb = sender as ToggleButton;
            Point        pt = new Point();

            if (tb == null)
            {
                return;
            }

            if (tb.IsChecked == true)
            {
                ToggleButton1.Content = "Save";
                //Button2.Visibility = Visibility.Visible;
                _PausedMediaTimeSpan = new TimeSpan(_CurrentMediaTimeSpan.Ticks);

                Button1.RaiseEvent(e); // forward click event to pause button
                Application.Current.Windows[1].Height = _ANNOTATE_HEIGHT;
            }
            else
            {
                // save the annotation
                //if (myInkCanvas.Strokes.Count != 0)
                {
                    ToggleButton1.Content = "Annotate";
                    //Button2.Visibility = Visibility.Collapsed;

                    TransformGroup     tg = Ellipse2.RenderTransform as TransformGroup;
                    TranslateTransform tt = tg.Children[5] as TranslateTransform;
                    pt.X = tt.X;

                    tg   = Ellipse2.RenderTransform as TransformGroup;
                    tt   = tg.Children[5] as TranslateTransform;
                    pt.Y = tt.Y;

                    _VideoAnnotation.Add(myInkCanvas.Strokes.Clone(), _CurrentAnnotationID.ToString(), TextBox1.Text, _PausedMediaTimeSpan, pt);

                    _CurrentAnnotationID++;
                }

                Button2.RaiseEvent(e); // forward click event to resume button
            }
        }
Esempio n. 3
0
        public void Sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            string txt        = e.Result.Text;
            float  confidence = e.Result.Confidence;

            if (confidence >= 0.4)
            {
                int first = Convert.ToInt32(e.Result.Semantics["first"].Value);

                //int second = Convert.ToInt32(e.Result.Semantics["second"].Value);
                //string operation = e.Result.Semantics["operation"].Value.ToString();


                switch (first)
                {
                case 1:
                    Button1.Dispatcher.Invoke(new Action(() =>
                    {
                        Button1.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                        SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221));
                        Button1.Background    = brush;
                        ColorAnimation anima  = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5)));
                        anima.AutoReverse     = true;
                        brush.BeginAnimation(SolidColorBrush.ColorProperty, anima);
                    }));
                    break;

                case 2:
                    Button2.Dispatcher.Invoke(new Action(() =>
                    {
                        Button2.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                        SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221));
                        Button2.Background    = brush;
                        ColorAnimation anima  = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5)));
                        anima.AutoReverse     = true;
                        brush.BeginAnimation(SolidColorBrush.ColorProperty, anima);
                    }));
                    break;

                case 3:
                    Button3.Dispatcher.Invoke(new Action(() =>
                    {
                        Button3.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                        SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221));
                        Button3.Background    = brush;
                        ColorAnimation anima  = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5)));
                        anima.AutoReverse     = true;
                        brush.BeginAnimation(SolidColorBrush.ColorProperty, anima);
                    }));
                    break;

                case 4:
                    Button4.Dispatcher.Invoke(new Action(() =>
                    {
                        Button4.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                        SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221));
                        Button4.Background    = brush;
                        ColorAnimation anima  = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5)));
                        anima.AutoReverse     = true;
                        brush.BeginAnimation(SolidColorBrush.ColorProperty, anima);
                    }));
                    break;

                case 5:
                    Button5.Dispatcher.Invoke(new Action(() =>
                    {
                        Button5.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                        SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221));
                        Button5.Background    = brush;
                        ColorAnimation anima  = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5)));
                        anima.AutoReverse     = true;
                        brush.BeginAnimation(SolidColorBrush.ColorProperty, anima);
                    }));
                    break;

                case 6:
                    Button6.Dispatcher.Invoke(new Action(() =>
                    {
                        Button6.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                        SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221));
                        Button6.Background    = brush;
                        ColorAnimation anima  = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5)));
                        anima.AutoReverse     = true;
                        brush.BeginAnimation(SolidColorBrush.ColorProperty, anima);
                    }));
                    break;

                case 7:
                    Button7.Dispatcher.Invoke(new Action(() =>
                    {
                        Button7.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                        SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221));
                        Button7.Background    = brush;
                        ColorAnimation anima  = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5)));
                        anima.AutoReverse     = true;
                        brush.BeginAnimation(SolidColorBrush.ColorProperty, anima);
                    }));
                    break;

                case 8:
                    Button8.Dispatcher.Invoke(new Action(() =>
                    {
                        Button8.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                        SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221));
                        Button8.Background    = brush;
                        ColorAnimation anima  = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5)));
                        anima.AutoReverse     = true;
                        brush.BeginAnimation(SolidColorBrush.ColorProperty, anima);
                    }));
                    break;

                case 9:
                    Button9.Dispatcher.Invoke(new Action(() =>
                    {
                        Button9.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                        SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221));
                        Button9.Background    = brush;
                        ColorAnimation anima  = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5)));
                        anima.AutoReverse     = true;
                        brush.BeginAnimation(SolidColorBrush.ColorProperty, anima);
                    }));
                    break;

                case 0:
                    Button0.Dispatcher.Invoke(new Action(() =>
                    {
                        Button0.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                        SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221));
                        Button0.Background    = brush;
                        ColorAnimation anima  = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5)));
                        anima.AutoReverse     = true;
                        brush.BeginAnimation(SolidColorBrush.ColorProperty, anima);
                    }));
                    break;

                case 10:
                    ButtonRowne.Dispatcher.Invoke(new Action(() =>
                    {
                        ButtonRowne.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                        SolidColorBrush brush  = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221));
                        ButtonRowne.Background = brush;
                        ColorAnimation anima   = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5)));
                        anima.AutoReverse      = true;
                        brush.BeginAnimation(SolidColorBrush.ColorProperty, anima);
                    }));
                    break;

                case 11:
                    ButtonPlus.Dispatcher.Invoke(new Action(() =>
                    {
                        ButtonPlus.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                        SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221));
                        ButtonPlus.Background = brush;
                        ColorAnimation anima  = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5)));
                        anima.AutoReverse     = true;
                        brush.BeginAnimation(SolidColorBrush.ColorProperty, anima);
                    }));
                    break;

                case 12:
                    ButtonMinus.Dispatcher.Invoke(new Action(() =>
                    {
                        ButtonMinus.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                        SolidColorBrush brush  = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221));
                        ButtonMinus.Background = brush;
                        ColorAnimation anima   = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5)));
                        anima.AutoReverse      = true;
                        brush.BeginAnimation(SolidColorBrush.ColorProperty, anima);
                    }));
                    break;

                case 13:
                    ButtonRazy.Dispatcher.Invoke(new Action(() =>
                    {
                        ButtonRazy.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                        SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221));
                        ButtonRazy.Background = brush;
                        ColorAnimation anima  = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5)));
                        anima.AutoReverse     = true;
                        brush.BeginAnimation(SolidColorBrush.ColorProperty, anima);
                    }));
                    break;

                case 14:
                    ButtonPrzez.Dispatcher.Invoke(new Action(() =>
                    {
                        ButtonPrzez.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                        SolidColorBrush brush  = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221));
                        ButtonPrzez.Background = brush;
                        ColorAnimation anima   = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5)));
                        anima.AutoReverse      = true;
                        brush.BeginAnimation(SolidColorBrush.ColorProperty, anima);
                    }));
                    break;

                case 15:
                    ButtonC.Dispatcher.Invoke(new Action(() =>
                    {
                        ButtonC.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                        SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221));
                        ButtonC.Background    = brush;
                        ColorAnimation anima  = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5)));
                        anima.AutoReverse     = true;
                        brush.BeginAnimation(SolidColorBrush.ColorProperty, anima);
                    }));
                    break;

                default:
                    break;
                }



                //if (operation == "plus")
                //{
                //    ButtonPlus.Dispatcher.Invoke(new Action(() =>
                //    {
                //        ButtonPlus.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                //    }));

                //}
                //else if (operation == "minus")
                //{
                //    ButtonMinus.Dispatcher.Invoke(new Action(() =>
                //    {
                //        ButtonMinus.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                //    }));

                //}
                //else if (operation == "razy")
                //{
                //    ButtonRazy.Dispatcher.Invoke(new Action(() =>
                //    {
                //        ButtonRazy.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                //    }));
                //}
                //else if (operation == "przez")
                //{
                //    ButtonPrzez.Dispatcher.Invoke(new Action(() =>
                //    {
                //        ButtonPrzez.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                //    }));


                //}

                //switch (second)
                //{
                //    case 1:
                //        Button1.Dispatcher.Invoke(new Action(() =>
                //        {
                //            Button1.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                //        }));
                //        break;
                //    case 2:
                //        Button2.Dispatcher.Invoke(new Action(() =>
                //        {
                //            Button2.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                //        }));
                //        break;

                //    case 3:
                //        Button3.Dispatcher.Invoke(new Action(() =>
                //        {
                //            Button3.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                //        }));
                //        break;

                //    case 4:
                //        Button4.Dispatcher.Invoke(new Action(() =>
                //        {
                //            Button4.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                //        }));
                //        break;

                //    case 5:
                //        Button5.Dispatcher.Invoke(new Action(() =>
                //        {
                //            Button5.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                //        }));
                //        break;

                //    case 6:
                //        Button6.Dispatcher.Invoke(new Action(() =>
                //        {
                //            Button6.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                //        }));
                //        break;

                //    case 7:
                //        Button7.Dispatcher.Invoke(new Action(() =>
                //        {
                //            Button7.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                //        }));
                //        break;

                //    case 8:
                //        Button8.Dispatcher.Invoke(new Action(() =>
                //        {
                //            Button8.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                //        }));
                //        break;

                //    case 9:
                //        Button9.Dispatcher.Invoke(new Action(() =>
                //        {
                //            Button9.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                //        }));
                //        break;

                //    case 0:
                //        Button0.Dispatcher.Invoke(new Action(() =>
                //        {
                //            Button0.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                //        }));
                //        break;
                //    default:
                //        break;
                //}
                //ButtonRowne.Dispatcher.Invoke(new Action(() =>
                //{
                //    ButtonRowne.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                //}));
            }
            else
            {
                ss.Speak("Proszę powtórzyć");
            }
        }