Пример #1
0
        private void ExportDirt_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 DirtCarExteriorPssgGltfConverter();
                    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);
                }
            }
        }
Пример #2
0
 private bool ExportDirt_CanExecute(object parameter)
 {
     try
     {
         return(_pssg != null && DirtCarExteriorPssgGltfConverter.SupportsPssg(_pssg));
     }
     catch { return(false); }
 }