public GolfView(GolfModel golfModel) { InitializeComponent(); DataContext = _viewModel = new GolfViewModel(golfModel); _viewModel.PropertyChanged += ViewModelOnPropertyChanged; Unloaded += GolfView_Unloaded; }
public GolfFollowResource(GolfModel golfModel) { InitializeComponent(); DataContext = ViewModel = new GolfFollowResourceViewModel(golfModel); Owner = Application.Current.MainWindow; Loaded += OnGolfFollowResourcesViewLoaded; ViewModel.PropertyChanged += ViewModelOnPropertyChanged; }
public GolfFollowResourceViewModel(GolfModel golfModel) { var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve <IDataUnitLocator>(); _adminDataUnit = dataUnitLocator.ResolveDataUnit <IAdminDataUnit>(); SubmitCommand = new RelayCommand(SubmitCommandExecuted); Golf = golfModel; GolfFollowResources = new ObservableCollection <GolfModel>(); GolfFollowResources.CollectionChanged += GolfFollowResources_CollectionChanged; }
private void SetGolfTurnDefault(GolfModel model) { if (model.Golf.TurnDefault != null) { if (Golfs.Any(golf => golf.Golf.ID == model.Golf.TurnDefault)) { Application.Current.Dispatcher.BeginInvoke( new Action( () => { model.TurnDefaultGolf = Golfs.FirstOrDefault(golf => golf.Golf.ID == model.Golf.TurnDefault); })); } } }
public GolfViewModel(GolfModel golfModel) { if (IsDirty) { IsDirty = false; } var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve <IDataUnitLocator>(); _adminDataUnit = dataUnitLocator.ResolveDataUnit <IAdminDataUnit>(); SaveCommand = new RelayCommand(SaveCommandExecuted, SaveCommandCanExecute); EditFollowResourceCommand = new RelayCommand(EditFollowResourceCommandExecuted); Golf = golfModel; Golf.PropertyChanged += OnPropertyChanged; Golf.Golf.PropertyChanged += OnPropertyChanged; }
private void SetGolfTurnDefault(GolfModel model, Guid?turnDefaultId, ObservableCollection <GolfModel> Golfs) { if (turnDefaultId != null) { if (Golfs.Any(golf => golf.Golf.ID == turnDefaultId)) { Application.Current.Dispatcher.BeginInvoke( new Action( () => { model.TurnDefaultGolf = Golfs.FirstOrDefault(golf => golf.Golf.ID == turnDefaultId); })); } } }
private void SetAvailableGolfs(GolfModel golf) { golf.AvailableGolfs = new ObservableCollection <GolfModel>(golf.Golf.GolfFollowResources.Select(x => Golfs.Where(p => p.Golf.ID == x.FollowResourceID).FirstOrDefault())); }