Ejemplo n.º 1
0
        public async void ExitMenu()
        {
            Modal_ConfirmationViewModel modal;

            if (!UnitOfWork.IsSaved)
            {
                modal = new Modal_ConfirmationViewModel(ResourceService.SaveBeforeExitMessage)
                {
                    NoIsVisible = true
                };
                WindowManager.ShowDialog(modal);
                if (!modal.Result.HasValue)
                {
                    return;
                }
                else if (modal.Result.Value)
                {
                    await UnitOfWork.DisposeAsync();
                }
            }

            modal = new Modal_ConfirmationViewModel(ResourceService.ExitMessage);
            WindowManager.ShowDialog(modal);
            if (modal.Result.GetValueOrDefault())
            {
                TryClose();
            }
        }
Ejemplo n.º 2
0
        public async void OnClose(CancelEventArgs eventArgs)
        {
            Modal_ConfirmationViewModel modal;

            if (!UnitOfWork.IsSaved)
            {
                modal = new Modal_ConfirmationViewModel(ResourceService.SaveBeforeExitMessage)
                {
                    NoIsVisible     = true,
                    CancelIsVisible = false
                };
                WindowManager.ShowDialog(modal);
                if (modal.Result.GetValueOrDefault())
                {
                    await UnitOfWork.DisposeAsync();
                }
            }
        }