public PhoneMainViewModel(IBirthdaySource source, ISettingsService settings, INavigationService navigation)
            : base(source, settings, navigation)
        {
            AboutCommand    = new RelayCommand(About);
            SettingsCommand = new RelayCommand(Settings);
            RateCommand     = new RateThisAppCommand();
            PinCommand      = new RelayCommand(PinToStart);
            var addContactCmd = new AddContactCommand();

            addContactCmd.ContactAdded += addContactCmd_ContactAdded;
            AddContactCommand           = addContactCmd;
            ViewPeopleCommand           = new ViewPeopleCommand();
        }
Beispiel #2
0
        public MainViewModel(IBirthdaySource source, ISettingsService settings, INavigationService navigation)
        {
            if (source == null)
            {
                throw new ArgumentNullException("repository");
            }
            _source = source;
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            _settings = settings;
            if (navigation == null)
            {
                throw new ArgumentNullException("navigation");
            }
            _navigation = navigation;

            _allBirthdays = new List <BirthdayContact>();
            _allContacts  = new ObservableCollection <ContactViewModel>();
            _allContacts.CollectionChanged += (s, e) =>
            {
                RaisePropertyChanged(() => AllContacts);
            };
            _upcomingContacts = new ObservableCollection <ContactViewModel>();
            _upcomingContacts.CollectionChanged += (s, e) =>
            {
                RaisePropertyChanged(() => UpcomingContacts);
            };
            _pastContacts = new ObservableCollection <ContactViewModel>();
            _pastContacts.CollectionChanged += (s, e) =>
            {
                RaisePropertyChanged(() => PastContacts);
            };

            _monthNames = new List <MonthGroup>();
            for (int i = 0; i < 12; i++)
            {
                _monthNames.Add(new MonthGroup(new DateTime(DateTime.Today.Year, i + 1, 1, 0, 0, 0, DateTimeKind.Utc)));
            }

            _contactGroups = new List <MonthGroup>();
        }