Esempio n. 1
0
 private void ShowMessage(string text)
 {
     MessageBoxViewModel            = new MessageBoxViewModel();
     MessageBoxViewModel.Text       = text;
     MessageBoxViewModel.Confirmed += delegate { HideDialog?.Invoke(this, null); };
     SetDialog?.Invoke(this, MessageBoxViewModel);
 }
Esempio n. 2
0
 private void ShowMessage(string text, EventHandler confirmEventHandler)
 {
     MessageBoxViewModel            = new MessageBoxViewModel();
     MessageBoxViewModel.Text       = text;
     MessageBoxViewModel.Confirmed += confirmEventHandler;
     SetDialog?.Invoke(this, MessageBoxViewModel);
 }
Esempio n. 3
0
        private void InitializeCommands()
        {
            _requestUserStoryCreation = new Command(
                new Action(
                    delegate
            {
                StoryDialogViewModel = new StoryDialogViewModel();
                StoryDialogViewModel.IsStatusEditable = false;
                StoryDialogViewModel.Status           = _storyStatusesDataModel.GetStatusText(StoryStatus.WaitingForExecutor);
                StoryDialogViewModel.ConfirmSelected += CreateStoryFromDialog;
                StoryDialogViewModel.CancelSelected  +=
                    delegate
                {
                    HideDialog?.Invoke(this, null);
                };
                SetDialog?.Invoke(this, StoryDialogViewModel);
            }),
                null);

            _finishCommand = new Command(
                new Action(
                    delegate
            {
                ConfirmationDialogViewModel                  = new ConfirmationDialogViewModel();
                ConfirmationDialogViewModel.Text             = "Do you really want to finish the sprint now?";
                ConfirmationDialogViewModel.ConfirmSelected += FinishCurrentSprint;
                ConfirmationDialogViewModel.CancelSelected  +=
                    delegate
                {
                    HideDialog?.Invoke(this, null);
                };
                SetDialog?.Invoke(this, ConfirmationDialogViewModel);
            }),
                null);

            _requestStoryEditing = new Command(
                parameterizedAction :
                delegate(object param)
            {
                StoryDialogViewModel = new StoryDialogViewModel();
                StoryDialogViewModel.IsStatusEditable = true;
                StoryDialogViewModel.ConfirmSelected += EditSelectedStory;
                StoryDialogViewModel.CancelSelected  += delegate { HideDialog?.Invoke(this, null); };
                FillStoryDialog(param);
                SetDialog?.Invoke(this, StoryDialogViewModel);
            },
                canExecute: null);

            _requestStoryRemoving = new Command(
                parameterizedAction :
                delegate(object param)
            {
                ConfirmationDialogViewModel                  = new ConfirmationDialogViewModel();
                ConfirmationDialogViewModel.Text             = "Are you sure you want to delete the user story?";
                ConfirmationDialogViewModel.ConfirmSelected += RemoveSelectedStory;
                ConfirmationDialogViewModel.CancelSelected  += delegate { HideDialog?.Invoke(this, null); };
                SetDialog?.Invoke(this, ConfirmationDialogViewModel);
            },
                canExecute: null);
        }
Esempio n. 4
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();
                }
            }
        }
Esempio n. 5
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);
        }