public MainViewModel(IDataProvider dataProvider, IEditWindowController editWindowController, IDialogService dialogService) { DataProvider = dataProvider; EditWindowController = editWindowController; DialogService = dialogService; AddPersonalCommand = new RelayCommand(AddPersonal); EditPersonalCommand = new RelayCommand <Personal>(EditPersonal, personal => SelectedPersonal != null); DeletePersonalCommand = new RelayCommand <Personal>(DeletePersonal, personal => SelectedPersonal != null); AllPersonals = new ObservableCollection <Personal>(dataProvider.GetAllPersonal().OfType <Personal>()); }
public MainViewModel(IDataProvider dataProvider, IEditWindowController editWindowController, IDialogService dialogService) { DataProvider = dataProvider; EditWindowController = editWindowController; DialogService = dialogService; AddFriendCommand = new RelayCommand(AddFriend); EditFriendCommand = new RelayCommand <Friend>(EditFriend, friend => SelectedFriend != null); DeleteFriendCommand = new RelayCommand <Friend>(DeleteFriend, friend => SelectedFriend != null); AllFriends = new ObservableCollection <Friend>(dataProvider.GetAllFriends().OfType <Friend>()); }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel(IDataProvider dataProvider, IEditWindowController editWindowController, IDialogService dialogService) { DataProvider = dataProvider; EditWindowController = editWindowController; DialogService = dialogService; AddContactCommand = new RelayCommand(AddContact); EditContactCommand = new RelayCommand <Contact>(EditContact, contact => SelectedContact != null); DeleteContactCommand = new RelayCommand <Contact>(DeleteContact, contact => SelectedContact != null); ExitProgramCommand = new RelayCommand(ExitProgram); AllContacts = new ObservableCollection <Contact>(dataProvider.GetAllContacts().OfType <Contact>()); }