void CreateNewVenue(GroupID groupId) { var newVenuePayload = new PostNewVenuePayload { name = "NewVenue", description = "説明未設定", groupId = groupId.Value, }; var postVenueService = new PostRegisterNewVenueService( userInfo.VerifiedToken, newVenuePayload, venue => { RefreshVenueSelector(groupId, venue.VenueId); reactiveCurrentVenue.Val = venue; }, exception => { Debug.LogException(exception); selector.Add(new IMGUIContainer(() => EditorGUILayout.HelpBox($"新規会場の登録ができませんでした。{exception.Message}", MessageType.Error))); }); postVenueService.Run(); }
public void Process() { if (dataStore.AccessToken == null) { return; } if (dataStore.GroupsIsDirty && !callingGetGroups) { callingGetGroups = true; var _ = APIServiceClient.GetGroups.CallWithCallback(Empty.Value, dataStore.AccessToken, groups => { callingGetGroups = false; dataStore.Groups = groups; dataStore.GroupsIsDirty = false; if (dataStore.Groups.List.Any()) { dataStore.SelectGroup = dataStore.Groups.List[0]; } }, exception => { callingGetGroups = false; dataStore.GroupsIsDirty = true; }); } var copiedMap = new Dictionary <GroupID, bool>(dataStore.VenueDirtyMap); foreach (var dirtyPair in copiedMap) { var groupId = dirtyPair.Key; if (dirtyPair.Value && !callingGetVenue.Contains(groupId)) { callingGetVenue.Add(groupId); var _ = APIServiceClient.GetGroupVenues.CallWithCallback(groupId, dataStore.AccessToken, venues => { callingGetVenue.Remove(groupId); dataStore.VenueMap[dirtyPair.Key] = venues; dataStore.VenueDirtyMap[dirtyPair.Key] = false; }, exception => { callingGetVenue.Remove(groupId); dataStore.VenueDirtyMap[dirtyPair.Key] = true; }); } } if (dataStore.SelectGroup != null && !dataStore.VenueMap.ContainsKey(dataStore.SelectGroup.Id)) { dataStore.VenueDirtyMap[dataStore.SelectGroup.Id] = true; } if (executeNewVenue && dataStore.SelectGroup != null) { executeNewVenue = false; var newVenuePayload = new PostNewVenuePayload { description = "説明未設定", name = "NewVenue", groupId = dataStore.SelectGroup.Id.Value }; var postVenueService = new PostRegisterNewVenueService( dataStore.AccessToken, newVenuePayload, venue => { var venueList = dataStore.VenueMap[venue.Group.Id].List; venueList.Add(venue); dataStore.SelectVenue = venue; dataStore.EditVenue = null; venueIdIndex = venueList.Count - 1; }, exception => errorMessageRegisterVenue = $"新規会場の登録ができませんでした。{exception.Message}"); postVenueService.Run(); errorMessageRegisterVenue = null; } }