Created
December 15, 2015 19:56
-
-
Save BrianJVarley/736aac6275cdc54da10c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MongoDBApp.ViewModels | |
{ | |
[ImplementPropertyChanged] | |
public class CustomerOrdersViewModel : IPageViewModel | |
{ | |
public ICommand EditCommand { get; set; } | |
private IDialogService _dialogService; | |
public CustomerOrdersViewModel(IDialogService dialogservice) | |
{ | |
this._dialogService = dialogservice; | |
Messenger.Default.Register<UpdateProductMessage>(this, OnUpdateProductMessageReceived); | |
LoadCommands(); | |
} | |
public ProductModel SelectedProduct { get; set; } | |
#region methods | |
private void LoadCommands() | |
{ | |
EditCommand = new CustomCommand(EditOrder, CanModifyOrder); | |
} | |
private bool CanModifyOrder(object obj) | |
{ | |
if (SelectedOrder != null && SelectedOrder.Email != null && SelectedOrder.Date != null && | |
SelectedOrder.Id != null && SelectedProduct != null ) | |
{ | |
return true; | |
} | |
return false; | |
} | |
private void EditOrder(object obj) | |
{ | |
Messenger.Default.Send<ProductModel>(SelectedProduct); | |
_dialogService.ShowDetailDialog(); | |
} | |
#endregion | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MongoDBApp.ViewModels | |
{ | |
[ImplementPropertyChanged] | |
class ProductViewModel | |
{ | |
public ProductViewModel() | |
{ | |
Messenger.Default.Register<ProductModel>(this, OnProductReceived); | |
} | |
public ProductModel SelectedProduct { get; set; } | |
#region methods | |
public void OnProductReceived(ProductModel product) | |
{ | |
SelectedProduct = product; | |
} | |
#endregion | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment