public void AddByFleet(string data)
        {
            int deckid;

            if (!int.TryParse(data, out deckid))
            {
                return;
            }

            if (deckid > 0)
            {
                var KanColleFleets = KanColleClient.Current.Homeport.Organization.Fleets;
                if (KanColleClient.Current.IsStarted == false || KanColleFleets.Count < deckid || KanColleFleets[deckid].Ships.Count() < 1)
                {
                    return;
                }

                var fleet = KanColleClient.Current.Homeport.Organization.Fleets
                            .Where(x => x.Value.Id == deckid)
                            .SingleOrDefault().Value;

                var item = new PresetFleetModel();
                item.Name  = string.IsNullOrEmpty(this.FleetName) ? fleet.Name : this.FleetName;
                item.Ships = fleet.Ships
                             .Select(x => new PresetShipData(x).Source)
                             .Where(x => x.Id > 0)
                             .ToArray();

                this._ViewModel.AddFleet(new PresetFleetData(item));
                Messenger.Raise(new WindowActionMessage(WindowAction.Close, "Close"));
            }
        }
Exemplo n.º 2
0
 public void Deserialize(string Data)
 => this.Source = PresetFleetModel.Deserialize(Data);
Exemplo n.º 3
0
 public PresetFleetData(PresetFleetModel fleet)
 {
     this.Source = fleet;
 }