private void DisplayFriendSelector()
        {
            if (Game1.activeClickableMenu != null)
            {
                return;
            }
            List <Response> responseList = new List <Response>();
            var             friends      = _farmerService.CurrentFarmer.Friends;

            foreach (var friend in friends)
            {
                responseList.Add(new Response(friend.Id, friend.DisplayText));
            }

            if (!responseList.Any())
            {
                ModHelper.ShowInfoMessage(_noFriendsNotification);
                return;
            }

            responseList.Add(new Response(_leaveSelectionKeyAndValue, _leaveSelectionKeyAndValue));

            Game1.currentLocation.createQuestionDialogue("Select Friend:", responseList.ToArray(), FriendSelectorAnswered, (NPC)null);
            Game1.player.Halt();
        }
        private void MailComposed(object sender, MailComposedEventArgs e)
        {
            var toFarmerId = e.ToFarmerId;
            var fromFarmer = _farmerService.CurrentFarmer;
            var item       = e.Item;

            if (item == null)
            {
                return;
            }

            var messageText = string.Format(_messageFormat, fromFarmer.Name, item.ParentSheetIndex, item.Stack);

            // Consider: Moving this to own service
            var mail = new Mail()
            {
                Id                = Guid.NewGuid(),
                ToFarmerId        = toFarmerId,
                FromFarmerId      = fromFarmer.Id,
                Text              = messageText,
                CreatedDate       = DateTime.Now.ToUniversalTime(),
                Status            = MailStatus.Composed,
                CreatedInGameDate = ModHelper.GetGameDayTime()
            };

            Repository.Instance.Insert(mail);
            ModHelper.ShowInfoMessage(_letterPostedNotification);
        }
 private void SaveEvents_AfterLoad(object sender, EventArgs e)
 {
     // render update warning
     if (_config.CheckForUpdates && !_hasSeenUpdateWarning && _newRelease != null)
     {
         try
         {
             _hasSeenUpdateWarning = true;
             ModHelper.ShowInfoMessage($"You can update {ModConstants.ModName} from {_currentVersion} to {_newRelease}.");
         }
         catch (Exception ex)
         {
             ModHelper.HandleError(_mod, ex, "showing the new version available");
         }
     }
 }