Пример #1
0
        public void SaveBoat(IEnumerable <Tuple <IBoat, DateTime, string> > list)
        {
            foreach (var tuple in list)
            {
                var boat  = tuple.Item1;
                var time  = tuple.Item2;
                var notes = tuple.Item3;

                ISequenceItem item = new SequenceItem(boat == null ? UnidentifiedBoat : boat, time, notes);
                _location.SequenceItems.Add(item);

                var sw = new Stopwatch();
                sw.Start();
                // note: for now this has to happen first, otherwise the visible time is not going to be populated ahead of being displayed in the master panel binding
                _repos.ForEach(r => r.LogATime(_location, item));
                sw.Stop();
                ReportStopwatch(sw, boat.Number.ToString());


                _keepUnfinished.Remove(boat);
                Unfinished.Remove(boat);

//				if(boat.Number < 0)
//					Unfinished.Insert(0, UnidentifiedBoat);
            }
            RefreshObservable();
        }
Пример #2
0
        void RefreshObservable()
        {
            var sw = new Stopwatch();

            sw.Start();

            Finished.Clear();
            _location.SequenceItems.OrderByDescending(i => i.TimeStamp).ForEach(Finished.Add);

            Unfinished.Clear();
//			Unfinished.Insert(0, UnidentifiedBoat);

            foreach (var u in
                     _keepUnfinished
                     .Where(b => b.Number < 0 || string.IsNullOrEmpty(_filter) || b.PrettyName.ToLowerInvariant().Contains(_filter))
                     .OrderBy(b => b.End ? 1 : 0)
                     .ThenBy(b => b.Number))

            {
                Unfinished.Add(u);
            }
            sw.Stop();
            ReportStopwatch(sw, _filter);


            // TODO - add a timer to retry if any are not null
            // TODO - keep a track to be able to report the status
        }