コード例 #1
0
        public ContactsState()
        {
            mailbox = VirtualMailBox.Current;

            SelectedPersons = new AdvancedObservableCollection <Person>();

            PersonsViewSource = new CollectionViewSource {
                Source = VirtualMailBox.Current.Persons
            };
            PersonsViewSource.View.Filter = ContactsViewSourceFilter;

            Sort = new SortHelper(PersonsViewSource);
            Sort.LoadSettings();

            Filter = new FilterHelper(PersonsViewSource);

            SelectedPersons.CollectionChanged += delegate
            {
                OnPropertyChanged("SelectedPerson");

                OnSelectionChanged();
            };

            EventBroker.Subscribe(AppEvents.SyncContactsFinished, () => Thread.CurrentThread.ExecuteOnUIThread(() => PersonsViewSource.View.Refresh()));
        }
コード例 #2
0
        public NotesState()
        {
            SelectedNotes = new AdvancedObservableCollection <Note>();
            Notes         = new AdvancedObservableCollection <Note>();

            NotesViewSource = new CollectionViewSource {
                Source = Notes
            };
            NotesViewSource.View.Filter = NotesViewSourceFilter;

            new CollectionObserverDelegate <ChannelInstance>(ChannelsManager.Channels, delegate(ChannelInstance channel)
            {
                channel.IsVisibleChanged += delegate { NotesViewSource.View.Refresh(); };
            });

            Sort = new SortHelper(NotesViewSource);
            Sort.LoadSettings();

            Filter = new FilterHelper(NotesViewSource);
            Filter.LoadSettings();

            SelectedNotes.CollectionChanged += delegate
            {
                OnPropertyChanged("SelectedNote");

                OnSelectionChanged();
            };
        }
コード例 #3
0
        public DocumentsState()
        {
            SelectedDocuments = new AdvancedObservableCollection <Document>();

            DocumentsViewSource = new CollectionViewSource {
                Source = Documents
            };

            DocumentSort = new SortHelper(DocumentsViewSource, "Documents");
            DocumentSort.LoadSettings();
            DocumentFilter = new FilterHelper(DocumentsViewSource);

            DocumentsViewSource.View.Filter = DocumentsViewSourceFilter;

            ImagesViewSource = new CollectionViewSource {
                Source = Documents
            };

            ImageSort = new SortHelper(ImagesViewSource, "Images");
            ImageSort.LoadSettings();

            ImageFilter = new FilterHelper(ImagesViewSource);

            ImagesViewSource.View.Filter = ImagesViewSourceFilter;

            SelectedDocuments.CollectionChanged += delegate
            {
                OnPropertyChanged("SelectedDocument");

                OnSelectionChanged();
            };
        }
コード例 #4
0
        public CalendarState()
        {
            // Set the viewsource of the events collection
            Events           = new AdvancedObservableCollection <Event>();
            EventsViewSource = new CollectionViewSource {
                Source = Events
            };
            EventsViewSource.View.Filter = CalendarViewSourceFilter;

            // Add channel turn off/on execution code
            new CollectionObserverDelegate <ChannelInstance>(ChannelsManager.Channels,
                                                             delegate(ChannelInstance channel)
            {
                channel.IsVisibleChanged += delegate { EventsViewSource.View.Refresh(); };
            });

            // Add sorters
            Sort = new SortHelper(EventsViewSource);
            Sort.LoadSettings();

            // Add filters
            Filter = new FilterHelper(EventsViewSource);
            Filter.LoadSettings();

            // Add selection for days
            SelectedDays = new AdvancedObservableCollection <Day>();
            SelectedDays.CollectionChanged += delegate
            {
                OnPropertyChanged("SelectedDay");
                OnSelectionChanged();
            };
            SelectedDaysViewSource = new CollectionViewSource {
                Source = Events
            };
            SelectedDaysViewSource.View.Filter = SelectedDaysViewSourceFilter;

            // Add selection for events
            SelectedEvents = new AdvancedObservableCollection <Event>();
            SelectedEvents.CollectionChanged += delegate
            {
                OnPropertyChanged("SelectedEvent");
                OnSelectionChanged();
            };
        }