Пример #1
0
        private void DecompressMpeg_Click(object sender, RoutedEventArgs e)
        {
            // file dialog
            OpenFileDialog fileDialog = new OpenFileDialog
            {
                Title            = "Open CMPX File",
                Filter           = "cmpx files (*.cmpx)|*.cmpx",
                RestoreDirectory = true
            };

            if (fileDialog.ShowDialog() == true)
            {
                Task.Factory.StartNew(() =>
                {
                    frames = Compress.DecompressIPFrames(fileDialog.FileName);

                    frameIndex = 0;
                    SetDisplayImage(frames[frameIndex]);
                });
            }
        }
Пример #2
0
        private void CompressMpeg_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog
            {
                Title            = "Select Frames",
                Filter           = "frames files (*.jpg;*.jpeg;*.bmp)|*.jpg;*.jpeg;*.bmp",
                Multiselect      = true,
                RestoreDirectory = true
            };


            if (fileDialog.ShowDialog() == true)
            {
                var outPath = fileDialog.FileName.Substring(0, fileDialog.FileName.LastIndexOf("\\")) + "\\frames.cmpx";
                Task.Factory.StartNew(() =>
                {
                    var result = Compress.CompressIPFrames(fileDialog.FileNames, 12, outPath);
                    Dispatcher.Invoke((Action)(
                                          () => InfoText.Text = result.ToString()
                                          ));
                });
            }
        }