private void UpdateSlackUsers() { var slackUserRepository = ServiceLocator.Instance.GetInstance <SlackUserRepository>(); SlackUsers.Clear(); var slackUsers = slackUserRepository.FindAll(); slackUsers.ForEach(user => SlackUsers.Add(user)); if (SelectedSlackUser != null) { var token = SelectedSlackUser.AccessToken; SelectedSlackUser = SlackUsers.ToList().Find(user => user.AccessToken == token); } }
public void OnClose() { //現在の状態を保存 var slackUserRepository = ServiceLocator.Instance.GetInstance <SlackUserRepository>(); slackUserRepository.Save(SlackUsers.ToList()); //差分からアカウントを削除 var diff = new List <SlackUser>(_oldSlackUsersList); foreach (var twitterUser in SlackUsers) { diff.Remove(twitterUser); } slackUserRepository.Delete(diff); }