Source

main-vinayFork / Source / Excel / Excel.AddIn / Excel.AddIn / ViewModels / RepositoryDetailListViewModel.cs

using System.Collections.ObjectModel;

namespace DataUp.Excel.Addin
{
    public class RepositoryDetailListViewModel : ViewModelBase
    {
        private ObservableCollection<RepositoryDetailsViewModel> repositoryList;

        private RepositoryDetailsViewModel repositoryDetailsViewModel;

        public RepositoryDetailsViewModel RepositoryDetailsViewModel
        {
            get
            {
                return repositoryDetailsViewModel;
            }
            set
            {
                repositoryDetailsViewModel = value;
                OnNotifyPropertyChanged("RepositoryDetailsViewModel");
                if (this.RepositoryDetailsViewModel != null)
                {
                    this.RepositoryDetailsViewModel.LoadFromCache();
                }
            }
        }

        public ObservableCollection<RepositoryDetailsViewModel> RepositoryList
        {
            get
            {
                return repositoryList;
            }
            set
            {
                repositoryList = value;
                OnNotifyPropertyChanged("RepositoryList");
            }
        }

        public RepositoryDetailListViewModel()
        {
            this.RepositoryDetailsViewModel = new RepositoryDetailsViewModel();
            this.RepositoryList = new ObservableCollection<RepositoryDetailsViewModel>();
        }

        public void LoadValues()
        {
            this.RepositoryList.Clear();

            foreach (var repository in Controller.Instance.GetRepositories())
            {
                this.RepositoryList.Add(new RepositoryDetailsViewModel()
                {
                    IsPasswordRequired = repository.IsPasswordRequired,
                    RepositoryName = repository.RepositoryName,
                    RepositoryType = repository.RepositoryType
                });
            }

            if (this.RepositoryDetailsViewModel != null)
            {
                this.RepositoryDetailsViewModel.Clear();
                this.RepositoryDetailsViewModel.LoadFromCache();
            }
            else
            {
                this.RepositoryDetailsViewModel = new RepositoryDetailsViewModel();
                this.RepositoryDetailsViewModel.LoadFromCache();
            }
        }
    }
}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.