private void OpenCloseButton_Click(object sender, RoutedEventArgs e)
        {
            var status = (Mode)ModeCombo.SelectedIndex + 1;

            switch (status)
            {
            case Mode.Video:

                if (!active)
                {
                    var op = new OpenFileDialog();
                    op.Title  = "動画ファイルを開く";
                    op.Filter = "(*.mp4)|*.mp4";
                    if (op.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        active     = true;
                        _videoName = op.FileName;
                        ChangeStatus(status);
                        RxVideo.OpenFile(_videoName, 640, 480);
                        ReceiveVideoStream();
                        PauseButton.IsEnabled = true;
                        Slider.IsEnabled      = true;
                    }
                }
                else
                {
                    active = false;
                    ChangeStatus(status);
                    PauseButton.IsEnabled = false;
                    Slider.IsEnabled      = false;
                    vidDisposer?.Dispose();
                    RxVideo.Close();
                }
                break;

            case Mode.Chart:
                if (!active)
                {
                    active = true;
                    ChangeStatus(status);
                    var timeLoc     = new OpenCvSharp.Point(1100, 30);
                    var sinLoc      = new OpenCvSharp.Point(1100, 60);
                    var noisySinLoc = new OpenCvSharp.Point(1100, 90);
                    var fontscale   = 1.0;
                    var color       = new Scalar(100, 100, 255);

                    //Rxの2つ目、数値のストリームを受け取る部分

                    RxLogger.MakeStream(10)
                    .Select(obj =>
                    {
                        Cv2.PutText(obj.Frame, $"Time     : {obj.Time:f1}", timeLoc, HersheyFonts.HersheySimplex, fontscale, color, 2);
                        Cv2.PutText(obj.Frame, $"Sin      : {obj.Sin:f2}", sinLoc, HersheyFonts.HersheySimplex, fontscale, color, 2);
                        Cv2.PutText(obj.Frame, $"NoisySin : {obj.NoisySin:f2}", noisySinLoc, HersheyFonts.HersheySimplex, fontscale, color, 2);
                        return(obj.Frame);
                    })
                    .ObserveOnDispatcher()
                    .Subscribe(frame =>
                    {
                        Image.Source = frame.ToBitmapSource();
                    });
                }
                else
                {
                    RxLogger.Close();
                    active = false;
                    ChangeStatus(status);
                }
                break;

            default:

                break;
            }
        }
        private void ChangeStatus(Mode status)
        {
            switch (status)
            {
            case Mode.Init:
                OpenCloseButton.IsEnabled  = false;
                OpenCloseButton.Visibility = Visibility.Hidden;
                Slider.Visibility          = Visibility.Hidden;
                PauseButton.Visibility     = Visibility.Hidden;
                Image.Source             = new Mat(480, 640, MatType.CV_8UC3, new Scalar(0, 0, 0)).ToBitmapSource();
                Image.IsEnabled          = false;
                Image.Visibility         = Visibility.Hidden;
                DialogueCombo.IsEnabled  = false;
                DialogueCombo.Visibility = Visibility.Hidden;
                Instraction.Visibility   = Visibility.Hidden;
                MessageTx.IsEnabled      = false;
                MessageTx.Visibility     = Visibility.Hidden;
                LeftLabel.Visibility     = Visibility.Hidden;
                RightLabel.Visibility    = Visibility.Hidden;
                break;

            case Mode.Video:

                OpenCloseButton.IsEnabled  = true;
                OpenCloseButton.Visibility = Visibility.Visible;
                Slider.Visibility          = Visibility.Visible;
                PauseButton.Visibility     = Visibility.Visible;
                Image.IsEnabled            = true;
                Image.Visibility           = Visibility.Visible;
                DialogueCombo.IsEnabled    = false;
                DialogueCombo.Visibility   = Visibility.Hidden;
                Instraction.Visibility     = Visibility.Hidden;
                MessageTx.IsEnabled        = false;
                MessageTx.Visibility       = Visibility.Hidden;
                LeftLabel.Visibility       = Visibility.Hidden;
                RightLabel.Visibility      = Visibility.Hidden;
                if (active)
                {
                    OpenCloseButton.Content = "Close";
                    ModeCombo.IsEnabled     = false;
                    PauseButton.Content     = "| |";
                }
                else
                {
                    OpenCloseButton.Content = "Open";
                    ModeCombo.IsEnabled     = true;
                    PauseButton.Content     = "▶";
                }
                break;

            case Mode.Chart:

                OpenCloseButton.IsEnabled  = true;
                OpenCloseButton.Visibility = Visibility.Visible;
                Slider.Visibility          = Visibility.Hidden;
                PauseButton.Visibility     = Visibility.Hidden;
                Image.IsEnabled            = true;
                Image.Visibility           = Visibility.Visible;
                DialogueCombo.IsEnabled    = false;
                DialogueCombo.Visibility   = Visibility.Hidden;
                Instraction.Visibility     = Visibility.Hidden;
                MessageTx.IsEnabled        = false;
                MessageTx.Visibility       = Visibility.Hidden;
                LeftLabel.Visibility       = Visibility.Hidden;
                RightLabel.Visibility      = Visibility.Hidden;
                Image.Source = RxLogger.Init().ToBitmapSource();
                if (active)
                {
                    OpenCloseButton.Content = "Stop";
                    ModeCombo.IsEnabled     = false;
                }
                else
                {
                    OpenCloseButton.Content = "Start";
                    ModeCombo.IsEnabled     = true;
                }
                break;

            case Mode.Dialogue:

                OpenCloseButton.IsEnabled  = false;
                OpenCloseButton.Visibility = Visibility.Hidden;
                Slider.Visibility          = Visibility.Hidden;
                PauseButton.Visibility     = Visibility.Hidden;
                Image.IsEnabled            = false;
                Image.Visibility           = Visibility.Hidden;
                DialogueCombo.IsEnabled    = true;
                DialogueCombo.Visibility   = Visibility.Visible;
                Instraction.Visibility     = Visibility.Visible;
                MessageTx.IsEnabled        = true;
                MessageTx.Visibility       = Visibility.Visible;
                MessageTx.Text             = "";
                LeftLabel.Visibility       = Visibility.Visible;
                LeftLabel.Content          = "";
                RightLabel.Visibility      = Visibility.Visible;
                RightLabel.Content         = "";

                _subject = MakeSubject((SubjectMode)DialogueCombo.SelectedIndex);

                break;
            }
        }