Beispiel #1
0
        private async Task LogToScreen()
        {
            var memoryLogger = new MemoryLogger();

            await PostData(memoryLogger);

            LogEntries.AddRange(memoryLogger.LogEntries.SelectMany(x => x.Split(Environment.NewLine.ToCharArray())));
        }
Beispiel #2
0
        public void Load(Box box)
        {
            Cards.AddRange(box.Cards.Select(x => mapper.Map <Card, CardViewModel>(x)));
            Columns.AddRange(box.Columns.Select(x => mapper.Map <Column, ColumnViewModel>(x)));
            Rows.AddRange(box.Rows.Select(x => mapper.Map <Row, RowViewModel>(x)));
            Boards.AddRange(box.Boards.Select(x => mapper.Map <Board, BoardViewModel>(x)));
            LogEntries.AddRange(box.Log.Select(x => mapper.Map <Kamban.Repository.Models.LogEntry, LogEntryViewModel>(x)));

            Loaded = true;
        }
Beispiel #3
0
        async Task LoadEntries()
        {
            try
            {
                if (IsBusy)
                {
                    return;
                }

                IsBusy = true;

                LogEntries.Clear();

                ReadLibraries readLibraries = new ReadLibraries();
                List <string> libraries     = readLibraries.libraries;

                var tempEntries = new List <PlugEVMeEntry>();

                tempEntries.Add(homeEntry);

                foreach (string library in libraries)
                {
                    PlugEVMeEntry _entry = new PlugEVMeEntry();

                    string[] libs = library.Split(',');

                    _entry.Longitude = Convert.ToDouble(libs[libs.Length - 1]);
                    _entry.Latitude  = Convert.ToDouble(libs[libs.Length - 2]);
                    libs.Take(libs.Length - 1);
                    libs.Take(libs.Length - 2);

                    _entry.Title = libs[0];
                    _entry.Date  = DateTime.Now;
                    _entry.Title = string.Join(" ", libs);
                    _entry.Notes = _entry.Latitude + " " + _entry.Longitude;
                    tempEntries.Add(_entry);
                }

                // AddRange() in ObservableRangeCollection differs from Add() in ObservableCollection in that it fires a single
                // CollectionChanged notification when all the items are added to the collection at once, instead of many individual
                // CollectionChanged notifications from calling Add() over and over.
                LogEntries.AddRange(tempEntries);
            }
            finally
            {
                IsBusy = false;
            }

            await Task.CompletedTask;
        }
Beispiel #4
0
        public void BatchLoad(IEnumerable <object> logEntries)
        {
            LogEntries.Clear();
            LogEntries.AddRange(logEntries);
            var start = LogEntries.OfType <SessionStart>().LastOrDefault();

            if (start != null)
            {
                ApplyStart(start);
            }
            else
            {
                TrackOfCheckpoints = ReloadTrack(StartTime, FinishCriteria);
            }
        }
Beispiel #5
0
        /// <summary>
        /// Contextual log, important messages and traces.
        /// </summary>
        /// <returns>Log Entries</returns>
        public LogEntries Contextual()
        {
            int index = 0;
            LogEntries logEntries = new LogEntries();
            while (logEntries.Count < 200)
            {
                if (index >= Entries.Count) break;
                LogEntry logEntry = Entries[index++];

                switch (logEntry.EventType)
                {
                    case LogEventType.Information:
                    case LogEventType.Warning:
                        logEntries.Add(logEntry);
                        break;
                    case LogEventType.Error:
                    case LogEventType.Critical:
                        logEntries.AddRange(Entries.Skip(index - 10).Take(10).Where(match => !logEntries.Contains(match)));
                        logEntries.AddRange(Entries.Skip(index).Take(10));
                        index += 10;
                        break;
                    case LogEventType.Trace:
                    default:
                        continue;
                }
            }

            return logEntries;
        }
Beispiel #6
0
 public LogEntries Chronoligical()
 {
     LogEntries logEntries = new LogEntries();
     logEntries.AddRange(this.Entries.OrderByDescending(logEntry => logEntry.TimeStamp));
     return logEntries;
 }