Example #1
0
 public GolfView(GolfModel golfModel)
 {
     InitializeComponent();
     DataContext = _viewModel = new GolfViewModel(golfModel);
     _viewModel.PropertyChanged += ViewModelOnPropertyChanged;
     Unloaded += GolfView_Unloaded;
 }
Example #2
0
        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;
        }
Example #4
0
        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;
        }
Example #5
0
 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);
                     }));
         }
     }
 }