コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: dtbinh/cs161grp1
        // playback start/stop button
        private void image4_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (!recordSet)
            {
                if (!playback)
                {
                    totalCounted        = 0;
                    totalCorrespondence = 0;
                    startFrame          = 0;
                    playback            = true;
                    //statement under this: value changed from FileText.Text to mDataComboBox.SelectedValue
                    masterData = new StreamFileReader(mDataComboBox.SelectedValue + ".txt");
                    //statement under this: value changed from FileText.Text to mDataComboBox.SelectedValue
                    dataStream   = new FileStream(mDataComboBox.SelectedValue + ".dat", FileMode.Open, FileAccess.Read);
                    streamLength = dataStream.Length;

                    // swap image
                    BitmapImage bitmap = new BitmapImage();
                    bitmap.BeginInit();
                    bitmap.UriSource = new Uri("/VirtualSifu;component/Images/stop.png", UriKind.Relative);
                    bitmap.EndInit();
                    image4.Stretch = Stretch.Fill;
                    image4.Source  = bitmap;

                    // also dim out record button
                    bitmap = new BitmapImage();
                    bitmap.BeginInit();
                    bitmap.UriSource = new Uri("/VirtualSifu;component/Images/record_disabled.png", UriKind.Relative);
                    bitmap.EndInit();
                    image2.Stretch = Stretch.Fill;
                    image2.Source  = bitmap;
                }
                else
                {
                    playback = false;
                    dataStream.Close();
                    countdown = 0;
                    // swap image
                    BitmapImage bitmap = new BitmapImage();
                    bitmap.BeginInit();
                    bitmap.UriSource = new Uri("/VirtualSifu;component/Images/play.png", UriKind.Relative);
                    bitmap.EndInit();
                    image4.Stretch = Stretch.Fill;
                    image4.Source  = bitmap;

                    // undim record button
                    bitmap = new BitmapImage();
                    bitmap.BeginInit();
                    bitmap.UriSource = new Uri("/VirtualSifu;component/Images/record.png", UriKind.Relative);
                    bitmap.EndInit();
                    image2.Stretch = Stretch.Fill;
                    image2.Source  = bitmap;

                    masterView.Source = null;
                    changeVisibility(System.Windows.Visibility.Hidden);
                }
            }
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: tbalci/cs161grp1
        // playback start/stop button
        private void image4_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (!recordSet)
            {
                if (!playback)
                {
                    totalCounted = 0;
                    totalCorrespondence = 0;
                    startFrame = 0;
                    playback = true;
                    //statement under this: value changed from FileText.Text to mDataComboBox.SelectedValue
                    masterData = new StreamFileReader(mDataComboBox.SelectedValue + ".txt");
                    //statement under this: value changed from FileText.Text to mDataComboBox.SelectedValue
                    dataStream = new FileStream(mDataComboBox.SelectedValue + ".dat", FileMode.Open, FileAccess.Read);
                    streamLength = dataStream.Length;

                    // swap image
                    BitmapImage bitmap = new BitmapImage();
                    bitmap.BeginInit();
                    bitmap.UriSource = new Uri("/VirtualSifu;component/Images/stop.png", UriKind.Relative);
                    bitmap.EndInit();
                    image4.Stretch = Stretch.Fill;
                    image4.Source = bitmap;

                    // also dim out record button
                    bitmap = new BitmapImage();
                    bitmap.BeginInit();
                    bitmap.UriSource = new Uri("/VirtualSifu;component/Images/record_disabled.png", UriKind.Relative);
                    bitmap.EndInit();
                    image2.Stretch = Stretch.Fill;
                    image2.Source = bitmap;
                }
                else
                {
                    playback = false;
                    dataStream.Close();
                    countdown = 0;
                    // swap image
                    BitmapImage bitmap = new BitmapImage();
                    bitmap.BeginInit();
                    bitmap.UriSource = new Uri("/VirtualSifu;component/Images/play.png", UriKind.Relative);
                    bitmap.EndInit();
                    image4.Stretch = Stretch.Fill;
                    image4.Source = bitmap;

                    // undim record button
                    bitmap = new BitmapImage();
                    bitmap.BeginInit();
                    bitmap.UriSource = new Uri("/VirtualSifu;component/Images/record.png", UriKind.Relative);
                    bitmap.EndInit();
                    image2.Stretch = Stretch.Fill;
                    image2.Source = bitmap;

                    masterView.Source = null;
                    changeVisibility(System.Windows.Visibility.Hidden);
                }
            }
        }