private void OnUnSelectAttackRoute(UserParty party) { var target = AttackParties.SingleOrDefault(x => x.Id == party.Id); var userParty = UserParties.SingleOrDefault(x => x.Party.Value.Id == party.Id); //凸ルート編成後にユーザーパーティを消す場合があるので必ずチェックする if (userParty != null) { userParty.IsSelectedRoute.Value = false; } if (userParty == null) { var result = MessageBox.Show("マイパーティ一覧から既にこの編成が消えています。\nこの編成をマイパーティに追加して凸ルートから削除しますか?", "警告", MessageBoxButton.YesNoCancel); if (result == MessageBoxResult.Yes) { var newParty = new UserParty(party.UserUnits, party.Comment, party.EstimateDamage); Database.I.AddParty(newParty); } else if (result == MessageBoxResult.Cancel) { return; } } AttackParties.Remove(target); CheckDoubling(); }
private void OnAddUserParty(UserParty party) { UserParties.Add(new PartyListElementViewModel(party, OnSelectAttackRoute)); var parties = UserParties.ToArray(); UserParties.Clear(); UserParties.AddRange(parties.OrderByDescending(x => x.Party.Value.CreateTime)); }
private void OnRemoveUserParty(UserParty party) { var userPartyIndex = UserParties.ToList().FindIndex(x => x.Id == party.Id); if (userPartyIndex >= 0) { UserParties.RemoveAt(userPartyIndex); } }
protected override bool ExecuteRemoveParty(Party partyToRemove, bool isUser) { if (isUser) { return(UserParties.Remove(partyToRemove)); } return(BotParties.Remove(partyToRemove)); }
public override void DeleteAll() { base.DeleteAll(); AggregationParties.Clear(); UserParties.Clear(); BotParties.Clear(); PendingRequests.Clear(); ConnectedParties.Clear(); }
public virtual void DeleteAll() { AggregationParties.Clear(); UserParties.Clear(); BotParties.Clear(); PendingRequests.Clear(); ConnectedParties.Clear(); #if DEBUG LastMessageRouterResults.Clear(); #endif }
protected override bool ExecuteAddParty(Party partyToAdd, bool isUser) { if (isUser) { UserParties.Add(partyToAdd); } else { BotParties.Add(partyToAdd); } return(true); }
public void SaveParty(UserParty party) { if (UserParties.Contains(party)) { var index = UserParties.FindIndex(x => x.Id == party.Id); UserParties[index] = party; OnChangeUserParty?.Invoke(party); FileManager.I.SaveJson(UserParties.ToArray()); } else { AddParty(party); } }
public virtual Party FindPartyByChannelAccountIdAndConversationId(string channelAccountId, string conversationId) { Party userParty = null; try { userParty = UserParties.Single(party => (party.ChannelAccount.Id.Equals(channelAccountId) && party.ConversationAccount.Id.Equals(conversationId))); } catch (InvalidOperationException) { } return(userParty); }
public virtual Party FindExistingUserParty(Party partyToFind) { Party foundParty = null; try { foundParty = UserParties.First(party => partyToFind.Equals(party)); } catch (ArgumentNullException) { } catch (InvalidOperationException) { } return(foundParty); }
private void OnChangeUserParty(UserParty party) { var userPartyIndex = UserParties.ToList().FindIndex(x => x.Id == party.Id); if (userPartyIndex >= 0) { UserParties[userPartyIndex].UpdateParty(party);; var parties = UserParties.ToArray(); UserParties.Clear(); UserParties.AddRange(parties.OrderByDescending(x => x.Party.Value.CreateTime)); } var attackRouteIndex = AttackParties.ToList().FindIndex(x => x.Id == party.Id); if (attackRouteIndex >= 0) { AttackParties[attackRouteIndex].UpdateParty(party); CheckDoubling(); } }
public virtual IList <Party> FindPartiesWithMatchingChannelAccount(Party partyToFind, IList <Party> parties) { IList <Party> matchingParties = null; IEnumerable <Party> foundParties = null; try { foundParties = UserParties.Where(party => party.HasMatchingChannelInformation(partyToFind)); } catch (ArgumentNullException) { } catch (InvalidOperationException) { } if (foundParties != null) { matchingParties = foundParties.ToArray(); } return(matchingParties); }
public virtual bool AddParty(Party newParty, bool isUser = true) { if (newParty == null || (isUser ? UserParties.Contains(newParty) : BotParties.Contains(newParty))) { return(false); } if (isUser) { UserParties.Add(newParty); } else { if (newParty.ChannelAccount == null) { throw new NullReferenceException($"Channel account of a bot party ({nameof(newParty.ChannelAccount)}) cannot be null"); } BotParties.Add(newParty); } return(true); }
public virtual void DeleteAll() { UserParties.Clear(); BotParties.Clear(); }
public void RemoveParty(UserParty party) { UserParties.Remove(party); OnRemoveUserParty?.Invoke(party); FileManager.I.SaveJson(UserParties.ToArray()); }
public void AddParty(UserParty party) { UserParties.Add(party); OnAddUserParty?.Invoke(party); FileManager.I.SaveJson(UserParties.ToArray()); }