Beispiel #1
0
        public MainPageViewModel()
        {
            AddReminderCommand = new AddReminderCommand(this);

            Namedays = new ObservableCollection <NamedayModel>();

            if (Windows.ApplicationModel.DesignMode.DesignModeEnabled)
            {
                Contacts = new ObservableCollection <ContactEx>
                {
                    new ContactEx("Contact", "1"),
                    new ContactEx("Contact", "2"),
                    new ContactEx("Contact", "3"),
                };

                for (int month = 1; month <= 12; month++)
                {
                    _allNamedays.Add(new NamedayModel(
                                         month, 1, new string[] { "Adam" }));
                    _allNamedays.Add(new NamedayModel(
                                         month, 24, new string[] { "Eve", "Andrew" }));
                }
                PerformFiltering();
            }
            else
            {
                LoadData();
            }
        }
        public MainPageViewModel()
        {
            AddReminderCommand = new AddReminderCommand(this);

            Namedays = new ObservableCollection<NamedayModel>();

            if (Windows.ApplicationModel.DesignMode.DesignModeEnabled)
            {
                Contacts = new ObservableCollection<ContactEx>
                               {
                                   new ContactEx("Contact", "1"),
                                   new ContactEx("Contact", "2"),
                                   new ContactEx("Contact", "3"),
                               };

                for (int month = 1; month <= 12; month++)
                {
                    _allNamedays.Add(new NamedayModel(
                        month, 1, new string[] { "Adam" }));
                    _allNamedays.Add(new NamedayModel(
                        month, 24, new string[] { "Eve", "Andrew" }));
                }
                PerformFiltering();
            }
            else
                LoadData();
        }
        public MainPageData()
        {
            AddReminderCommand = new AddReminderCommand(this);

            Namedays = new ObservableCollection<NamedayModel>();

            // to use only fake data in designing 
            // Whether the code is running in Run-time or Designer
            if (Windows.ApplicationModel.DesignMode.DesignModeEnabled)
            {

                // fake contact data
                Contacts = new ObservableCollection<ContactEx> {
                   new ContactEx("Contact","1"),
                   new ContactEx("Contact","2"),
                   new ContactEx("Contact","3")
                };


                // fake Nameday data
                for (int month = 1; month <= 12; month++)
                {
                    _allNamedays.Add(new NamedayModel(
                        month, 1, new string[] { "Adam" }));
                    _allNamedays.Add(new NamedayModel(
                        month, 24, new string[] { "Eve", "Andrew" }));
                }

                PerformFiltering();
            }
            else
                LoadData(); // async from server
        }