예제 #1
0
        public RepositoryViewModel(TaskRepository repository, IDialogServiceFactory fileDialogServiceFactory, String filename)
        {
            if (null == repository)
            {
                throw new ArgumentNullException("repository");
            }
            if (null == fileDialogServiceFactory)
            {
                throw new ArgumentNullException("fileDialogService");
            }
            _dialog     = fileDialogServiceFactory.CreateService();
            _repository = repository;
            _filename   = filename;
            _workspaces = new WorkspaceCollectionViewModel <WorkspaceViewModel>();
            _tree       = new WorkspaceCollectionViewModel <CollectionTreeViewModel>(
                _repository.Select(x => new CollectionTreeViewModel(x, _repository, _dialog)));
            _tree.PropertyChanged       += this.OnChildCollectionPropertyChanged;
            _tree.RequestOpen           += this.OnWorkspaceRequestOpen;
            _workspaces.PropertyChanged += this.OnChildCollectionPropertyChanged;
            _workspaces.RequestOpen     += this.OnWorkspaceRequestOpen;
            _workspaces.RequestClose    += this.OnWorkspaceRequestClose;

            _repository.RepositoryChanged += this.OnRepositoryChanged;
            this.IsSaved = true;
        }
예제 #2
0
 public MainWindowViewModel(IDialogServiceFactory fileDialogServiceFactory)
 {
     if (null == fileDialogServiceFactory)
         throw new ArgumentNullException("fileDialogService");
     _dialogFactory = fileDialogServiceFactory;
     _dialog = _dialogFactory.CreateService();
     _repositories = new WorkspaceCollectionViewModel<RepositoryViewModel>();
     _repositories.RequestClose += this.OnRequestClose;
 }
예제 #3
0
 public MainWindowViewModel(IDialogServiceFactory fileDialogServiceFactory)
 {
     if (null == fileDialogServiceFactory)
     {
         throw new ArgumentNullException("fileDialogService");
     }
     _dialogFactory              = fileDialogServiceFactory;
     _dialog                     = _dialogFactory.CreateService();
     _repositories               = new WorkspaceCollectionViewModel <RepositoryViewModel>();
     _repositories.RequestClose += this.OnRequestClose;
 }
예제 #4
0
        public RepositoryViewModel(TaskRepository repository, IDialogServiceFactory fileDialogServiceFactory, String filename)
        {
            if (null == repository)
                throw new ArgumentNullException("repository");
            if (null == fileDialogServiceFactory)
                throw new ArgumentNullException("fileDialogService");
            _dialog = fileDialogServiceFactory.CreateService();
            _repository = repository;
            _filename = filename;
            _workspaces = new WorkspaceCollectionViewModel<WorkspaceViewModel>();
            _tree = new WorkspaceCollectionViewModel<CollectionTreeViewModel>(
                _repository.Select(x => new CollectionTreeViewModel(x, _repository, _dialog)));
            _tree.PropertyChanged += this.OnChildCollectionPropertyChanged;
            _tree.RequestOpen += this.OnWorkspaceRequestOpen;
            _workspaces.PropertyChanged += this.OnChildCollectionPropertyChanged;
            _workspaces.RequestOpen += this.OnWorkspaceRequestOpen;
            _workspaces.RequestClose += this.OnWorkspaceRequestClose;

            _repository.RepositoryChanged += this.OnRepositoryChanged;
            this.IsSaved = true;
        }