public ExportViewModel(Models.Models models) { this.models = models; // init layers for (var i = 0; i < models.Images.NumLayers; ++i) { AvailableLayers.Add(new ComboBoxItem <int>("Layer " + i, i)); } selectedLayer = AvailableLayers[models.Export.Layer]; Debug.Assert(selectedLayer.Cargo == models.Export.Layer); // init mipmaps for (var i = 0; i < models.Images.NumMipmaps; ++i) { AvailableMipmaps.Add(new ComboBoxItem <int>("Mipmap " + i, i)); } selectedMipmap = AvailableMipmaps[models.Export.Mipmap]; Debug.Assert(selectedMipmap.Cargo == models.Export.Mipmap); // all layer option for ktx and dds if (models.Images.NumLayers > 1 && (models.Export.FileType == FileFormat.Ktx || models.Export.FileType == FileFormat.Ktx2 || models.Export.FileType == FileFormat.Dds)) { AvailableLayers.Add(new ComboBoxItem <int>("All Layer", -1)); selectedLayer = AvailableLayers.Last(); models.Export.Layer = selectedLayer.Cargo; } // all mipmaps option for ktx and dds if (models.Images.NumMipmaps > 1 && (models.Export.FileType == FileFormat.Ktx || models.Export.FileType == FileFormat.Ktx2 || models.Export.FileType == FileFormat.Dds)) { AvailableMipmaps.Add(new ComboBoxItem <int>("All Mipmaps", -1)); selectedMipmap = AvailableMipmaps.Last(); models.Export.Mipmap = selectedMipmap.Cargo; } // init formats foreach (var format in models.Export.SupportedFormats) { AvailableFormat.Add(new ComboBoxItem <DisplayedFormat>(format.DisplayedName, format)); if (format == models.Export.TexFormat) { SelectedFormat = AvailableFormat.Last(); } } models.Export.PropertyChanged += ExportOnPropertyChanged; }
public IExportFormat ExportFormat(AvailableFormat format, DataTable dt) { return(factories[format].Export(dt)); }