diff options
Diffstat (limited to 'Xamarin.PropertyEditing.Mac/Controls/RequestResource/RequestResourcePanel.cs')
-rw-r--r-- | Xamarin.PropertyEditing.Mac/Controls/RequestResource/RequestResourcePanel.cs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/RequestResource/RequestResourcePanel.cs b/Xamarin.PropertyEditing.Mac/Controls/RequestResource/RequestResourcePanel.cs index 4907d2a..2a3143b 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/RequestResource/RequestResourcePanel.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/RequestResource/RequestResourcePanel.cs @@ -18,7 +18,8 @@ namespace Xamarin.PropertyEditing.Mac private NSTableView resourceTable; private ResourceTableDataSource dataSource; - private ResourceSelectorViewModel viewModel; + private readonly ResourceSelectorViewModel viewModel; + public ResourceSelectorViewModel ViewModel => this.viewModel; private SimpleCollectionView collectionView => this.viewModel.Resources as SimpleCollectionView; public Resource SelectedResource { @@ -38,11 +39,14 @@ namespace Xamarin.PropertyEditing.Mac private object selectedValue; - public RequestResourcePanel (ResourceSelectorViewModel viewModel, object value) + public RequestResourcePanel (IHostResourceProvider hostResources, ResourceSelectorViewModel viewModel, object value) { + if (hostResources == null) + throw new ArgumentNullException (nameof (hostResources)); + this.viewModel = viewModel; this.viewModel.PropertyChanged += OnPropertyChanged; - Initialize (value); + Initialize (hostResources, value); } private void OnPropertyChanged (object sender, PropertyChangedEventArgs e) @@ -58,7 +62,7 @@ namespace Xamarin.PropertyEditing.Mac } } - private void Initialize (object selectedValue) + private void Initialize (IHostResourceProvider hostResources, object selectedValue) { this.selectedValue = selectedValue; Frame = new CGRect (10, 35, 630, 305); @@ -80,7 +84,7 @@ namespace Xamarin.PropertyEditing.Mac }; this.dataSource = new ResourceTableDataSource (viewModel); - var resourceTableDelegate = new ResourceTableDelegate (dataSource); + var resourceTableDelegate = new ResourceTableDelegate (hostResources, dataSource); resourceTableDelegate.ResourceSelected += (sender, e) => { this.previewPanel.SelectedResource = SelectedResource; |