public MembersListViewModel(
            [Import] IBackgroundExecutor backgroundExecutor,
            [Import] IEventAggregator eventAggregator,
            [Import] IAuthorizationService authorizator,
            [Import] IDialogService dialogService,
            [Import] ITeamService teamService,
            [Import] IProjectsService projectService)
        {
            this.aggregator = eventAggregator;
                this.executor = backgroundExecutor;
                this.authorizator = authorizator;
                this.dialogs = dialogService;

                this.teamService = teamService;
                this.projectService = projectService;

                membersViewSource = new System.Windows.Data.CollectionViewSource();
                membersViewSource.SortDescriptions.Add(new SortDescription("MemberProfile.FullName", ListSortDirection.Ascending));

                membersViewSource.Filter += new FilterEventHandler(membersViewSource_Filter);
                delayFilter = new DelayAction(500, new DelayAction.ActionDelegate(() => { if (FilteredMembers != null) FilteredMembers.Refresh(); }));

                aggregator.Subscribe<MemberProfile>(ScrumFactoryEvent.SignedMemberChanged, OnSignedMemberChanged);

                aggregator.Subscribe<MemberProfile>(ScrumFactoryEvent.ShowMemberDetail,
                    member => {
                        dialogs.SelectTopMenu(this);
                        ShowDetail(member);
                    });

                OnLoadCommand = new DelegateCommand(() => { if (NeedRefresh) LoadMembers(); });
                RefreshCommand = new DelegateCommand(LoadMembers);
                ShowDetailWindowCommand = new DelegateCommand<MemberViewModel>(ShowDetail);

                AddNewMemberCommand = new DelegateCommand(CanAddMember, AddMember);

                OnlyActiveMembers = true;

                NeedRefresh = true;
        }
        public ProjectsListViewModel(
            [Import] IEventAggregator aggregator,
            [Import] IProjectsService projectsService,
            [Import] IBackgroundExecutor executor,
            [Import] IDialogService dialogs,
            [Import] IAuthorizationService authorizator)
        {
            this.aggregator = aggregator;
            this.projectsService = projectsService;
            this.executor = executor;
            this.dialogs = dialogs;
            this.authorizator = authorizator;

            projectsViewSource = new System.Windows.Data.CollectionViewSource();
            projectsViewSource.SortDescriptions.Add(new SortDescription("Status", ListSortDirection.Ascending));
            projectsViewSource.SortDescriptions.Add(new SortDescription("TotalDayAllocation", ListSortDirection.Descending));
            projectsViewSource.SortDescriptions.Add(new SortDescription("ProjectNumber", ListSortDirection.Descending));

            projectsViewSource.Filter += new System.Windows.Data.FilterEventHandler(FilteredProjects_Filter);
            delayFilter = new DelayAction(500, new DelayAction.ActionDelegate(() => {
                if (allDataLoaded && FilteredProjects != null) {
                    FilteredProjects.Refresh();
                    SetGroupCount();
                } else {
                    LoadProjectList();
                }
            }));

            aggregator.Subscribe<Project>(ScrumFactoryEvent.ProjectStatusChanged, OnProjectStatusChanged);

            aggregator.Subscribe<Project>(ScrumFactoryEvent.ProjectCreated, OnProjectCreated);

            aggregator.Subscribe<MemberProfile>(ScrumFactoryEvent.SignedMemberChanged,
                m => {
                    ((DelegateCommand)CreateProjectCommand).NotifyCanExecuteChanged();
                    if (m == null) {
                        OnProjectListLoaded(new List<Project>());
                        SelectedProject = null;
                        aggregator.Publish<Project>(ScrumFactoryEvent.ViewProjectDetails, SelectedProject);
                        return;
                    }
                    LoadProjectList();
                    ShowDetailOnInit();
                });

            aggregator.Subscribe<Project>(ScrumFactoryEvent.ViewProjectDetails, p => {
                if (SelectedProject != p)
                    SelectedProject = p;
            });

            aggregator.Subscribe(ScrumFactoryEvent.CreateNewProject, () => {
                dialogs.SelectTopMenu(this);
                OpenCreateProjectWindow();
            });

            aggregator.Subscribe<int>(ScrumFactoryEvent.ProjectArgOnInit, OnProjectArgOnInit);

            OnLoadCommand = new DelegateCommand(() => { if (NeedRefresh) LoadProjectList(); });

            RefreshProjectListCommand = new DelegateCommand(() => { LoadProjectList(); });
            ShowDetailWindowCommand = new DelegateCommand<Project>(p => { ShowDetailWindow(p.ProjectUId); });
            CreateProjectCommand = new DelegateCommand(CanCreateProject, OpenCreateProjectWindow);

            CopyToClipboardCommand = new DelegateCommand(CopyToClipboard);

            LoadMoreCommand = new DelegateCommand(() => { LoadProjectList(false); });

            NeedRefresh = true;
        }