Esempio n. 1
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. 2
0
        /// <summary>
        /// Confirm that file should be closed</summary>
        /// <param name="message">Confirmation message</param>
        /// <returns>Dialog result</returns>
        public FileDialogResult ConfirmFileClose(string message)
        {
            var vm = new ConfirmationDialogViewModel("Close".Localize("Close file"), message)
            {
                YesButtonText = "Save".Localize(), NoButtonText = "Discard".Localize()
            };

            vm.ShowDialog();

            return(ToFileDialogResult(vm.Result));
        }
Esempio n. 3
0
        private async void ShowConfirmationDialog()
        {
            var confirmationDialog = new ConfirmationDialogViewModel
            {
                Title   = "Modal Message Example",
                Message = "This is an example of a modal message",
                Buttons = MessageBoxButton.YesNo,
                Icon    = MessageBoxImage.Information
            };

            var result = await _modalService.ShowOverlayAsync(confirmationDialog);

            //If no was selected
            if (!result.HasValue || !result.Value)
            {
                return;
            }
        }
Esempio n. 4
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);
        }
Esempio n. 5
0
        /// <summary>
        /// Execute the <see cref="DeleteCommand"/>
        /// </summary>
        /// <param name="thing">
        /// The thing to delete.
        /// </param>
        protected virtual async void ExecuteDeleteCommand(Thing thing)
        {
            if (thing == null)
            {
                return;
            }

            var confirmation = new ConfirmationDialogViewModel(thing);
            var dialogResult = this.dialogNavigationService.NavigateModal(confirmation);

            if (dialogResult == null || !dialogResult.Result.HasValue || !dialogResult.Result.Value)
            {
                return;
            }

            this.IsBusy = true;

            var context = TransactionContextResolver.ResolveContext(this.Thing);

            var transaction = new ThingTransaction(context);

            transaction.Delete(thing.Clone(false));

            try
            {
                await this.Session.Write(transaction.FinalizeTransaction());
            }
            catch (Exception ex)
            {
                logger.Error("An error was produced when deleting the {0}: {1}", thing.ClassKind, ex.Message);
                this.Feedback = ex.Message;
            }
            finally
            {
                this.IsBusy = false;
            }
        }
Esempio n. 6
0
 public ConfirmationDialogView(ConfirmationDialogInfo confirmationDialogInfo)
 {
     InitializeComponent();
     ConfirmationDialogViewModel = new ConfirmationDialogViewModel(confirmationDialogInfo);
     DataContext = ConfirmationDialogViewModel;
 }
Esempio n. 7
0
        /// <summary>
        /// Confirm that file should be closed</summary>
        /// <param name="message">Confirmation message</param>
        /// <returns>Dialog result</returns>
        public FileDialogResult ConfirmFileClose(string message)
        {
            var vm = new ConfirmationDialogViewModel("Close".Localize("Close file"), message)
            {
                YesButtonText = "Save".Localize(), NoButtonText = "Discard".Localize()
            };

            vm.ShowDialog();

            return ToFileDialogResult(vm.Result);
        }
 public async Task <IViewComponentResult> InvokeAsync(ConfirmationDialogViewModel confirmationDialogViewComponent)
 {
     return(View(confirmationDialogViewComponent));
 }