コード例 #1
0
        private void InitializeCommands()
        {
            _hideErrorMessageDialog = new Command(
                () =>
            {
                ShowErrorMessageDialog = false;

                if (_menuBasedShellViewModel.CurrentTeam == null)
                {
                    _menuBasedShellViewModel.SetCurrentViewModel(typeof(TeamsViewModel));
                }
            },
                null);

            _requestProjectCreation = new Command(
                new Action(
                    delegate
            {
                if (_menuBasedShellViewModel.CurrentTeam == null)
                {
                    ShowErrorMessage("Select team!");
                }
                else
                {
                    ShowCreateNewProjectDialog = true;
                }
            }),
                null);

            _createProjectCommand  = new Command(CreateProject, CanCreateProject);
            _cancelProjectCreation = new Command(
                new Action(delegate { ShowCreateNewProjectDialog = false; }),
                null);
        }
コード例 #2
0
        private void InitializeFields()
        {
            Project currentProject = _menuBasedShellViewModel.CurrentProject;

            if (currentProject == null)
            {
                MessageBoxViewModel            = new MessageBoxViewModel();
                MessageBoxViewModel.Text       = "Select project!";
                MessageBoxViewModel.Confirmed += delegate
                {
                    _menuBasedShellViewModel.SetCurrentViewModel(typeof(Projects.ProjectsViewModel));
                };
                SetDialog?.Invoke(this, MessageBoxViewModel);
                return;
            }

            Data.Entities.Sprint currentSprint = _sprintsDataModel.GetSprintByProjectId(_menuBasedShellViewModel.CurrentProject.Id);

            if (currentSprint == null)
            {
                SprintDialogViewModel = new SprintDialogViewModel();
                SprintDialogViewModel.ConfirmSelected += delegate
                {
                    CreateSprintFromDialog(); // Here sets value of '_currentSprint'.
                    HideDialog?.Invoke(this, null);
                };
                SprintDialogViewModel.CancelSelected += delegate { /*HideDialog?.Invoke(this, null);*/ };
                SetDialog?.Invoke(this, SprintDialogViewModel);
            }
            else
            {
                if (_currentSprint != null)
                {
                    if (!_currentSprint.Equals(currentSprint))
                    {
                        _currentSprint = currentSprint;
                        Backlog          currentSprintBacklog = ComponentsContainer.Get <IBacklogsDataModel>().GetBacklogById(currentSprint.BacklogId);
                        List <StoryItem> items = ConvertToStoryItems(currentSprintBacklog.Stories);
                        AllUserStories = new ObservableCollection <StoryItem>(items);
                        InitializeSprintDependentFields();
                    }
                }
                else
                {
                    _currentSprint = currentSprint;
                    Backlog          currentSprintBacklog = ComponentsContainer.Get <IBacklogsDataModel>().GetBacklogById(currentSprint.BacklogId);
                    List <StoryItem> items = ConvertToStoryItems(currentSprintBacklog.Stories);
                    AllUserStories = new ObservableCollection <StoryItem>(items);
                    InitializeSprintDependentFields();
                }
            }
        }
コード例 #3
0
        internal LogoutViewModel(MenuBasedShellViewModel menuBasedShellViewModel)
        {
            _menuBasedShellViewModel = menuBasedShellViewModel;

            SetDialog += delegate(object sender, ViewModelBase dialogViewModel)
            {
                CurrentDialogViewModel = dialogViewModel;
                ShowDialog             = true;
            };

            HideDialog += delegate
            {
                ShowDialog = false;
            };

            ConfirmationDialogViewModel                  = new ConfirmationDialogViewModel();
            ConfirmationDialogViewModel.Text             = "Do you really want to log out?";
            ConfirmationDialogViewModel.ConfirmSelected += delegate
            {
                try
                {
                    _menuBasedShellViewModel.Logout();
                }
                catch
                {
                    if (ViewContext != null)
                    {
                        ComponentsContainer.Get <IDialogCoordinator>().ShowMessageAsync(
                            ViewContext,
                            "Log out error",
                            "Please, run applications with administrator rights and try to log out again.");
                    }
                }
            };
            ConfirmationDialogViewModel.CancelSelected += delegate
            {
                _menuBasedShellViewModel.SetCurrentViewModel(typeof(AllUserTasksViewModel));
            };

            SetDialog?.Invoke(this, ConfirmationDialogViewModel);
        }