예제 #1
0
 public GolfView(GolfModel golfModel)
 {
     InitializeComponent();
     DataContext = _viewModel = new GolfViewModel(golfModel);
     _viewModel.PropertyChanged += ViewModelOnPropertyChanged;
     Unloaded += GolfView_Unloaded;
 }
예제 #2
0
        public GolfFollowResource(GolfModel golfModel)
        {
            InitializeComponent();
            DataContext = ViewModel = new GolfFollowResourceViewModel(golfModel);

            Owner = Application.Current.MainWindow;
            Loaded += OnGolfFollowResourcesViewLoaded;
            ViewModel.PropertyChanged += ViewModelOnPropertyChanged;
        }
예제 #3
0
        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;
        }
예제 #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;
        }
예제 #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);
                     }));
         }
     }
 }