|
@ -15,9 +15,9 @@ namespace Pores |
|
|
{ |
|
|
{ |
|
|
public Material CurrentMaterial { get; set; } |
|
|
public Material CurrentMaterial { get; set; } |
|
|
public ObservableCollection<Pore> Pores { get; set; } = new ObservableCollection<Pore>(); |
|
|
public ObservableCollection<Pore> Pores { get; set; } = new ObservableCollection<Pore>(); |
|
|
public IEnumerable<IPoreLocalization> Localizations { get; set; } |
|
|
public IEnumerable<IPoreSpread> Spreads { get; set; } |
|
|
|
|
|
|
|
|
public IPoreLocalization SelectedLocalization { get; set; } |
|
|
public IPoreSpread SelectedSpread { get; set; } |
|
|
public IPoreGenerator PoreGeneratorInstance { get; set; } |
|
|
public IPoreGenerator PoreGeneratorInstance { get; set; } |
|
|
public BatchGenerator BatchGenerator { get; } |
|
|
public BatchGenerator BatchGenerator { get; } |
|
|
public ConnectedPoreReportGenerator ConnectedPoreReportGenerator { get; } |
|
|
public ConnectedPoreReportGenerator ConnectedPoreReportGenerator { get; } |
|
@ -43,25 +43,25 @@ namespace Pores |
|
|
|
|
|
|
|
|
public MainWindowViewModel( |
|
|
public MainWindowViewModel( |
|
|
Material material, |
|
|
Material material, |
|
|
IEnumerable<IPoreLocalization> localizations, |
|
|
IEnumerable<IPoreSpread> localizations, |
|
|
IPoreGenerator poreGenerator, |
|
|
IPoreGenerator poreGenerator, |
|
|
ReportGenerator reportSaver, |
|
|
ReportGenerator reportSaver, |
|
|
BatchGenerator batchGenerator, |
|
|
BatchGenerator batchGenerator, |
|
|
ConnectedPoreReportGenerator connectedPoreReportGenerator) |
|
|
ConnectedPoreReportGenerator connectedPoreReportGenerator) |
|
|
{ |
|
|
{ |
|
|
CurrentMaterial = material; |
|
|
CurrentMaterial = material; |
|
|
Localizations = localizations; |
|
|
Spreads = localizations; |
|
|
PoreGeneratorInstance = poreGenerator; |
|
|
PoreGeneratorInstance = poreGenerator; |
|
|
ReportSaver = reportSaver; |
|
|
ReportSaver = reportSaver; |
|
|
BatchGenerator = batchGenerator; |
|
|
BatchGenerator = batchGenerator; |
|
|
ConnectedPoreReportGenerator = connectedPoreReportGenerator; |
|
|
ConnectedPoreReportGenerator = connectedPoreReportGenerator; |
|
|
|
|
|
|
|
|
GeneratePoresCommand = new RelayCommand(GeneratePoresToForm, () => SelectedLocalization != null); |
|
|
GeneratePoresCommand = new RelayCommand(GeneratePoresToForm, () => SelectedSpread != null); |
|
|
SaveToFileCommand = new RelayCommand(Save, () => Pores?.Count > 0); |
|
|
SaveToFileCommand = new RelayCommand(Save, () => Pores?.Count > 0); |
|
|
GenAndSaveBatchCommand = new RelayCommand(SaveBatch, () => Pores?.Count > 0); |
|
|
GenAndSaveBatchCommand = new RelayCommand(SaveBatch, () => Pores?.Count > 0); |
|
|
GenerateAllCommand = new RelayCommand(c => GenAndSaveAll((int)c), () => |
|
|
GenerateAllCommand = new RelayCommand(c => GenAndSaveAll((int)c), () => |
|
|
{ |
|
|
{ |
|
|
if (SelectedLocalization != null) |
|
|
if (SelectedSpread != null) |
|
|
if (AllSavingThread?.IsAlive != true) |
|
|
if (AllSavingThread?.IsAlive != true) |
|
|
return true; |
|
|
return true; |
|
|
return false; |
|
|
return false; |
|
@ -73,10 +73,10 @@ namespace Pores |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void GeneratePoresToForm() |
|
|
public void GeneratePoresToForm() |
|
|
=> Pores = new ObservableCollection<Pore>(PoreGeneratorInstance.Generate(SelectedLocalization)); |
|
|
=> Pores = new ObservableCollection<Pore>(PoreGeneratorInstance.Generate(SelectedSpread)); |
|
|
|
|
|
|
|
|
public IList<Pore> GeneratePores() |
|
|
public IList<Pore> GeneratePores() |
|
|
=> PoreGeneratorInstance.Generate(SelectedLocalization); |
|
|
=> PoreGeneratorInstance.Generate(SelectedSpread); |
|
|
|
|
|
|
|
|
public void Save() |
|
|
public void Save() |
|
|
=> Save(Pores); |
|
|
=> Save(Pores); |
|
|