Ejemplo n.º 1
0
        private void ExportCarInterior_Execute(object parameter)
        {
            SaveFileDialog dialog = new SaveFileDialog();

            dialog.Filter     = "Gltf files|*.glb;*.gltf|All files|*.*";
            dialog.Title      = "Select the model's save location and file name";
            dialog.DefaultExt = "glb";
            if (!string.IsNullOrEmpty(mainView.FilePath))
            {
                dialog.FileName         = Path.GetFileNameWithoutExtension(mainView.FilePath);
                dialog.InitialDirectory = Path.GetDirectoryName(mainView.FilePath);
            }

            if (dialog.ShowDialog() == true)
            {
                try
                {
                    var converter = new CarInteriorPssgGltfConverter();
                    var model     = converter.Convert(_pssg);
                    model.Save(dialog.FileName);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Could not export the model!" + Environment.NewLine + Environment.NewLine +
                                    ex.Message, Properties.Resources.AppTitleLong, MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
Ejemplo n.º 2
0
 private bool ExportCarInterior_CanExecute(object parameter)
 {
     try
     {
         return(_pssg != null && CarInteriorPssgGltfConverter.SupportsPssg(_pssg));
     }
     catch { return(false); }
 }