예제 #1
0
        public SelectableOptionViewModel(ISyncSelectionOption option, SyncOptionListViewModel parentList, SelectableOptionViewModel parent, string filter)
        {
            string str;

            this.isExpanded = true;
            this.lockObject = new object();
            if (option == null)
            {
                throw new ArgumentNullException("option");
            }
            this.Option       = option;
            this.parentVm     = parent;
            this.parentListVm = parentList;
            this.filterString = filter;
            if (parentList != null)
            {
                this.isAutoSelected     = parentList.IsAutoSelected;
                this.autoSelectionValue = parentList.AutoSelectionValue;
            }
            if (StringUtilities.HasArticlePrefix(option.Label, out str))
            {
                this.sortString = str;
            }
            this.InitViewModel();
        }
예제 #2
0
 public void ResetView()
 {
     lock (this.lockObject)
     {
         if (this.childOptionListVm == null)
         {
             this.childOptionListVm = new SyncOptionListViewModel(this.Option.ChildOptions, this);
             this.childOptionListVm.SetAutoSelect(this.isAutoSelected, this.autoSelectionValue);
             this.childView = new ListCollectionView(this.childOptionListVm);
             using (this.childView.DeferRefresh())
             {
                 this.childView.CustomSort = labelSorter;
                 this.childView.Filter     = new Predicate <object>(SelectableOptionViewModel.DoesMatchFilter);
                 goto Label_00C9;
             }
         }
         if (!this.Option.HasChildOptions)
         {
             this.childOptionListVm.Dispose();
             this.childOptionListVm = null;
             this.ChildView         = null;
         }
         Label_00C9 :;
     }
 }
예제 #3
0
 protected static void UpdateFilterStrings(SyncOptionListViewModel list, string filterString)
 {
     if (list != null)
     {
         list.FilterString = filterString;
         foreach (SelectableOptionViewModel model in list)
         {
             model.FilterString = filterString;
         }
     }
 }
예제 #4
0
        private static void ResetPivotOptions(SyncOptionListViewModel list, CollectionViewSource viewSource, bool enabled, bool all)
        {
            UpdateAutomaticSelections(list, enabled, all);
            viewSource.Source = list;
            ListCollectionView view = (ListCollectionView)viewSource.View;

            if (view != null)
            {
                using (view.DeferRefresh())
                {
                    view.CustomSort = labelSorter;
                    view.Filter     = new Predicate <object>(SelectableOptionViewModel.DoesMatchFilter);
                }
            }
        }
예제 #5
0
 private void ResetRingtones()
 {
     if (this.ringtonesSource != null)
     {
         this.ringtonesSource.Dispose();
         this.ringtonesSource = null;
     }
     if (this.MusicAndMovieProvider != null)
     {
         this.ringtonesSource = GetViewModel(this.MusicAndMovieProvider.Ringtones, this.ringtonesFilterStringUpper);
         ResetPivotOptions(this.ringtonesSource, this.ringtones, true, false);
     }
     else
     {
         this.ringtones.Source = null;
     }
 }
예제 #6
0
 private void ResetPodcasts()
 {
     if (this.podcastsSource != null)
     {
         this.podcastsSource.Dispose();
         this.podcastsSource = null;
     }
     if (this.MusicAndMovieProvider != null)
     {
         this.podcastsSource = GetViewModel(this.MusicAndMovieProvider.Podcasts, this.podcastsFilterStringUpper);
         ResetPivotOptions(this.podcastsSource, this.podcasts, this.SyncRules.IsPodcastSyncEnabled, this.SyncRules.SyncAllPodcasts);
     }
     else
     {
         this.podcasts.Source = null;
     }
 }
예제 #7
0
 private void ResetPhotoVideoAlbums()
 {
     if (this.photoVideoAlbumsSource != null)
     {
         this.photoVideoAlbumsSource.Dispose();
         this.photoVideoAlbumsSource = null;
     }
     if (this.PhotoAndVideoProvider != null)
     {
         this.photoVideoAlbumsSource = GetViewModel(this.PhotoAndVideoProvider.PhotoVideoAlbums, this.photosVideosFilterStringUpper);
         ResetPivotOptions(this.photoVideoAlbumsSource, this.photoVideoAlbums, this.SyncRules.IsPhotoVideoSyncEnabled, this.SyncRules.SyncAllPhotosVideos);
     }
     else
     {
         this.photoVideoAlbums.Source = null;
     }
 }
예제 #8
0
 private void ResetMoviesTVShows()
 {
     if (this.moviesTVShowsSource != null)
     {
         this.moviesTVShowsSource.Dispose();
         this.moviesTVShowsSource = null;
     }
     if (this.MusicAndMovieProvider != null)
     {
         this.moviesTVShowsSource = GetViewModel(this.MusicAndMovieProvider.MoviesTVShows, this.moviesTVSeriesFilterStringUpper);
         ResetPivotOptions(this.moviesTVShowsSource, this.moviesTVShows, this.SyncRules.IsTVMoviesSyncEnabled, this.SyncRules.SyncAllTvMovies);
     }
     else
     {
         this.moviesTVShows.Source = null;
     }
 }
예제 #9
0
 private void ResetGenres()
 {
     if (this.genresSource != null)
     {
         this.genresSource.Dispose();
         this.genresSource = null;
     }
     if (this.MusicAndMovieProvider != null)
     {
         this.genresSource = GetViewModel(this.MusicAndMovieProvider.Genres, this.musicFilterStringUpper);
         ResetPivotOptions(this.genresSource, this.genres, this.SyncRules.IsMusicSyncEnabled, this.SyncRules.SyncAllMusic);
     }
     else
     {
         this.genres.Source = null;
     }
 }
예제 #10
0
 protected static void UpdateAutomaticSelections(SyncOptionListViewModel list, bool isSyncEnabled, bool syncAll)
 {
     if (list != null)
     {
         bool autoSelectOn    = false;
         bool autoSelectValue = false;
         if (!isSyncEnabled)
         {
             autoSelectOn = true;
         }
         else if (syncAll)
         {
             autoSelectOn    = true;
             autoSelectValue = true;
         }
         list.SetAutoSelect(autoSelectOn, autoSelectValue);
     }
 }
예제 #11
0
 public SelectableOptionViewModel(ISyncSelectionOption option, SyncOptionListViewModel parentList, string filter) : this(option, parentList, null, filter)
 {
 }
예제 #12
0
 public SelectableOptionViewModel(ISyncSelectionOption option, SyncOptionListViewModel parentList, SelectableOptionViewModel parent) : this(option, parentList, parent, null)
 {
 }