private void ProcessVesselList(ANWI.Messaging.IMessagePayload p)
        {
            ANWI.Messaging.FullVesselReg reg
                = p as ANWI.Messaging.FullVesselReg;

            _vesselList = new ObservableCollection <LiteVessel>(
                reg.vessels.Where(
                    vessel => {
                foreach (FleetUnit unit in currentFleet)
                {
                    if (unit is Ship &&
                        (unit as Ship).v.id == vessel.id)
                    {
                        return(false);
                    }
                }
                return(true);
            }
                    ));
            NotifyPropertyChanged("vesselList");
        }
예제 #2
0
        /// <summary>
        /// Called upon receiving the FullVesselReg message.
        /// Loads the data into the list.
        /// </summary>
        /// <param name="m"></param>
        private void LoadVesselList(ANWI.Messaging.IMessagePayload m)
        {
            ANWI.Messaging.FullVesselReg fvr
                = m as ANWI.Messaging.FullVesselReg;

            fvr.vessels.Sort((a, b) => {
                if (a.hull.ordering < b.hull.ordering)
                {
                    return(-1);
                }
                else if (a.hull.ordering == b.hull.ordering)
                {
                    return(0);
                }
                else
                {
                    return(1);
                }
            });

            foreach (LiteVessel v in fvr.vessels)
            {
                // For now 100 will be the boundary between named and
                // unnamed vessels
                if (v.hull.ordering < 100)
                {
                    NamedVessel vr = new NamedVessel();
                    vr.v = v;
                    this.Dispatcher.Invoke(() => { _vesselList.Add(vr); });
                }
                else
                {
                    // TODO
                }
            }

            this.Dispatcher.Invoke(() => {
                Spinner_List.Visibility = Visibility.Hidden;
            });
        }