예제 #1
0
        /// <summary>
        /// Requests the new Log-id and calls the stored procedure
        /// </summary>
        public void ExecuteValidation()
        {
            if (_validator.IsSavable)
            {
                var vm = new SaveChangesBeforeValidationMessage();
                GalaSoft.MvvmLight.Messaging.Messenger.Default.Send(vm);

                switch (vm.HandleUnsavedChanges)
                {
                case HandleUnsavedChanges.Save:
                    Save();
                    break;

                case HandleUnsavedChanges.ExecuteWithoutSave:
                    //Nothing is saved
                    break;

                case HandleUnsavedChanges.Cancel:
                    return;
                }
            }
            _validator.ExecuteValidation();
            ResetWrongValues();
            OnPropertyChanged("WrongValues");
            GalaSoft.MvvmLight.Messaging.Messenger.Default.Send(new ValidationFinishedMessage());
        }
예제 #2
0
        private void AskUserHowToHandleUnsavedChanges(SaveChangesBeforeValidationMessage m)
        {
            var res = MessageBox.Show("There are unsaved changes. Would you want to save them before executing the validation?", "Unsaved changes", MessageBoxButton.YesNoCancel);
            HandleUnsavedChanges answer;

            switch (res)
            {
            case MessageBoxResult.Yes:
                answer = HandleUnsavedChanges.Save;
                break;

            case MessageBoxResult.No:
                answer = HandleUnsavedChanges.ExecuteWithoutSave;
                break;

            default:
                answer = HandleUnsavedChanges.Cancel;
                break;
            }
            m.HandleUnsavedChanges = answer;
        }