Пример #1
0
        protected virtual string GetPromptText(EditorProject project, SaveChangesReason reason)
        {
            Argument.IsNotNull(() => project);

            var location = project.Location;

            string message;

            switch (reason)
            {
            case SaveChangesReason.Closing:
                message = $"The file '{location}' has to be closed, but is was changed\n\nDo you want to save changes?";
                break;

            case SaveChangesReason.Refreshing:
                message = $"The file '{location}' has to be refreshed, but is was changed\n\nDo you want to save changes?";
                break;

            default:
                message = $"The file '{location}' has been changed\n\nDo you want to save changes?";
                break;
            }

            return(message);
        }
Пример #2
0
        public Task <bool> EnsureChangesSavedAsync(EditorProject project, SaveChangesReason reason)
        {
            Argument.IsNotNull(() => project);

            var message = GetPromptText(project, reason);

            return(EnsureChangesSavedAsync(project, message));
        }