コード例 #1
0
 private void открытьПроектToolStripMenuItem_Click(object sender, EventArgs e)
 {
     openFileDialog1.Filter = "project files (*.pvb)|*.pvb";
     if (openFileDialog1.ShowDialog() == DialogResult.OK)
     {
         FileInfo file = new FileInfo(openFileDialog1.FileName);
         long     size = file.Length;
         if (size > 0)
         {
             fStream           = new FileStream(openFileDialog1.FileName, FileMode.Open);
             formatter         = new BinaryFormatter();
             serialize         = (Serilization)formatter.Deserialize(fStream);
             project           = serialize.vp;
             project.Bookmarks = serialize.bm;
             fStream.Close();
             if (File.Exists(project.FilePath))
             {
                 Init_Video(project.FilePath);
                 UpdateList();
             }
             else
             {
                 MessageBox.Show("Исходный файл не найден по сохранненому пути.");
             }
         }
         else
         {
             MessageBox.Show("Файл пустой.");
         }
     }
 }
コード例 #2
0
        void Init_Video(string FileName)
        {
            try
            {
                video = new Video(FileName);
                video.Open(FileName);
                video.Owner   = VideoOut;
                video.Ending += Video_Ending;

                CurrentPosition = Convert.ToInt32(video.CurrentPosition);
                MaxPosition     = Convert.ToInt32(video.Duration);

                TimeLine.Minimum     = 0;
                TimeLine.Maximum     = MaxPosition;
                TimeLine.LargeChange = 1;

                if (project == null)
                {
                    project = new VideoProject(FileName);
                }
                Text = project.Name;

                MessageBox.Show("Видео загружено. Для воспроизведения нажмите кнопку Пуск.");
            }
            catch (Exception exp)
            {
                MessageBox.Show($"Открытие видео произошло с ошибкой: {exp}");
            }
        }