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();
 }
 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;
     }
 }
 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;
     }
 }
 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;
     }
 }
 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;
     }
 }
 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;
     }
 }
 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);
         }
     }
 }
 protected static void UpdateFilterStrings(SyncOptionListViewModel list, string filterString)
 {
     if (list != null)
     {
         list.FilterString = filterString;
         foreach (SelectableOptionViewModel model in list)
         {
             model.FilterString = filterString;
         }
     }
 }
 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);
     }
 }
 public SelectableOptionViewModel(ISyncSelectionOption option, SyncOptionListViewModel parentList, string filter)
     : this(option, parentList, null, filter)
 {
 }
 public SelectableOptionViewModel(ISyncSelectionOption option, SyncOptionListViewModel parentList, SelectableOptionViewModel parent)
     : this(option, parentList, parent, null)
 {
 }
 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:;
     }
 }