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)); }
protected override bool ExecuteAddParty(Party partyToAdd, bool isUser) { if (isUser) { UserParties.Add(partyToAdd); } else { BotParties.Add(partyToAdd); } return(true); }
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 void AddParty(UserParty party) { UserParties.Add(party); OnAddUserParty?.Invoke(party); FileManager.I.SaveJson(UserParties.ToArray()); }