private bool tryLockFile(string projectFile) { try { _context.LockFile(projectFile); return(true); } catch (CannotLockFileException e) { var ans = _dialogCreator.MessageBoxYesNo(AppConstants.Exceptions.ProjectWillBeOpenedAsReadOnly(e.Message), AppConstants.Captions.OpenAnyway, AppConstants.Captions.CancelButton); var shouldOpenInReadOnly = (ans == ViewResult.Yes); if (!shouldOpenInReadOnly) { return(false); } _context.ProjectIsReadOnly = true; return(true); } }