Exemplo n.º 1
0
        private void SubscribeToViewModelEvents(ProjectsViewModel projectsViewModel)
        {
            if (projectsViewModel.Projects.Count > 0)
            {
                AddProjectsItems(projectsViewModel.Projects.ToList() as IList <Project>);
            }

            projectsViewModel.Projects.CollectionChanged += OnProjectsCollectionChanged;
            projectsViewModel.ProjectSelected            += OnProjectSelected;
        }
Exemplo n.º 2
0
        private void DataContextChangedEventHandler(object sender, DependencyPropertyChangedEventArgs e)
        {
            if (DataContext != null && DataContext is ProjectsViewModel)
            {
                _viewModel = DataContext as ProjectsViewModel;

                Control createProjectControl = CreateCpControl();
                currentUserProjectsContainer.Children.Add(createProjectControl);
                _viewModel.ViewContext = this;

                SubscribeToViewModelEvents();

                RefreshShowErrorMessageDialogVisibility();
                RefreshCreateNewProjectDialogVisibility();
            }
        }
Exemplo n.º 3
0
        public ProjectsView()
        {
            InitializeComponent();

            if (DataContext is ProjectsViewModel)
            {
                _viewModel = DataContext as ProjectsViewModel;

                Control createProjectControl = CreateCpControl();
                currentUserProjectsContainer.Children.Add(createProjectControl);

                SubscribeToViewModelEvents();

                RefreshShowErrorMessageDialogVisibility();
                RefreshCreateNewProjectDialogVisibility();
            }
            else
            {
                DataContextChanged += new DependencyPropertyChangedEventHandler(DataContextChangedEventHandler);
            }
        }