コード例 #1
0
        private void Save(IStreamable sender)
        {
            if (sender is IImage)
            {
                var saveFileDialog = new System.Windows.Forms.SaveFileDialog();
                saveFileDialog.FileName      = "*";
                saveFileDialog.DefaultExt    = "jpg";
                saveFileDialog.ValidateNames = true;

                saveFileDialog.Filter = "Image File (.jpg)|*.jpg";

                DialogResult result = saveFileDialog.ShowDialog();

                if (!(result == DialogResult.OK)) // Test result.
                {
                    return;
                }

                sender.Save(saveFileDialog.FileName);
            }
            else if (sender is IVideo || sender is ICamera)
            {
                if (videoWriter == null)
                {
                    var saveFileDialog = new System.Windows.Forms.SaveFileDialog();
                    saveFileDialog.FileName      = "*";
                    saveFileDialog.DefaultExt    = "gyg";
                    saveFileDialog.ValidateNames = true;

                    saveFileDialog.Filter = "Gygax Video (.gyg)|*.gyg";

                    DialogResult result = saveFileDialog.ShowDialog();

                    if (!(result == DialogResult.OK)) // Test result.
                    {
                        return;
                    }

                    videoWriter        = new GygaxVideoWriter(saveFileDialog.FileName);
                    videoWriter.Source = (IStreamable)sender;

                    RecordingButton.Visibility     = Visibility.Visible;
                    StopRecordingButton.Visibility = Visibility.Visible;
                }
            }
        }
コード例 #2
0
ファイル: Control3D.xaml.cs プロジェクト: thegodi/Gygax
        private void Save(IStreamable sender)
        {
            if (sender is Pointcloud)
            {
                var saveFileDialog = new System.Windows.Forms.SaveFileDialog();
                saveFileDialog.FileName      = "*";
                saveFileDialog.DefaultExt    = "pcd";
                saveFileDialog.ValidateNames = true;

                saveFileDialog.Filter = "Pointcloud File (.pcd)|*.pcd";

                DialogResult result = saveFileDialog.ShowDialog();

                if (!(result == DialogResult.OK)) // Test result.
                {
                    return;
                }

                sender.Save(saveFileDialog.FileName);
            }
            else if (sender is IfcViewerWrapper)
            {
                var saveFileDialog = new System.Windows.Forms.SaveFileDialog();
                saveFileDialog.FileName      = "*";
                saveFileDialog.DefaultExt    = "obj";
                saveFileDialog.ValidateNames = true;

                saveFileDialog.Filter = "Wavefront Obj File (.obj)|*.obj";

                DialogResult result = saveFileDialog.ShowDialog();

                if (!(result == DialogResult.OK)) // Test result.
                {
                    return;
                }

                var objExporter = new WavefrontObjWriter();
                objExporter.Export(IfcVisualizer.GetItems((IfcViewerWrapper)sender.Data, false), saveFileDialog.FileName, "", false);
            }
        }